ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/DecayParticle.h
Revision: 1.27
Committed: Mon Jul 13 11:00:28 2009 UTC (15 years, 9 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, Mit_010
Changes since 1.26: +1 -3 lines
Log Message:
Include files checked.

File Contents

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