ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/DecayParticle.h
Revision: 1.15
Committed: Wed Oct 29 17:02:55 2008 UTC (16 years, 6 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.14: +4 -1 lines
Log Message:
Added daughter comparison functions to DecayParticle

File Contents

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