1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
bendavid |
1.33 |
// $Id: DecayParticle.h,v 1.32 2011/03/13 22:14:11 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 |
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 |
bendavid |
1.11 |
#include "MitAna/DataTree/interface/DaughterData.h"
|
22 |
bendavid |
1.13 |
#include "MitAna/DataTree/interface/Vertex.h"
|
23 |
bendavid |
1.30 |
#include "MitAna/DataTree/interface/ConversionQuality.h"
|
24 |
bendavid |
1.13 |
#include "MitAna/DataCont/interface/RefArray.h"
|
25 |
loizides |
1.20 |
|
26 |
loizides |
1.1 |
namespace mithep
|
27 |
|
|
{
|
28 |
bendavid |
1.13 |
class DecayParticle : public Particle
|
29 |
loizides |
1.1 |
{
|
30 |
|
|
public:
|
31 |
loizides |
1.23 |
DecayParticle() :
|
32 |
|
|
fAbsPdgId(0), fChi2(0), fNdof(0), fMassError(0),
|
33 |
bendavid |
1.33 |
fLxy(0), fLxyError(0), fDxy(0), fDxyError(0), fLz(0), fLzError(0), fDzBeamlineError(0),
|
34 |
|
|
fDzBeamlineEcal(0), fDzBeamlineEcalError(0), fNSharedHits(0) {}
|
35 |
loizides |
1.20 |
DecayParticle(Int_t absPdgId) :
|
36 |
loizides |
1.23 |
fAbsPdgId(absPdgId), fChi2(0), fNdof(0), fMassError(0),
|
37 |
bendavid |
1.33 |
fLxy(0), fLxyError(0), fDxy(0), fDxyError(0), fLz(0), fLzError(0), fDzBeamlineError(0),
|
38 |
|
|
fDzBeamlineEcal(0), fDzBeamlineEcalError(0), fNSharedHits(0) {}
|
39 |
bendavid |
1.7 |
|
40 |
loizides |
1.26 |
void AddDaughterData(const DaughterData *dd)
|
41 |
|
|
{ fDaughterData.Add(dd); ClearCharge(); }
|
42 |
loizides |
1.25 |
UInt_t AbsPdgId() const { return fAbsPdgId; }
|
43 |
|
|
Double_t Chi2() const { return fChi2; }
|
44 |
|
|
const Particle *Daughter(UInt_t i) const { return DaughterDat(i)->Original(); }
|
45 |
|
|
const DaughterData *DaughterDat(UInt_t i) const { return fDaughterData.At(i); }
|
46 |
|
|
Double_t Dxy() const { return fDxy; }
|
47 |
bendavid |
1.29 |
Double_t DxyCorrected(const ThreeVector &v) const;
|
48 |
|
|
Double_t DxyCorrected(const BaseVertex *v) const;
|
49 |
loizides |
1.25 |
Double_t DxyError() const { return fDxyError; }
|
50 |
bendavid |
1.32 |
Double_t DzBeamlineError() const { return fDzBeamlineError; }
|
51 |
bendavid |
1.33 |
Double_t DzBeamlineEcal() const { return fDzBeamlineEcal; }
|
52 |
|
|
Double_t DzBeamlineEcalError() const { return fDzBeamlineEcalError; }
|
53 |
bendavid |
1.29 |
Double_t DzCorrected(const ThreeVector &v) const;
|
54 |
|
|
Double_t DzCorrected(const BaseVertex *v) const;
|
55 |
loizides |
1.20 |
Bool_t HasDaughter(const Particle *p) const;
|
56 |
|
|
Bool_t HasCommonDaughter(const DecayParticle *p) const;
|
57 |
loizides |
1.25 |
Bool_t HasPriVertex() const { return fPriVtx.IsValid(); }
|
58 |
loizides |
1.23 |
Bool_t HasPriVertex(const Vertex *v)
|
59 |
loizides |
1.25 |
const { return fPriVtx.RefsObject(v); }
|
60 |
loizides |
1.26 |
Bool_t HasSameDaughters(const DecayParticle *p) const;
|
61 |
loizides |
1.25 |
Double_t Lxy() const { return fLxy; }
|
62 |
|
|
Double_t LxyError() const { return fLxyError; }
|
63 |
bendavid |
1.31 |
Double_t LxyCorrected(const BaseVertex *v) const;
|
64 |
loizides |
1.25 |
Double_t Lz() const { return fLz; }
|
65 |
|
|
Double_t LzError() const { return fLzError; }
|
66 |
loizides |
1.26 |
Double_t MassError() const { return fMassError; }
|
67 |
|
|
UShort_t Ndof() const { return fNdof; }
|
68 |
loizides |
1.25 |
UInt_t NDaughters() const { return fDaughterData.Entries(); }
|
69 |
|
|
EObjType ObjType() const { return kDecayParticle; }
|
70 |
loizides |
1.20 |
TParticlePDG *ParticlePdgEntry() const;
|
71 |
|
|
Double_t PdgMass() const;
|
72 |
loizides |
1.26 |
const Vertex *PriVertex() const { return fPriVtx.Obj(); }
|
73 |
loizides |
1.25 |
Double_t Prob() const { return TMath::Prob(fChi2,fNdof); }
|
74 |
bendavid |
1.24 |
const ThreeVector &Position() const;
|
75 |
bendavid |
1.30 |
const ConversionQuality &Quality() const { return fQuality; }
|
76 |
|
|
ConversionQuality &Quality() { return fQuality; }
|
77 |
loizides |
1.20 |
const ThreeVector RelativePosition() const;
|
78 |
bendavid |
1.28 |
Bool_t SharedLayer(Track::EHitLayer l) const { return fSharedLayers.TestBit(l); }
|
79 |
|
|
const BitMask48 &SharedLayers() const { return fSharedLayers; }
|
80 |
bendavid |
1.30 |
UInt_t NSharedLayers() const { return fSharedLayers.NBitsSet(); }
|
81 |
|
|
UInt_t NSharedHits() const { return TMath::Max(UInt_t(fNSharedHits),NSharedLayers()); }
|
82 |
loizides |
1.25 |
void SetAbsPdgId(UInt_t apid) { fAbsPdgId=apid; }
|
83 |
|
|
void SetChi2(Double_t chi2) { fChi2 = chi2; }
|
84 |
|
|
void SetDxy(Double_t dxy) { fDxy = dxy; ClearPos(); }
|
85 |
|
|
void SetDxyError(Double_t dxyError) { fDxyError = dxyError; }
|
86 |
bendavid |
1.32 |
void SetDzBeamlineError(Double_t dzError) { fDzBeamlineError = dzError; }
|
87 |
bendavid |
1.33 |
void SetDzBeamlineEcal(Double_t dz) { fDzBeamlineEcal = dz; }
|
88 |
|
|
void SetDzBeamlineEcalError(Double_t dzError) { fDzBeamlineEcalError = dzError; }
|
89 |
loizides |
1.25 |
void SetLxy(Double_t lxy) { fLxy = lxy; ClearPos(); }
|
90 |
|
|
void SetLxyError(Double_t lxyError) { fLxyError = lxyError; }
|
91 |
|
|
void SetLz(Double_t lz) { fLz = lz; ClearPos(); }
|
92 |
|
|
void SetLzError(Double_t lzError) { fLzError = lzError; }
|
93 |
loizides |
1.26 |
void SetMassError(Double_t massError) { fMassError = massError; }
|
94 |
|
|
void SetMom(Double_t px, Double_t py, Double_t pz, Double_t e);
|
95 |
|
|
void SetMom(const FourVector &p)
|
96 |
|
|
{ fMomentum = p; ClearMom(); ClearPos(); }
|
97 |
|
|
void SetNdof(UShort_t ndof) { fNdof = ndof; }
|
98 |
bendavid |
1.30 |
void SetNSharedHits(UShort_t nhits) { fNSharedHits = nhits; }
|
99 |
bendavid |
1.24 |
void SetPriVertex(const Vertex *v) { fPriVtx = v; ClearPos(); }
|
100 |
bendavid |
1.28 |
void SetSharedLayer(Track::EHitLayer l) { fSharedLayers.SetBit(l); }
|
101 |
|
|
void SetSharedLayers(const BitMask48 &layers) { fSharedLayers = layers; }
|
102 |
loizides |
1.12 |
using TObject::Error;
|
103 |
loizides |
1.20 |
|
104 |
loizides |
1.1 |
protected:
|
105 |
bendavid |
1.24 |
void ClearPos() const { fCachePosFlag.ClearCache(); }
|
106 |
loizides |
1.23 |
Double_t GetCharge() const;
|
107 |
|
|
void GetMom() const;
|
108 |
bendavid |
1.24 |
void GetPos() const;
|
109 |
loizides |
1.23 |
|
110 |
loizides |
1.20 |
UInt_t fAbsPdgId; //absolute value of pid code
|
111 |
loizides |
1.26 |
Double32_t fChi2; //[0,0,12]chi-squared of fit
|
112 |
|
|
UShort_t fNdof; //degrees of freedom for fit
|
113 |
|
|
Double32_t fMassError; //[0,0,14]fitted mass error
|
114 |
|
|
Double32_t fLxy; //[0,0,14]fitted lxy (decay length)
|
115 |
|
|
Double32_t fLxyError; //[0,0,14]fitted lxy error
|
116 |
|
|
Double32_t fDxy; //[0,0,14]fitted impact parameter
|
117 |
|
|
Double32_t fDxyError; //[0,0,14]fitted impact parameter error
|
118 |
|
|
Double32_t fLz; //[0,0,14]fitted lz (decay length)
|
119 |
|
|
Double32_t fLzError; //[0,0,14]fitted lz error
|
120 |
bendavid |
1.32 |
Double32_t fDzBeamlineError; //[0,0,14]fitted deltaz error at beamline
|
121 |
bendavid |
1.33 |
Double32_t fDzBeamlineEcal; //[0,0,14]fitted deltaz at beamline (with ecal constraint)
|
122 |
|
|
Double32_t fDzBeamlineEcalError; //[0,0,14]fitted deltaz error at beamline (with ecal constraint)
|
123 |
loizides |
1.26 |
Vect4M fMomentum; //momentum fourvector
|
124 |
bendavid |
1.24 |
RefArray<DaughterData> fDaughterData; //momentum of daughters at vertex
|
125 |
loizides |
1.25 |
Ref<Vertex> fPriVtx; //reference to primary vertex
|
126 |
bendavid |
1.28 |
BitMask48 fSharedLayers; //layer mask for shared hits from daughter particles
|
127 |
bendavid |
1.30 |
UShort_t fNSharedHits; //number of shared hits
|
128 |
|
|
ConversionQuality fQuality; //conversion quality flags
|
129 |
bendavid |
1.24 |
mutable CacheFlag fCachePosFlag; //||cache validity flag for position
|
130 |
|
|
mutable ThreeVector fCachedPos; //!cached momentum vector (filled by derived classes)
|
131 |
|
|
|
132 |
bendavid |
1.33 |
ClassDef(DecayParticle, 5) // Decay particle class
|
133 |
loizides |
1.1 |
};
|
134 |
|
|
}
|
135 |
bendavid |
1.7 |
|
136 |
|
|
//--------------------------------------------------------------------------------------------------
|
137 |
loizides |
1.23 |
inline Double_t mithep::DecayParticle::GetCharge() const
|
138 |
|
|
{
|
139 |
|
|
// Return sum of charge of daughter particles.
|
140 |
|
|
|
141 |
|
|
Double_t charge = 0;
|
142 |
|
|
for (UInt_t i=0; i<NDaughters(); ++i)
|
143 |
|
|
charge += DaughterDat(i)->Charge();
|
144 |
|
|
|
145 |
|
|
return charge;
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
//--------------------------------------------------------------------------------------------------
|
149 |
|
|
inline void mithep::DecayParticle::GetMom() const
|
150 |
|
|
{
|
151 |
|
|
// Get momentum values from stored values.
|
152 |
|
|
|
153 |
loizides |
1.26 |
fCachedMom.SetCoordinates(fMomentum.Pt(), fMomentum.Eta(), fMomentum.Phi(), fMomentum.M());
|
154 |
loizides |
1.23 |
}
|
155 |
|
|
|
156 |
|
|
//--------------------------------------------------------------------------------------------------
|
157 |
bendavid |
1.7 |
inline TParticlePDG *mithep::DecayParticle::ParticlePdgEntry() const
|
158 |
|
|
{
|
159 |
loizides |
1.20 |
// Return entry to pdg database for the particle.
|
160 |
bendavid |
1.7 |
|
161 |
|
|
return TDatabasePDG::Instance()->GetParticle(fAbsPdgId);
|
162 |
|
|
}
|
163 |
bendavid |
1.8 |
|
164 |
|
|
//--------------------------------------------------------------------------------------------------
|
165 |
|
|
inline void mithep::DecayParticle::SetMom(Double_t px, Double_t py, Double_t pz, Double_t e)
|
166 |
|
|
{
|
167 |
loizides |
1.20 |
// Set four vector.
|
168 |
bendavid |
1.8 |
|
169 |
bendavid |
1.11 |
fMomentum.SetXYZT(px,py,pz,e);
|
170 |
bendavid |
1.24 |
ClearMom();
|
171 |
|
|
ClearPos();
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
//--------------------------------------------------------------------------------------------------
|
175 |
|
|
inline const mithep::ThreeVector &mithep::DecayParticle::Position() const
|
176 |
|
|
{
|
177 |
|
|
// Return cached momentum value.
|
178 |
|
|
|
179 |
|
|
if (!fCachePosFlag.IsValid()) {
|
180 |
|
|
GetPos();
|
181 |
|
|
fCachePosFlag.SetValid();
|
182 |
|
|
}
|
183 |
|
|
|
184 |
|
|
return fCachedPos;
|
185 |
bendavid |
1.11 |
}
|
186 |
|
|
|
187 |
|
|
//--------------------------------------------------------------------------------------------------
|
188 |
bendavid |
1.24 |
inline void mithep::DecayParticle::GetPos() const
|
189 |
bendavid |
1.13 |
{
|
190 |
loizides |
1.20 |
// Return absolute position of decay.
|
191 |
bendavid |
1.13 |
|
192 |
|
|
const mithep::Vertex *pv = PriVertex();
|
193 |
|
|
|
194 |
|
|
if (pv)
|
195 |
bendavid |
1.24 |
fCachedPos = pv->Position() + RelativePosition();
|
196 |
bendavid |
1.13 |
else
|
197 |
bendavid |
1.24 |
fCachedPos = RelativePosition();
|
198 |
bendavid |
1.13 |
}
|
199 |
|
|
|
200 |
|
|
//--------------------------------------------------------------------------------------------------
|
201 |
|
|
inline const mithep::ThreeVector mithep::DecayParticle::RelativePosition() const
|
202 |
|
|
{
|
203 |
loizides |
1.20 |
// Compute the position vector of the decay vertex relative to the primary vertex.
|
204 |
bendavid |
1.13 |
|
205 |
loizides |
1.26 |
mithep::ThreeVector dz(0,0,fLz*TMath::Abs(Pz())/Pz());
|
206 |
|
|
mithep::ThreeVector momPerp(Px(),Py(),0);
|
207 |
bendavid |
1.13 |
mithep::ThreeVector zHat(0,0,1.0);
|
208 |
paus |
1.17 |
mithep::ThreeVector dxy = -momPerp.Cross(zHat)*fDxy/momPerp.R();
|
209 |
|
|
mithep::ThreeVector dlxy = momPerp*fLxy/momPerp.R();
|
210 |
bendavid |
1.13 |
return (dxy+dlxy+dz);
|
211 |
|
|
}
|
212 |
bendavid |
1.29 |
|
213 |
|
|
//--------------------------------------------------------------------------------------------------
|
214 |
|
|
inline Double_t mithep::DecayParticle::DxyCorrected(const mithep::ThreeVector &v) const
|
215 |
|
|
{
|
216 |
|
|
// Compute Dxy with respect to a given position
|
217 |
|
|
mithep::ThreeVector momPerp(Px(),Py(),0);
|
218 |
|
|
return momPerp.Cross(Position() - v).Z()/Pt();
|
219 |
|
|
|
220 |
|
|
}
|
221 |
|
|
|
222 |
|
|
//--------------------------------------------------------------------------------------------------
|
223 |
|
|
inline Double_t mithep::DecayParticle::DxyCorrected(const mithep::BaseVertex *v) const
|
224 |
|
|
{
|
225 |
|
|
// Compute Dxy with respect to a given beamspot/vertex
|
226 |
|
|
return DxyCorrected(v->Position());
|
227 |
|
|
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
//--------------------------------------------------------------------------------------------------
|
231 |
|
|
inline Double_t mithep::DecayParticle::DzCorrected(const mithep::ThreeVector &v) const
|
232 |
|
|
{
|
233 |
|
|
// Compute Dxy with respect to a given position
|
234 |
|
|
mithep::ThreeVector momPerp(Px(),Py(),0);
|
235 |
|
|
mithep::ThreeVector posPerp(Position().X()-v.X(),Position().Y()-v.Y(),0);
|
236 |
|
|
return Position().Z() - v.Z() - posPerp.Dot(momPerp)/Pt() * (Pz()/Pt());
|
237 |
|
|
|
238 |
|
|
}
|
239 |
|
|
|
240 |
|
|
//--------------------------------------------------------------------------------------------------
|
241 |
|
|
inline Double_t mithep::DecayParticle::DzCorrected(const mithep::BaseVertex *v) const
|
242 |
|
|
{
|
243 |
|
|
// Compute Dxy with respect to a given beamspot/vertex
|
244 |
|
|
return DzCorrected(v->Position());
|
245 |
|
|
|
246 |
|
|
}
|
247 |
|
|
|
248 |
bendavid |
1.31 |
inline Double_t mithep::DecayParticle::LxyCorrected(const mithep::BaseVertex *v) const
|
249 |
|
|
{
|
250 |
|
|
// Compute Dxy with respect to a given beamspot/vertex
|
251 |
|
|
Double_t dx = Position().X() - v->X();
|
252 |
|
|
Double_t dy = Position().Y() - v->Y();
|
253 |
|
|
Double_t lxy = (dx*Px() + dy*Py())/Pt();
|
254 |
|
|
return lxy;
|
255 |
|
|
|
256 |
|
|
}
|
257 |
|
|
|
258 |
loizides |
1.1 |
#endif
|