ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootParticle.h
Revision: 1.6
Committed: Wed Dec 17 16:23:49 2008 UTC (16 years, 4 months ago) by lethuill
Content type: text/plain
Branch: MAIN
Changes since 1.5: +92 -41 lines
Log Message:
Add reference (TRef) to mcParticle

File Contents

# User Rev Content
1 mlethuil 1.1 #ifndef TRootParticle_h
2     #define TRootParticle_h
3    
4     #include <string>
5     #include <iostream>
6    
7     #include "Rtypes.h"
8     #include "TLorentzVector.h"
9     #include "TVector3.h"
10 lethuill 1.3 #include "TRef.h"
11 mlethuil 1.1
12     using namespace std;
13    
14     class TRootParticle : public TLorentzVector
15     {
16 mlethuil 1.2
17 mlethuil 1.1 public:
18    
19 lethuill 1.6 TRootParticle() :
20     TLorentzVector()
21     ,vertex_()
22     ,type_(0)
23     ,charge_(0.)
24     ,genParticleIndex_(-1)
25     ,genParticle_()
26     {;}
27    
28     TRootParticle(const TRootParticle& particle) :
29     TLorentzVector(particle)
30     ,vertex_(particle.vertex_)
31     ,type_(particle.type_)
32     ,charge_(particle.charge_)
33     ,genParticleIndex_(particle.genParticleIndex_)
34     ,genParticle_(particle.genParticle_)
35     {;}
36    
37     TRootParticle(Double_t px, Double_t py, Double_t pz, Double_t e) :
38     TLorentzVector(px,py,pz,e)
39     ,vertex_()
40     ,type_(0)
41     ,charge_(0.)
42     ,genParticleIndex_(-1)
43     ,genParticle_()
44     {;}
45    
46     TRootParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z) :
47     TLorentzVector(px,py,pz,e)
48     ,vertex_(vtx_x,vtx_y,vtx_z)
49     ,type_(0)
50     ,charge_(0.)
51     ,genParticleIndex_(-1)
52     ,genParticle_()
53     {;}
54    
55     TRootParticle(Double_t px, Double_t py, Double_t pz, Double_t e, Double_t vtx_x, Double_t vtx_y, Double_t vtx_z,Int_t type, Float_t charge) :
56     TLorentzVector(px,py,pz,e)
57     ,vertex_(vtx_x,vtx_y,vtx_z)
58     ,type_(type)
59     ,charge_(charge)
60     ,genParticleIndex_(-1)
61     ,genParticle_()
62     {;}
63    
64    
65     TRootParticle(const TLorentzVector &momentum) :
66     TLorentzVector(momentum)
67     ,vertex_()
68     ,type_(0)
69     ,charge_(0.)
70     ,genParticleIndex_(-1)
71     ,genParticle_()
72     {;}
73    
74     TRootParticle(const TLorentzVector &momentum, const TVector3 &vertex) :
75     TLorentzVector(momentum)
76     ,vertex_(vertex)
77     ,type_(0)
78     ,charge_(0.)
79     ,genParticleIndex_(-1)
80     ,genParticle_()
81     {;}
82    
83     TRootParticle(const TLorentzVector &momentum, const TVector3 &vertex, Int_t type, Float_t charge) :
84     TLorentzVector(momentum)
85     ,vertex_(vertex)
86     ,type_(type)
87     ,charge_(charge)
88     ,genParticleIndex_(-1)
89     ,genParticle_()
90     {;}
91    
92 mlethuil 1.1 ~TRootParticle() {;}
93    
94 lethuill 1.6
95 mlethuil 1.1 Double_t vx() const { return vertex_.x(); }
96     Double_t vy() const { return vertex_.y(); }
97     Double_t vz() const { return vertex_.z(); }
98     Int_t type() const { return type_; }
99     Float_t charge() const { return charge_; }
100 lethuill 1.6 Int_t genParticleIndex() const { return genParticleIndex_; }
101     TObject* genParticle() const { return genParticle_.GetObject() ;}
102     virtual TString typeName() const { return "TRootParticle"; }
103    
104 mlethuil 1.1
105 lethuill 1.4 // FIXME setVx, setVy and setVz must modify the TLorentzVector ?
106 mlethuil 1.1 void setVx(Double_t vx) { vertex_.SetX(vx); }
107     void setVy(Double_t vy) { vertex_.SetY(vy); }
108     void setVz(Double_t vz) { vertex_.SetZ(vz); }
109     void setType(Int_t type) { type_ = type; }
110     void setCharge(Int_t charge) { charge_ = charge; }
111 lethuill 1.6 void setGenParticleIndex(Int_t genParticleIndex) { genParticleIndex_ = genParticleIndex; }
112     void setGenParticle(TObject* genParticle) { genParticle_ = genParticle; }
113    
114     friend std::ostream& operator<< (std::ostream& stream, const TRootParticle& part)
115     {
116     stream << "Type=" << part.type_ << " Charge=" << part.charge_ << " (Et,eta,phi)=("<< part.Et() <<","<< part.Eta() <<","<< part.Phi() << ")"
117     << " vertex(x,y,z)=("<< part.vx() <<","<< part.vy() <<","<< part.vz() << ")";
118     return stream;
119     };
120    
121    
122    
123 mlethuil 1.1 protected:
124    
125     TVector3 vertex_;
126     Int_t type_;
127     Float_t charge_;
128 lethuill 1.6 Int_t genParticleIndex_;
129     TRef genParticle_;
130 mlethuil 1.1
131     ClassDef (TRootParticle,1);
132     };
133    
134     #endif
135 lethuill 1.5
136