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