]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliKalmanTrack.h
Initialization of the conversion constant in AliExternalTrackParam (C.Cheshkov)
[u/mrichter/AliRoot.git] / STEER / AliKalmanTrack.h
1 #ifndef ALIKALMANTRACK_H
2 #define ALIKALMANTRACK_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 //-------------------------------------------------------------------------
10 //                          Class AliKalmanTrack
11 //      fixed the interface for the derived reconstructed track classes 
12 //            Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch 
13 //-------------------------------------------------------------------------
14
15 #include <TObject.h>
16 #include "AliLog.h"
17 #include "AliPID.h"
18 #include "AliMagF.h"
19
20 class AliCluster;
21
22 class AliKalmanTrack : public TObject {
23 public:
24   AliKalmanTrack();
25   AliKalmanTrack(const AliKalmanTrack &t);
26
27   virtual ~AliKalmanTrack(){};
28   void SetLabel(Int_t lab) {fLab=lab;}
29   void SetFakeRatio(Float_t ratio) {fFakeRatio=ratio;}
30
31   Bool_t   IsSortable() const {return kTRUE;}
32   Int_t    GetLabel()   const {return fLab;}
33   Float_t    GetFakeRatio()   const {return fFakeRatio;}
34   Double_t GetChi2()    const {return fChi2;}
35   Double_t GetMass()    const {return fMass;}
36   Int_t    GetNumberOfClusters() const {return fN;}
37   virtual Int_t GetClusterIndex(Int_t) const { //reserved for AliTracker
38     AliWarning("Method must be overloaded !\n");
39     return 0;
40   } 
41   virtual Double_t GetPIDsignal() const {
42     AliWarning("Method must be overloaded !\n");
43     return 0.;
44   }
45
46   virtual Double_t GetDCA(const AliKalmanTrack *p,Double_t &xthis,Double_t &xp) const; 
47   virtual 
48   Double_t PropagateToDCA(AliKalmanTrack *p, Double_t d=0., Double_t x0=0.); 
49   virtual Double_t GetAlpha() const {
50     AliWarning("Method must be overloaded !\n");
51     return 0.;
52   }
53   virtual Double_t GetSigmaY2() const {
54     AliWarning("Method must be overloaded !\n");
55     return 0.;
56   }
57   virtual Double_t GetSigmaZ2() const {
58     AliWarning("Method must be overloaded !\n");
59     return 0.;
60   }
61
62   virtual Int_t Compare(const TObject *) const {return 0;} 
63
64   virtual void GetExternalParameters(Double_t&/*xr*/,Double_t/*x*/[5]) const=0;
65   virtual void GetExternalCovariance(Double_t /*cov*/[15]) const = 0;
66
67   virtual Double_t GetPredictedChi2(const AliCluster *) const = 0;
68   virtual Int_t PropagateTo(Double_t/*xr*/,Double_t/*x0*/,Double_t/*rho*/) = 0;
69   //virtual Int_t PropagateToVertex(Double_t /*d*/=0., Double_t /*x0*/=0.) = 0; 
70   virtual Int_t Update(const AliCluster*, Double_t /*chi2*/, UInt_t) = 0;
71
72   static void SetFieldMap(const AliMagF *map) { fgkFieldMap=map; }
73   static const AliMagF *GetFieldMap() { return fgkFieldMap; }
74
75   static void SetUniformFieldTracking() {
76      if (fgkFieldMap==0) {
77         printf("AliKalmanTrack: Field map has not been set !\n"); 
78         exit(1);
79      } 
80      fgConvConst=1000/0.299792458/(fgkFieldMap->SolenoidField()+1e-13);
81   }
82   static void SetNonuniformFieldTracking() { fgConvConst=0.; }
83
84   static Double_t GetConvConst();
85   static Double_t MeanMaterialBudget(Double_t *start, Double_t *end, Double_t *mparam);
86  
87   // Time integration (S.Radomski@gsi.de)
88   void   StartTimeIntegral();
89   void SetIntegratedLength(Double_t l) {fIntegratedLength=l;}
90   void SetIntegratedTimes(const Double_t *times);
91
92   Bool_t IsStartedTimeIntegral() const {return fStartTimeIntegral;}
93   void     AddTimeStep(Double_t length);
94   void GetIntegratedTimes(Double_t *times) const;
95   Double_t GetIntegratedTime(Int_t pdg) const;
96   Double_t GetIntegratedLength() const {return fIntegratedLength;}
97   void PrintTime() const;
98
99 protected:
100   virtual void GetXYZ(Float_t r[3]) const = 0;
101   void     SaveLocalConvConst();
102   Double_t GetLocalConvConst() const;
103
104   void External2Helix(Double_t helix[6]) const;
105
106   void SetChi2(Double_t chi2) {fChi2=chi2;} 
107   void SetMass(Double_t mass) {fMass=mass;}
108   void SetNumberOfClusters(Int_t n) {fN=n;} 
109
110   Int_t fLab;             // track label
111   Float_t fFakeRatio;     // fake ratio
112   Double_t fChi2;         // total chi2 value for this track
113   Double_t fMass;         // mass hypothesis
114   Int_t fN;               // number of associated clusters
115
116 private:
117   static const AliMagF *fgkFieldMap;//pointer to the magnetic field map
118   static Double_t fgConvConst;      //conversion "curvature(1/cm) -> pt(GeV/c)"
119   Double_t fLocalConvConst;   //local conversion "curvature(1/cm) -> pt(GeV/c)"
120
121   // variables for time integration (S.Radomski@gsi.de)
122   Bool_t  fStartTimeIntegral;       // indicator wether integrate time
123   Double_t fIntegratedTime[AliPID::kSPECIES];       // integrated time
124   Double_t fIntegratedLength;        // integrated length
125   
126   ClassDef(AliKalmanTrack,4)    // Reconstructed track
127 };
128
129 inline Double_t AliKalmanTrack::GetConvConst() {
130 //
131 //  For backward compatibility only !
132 //
133     if (fgConvConst > 0 || fgConvConst < 0) return fgConvConst; 
134     return 1000/0.299792458/(fgkFieldMap->SolenoidField()+1e-13);
135 }
136
137 inline void AliKalmanTrack::SaveLocalConvConst() {
138   //---------------------------------------------------------------------
139   // Saves local conversion constant "curvature (1/cm) -> pt (GeV/c)" 
140   //---------------------------------------------------------------------
141      if (fgConvConst > 0 || fgConvConst < 0) return; //uniform field tracking
142      Float_t r[3]={0.,0.,0.}; GetXYZ(r);
143      Float_t b[3]; fgkFieldMap->Field(r,b);
144      fLocalConvConst=1000/0.299792458/(1e-13 - b[2]);
145
146
147 inline Double_t AliKalmanTrack::GetLocalConvConst() const {
148   //---------------------------------------------------------------------
149   // Returns conversion constant "curvature (1/cm) -> pt (GeV/c)" 
150   //---------------------------------------------------------------------
151      if (fgConvConst > 0 || fgConvConst < 0) return fgConvConst; //uniform field tracking
152      return fLocalConvConst;
153
154
155 #endif
156
157