BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
KFParticleBase.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------
2// The KFParticleBase class
3// .
4// @author S.Gorbunov, I.Kisel, I.Kulakov, M.Zyzak
5// @version 1.0
6// @since 13.05.07
7//
8// Class to reconstruct and store the decayed particle parameters.
9// The method is described in CBM-SOFT note 2007-003,
10// ``Reconstruction of decayed particles based on the Kalman filter'',
11// http://www.gsi.de/documents/DOC-2007-May-14-1.pdf
12//
13// This class describes general mathematics which is used by KFParticle class
14//
15// -= Copyright &copy ALICE HLT and CBM L1 Groups =-
16//_________________________________________________________________________________
17
18#ifndef ALIKFPARTICLEBASE_H
19#define ALIKFPARTICLEBASE_H
20
21#include "TObject.h"
22
23#include <vector>
24
25class KFParticleBase : public TObject
26{
27
28 public:
29 //*
30 //* ABSTRACT METHODS HAVE TO BE DEFINED IN USER CLASS
31 //*
32
33 //* Virtual method to access the magnetic field
34
35 virtual void GetFieldValue(const Double_t xyz[], Double_t B[]) const = 0;
36
37 //* Virtual methods needed for particle transportation
38 //* One can use particular implementations for collider (only Bz component)
39 //* geometry and for fixed-target (CBM-like) geometry which are provided below
40 //* in TRANSPORT section
41
42 //* Get dS to xyz[] space point
43
44 virtual Double_t GetDStoPoint(const Double_t xyz[]) const = 0;
45
46 //* Get dS to other particle p (dSp for particle p also returned)
47
48 virtual void GetDStoParticle(const KFParticleBase& p, Double_t& DS, Double_t& DSp) const = 0;
49
50 //* Transport on dS value along trajectory, output to P,C
51
52 virtual void Transport(Double_t dS, Double_t P[], Double_t C[]) const = 0;
53
54 //*
55 //* INITIALIZATION
56 //*
57
58 //* Constructor
59
61
62 //* Destructor
63
64 virtual ~KFParticleBase() { ; }
65
66 //* Initialisation from "cartesian" coordinates ( X Y Z Px Py Pz )
67 //* Parameters, covariance matrix, charge, and mass hypothesis should be provided
68
69 void Initialize(const Double_t Param[], const Double_t Cov[], Int_t Charge, Double_t Mass);
70
71 //* Initialise covariance matrix and set current parameters to 0.0
72
73 void Initialize();
74
75 //* Set decay vertex parameters for linearisation
76
78
79 //* Set consruction method
80
82
83 //* Set and get mass hypothesis of the particle
85 const Double_t& GetMassHypo() const { return fMassHypo; }
86
87 //* Returns the sum of masses of the daughters
88 const Double_t& GetSumDaughterMass() const { return SumDaughterMass; }
89
90 //*
91 //* ACCESSORS
92 //*
93
94 //* Simple accessors
95
96 Double_t GetX() const { return fP[0]; }
97 Double_t GetY() const { return fP[1]; }
98 Double_t GetZ() const { return fP[2]; }
99 Double_t GetPx() const { return fP[3]; }
100 Double_t GetPy() const { return fP[4]; }
101 Double_t GetPz() const { return fP[5]; }
102 Double_t GetE() const { return fP[6]; }
103 Double_t GetS() const { return fP[7]; }
104 Int_t GetQ() const { return fQ; }
105 Double_t GetChi2() const { return fChi2; }
106 Int_t GetNDF() const { return fNDF; }
107
108 const Double_t& X() const { return fP[0]; }
109 const Double_t& Y() const { return fP[1]; }
110 const Double_t& Z() const { return fP[2]; }
111 const Double_t& Px() const { return fP[3]; }
112 const Double_t& Py() const { return fP[4]; }
113 const Double_t& Pz() const { return fP[5]; }
114 const Double_t& E() const { return fP[6]; }
115 const Double_t& S() const { return fP[7]; }
116 const Int_t& Q() const { return fQ; }
117 const Double_t& Chi2() const { return fChi2; }
118 const Int_t& NDF() const { return fNDF; }
119
120 Double_t GetParameter(Int_t i) const { return fP[i]; }
121 Double_t GetCovariance(Int_t i) const { return fC[i]; }
122 Double_t GetCovariance(Int_t i, Int_t j) const { return fC[IJ(i, j)]; }
123
124 //* Accessors with calculations( &value, &estimated sigma )
125 //* error flag returned (0 means no error during calculations)
126
127 Int_t GetMomentum(Double_t& P, Double_t& SigmaP) const;
128 Int_t GetPt(Double_t& Pt, Double_t& SigmaPt) const;
129 Int_t GetEta(Double_t& Eta, Double_t& SigmaEta) const;
130 Int_t GetPhi(Double_t& Phi, Double_t& SigmaPhi) const;
131 Int_t GetMass(Double_t& M, Double_t& SigmaM) const;
132 Int_t GetDecayLength(Double_t& L, Double_t& SigmaL) const;
133 Int_t GetDecayLengthXY(Double_t& L, Double_t& SigmaL) const;
134 Int_t GetLifeTime(Double_t& T, Double_t& SigmaT) const;
135 Int_t GetR(Double_t& R, Double_t& SigmaR) const;
136
137 //*
138 //* MODIFIERS
139 //*
140
141 Double_t& X() { return fP[0]; }
142 Double_t& Y() { return fP[1]; }
143 Double_t& Z() { return fP[2]; }
144 Double_t& Px() { return fP[3]; }
145 Double_t& Py() { return fP[4]; }
146 Double_t& Pz() { return fP[5]; }
147 Double_t& E() { return fP[6]; }
148 Double_t& S() { return fP[7]; }
149 Int_t& Q() { return fQ; }
150 Double_t& Chi2() { return fChi2; }
151 Int_t& NDF() { return fNDF; }
152
153 Double_t& Parameter(Int_t i) { return fP[i]; }
154 Double_t& Covariance(Int_t i) { return fC[i]; }
155 Double_t& Covariance(Int_t i, Int_t j) { return fC[IJ(i, j)]; }
156
157 //*
158 //* CONSTRUCTION OF THE PARTICLE BY ITS DAUGHTERS AND MOTHER
159 //* USING THE KALMAN FILTER METHOD
160 //*
161
162 //* Simple way to add daughter ex. D0+= Pion;
163
164 void operator+=(const KFParticleBase& Daughter);
165
166 //* Add daughter track to the particle
167
168 void AddDaughter(const KFParticleBase& Daughter);
169
170 void AddDaughterWithEnergyFit(const KFParticleBase& Daughter);
171 void AddDaughterWithEnergyCalc(const KFParticleBase& Daughter);
172 void AddDaughterWithEnergyFitMC(const KFParticleBase& Daughter); // with mass constrained
173
174 //* Set production vertex
175
176 void SetProductionVertex(const KFParticleBase& Vtx);
177
178 //* Set mass constraint
179
181 void SetMassConstraint(Double_t Mass, Double_t SigmaMass = 0);
182
183 //* Set no decay length for resonances
184
185 void SetNoDecayLength();
186
187 //* Everything in one go
188
189 void Construct(const KFParticleBase* vDaughters[],
190 Int_t nDaughters,
191 const KFParticleBase* ProdVtx = 0,
192 Double_t Mass = -1,
193 Bool_t IsConstrained = 0);
194
195 //*
196 //* TRANSPORT
197 //*
198 //* ( main transportation parameter is S = SignedPath/Momentum )
199 //* ( parameters of decay & production vertices are stored locally )
200 //*
201
202 //* Transport the particle to its decay vertex
203
205
206 //* Transport the particle to its production vertex
207
209
210 //* Transport the particle on dS parameter (SignedPath/Momentum)
211
212 void TransportToDS(Double_t dS);
213
214 //* Particular extrapolators one can use
215
216 Double_t GetDStoPointBz(Double_t Bz, const Double_t xyz[]) const;
217 Double_t GetDStoPointBy(Double_t By, const Double_t xyz[]) const;
218
219 void GetDStoParticleBz(Double_t Bz, const KFParticleBase& p, Double_t& dS, Double_t& dS1) const;
220 void GetDStoParticleBy(Double_t B, const KFParticleBase& p, Double_t& dS, Double_t& dS1) const;
221
222 Double_t GetDStoPointCBM(const Double_t xyz[]) const;
223 void GetDStoParticleCBM(const KFParticleBase& p, Double_t& dS, Double_t& dS1) const;
224
225 void TransportBz(Double_t Bz, Double_t dS, Double_t P[], Double_t C[]) const;
226 void TransportCBM(Double_t dS, Double_t P[], Double_t C[]) const;
227
228 //*
229 //* OTHER UTILITIES
230 //*
231
232 //* Calculate distance from another object [cm]
233
234 Double_t GetDistanceFromVertex(const Double_t vtx[]) const;
237
238 //* Calculate sqrt(Chi2/ndf) deviation from vertex
239 //* v = [xyz], Cv=[Cxx,Cxy,Cyy,Cxz,Cyz,Czz]-covariance matrix
240
241 Double_t GetDeviationFromVertex(const Double_t v[], const Double_t Cv[] = 0) const;
244
245 //* Subtract the particle from the vertex
246
247 void SubtractFromVertex(KFParticleBase& Vtx) const;
248
249 //* Special method for creating gammas
250
251 void ConstructGammaBz(const KFParticleBase& daughter1, const KFParticleBase& daughter2, double Bz);
252
253 //* return parameters for the Armenteros-Podolanski plot
254 static void GetArmenterosPodolanski(KFParticleBase& positive, KFParticleBase& negative, Double_t QtAlfa[2]);
255
256 //* Rotates the KFParticle object around OZ axis, OZ axis is set by the vertex position
257 void RotateXY(Double_t angle, Double_t Vtx[3]);
258
259 int Id() const { return fId; };
260 int NDaughters() const { return fDaughtersIds.size(); };
261 const std::vector<int>& DaughterIds() const { return fDaughtersIds; };
262
263 void SetId(int id) { fId = id; }; // should be always used (manualy)
264 void AddDaughterId(int id) { fDaughtersIds.push_back(id); };
265
266 void SetPDG(int pdg) { fPDG = pdg; }
267 int GetPDG() const { return fPDG; }
268
269 protected:
270 static Int_t IJ(Int_t i, Int_t j) { return (j <= i) ? i * (i + 1) / 2 + j : j * (j + 1) / 2 + i; }
271
272 Double_t& Cij(Int_t i, Int_t j) { return fC[IJ(i, j)]; }
273
274 void Convert(bool ToProduction);
275 void TransportLine(Double_t S, Double_t P[], Double_t C[]) const;
276 Double_t GetDStoPointLine(const Double_t xyz[]) const;
277 void GetDStoParticleLine(const KFParticleBase& p, Double_t& dS, Double_t& dS1) const;
278
279 void GetDSIter(const KFParticleBase& p, Double_t const& dS, Double_t x[3], Double_t dx[3], Double_t ddx[3]) const;
280
281 static Bool_t InvertSym3(const Double_t A[], Double_t Ainv[]);
282
283 static void MultQSQt(const Double_t Q[], const Double_t S[], Double_t SOut[]);
284
285 static Double_t GetSCorrection(const Double_t Part[], const Double_t XYZ[]);
286
287 void GetMeasurement(const Double_t XYZ[], Double_t m[], Double_t V[]) const;
288
289 //* Mass constraint function. is needed for the nonlinear mass constraint and a fit with mass constraint
290 void SetMassConstraint(Double_t* mP, Double_t* mC, Double_t mJ[7][7], Double_t mass);
291
292 Double_t fP[8]; //* Main particle parameters {X,Y,Z,Px,Py,Pz,E,S[=DecayLength/P]}
293 Double_t fC[36]; //* Low-triangle covariance matrix of fP
294 Int_t fQ; //* Particle charge
295 Int_t fNDF; //* Number of degrees of freedom
296 Double_t fChi2; //* Chi^2
297
298 Double_t fSFromDecay; //* Distance from decay vertex to current position
299
300 Bool_t fAtProductionVertex; //* Flag shows that the particle error along
301 //* its trajectory is taken from production vertex
302
303 Double_t fVtxGuess[3]; //* Guess for the position of the decay vertex
304 //* ( used for linearisation of equations )
305
306 Bool_t fIsLinearized; //* Flag shows that the guess is present
307
308 Int_t fConstructMethod; //* Determines the method for the particle construction.
309 //* 0 - Energy considered as an independent veriable, fitted independently from momentum, without any constraints on
310 // mass
311 //* 1 - Energy considered as a dependent variable, calculated from the momentum and mass hypothesis
312 //* 2 - Energy considered as an independent variable, fitted independently from momentum, with constraints on mass
313 // of daughter particle
314
315 Double_t SumDaughterMass; //* sum of the daughter particles masses
316 Double_t fMassHypo; //* sum of the daughter particles masse
317
318 int fId; // id of particle
319 std::vector<int> fDaughtersIds; // id of particles it created from. if size == 1 then this is id of track. TODO
320 // use in functions. why unsigned short int doesn't work???
321
322 int fPDG; // pdg hypothesis
323
325};
326
327#endif
__m128 v
Definition P4_F32vec4.h:1
int i
Definition P4_F32vec4.h:22
__m128 m
Definition P4_F32vec4.h:27
bool Bool_t
int Int_t
double Double_t
#define ClassDef(name, id)
void Convert(bool ToProduction)
Double_t & Y()
const Double_t & GetSumDaughterMass() const
Int_t GetNDF() const
void GetMeasurement(const Double_t XYZ[], Double_t m[], Double_t V[]) const
void SetProductionVertex(const KFParticleBase &Vtx)
const Int_t & Q() const
void AddDaughterWithEnergyFitMC(const KFParticleBase &Daughter)
Int_t GetPhi(Double_t &Phi, Double_t &SigmaPhi) const
const Double_t & Y() const
const Double_t & S() const
Double_t fVtxGuess[3]
static void MultQSQt(const Double_t Q[], const Double_t S[], Double_t SOut[])
Double_t GetPz() const
void GetDStoParticleBz(Double_t Bz, const KFParticleBase &p, Double_t &dS, Double_t &dS1) const
Double_t GetDStoPointCBM(const Double_t xyz[]) const
void SetNonlinearMassConstraint(Double_t Mass)
Double_t GetDStoPointLine(const Double_t xyz[]) const
void AddDaughter(const KFParticleBase &Daughter)
Double_t & Cij(Int_t i, Int_t j)
Double_t GetE() const
void AddDaughterWithEnergyCalc(const KFParticleBase &Daughter)
static Bool_t InvertSym3(const Double_t A[], Double_t Ainv[])
Double_t & Z()
Int_t GetLifeTime(Double_t &T, Double_t &SigmaT) const
Int_t GetEta(Double_t &Eta, Double_t &SigmaEta) const
Int_t GetDecayLength(Double_t &L, Double_t &SigmaL) const
Int_t GetR(Double_t &R, Double_t &SigmaR) const
Double_t SumDaughterMass
void SetPDG(int pdg)
const Double_t & GetMassHypo() const
Double_t & E()
static Double_t GetSCorrection(const Double_t Part[], const Double_t XYZ[])
Double_t GetCovariance(Int_t i, Int_t j) const
Double_t & Px()
const Double_t & Z() const
void TransportCBM(Double_t dS, Double_t P[], Double_t C[]) const
Int_t GetMomentum(Double_t &P, Double_t &SigmaP) const
Double_t GetY() const
virtual ~KFParticleBase()
void GetDSIter(const KFParticleBase &p, Double_t const &dS, Double_t x[3], Double_t dx[3], Double_t ddx[3]) const
void SubtractFromVertex(KFParticleBase &Vtx) const
const Double_t & E() const
Double_t & Parameter(Int_t i)
virtual void GetDStoParticle(const KFParticleBase &p, Double_t &DS, Double_t &DSp) const =0
Bool_t fAtProductionVertex
Double_t & Covariance(Int_t i, Int_t j)
Double_t GetDistanceFromVertex(const Double_t vtx[]) const
const std::vector< int > & DaughterIds() const
Double_t GetDStoPointBz(Double_t Bz, const Double_t xyz[]) const
Double_t & S()
void GetDStoParticleCBM(const KFParticleBase &p, Double_t &dS, Double_t &dS1) const
void TransportLine(Double_t S, Double_t P[], Double_t C[]) const
Double_t GetPx() const
void SetMassHypo(Double_t m)
const Double_t & Pz() const
Double_t GetZ() const
Int_t GetQ() const
Double_t & Pz()
virtual void Transport(Double_t dS, Double_t P[], Double_t C[]) const =0
Double_t GetDistanceFromParticle(const KFParticleBase &p) const
void operator+=(const KFParticleBase &Daughter)
Double_t GetS() const
Double_t GetDeviationFromParticle(const KFParticleBase &p) const
Double_t GetCovariance(Int_t i) const
void SetVtxGuess(Double_t x, Double_t y, Double_t z)
const Double_t & Chi2() const
void SetConstructMethod(Int_t m)
void GetDStoParticleLine(const KFParticleBase &p, Double_t &dS, Double_t &dS1) const
const Double_t & Px() const
Double_t & X()
void RotateXY(Double_t angle, Double_t Vtx[3])
virtual void GetFieldValue(const Double_t xyz[], Double_t B[]) const =0
std::vector< int > fDaughtersIds
Int_t GetMass(Double_t &M, Double_t &SigmaM) const
void AddDaughterId(int id)
void TransportToProductionVertex()
Double_t GetPy() const
Double_t GetChi2() const
void TransportBz(Double_t Bz, Double_t dS, Double_t P[], Double_t C[]) const
const Double_t & X() const
Double_t & Chi2()
Int_t GetDecayLengthXY(Double_t &L, Double_t &SigmaL) const
Double_t GetParameter(Int_t i) const
const Double_t & Py() const
static Int_t IJ(Int_t i, Int_t j)
int GetPDG() const
void SetId(int id)
Double_t GetX() const
void Construct(const KFParticleBase *vDaughters[], Int_t nDaughters, const KFParticleBase *ProdVtx=0, Double_t Mass=-1, Bool_t IsConstrained=0)
void SetMassConstraint(Double_t Mass, Double_t SigmaMass=0)
Double_t GetDeviationFromVertex(const Double_t v[], const Double_t Cv[]=0) const
const Int_t & NDF() const
static void GetArmenterosPodolanski(KFParticleBase &positive, KFParticleBase &negative, Double_t QtAlfa[2])
Double_t fC[36]
Double_t & Py()
void ConstructGammaBz(const KFParticleBase &daughter1, const KFParticleBase &daughter2, double Bz)
void GetDStoParticleBy(Double_t B, const KFParticleBase &p, Double_t &dS, Double_t &dS1) const
int NDaughters() const
Double_t & Covariance(Int_t i)
Double_t GetDStoPointBy(Double_t By, const Double_t xyz[]) const
void TransportToDS(Double_t dS)
Int_t GetPt(Double_t &Pt, Double_t &SigmaPt) const
void AddDaughterWithEnergyFit(const KFParticleBase &Daughter)
virtual Double_t GetDStoPoint(const Double_t xyz[]) const =0