ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/DecayParticle.h
Revision: 1.20
Committed: Tue Dec 9 17:46:59 2008 UTC (16 years, 4 months ago) by loizides
Content type: text/plain
Branch: MAIN
Changes since 1.19: +71 -102 lines
Log Message:
Added ObjType to retrieve type of object.

File Contents

# User Rev Content
1 loizides 1.1 //--------------------------------------------------------------------------------------------------
2 loizides 1.20 // $Id: DecayParticle.h,v 1.19 2008/12/03 16:58:17 bendavid 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     #ifndef DATATREE_DECAYPARTICLE_H
16     #define DATATREE_DECAYPARTICLE_H
17    
18 loizides 1.20 #include "MitAna/DataTree/interface/Types.h"
19 loizides 1.1 #include "MitAna/DataTree/interface/CompositeParticle.h"
20 bendavid 1.11 #include "MitAna/DataTree/interface/DaughterData.h"
21 bendavid 1.13 #include "MitAna/DataTree/interface/Vertex.h"
22     #include "MitAna/DataCont/interface/RefArray.h"
23 loizides 1.20 #include <TDatabasePDG.h>
24     #include <TParticlePDG.h>
25    
26 loizides 1.1
27     namespace mithep
28     {
29 bendavid 1.13 class DecayParticle : public Particle
30 loizides 1.1 {
31     public:
32 loizides 1.2 DecayParticle() {}
33 loizides 1.20 DecayParticle(Int_t absPdgId) :
34     fAbsPdgId(absPdgId), fChi2(0), fNdof(0), fMassError(0), fLxy(0), fLxyError(0), fDxy(0),
35     fDxyError(0), fLz(0), fLzError(0) {}
36 loizides 1.1 ~DecayParticle() {}
37 bendavid 1.7
38 loizides 1.20 UInt_t AbsPdgId() const { return fAbsPdgId; }
39     Double_t Charge() const;
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     Bool_t HasDaughter(const Particle *p) const;
46     Bool_t HasCommonDaughter(const DecayParticle *p) const;
47     Bool_t HasSameDaughters(const DecayParticle *p) const;
48     Double_t Lxy() const { return fLxy; }
49     Double_t LxyError() const { return fLxyError; }
50     Double_t MassError() const { return fMassError; }
51     UInt_t Ndof() const { return fNdof; }
52     Double_t Lz() const { return fLz; }
53     Double_t LzError() const { return fLzError; }
54     FourVector Mom() const { return FourVector(fMomentum); }
55     UInt_t NDaughters() const { return fDaughterData.Entries(); }
56     EObjType ObjType() const { return kDecayParticle; }
57     TParticlePDG *ParticlePdgEntry() const;
58     Double_t PdgMass() const;
59     Double_t Prob() const { return TMath::Prob(fChi2,fNdof); }
60     const ThreeVector Position() const;
61     const ThreeVector RelativePosition() const;
62     const Vertex *PriVertex() const;
63     void AddDaughterData(const DaughterData *dd) { fDaughterData.Add(dd); }
64     void SetAbsPdgId(UInt_t apid) { fAbsPdgId=apid; }
65     void SetChi2(Double_t chi2) { fChi2 = chi2;}
66     void SetMassError(Double_t massError) { fMassError = massError;}
67     void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
68     void SetMom(const FourVector &p) { fMomentum = p; }
69     void SetNdof(UInt_t ndof) { fNdof = ndof;}
70     void SetDxy(Double_t dxy) { fDxy = dxy;}
71     void SetDxyError(Double_t dxyError) { fDxyError = dxyError;}
72     void SetLxy(Double_t lxy) { fLxy = lxy;}
73     void SetLxyError(Double_t lxyError) { fLxyError = lxyError;}
74     void SetLz(Double_t lz) { fLz = lz;}
75     void SetLzError(Double_t lzError) { fLzError = lzError;}
76     void SetPriVertex(const Vertex *v)
77     { fPriVertex = const_cast<Vertex*>(v); }
78 loizides 1.12 using TObject::Error;
79 loizides 1.20
80 loizides 1.1 protected:
81 loizides 1.20 UInt_t fAbsPdgId; //absolute value of pid code
82     Double32_t fChi2; //chi-squared of fit
83     UInt_t fNdof; //degrees of freedom for fit
84     Double32_t fMassError; //fitted mass error
85     Double32_t fLxy; //fitted lxy (decay length)
86     Double32_t fLxyError; //fitted lxy error
87     Double32_t fDxy; //fitted impact parameter
88     Double32_t fDxyError; //fitted impact parameter error
89     Double32_t fLz; //fitted lz (decay length)
90     Double32_t fLzError; //fitted lz error
91     FourVectorM32 fMomentum; //momentum fourvector
92 bendavid 1.16 RefArray<DaughterData,32> fDaughterData; //momentum of daughters at vertex
93 loizides 1.20 TRef fPriVertex; //reference to primary vertex
94 loizides 1.1
95 loizides 1.20 ClassDef(DecayParticle, 1) // Decay particle class
96 loizides 1.1 };
97     }
98 bendavid 1.7
99     //--------------------------------------------------------------------------------------------------
100     inline TParticlePDG *mithep::DecayParticle::ParticlePdgEntry() const
101     {
102 loizides 1.20 // Return entry to pdg database for the particle.
103 bendavid 1.7
104     return TDatabasePDG::Instance()->GetParticle(fAbsPdgId);
105     }
106 bendavid 1.8
107     //--------------------------------------------------------------------------------------------------
108     inline void mithep::DecayParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
109     {
110 loizides 1.20 // Set four vector.
111 bendavid 1.8
112 bendavid 1.11 fMomentum.SetXYZT(px,py,pz,e);
113     }
114    
115     //--------------------------------------------------------------------------------------------------
116 bendavid 1.13 inline const mithep::ThreeVector mithep::DecayParticle::Position() const
117     {
118 loizides 1.20 // Return absolute position of decay.
119 bendavid 1.13
120     const mithep::Vertex *pv = PriVertex();
121    
122     if (pv)
123     return ( pv->Position() + RelativePosition() );
124     else
125     return RelativePosition();
126     }
127    
128     //--------------------------------------------------------------------------------------------------
129     inline const mithep::ThreeVector mithep::DecayParticle::RelativePosition() const
130     {
131 loizides 1.20 // Compute the position vector of the decay vertex relative to the primary vertex.
132 bendavid 1.13
133     mithep::ThreeVector dz(0,0,fLz*TMath::Abs(fMomentum.Pz())/fMomentum.Pz());
134     mithep::ThreeVector momPerp(fMomentum.Px(),fMomentum.Py(),0);
135     mithep::ThreeVector zHat(0,0,1.0);
136 paus 1.17 mithep::ThreeVector dxy = -momPerp.Cross(zHat)*fDxy/momPerp.R();
137     mithep::ThreeVector dlxy = momPerp*fLxy/momPerp.R();
138 bendavid 1.13 return (dxy+dlxy+dz);
139     }
140    
141     //--------------------------------------------------------------------------------------------------
142     inline const mithep::Vertex *mithep::DecayParticle::PriVertex() const
143     {
144 paus 1.17 // return primary vertex
145 bendavid 1.11
146 bendavid 1.13 return static_cast<const Vertex*>(fPriVertex.GetObject());
147 bendavid 1.8 }
148 loizides 1.1 #endif