ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/NtupleWriter/Objects/GenParticle.h
Revision: 1.5
Committed: Wed May 8 12:28:35 2013 UTC (12 years ago) by peiffer
Content type: text/plain
Branch: MAIN
CVS Tags: v1-00
Changes since 1.4: +4 -0 lines
Log Message:
added spin

File Contents

# User Rev Content
1 peiffer 1.1 #ifndef GenParticle_H
2     #define GenParticle_H
3    
4     #include "Particle.h"
5    
6 peiffer 1.4 /**
7     * @short generator particle class
8     * @author Thomas Peiffer
9     */
10    
11 peiffer 1.1 class GenParticle : public Particle{
12     public:
13     GenParticle(){
14     m_pdgId=0;
15     m_status=0;
16     m_index=0;
17     m_mother1=0;
18     m_mother2=0;
19     m_daughter1=0;
20     m_daughter2=0;
21 peiffer 1.5 m_spin=0;
22 peiffer 1.1 };
23     ~GenParticle(){
24     };
25    
26 peiffer 1.2 int pdgId() const{return m_pdgId;}
27     int status() const{return m_status;}
28     int index() const{return m_index;}
29 peiffer 1.3 int mother1() const{return m_mother1;}
30     int mother2() const{return m_mother2;}
31     int daughter1() const{return m_daughter1;}
32     int daughter2() const{return m_daughter2;}
33 peiffer 1.5 int spin() const{return m_spin;}
34 peiffer 1.1
35     //return mother 1 or 2 (ind<=1 or ind>=2)
36     GenParticle* mother(std::vector<GenParticle> *gplist, int ind=1){
37     for(unsigned int i=0; i< gplist->size(); ++i){
38     if(ind<=1){
39     if(this->m_mother1 == gplist->at(i).index()){
40     return &(gplist->at(i));
41     }
42     }
43     else{
44     if(this->m_mother2 == gplist->at(i).index()){
45     return &(gplist->at(i));
46     }
47     }
48     }
49     //std::cout << "WARNING: Mother " << ind << " not found in list of GenParticles" << std::endl;
50     return 0;
51     }
52     //return daughter 1 or 2 (ind<=1 or ind>=2)
53     GenParticle* daughter(std::vector<GenParticle> *gplist, int ind=1){
54     for(unsigned int i=0; i< gplist->size(); ++i){
55     if(ind<=1){
56     if(this->m_daughter1 == gplist->at(i).index()){
57     return &(gplist->at(i));
58     }
59     }
60     else{
61     if(this->m_daughter2 == gplist->at(i).index()){
62     return &(gplist->at(i));
63     }
64     }
65     }
66     //std::cout << "WARNING: Daughter " << ind << " not found in list of GenParticles" << std::endl;
67     return 0;
68     }
69    
70     void set_pdgId(int x){ m_pdgId=x;}
71     void set_status(int x){ m_status=x;}
72     void set_index(int x){ m_index=x;}
73     void set_mother1(int x){ m_mother1=x;}
74     void set_mother2(int x){ m_mother2=x;}
75     void set_daughter1(int x){ m_daughter1=x;}
76     void set_daughter2(int x){ m_daughter2=x;}
77 peiffer 1.5 void set_spin(int x){ m_spin=x;}
78 peiffer 1.1
79     private:
80     int m_pdgId;
81     int m_status;
82     int m_index;
83    
84     int m_mother1;
85     int m_mother2;
86     int m_daughter1;
87     int m_daughter2;
88 peiffer 1.5 int m_spin;
89 peiffer 1.1
90    
91     };
92    
93     #endif