ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/DecayParticle.h
Revision: 1.18
Committed: Fri Nov 14 14:46:35 2008 UTC (16 years, 5 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_006
Changes since 1.17: +14 -14 lines
Log Message:
Convert more things to Double32

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 bendavid 1.18 // $Id: DecayParticle.h,v 1.17 2008/11/06 15:01:15 paus Exp $
3 loizides 1.1 //
4     // Decay Particle
5     //
6 bendavid 1.7 // Decay Particle for use in vertexing based analyses.
7 bendavid 1.10 // Stores vertex fit information (including four momentum) and links to daughters.
8 loizides 1.1 //
9 bendavid 1.10 // 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 loizides 1.14 // Authors: C.Paus, J.Bendavid
13 loizides 1.1 //--------------------------------------------------------------------------------------------------
14    
15     #ifndef DATATREE_DECAYPARTICLE_H
16     #define DATATREE_DECAYPARTICLE_H
17    
18 bendavid 1.7 #include <TDatabasePDG.h>
19     #include <TParticlePDG.h>
20 loizides 1.1 #include "MitAna/DataTree/interface/CompositeParticle.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 bendavid 1.7 #include "MitAna/DataTree/interface/Types.h"
25 loizides 1.1
26     namespace mithep
27     {
28 bendavid 1.13 class DecayParticle : public Particle
29 loizides 1.1 {
30     public:
31 loizides 1.2 DecayParticle() {}
32 bendavid 1.13 DecayParticle(Int_t absPdgId) :
33 paus 1.17 fAbsPdgId (absPdgId),
34     fChi2 (0),
35     fNdof (0),
36 bendavid 1.13 fMassError(0),
37 paus 1.17 fLxy (0),
38     fLxyError (0),
39     fDxy (0),
40     fDxyError (0),
41     fLz (0),
42     fLzError (0) {}
43    
44 loizides 1.1 ~DecayParticle() {}
45 bendavid 1.7
46 loizides 1.12 UInt_t AbsPdgId() const { return fAbsPdgId; }
47     void SetAbsPdgId(UInt_t apid) { fAbsPdgId=apid; }
48 bendavid 1.7 TParticlePDG *ParticlePdgEntry() const;
49 loizides 1.12 Double_t PdgMass() const;
50     Double_t Prob() const { return TMath::Prob(fChi2,fNdof); }
51     Double_t Chi2() const { return fChi2; }
52 bendavid 1.18 UInt_t Ndof() const { return fNdof; }
53 loizides 1.12 void SetChi2(Double_t chi2) { fChi2 = chi2;}
54 bendavid 1.18 void SetNdof(UInt_t ndof) { fNdof = ndof;}
55 loizides 1.12 using TObject::Error;
56 bendavid 1.7
57     // Fitted Mass Error
58 paus 1.17 Double_t MassError() const { return fMassError; }
59     void SetMassError(Double_t massError) { fMassError = massError;}
60 bendavid 1.7 // Lxy
61 paus 1.17 Double_t Lxy() const { return fLxy; }
62     void SetLxy(Double_t lxy) { fLxy = lxy;}
63 bendavid 1.7 // Lxy Error
64 paus 1.17 Double_t LxyError() const { return fLxyError; }
65     void SetLxyError(Double_t lxyError) { fLxyError = lxyError;}
66 bendavid 1.7 // Dxy (two dimensional impact parameter)
67 paus 1.17 Double_t Dxy() const { return fDxy; }
68     void SetDxy(Double_t dxy) { fDxy = dxy;}
69 bendavid 1.7 // Dxy Error
70 paus 1.17 Double_t DxyError() const { return fDxyError; }
71     void SetDxyError(Double_t dxyError) { fDxyError = dxyError;}
72 bendavid 1.7 // Lz
73 paus 1.17 Double_t Lz() const { return fLz; }
74     void SetLz(Double_t lz) { fLz = lz;}
75 bendavid 1.7 // Lz Error
76 paus 1.17 Double_t LzError() const { return fLzError; }
77     void SetLzError(Double_t lzError) { fLzError = lzError;}
78    
79     //--------------------------------------------------------------------------------------------
80 bendavid 1.7 // Accessors/Setter: Extended Vertex fit info from this level
81 paus 1.17 //--------------------------------------------------------------------------------------------
82 bendavid 1.13 Double_t Charge() const;
83 bendavid 1.7
84 bendavid 1.10 //Momentum Accessors/setter
85 bendavid 1.18 FourVector Mom() const { return FourVector(fMomentum); }
86 bendavid 1.13 void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
87     void SetMom(const FourVector &p) { fMomentum = p; }
88 bendavid 1.11
89 bendavid 1.13 UInt_t NDaughters() const { return fDaughterData.Entries(); }
90     const Particle *Daughter(UInt_t i) const { return DaughterDat(i)->Original(); }
91     const DaughterData *DaughterDat(UInt_t i) const { return fDaughterData.At(i); }
92 bendavid 1.15 Bool_t HasDaughter(const Particle *p) const;
93     Bool_t HasCommonDaughter(const DecayParticle *p) const;
94     Bool_t HasSameDaughters(const DecayParticle *p) const;
95 bendavid 1.11
96 bendavid 1.13 void AddDaughterData(DaughterData *ddata) { fDaughterData.Add(ddata); }
97    
98     const ThreeVector Position() const;
99     const ThreeVector RelativePosition() const;
100    
101     const Vertex *PriVertex() const;
102     void SetPriVertex(Vertex *v) { fPriVertex = v; }
103 bendavid 1.11
104 loizides 1.1 protected:
105 bendavid 1.13 UInt_t fAbsPdgId;
106 bendavid 1.7 // Fit quality
107 bendavid 1.18 Double32_t fChi2;
108     UInt_t fNdof;
109 bendavid 1.7 // Base vertex fit info
110 bendavid 1.18 Double32_t fMassError;
111     Double32_t fLxy;
112     Double32_t fLxyError;
113     Double32_t fDxy;
114     Double32_t fDxyError;
115     Double32_t fLz;
116     Double32_t fLzError;
117 bendavid 1.7 // Extended vertex fit info
118 bendavid 1.18 FourVectorM32 fMomentum; //momentum fourvector
119 bendavid 1.16 RefArray<DaughterData,32> fDaughterData; //momentum of daughters at vertex
120 bendavid 1.13 TRef fPriVertex; //reference to primary vertex
121 loizides 1.1
122 paus 1.17 ClassDef(DecayParticle, 1)
123 loizides 1.1 };
124     }
125 bendavid 1.7
126     //--------------------------------------------------------------------------------------------------
127     inline TParticlePDG *mithep::DecayParticle::ParticlePdgEntry() const
128     {
129 paus 1.17 // return entry to pdg database for the particle
130 bendavid 1.7
131     return TDatabasePDG::Instance()->GetParticle(fAbsPdgId);
132     }
133 bendavid 1.8
134     //--------------------------------------------------------------------------------------------------
135     inline void mithep::DecayParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
136     {
137 paus 1.17 // set four vector
138 bendavid 1.8
139 bendavid 1.11 fMomentum.SetXYZT(px,py,pz,e);
140     }
141    
142     //--------------------------------------------------------------------------------------------------
143 bendavid 1.13 inline const mithep::ThreeVector mithep::DecayParticle::Position() const
144     {
145 paus 1.17 // return absolute position of decay
146 bendavid 1.13
147     const mithep::Vertex *pv = PriVertex();
148    
149     if (pv)
150     return ( pv->Position() + RelativePosition() );
151     else
152     return RelativePosition();
153    
154     }
155    
156     //--------------------------------------------------------------------------------------------------
157     inline const mithep::ThreeVector mithep::DecayParticle::RelativePosition() const
158     {
159 paus 1.17 // compute the position vector of the decay vertex relative to the primary vertex
160 bendavid 1.13
161     mithep::ThreeVector dz(0,0,fLz*TMath::Abs(fMomentum.Pz())/fMomentum.Pz());
162    
163     mithep::ThreeVector momPerp(fMomentum.Px(),fMomentum.Py(),0);
164     mithep::ThreeVector zHat(0,0,1.0);
165    
166 paus 1.17 mithep::ThreeVector dxy = -momPerp.Cross(zHat)*fDxy/momPerp.R();
167     mithep::ThreeVector dlxy = momPerp*fLxy/momPerp.R();
168 bendavid 1.13
169     return (dxy+dlxy+dz);
170     }
171    
172     //--------------------------------------------------------------------------------------------------
173     inline const mithep::Vertex *mithep::DecayParticle::PriVertex() const
174     {
175 paus 1.17 // return primary vertex
176 bendavid 1.11
177 bendavid 1.13 return static_cast<const Vertex*>(fPriVertex.GetObject());
178 bendavid 1.8 }
179 loizides 1.1 #endif