ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Morgan/interface/TRootParticle.h
(Generate patch)

Comparing UserCode/Morgan/interface/TRootParticle.h (file contents):
Revision 1.7 by lethuill, Thu Dec 18 18:01:49 2008 UTC vs.
Revision 1.9 by lethuill, Wed Jun 10 11:17:06 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines