ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitAna/DataTree/interface/DecayParticle.h
Revision: 1.22
Committed: Tue Feb 17 15:09:45 2009 UTC (16 years, 2 months ago) by bendavid
Content type: text/plain
Branch: MAIN
Changes since 1.21: +6 -12 lines
Log Message:
Switched to templated Ref class

File Contents

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