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