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

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.26 // $Id: DecayParticle.h,v 1.25 2009/03/03 17:04:09 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 loizides 1.20 #include "MitAna/DataTree/interface/Types.h"
22 loizides 1.1 #include "MitAna/DataTree/interface/CompositeParticle.h"
23 bendavid 1.11 #include "MitAna/DataTree/interface/DaughterData.h"
24 bendavid 1.13 #include "MitAna/DataTree/interface/Vertex.h"
25     #include "MitAna/DataCont/interface/RefArray.h"
26 loizides 1.20
27 loizides 1.1 namespace mithep
28     {
29 bendavid 1.13 class DecayParticle : public Particle
30 loizides 1.1 {
31     public:
32 loizides 1.23 DecayParticle() :
33     fAbsPdgId(0), fChi2(0), fNdof(0), fMassError(0),
34     fLxy(0), fLxyError(0), fDxy(0), fDxyError(0), fLz(0), fLzError(0) {}
35 loizides 1.20 DecayParticle(Int_t absPdgId) :
36 loizides 1.23 fAbsPdgId(absPdgId), fChi2(0), fNdof(0), fMassError(0),
37     fLxy(0), fLxyError(0), fDxy(0), fDxyError(0), fLz(0), fLzError(0) {}
38 bendavid 1.7
39 loizides 1.26 void AddDaughterData(const DaughterData *dd)
40     { fDaughterData.Add(dd); ClearCharge(); }
41 loizides 1.25 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 loizides 1.20 Bool_t HasDaughter(const Particle *p) const;
48     Bool_t HasCommonDaughter(const DecayParticle *p) const;
49 loizides 1.25 Bool_t HasPriVertex() const { return fPriVtx.IsValid(); }
50 loizides 1.23 Bool_t HasPriVertex(const Vertex *v)
51 loizides 1.25 const { return fPriVtx.RefsObject(v); }
52 loizides 1.26 Bool_t HasSameDaughters(const DecayParticle *p) const;
53 loizides 1.25 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 loizides 1.26 Double_t MassError() const { return fMassError; }
58     UShort_t Ndof() const { return fNdof; }
59 loizides 1.25 UInt_t NDaughters() const { return fDaughterData.Entries(); }
60     EObjType ObjType() const { return kDecayParticle; }
61 loizides 1.20 TParticlePDG *ParticlePdgEntry() const;
62     Double_t PdgMass() const;
63 loizides 1.26 const Vertex *PriVertex() const { return fPriVtx.Obj(); }
64 loizides 1.25 Double_t Prob() const { return TMath::Prob(fChi2,fNdof); }
65 bendavid 1.24 const ThreeVector &Position() const;
66 loizides 1.20 const ThreeVector RelativePosition() const;
67 loizides 1.25 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 loizides 1.26 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 bendavid 1.24 void SetPriVertex(const Vertex *v) { fPriVtx = v; ClearPos(); }
81 loizides 1.12 using TObject::Error;
82 loizides 1.20
83 loizides 1.1 protected:
84 bendavid 1.24 void ClearPos() const { fCachePosFlag.ClearCache(); }
85 loizides 1.23 Double_t GetCharge() const;
86     void GetMom() const;
87 bendavid 1.24 void GetPos() const;
88 loizides 1.23
89 loizides 1.20 UInt_t fAbsPdgId; //absolute value of pid code
90 loizides 1.26 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 bendavid 1.24 RefArray<DaughterData> fDaughterData; //momentum of daughters at vertex
101 loizides 1.25 Ref<Vertex> fPriVtx; //reference to primary vertex
102 bendavid 1.24 mutable CacheFlag fCachePosFlag; //||cache validity flag for position
103     mutable ThreeVector fCachedPos; //!cached momentum vector (filled by derived classes)
104    
105 loizides 1.20 ClassDef(DecayParticle, 1) // Decay particle class
106 loizides 1.1 };
107     }
108 bendavid 1.7
109     //--------------------------------------------------------------------------------------------------
110 loizides 1.23 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 loizides 1.26 fCachedMom.SetCoordinates(fMomentum.Pt(), fMomentum.Eta(), fMomentum.Phi(), fMomentum.M());
127 loizides 1.23 }
128    
129     //--------------------------------------------------------------------------------------------------
130 bendavid 1.7 inline TParticlePDG *mithep::DecayParticle::ParticlePdgEntry() const
131     {
132 loizides 1.20 // Return entry to pdg database for the particle.
133 bendavid 1.7
134     return TDatabasePDG::Instance()->GetParticle(fAbsPdgId);
135     }
136 bendavid 1.8
137     //--------------------------------------------------------------------------------------------------
138     inline void mithep::DecayParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
139     {
140 loizides 1.20 // Set four vector.
141 bendavid 1.8
142 bendavid 1.11 fMomentum.SetXYZT(px,py,pz,e);
143 bendavid 1.24 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 bendavid 1.11 }
159    
160     //--------------------------------------------------------------------------------------------------
161 bendavid 1.24 inline void mithep::DecayParticle::GetPos() const
162 bendavid 1.13 {
163 loizides 1.20 // Return absolute position of decay.
164 bendavid 1.13
165     const mithep::Vertex *pv = PriVertex();
166    
167     if (pv)
168 bendavid 1.24 fCachedPos = pv->Position() + RelativePosition();
169 bendavid 1.13 else
170 bendavid 1.24 fCachedPos = RelativePosition();
171 bendavid 1.13 }
172    
173     //--------------------------------------------------------------------------------------------------
174     inline const mithep::ThreeVector mithep::DecayParticle::RelativePosition() const
175     {
176 loizides 1.20 // Compute the position vector of the decay vertex relative to the primary vertex.
177 bendavid 1.13
178 loizides 1.26 mithep::ThreeVector dz(0,0,fLz*TMath::Abs(Pz())/Pz());
179     mithep::ThreeVector momPerp(Px(),Py(),0);
180 bendavid 1.13 mithep::ThreeVector zHat(0,0,1.0);
181 paus 1.17 mithep::ThreeVector dxy = -momPerp.Cross(zHat)*fDxy/momPerp.R();
182     mithep::ThreeVector dlxy = momPerp*fLxy/momPerp.R();
183 bendavid 1.13 return (dxy+dlxy+dz);
184     }
185 loizides 1.1 #endif