ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/DecayParticle.h
Revision: 1.26
Committed: Wed Mar 18 15:44:32 2009 UTC (16 years, 1 month ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008
Changes since 1.25: +28 -27 lines
Log Message:
Introduced Double32_t [0,0,14] consistently. Updated class descriptions.

File Contents

# Content
1 //--------------------------------------------------------------------------------------------------
2 // $Id: DecayParticle.h,v 1.25 2009/03/03 17:04:09 loizides Exp $
3 //
4 // DecayParticle
5 //
6 // The decay particle class is for use in vertexing based analyses. It
7 // stores vertex fit information (including four momentum) and links to daughters.
8 //
9 // Note that Charge() is still computed as a recursive loop over daughters, as inherited from
10 // CompositeParticle, but momentum is returned from the internally stored four vector.
11 //
12 // Authors: C.Paus, J.Bendavid
13 //--------------------------------------------------------------------------------------------------
14
15 #ifndef MITANA_DATATREE_DECAYPARTICLE_H
16 #define MITANA_DATATREE_DECAYPARTICLE_H
17
18 #include <TDatabasePDG.h>
19 #include <TParticlePDG.h>
20 #include "MitCommon/DataFormats/interface/Vect4M.h"
21 #include "MitAna/DataTree/interface/Types.h"
22 #include "MitAna/DataTree/interface/CompositeParticle.h"
23 #include "MitAna/DataTree/interface/DaughterData.h"
24 #include "MitAna/DataTree/interface/Vertex.h"
25 #include "MitAna/DataCont/interface/RefArray.h"
26
27 namespace mithep
28 {
29 class DecayParticle : public Particle
30 {
31 public:
32 DecayParticle() :
33 fAbsPdgId(0), fChi2(0), fNdof(0), fMassError(0),
34 fLxy(0), fLxyError(0), fDxy(0), fDxyError(0), fLz(0), fLzError(0) {}
35 DecayParticle(Int_t absPdgId) :
36 fAbsPdgId(absPdgId), fChi2(0), fNdof(0), fMassError(0),
37 fLxy(0), fLxyError(0), fDxy(0), fDxyError(0), fLz(0), fLzError(0) {}
38
39 void AddDaughterData(const DaughterData *dd)
40 { fDaughterData.Add(dd); ClearCharge(); }
41 UInt_t AbsPdgId() const { return fAbsPdgId; }
42 Double_t Chi2() const { return fChi2; }
43 const Particle *Daughter(UInt_t i) const { return DaughterDat(i)->Original(); }
44 const DaughterData *DaughterDat(UInt_t i) const { return fDaughterData.At(i); }
45 Double_t Dxy() const { return fDxy; }
46 Double_t DxyError() const { return fDxyError; }
47 Bool_t HasDaughter(const Particle *p) const;
48 Bool_t HasCommonDaughter(const DecayParticle *p) const;
49 Bool_t HasPriVertex() const { return fPriVtx.IsValid(); }
50 Bool_t HasPriVertex(const Vertex *v)
51 const { return fPriVtx.RefsObject(v); }
52 Bool_t HasSameDaughters(const DecayParticle *p) const;
53 Double_t Lxy() const { return fLxy; }
54 Double_t LxyError() const { return fLxyError; }
55 Double_t Lz() const { return fLz; }
56 Double_t LzError() const { return fLzError; }
57 Double_t MassError() const { return fMassError; }
58 UShort_t Ndof() const { return fNdof; }
59 UInt_t NDaughters() const { return fDaughterData.Entries(); }
60 EObjType ObjType() const { return kDecayParticle; }
61 TParticlePDG *ParticlePdgEntry() const;
62 Double_t PdgMass() const;
63 const Vertex *PriVertex() const { return fPriVtx.Obj(); }
64 Double_t Prob() const { return TMath::Prob(fChi2,fNdof); }
65 const ThreeVector &Position() const;
66 const ThreeVector RelativePosition() const;
67 void SetAbsPdgId(UInt_t apid) { fAbsPdgId=apid; }
68 void SetChi2(Double_t chi2) { fChi2 = chi2; }
69 void SetDxy(Double_t dxy) { fDxy = dxy; ClearPos(); }
70 void SetDxyError(Double_t dxyError) { fDxyError = dxyError; }
71 void SetLxy(Double_t lxy) { fLxy = lxy; ClearPos(); }
72 void SetLxyError(Double_t lxyError) { fLxyError = lxyError; }
73 void SetLz(Double_t lz) { fLz = lz; ClearPos(); }
74 void SetLzError(Double_t lzError) { fLzError = lzError; }
75 void SetMassError(Double_t massError) { fMassError = massError; }
76 void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
77 void SetMom(const FourVector &p)
78 { fMomentum = p; ClearMom(); ClearPos(); }
79 void SetNdof(UShort_t ndof) { fNdof = ndof; }
80 void SetPriVertex(const Vertex *v) { fPriVtx = v; ClearPos(); }
81 using TObject::Error;
82
83 protected:
84 void ClearPos() const { fCachePosFlag.ClearCache(); }
85 Double_t GetCharge() const;
86 void GetMom() const;
87 void GetPos() const;
88
89 UInt_t fAbsPdgId; //absolute value of pid code
90 Double32_t fChi2; //[0,0,12]chi-squared of fit
91 UShort_t fNdof; //degrees of freedom for fit
92 Double32_t fMassError; //[0,0,14]fitted mass error
93 Double32_t fLxy; //[0,0,14]fitted lxy (decay length)
94 Double32_t fLxyError; //[0,0,14]fitted lxy error
95 Double32_t fDxy; //[0,0,14]fitted impact parameter
96 Double32_t fDxyError; //[0,0,14]fitted impact parameter error
97 Double32_t fLz; //[0,0,14]fitted lz (decay length)
98 Double32_t fLzError; //[0,0,14]fitted lz error
99 Vect4M fMomentum; //momentum fourvector
100 RefArray<DaughterData> fDaughterData; //momentum of daughters at vertex
101 Ref<Vertex> fPriVtx; //reference to primary vertex
102 mutable CacheFlag fCachePosFlag; //||cache validity flag for position
103 mutable ThreeVector fCachedPos; //!cached momentum vector (filled by derived classes)
104
105 ClassDef(DecayParticle, 1) // Decay particle class
106 };
107 }
108
109 //--------------------------------------------------------------------------------------------------
110 inline Double_t mithep::DecayParticle::GetCharge() const
111 {
112 // Return sum of charge of daughter particles.
113
114 Double_t charge = 0;
115 for (UInt_t i=0; i<NDaughters(); ++i)
116 charge += DaughterDat(i)->Charge();
117
118 return charge;
119 }
120
121 //--------------------------------------------------------------------------------------------------
122 inline void mithep::DecayParticle::GetMom() const
123 {
124 // Get momentum values from stored values.
125
126 fCachedMom.SetCoordinates(fMomentum.Pt(), fMomentum.Eta(), fMomentum.Phi(), fMomentum.M());
127 }
128
129 //--------------------------------------------------------------------------------------------------
130 inline TParticlePDG *mithep::DecayParticle::ParticlePdgEntry() const
131 {
132 // Return entry to pdg database for the particle.
133
134 return TDatabasePDG::Instance()->GetParticle(fAbsPdgId);
135 }
136
137 //--------------------------------------------------------------------------------------------------
138 inline void mithep::DecayParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
139 {
140 // Set four vector.
141
142 fMomentum.SetXYZT(px,py,pz,e);
143 ClearMom();
144 ClearPos();
145 }
146
147 //--------------------------------------------------------------------------------------------------
148 inline const mithep::ThreeVector &mithep::DecayParticle::Position() const
149 {
150 // Return cached momentum value.
151
152 if (!fCachePosFlag.IsValid()) {
153 GetPos();
154 fCachePosFlag.SetValid();
155 }
156
157 return fCachedPos;
158 }
159
160 //--------------------------------------------------------------------------------------------------
161 inline void mithep::DecayParticle::GetPos() const
162 {
163 // Return absolute position of decay.
164
165 const mithep::Vertex *pv = PriVertex();
166
167 if (pv)
168 fCachedPos = pv->Position() + RelativePosition();
169 else
170 fCachedPos = RelativePosition();
171 }
172
173 //--------------------------------------------------------------------------------------------------
174 inline const mithep::ThreeVector mithep::DecayParticle::RelativePosition() const
175 {
176 // Compute the position vector of the decay vertex relative to the primary vertex.
177
178 mithep::ThreeVector dz(0,0,fLz*TMath::Abs(Pz())/Pz());
179 mithep::ThreeVector momPerp(Px(),Py(),0);
180 mithep::ThreeVector zHat(0,0,1.0);
181 mithep::ThreeVector dxy = -momPerp.Cross(zHat)*fDxy/momPerp.R();
182 mithep::ThreeVector dlxy = momPerp*fLxy/momPerp.R();
183 return (dxy+dlxy+dz);
184 }
185 #endif