]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliKFParticleBase.h
Added methods to set/get centrailty from clusters in outer layer, which is less noisy...
[u/mrichter/AliRoot.git] / STEER / AliKFParticleBase.h
1 //---------------------------------------------------------------------------------
2 // The AliKFParticleBase class
3 // .
4 // @author  S.Gorbunov, I.Kisel
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 AliKFParticle class
14 // 
15 //  -= Copyright &copy ALICE HLT Group =-
16 //_________________________________________________________________________________
17
18
19
20 #ifndef ALIKFPARTICLEBASE_H
21 #define ALIKFPARTICLEBASE_H
22
23 #include "TObject.h"
24
25 class AliKFParticleBase :public TObject {
26   
27  public:
28
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 AliKFParticleBase &p, 
49                                 Double_t &DS, Double_t &DSp ) const = 0;
50   
51   //* Transport on dS value along trajectory, output to P,C
52
53   virtual void Transport( Double_t dS, Double_t P[], Double_t C[] ) const = 0;
54
55
56
57   //*
58   //*  INITIALIZATION
59   //*
60
61   //* Constructor 
62
63   AliKFParticleBase();
64
65   //* Destructor 
66
67   virtual ~AliKFParticleBase() { ; }
68
69  //* Initialisation from "cartesian" coordinates ( X Y Z Px Py Pz )
70  //* Parameters, covariance matrix, charge, and mass hypothesis should be provided 
71
72   void Initialize( const Double_t Param[], const Double_t Cov[], Int_t Charge, Double_t Mass );
73
74   //* Initialise covariance matrix and set current parameters to 0.0 
75
76   void Initialize();
77
78   //* Set decay vertex parameters for linearisation 
79
80   void SetVtxGuess( Double_t x, Double_t y, Double_t z );
81
82   //*
83   //*  ACCESSORS
84   //*
85
86   //* Simple accessors 
87
88   Double_t GetX    () const { return fP[0]; }
89   Double_t GetY    () const { return fP[1]; }
90   Double_t GetZ    () const { return fP[2]; }
91   Double_t GetPx   () const { return fP[3]; }
92   Double_t GetPy   () const { return fP[4]; }
93   Double_t GetPz   () const { return fP[5]; }
94   Double_t GetE    () const { return fP[6]; }
95   Double_t GetS    () const { return fP[7]; }
96   Int_t    GetQ    () const { return fQ;    }
97   Double_t GetChi2 () const { return fChi2; }
98   Int_t    GetNDF  () const { return fNDF;  }
99   
100   Double_t GetParameter ( Int_t i )        const { return fP[i];       }
101   Double_t GetCovariance( Int_t i )        const { return fC[i];       }
102   Double_t GetCovariance( Int_t i, Int_t j ) const { return fC[IJ(i,j)]; }
103
104   //* Accessors with calculations( &value, &estimated sigma )
105   //* error flag returned (0 means no error during calculations) 
106
107   Int_t GetMomentum    ( Double_t &P, Double_t &SigmaP ) const ;
108   Int_t GetPt          ( Double_t &Pt, Double_t &SigmaPt ) const ;
109   Int_t GetEta         ( Double_t &Eta, Double_t &SigmaEta ) const ;
110   Int_t GetPhi         ( Double_t &Phi, Double_t &SigmaPhi ) const ;
111   Int_t GetMass        ( Double_t &M, Double_t &SigmaM ) const ;
112   Int_t GetDecayLength ( Double_t &L, Double_t &SigmaL ) const ;
113   Int_t GetDecayLengthXY ( Double_t &L, Double_t &SigmaL ) const ;
114   Int_t GetLifeTime    ( Double_t &T, Double_t &SigmaT ) const ;
115   Int_t GetR           ( Double_t &R, Double_t &SigmaR ) const ;
116
117   //*
118   //*  MODIFIERS
119   //*
120   
121   Double_t & X    () { return fP[0]; }
122   Double_t & Y    () { return fP[1]; }
123   Double_t & Z    () { return fP[2]; }
124   Double_t & Px   () { return fP[3]; }
125   Double_t & Py   () { return fP[4]; }
126   Double_t & Pz   () { return fP[5]; }
127   Double_t & E    () { return fP[6]; }
128   Double_t & S    () { return fP[7]; }
129   Int_t    & Q    () { return fQ;    }
130   Double_t & Chi2 () { return fChi2; }
131   Int_t    & NDF  () { return fNDF;  }
132
133   Double_t & Parameter ( Int_t i )        { return fP[i];       }
134   Double_t & Covariance( Int_t i )        { return fC[i];       }
135   Double_t & Covariance( Int_t i, Int_t j ) { return fC[IJ(i,j)]; }
136
137
138   //* 
139   //* CONSTRUCTION OF THE PARTICLE BY ITS DAUGHTERS AND MOTHER
140   //* USING THE KALMAN FILTER METHOD
141   //*
142
143
144   //* Simple way to add daughter ex. D0+= Pion; 
145
146   void operator +=( const AliKFParticleBase &Daughter );  
147
148   //* Add daughter track to the particle 
149
150   void AddDaughter( const AliKFParticleBase &Daughter );
151
152   //* Set production vertex 
153
154   void SetProductionVertex( const AliKFParticleBase &Vtx );
155
156   //* Set mass constraint 
157
158   void SetMassConstraint( Double_t Mass, Double_t SigmaMass = 0 );
159   
160   //* Set no decay length for resonances
161
162   void SetNoDecayLength();
163
164
165   //* Everything in one go  
166
167   void Construct( const AliKFParticleBase *vDaughters[], Int_t NDaughters, 
168                   const AliKFParticleBase *ProdVtx=0,   Double_t Mass=-1, Bool_t IsConstrained=0  );
169
170
171   //*
172   //*                   TRANSPORT
173   //* 
174   //*  ( main transportation parameter is S = SignedPath/Momentum )
175   //*  ( parameters of decay & production vertices are stored locally )
176   //*
177
178
179   //* Transport the particle to its decay vertex 
180
181   void TransportToDecayVertex();
182
183   //* Transport the particle to its production vertex 
184
185   void TransportToProductionVertex();
186
187   //* Transport the particle on dS parameter (SignedPath/Momentum) 
188
189   void TransportToDS( Double_t dS );
190
191   //* Particular extrapolators one can use 
192
193   Double_t GetDStoPointBz( Double_t Bz, const Double_t xyz[] ) const;
194   
195   void GetDStoParticleBz( Double_t Bz, const AliKFParticleBase &p, 
196                           Double_t &dS, Double_t &dS1       ) const ;
197  
198   // Double_t GetDStoPointCBM( const Double_t xyz[] ) const;
199  
200    void TransportBz( Double_t Bz, Double_t dS, Double_t P[], Double_t C[] ) const;
201    void TransportCBM( Double_t dS, Double_t P[], Double_t C[] ) const;  
202
203
204   //* 
205   //* OTHER UTILITIES
206   //*
207
208   //* Calculate distance from another object [cm]
209
210   Double_t GetDistanceFromVertex( const Double_t vtx[] ) const;
211   Double_t GetDistanceFromVertex( const AliKFParticleBase &Vtx ) const;
212   Double_t GetDistanceFromParticle( const AliKFParticleBase &p ) const;
213
214   //* Calculate sqrt(Chi2/ndf) deviation from vertex
215   //* v = [xyz], Cv=[Cxx,Cxy,Cyy,Cxz,Cyz,Czz]-covariance matrix
216
217   Double_t GetDeviationFromVertex( const Double_t v[], 
218                                    const Double_t Cv[]=0 ) const;
219   Double_t GetDeviationFromVertex( const AliKFParticleBase &Vtx ) const;
220   Double_t GetDeviationFromParticle( const AliKFParticleBase &p ) const;  
221
222   //* Subtract the particle from the vertex  
223
224   void SubtractFromVertex( AliKFParticleBase &Vtx ) const;
225
226   //* Special method for creating gammas
227
228   void ConstructGammaBz( const AliKFParticleBase &daughter1,
229                          const AliKFParticleBase &daughter2, double Bz  );
230
231  protected:
232
233   static Int_t IJ( Int_t i, Int_t j ){ 
234     return ( j<=i ) ? i*(i+1)/2+j :j*(j+1)/2+i;
235   }
236
237   Double_t & Cij( Int_t i, Int_t j ){ return fC[IJ(i,j)]; }
238
239   void Convert( bool ToProduction );
240   void TransportLine( Double_t S, Double_t P[], Double_t C[] ) const ;
241   Double_t GetDStoPointLine( const Double_t xyz[] ) const;
242
243   static Bool_t InvertSym3( const Double_t A[], Double_t Ainv[] );
244
245   static void MultQSQt( const Double_t Q[], const Double_t S[], 
246                         Double_t SOut[] );
247
248   static Double_t GetSCorrection( const Double_t Part[], const Double_t XYZ[] );
249
250   void GetMeasurement( const Double_t XYZ[], Double_t m[], Double_t V[] ) const ;
251
252   Double_t fP[8];  //* Main particle parameters {X,Y,Z,Px,Py,Pz,E,S[=DecayLength/P]}
253   Double_t fC[36]; //* Low-triangle covariance matrix of fP
254   Int_t    fQ;     //* Particle charge 
255   Int_t    fNDF;   //* Number of degrees of freedom 
256   Double_t fChi2;  //* Chi^2
257
258   Double_t fSFromDecay; //* Distance from decay vertex to current position
259
260   Bool_t fAtProductionVertex; //* Flag shows that the particle error along
261                               //* its trajectory is taken from production vertex    
262
263   Double_t fVtxGuess[3];  //* Guess for the position of the decay vertex 
264                           //* ( used for linearisation of equations )
265
266   Bool_t fIsLinearized;   //* Flag shows that the guess is present
267
268   ClassDef( AliKFParticleBase, 1 );
269 };
270
271 #endif