ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/UHHAnalysis/NtupleWriter/Objects/GenParticle.h
Revision: 1.1
Committed: Tue May 22 09:32:32 2012 UTC (12 years, 11 months ago) by peiffer
Content type: text/plain
Branch: MAIN
Log Message:
new class structure for objects

File Contents

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