37f958af26043db7db92aeab578c760e26723d31
[u/mrichter/AliRoot.git] / TRD / AliTRDtrack.h
1 #ifndef ALITRDTRACK_H
2 #define ALITRDTRACK_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 #include <AliKalmanTrack.h>
8 #include <AliTRDtracklet.h>
9
10 class AliTRDcluster;
11 class AliTPCtrack;
12 class AliESDtrack;
13 class AliTrackReference;
14
15 const unsigned kMAXCLUSTERSPERTRACK = 210; 
16
17 ///////////////////////////////////////////////////////////////////////////////
18 //                                                                           //
19 //  Represents a reconstructed TRD track                                     //
20 //                                                                           //
21 ///////////////////////////////////////////////////////////////////////////////
22
23 class AliTRDtrack : public AliKalmanTrack {
24    
25   enum { kNdet      = 540
26        , kNstacks   = 90
27        , kNplane    = 6
28        , kNcham     = 5
29        , kNsect     = 18
30        , kNslice    = 3
31        , kNtimeBins = 22 };
32
33   friend class AliTRDtracker;
34
35  public:
36
37   AliTRDtrack();
38    AliTRDtrack(const AliTRDcluster *c, UInt_t index, const Double_t xx[5],
39                const Double_t cc[15], Double_t xr, Double_t alpha);  
40    AliTRDtrack(const AliTRDtrack& t);    
41    AliTRDtrack(const AliKalmanTrack& t, Double_t alpha); 
42    AliTRDtrack(const AliESDtrack& t);
43    ~AliTRDtrack();
44
45    AliTRDtrack     &operator=(const AliTRDtrack &t);
46
47    //static AliTRDtrack* MakeTrack(const AliTrackReference *ref, Double_t mass);
48    Int_t           Compare(const TObject *o) const;
49    void            CookdEdx(Double_t low=0.05, Double_t up=0.7);   
50    Float_t         StatusForTOF();
51    Double_t        GetAlpha() const                     { return fAlpha;         }
52    Int_t           GetSector() const;
53    Double_t        GetC() const                         { return fC;             }
54    Int_t           GetClusterIndex(Int_t i) const       { return fIndex[i];      }    
55    Float_t         GetClusterdQdl(Int_t i) const        { return fdQdl[i];       }    
56    void            GetCovariance(Double_t cov[15]) const;  
57    Double_t        GetdEdx() const                      { return fdEdx;          }
58    Double_t        GetPIDsignal() const                 { return GetdEdx();      }
59    Float_t         GetPIDsignals(Int_t iPlane, Int_t iSlice) const 
60                                                         { return fdEdxPlane[iPlane][iSlice]; }
61    Int_t           GetPIDTimBin(Int_t i) const          { return fTimBinPlane[i];}
62    Double_t        GetEta() const                       { return fE;             }
63
64    void            GetExternalCovariance(Double_t cov[15]) const;   
65    void            GetExternalParameters(Double_t& xr, Double_t x[5]) const;
66
67    Double_t        GetLikelihoodElectron() const        { return fLhElectron;    }
68    Double_t        Get1Pt() const;
69    Double_t        GetP() const;
70    Double_t        GetPredictedChi2(const AliTRDcluster* c, Double_t h01) const;
71    Double_t        GetPt() const                        { return 1.0 / Get1Pt(); }   
72    void            GetPxPyPz(Double_t &px, Double_t &py, Double_t &pz) const;
73    void            GetGlobalXYZ(Double_t &x, Double_t &y, Double_t &z) const;
74    Int_t           GetSeedLabel() const                 { return fSeedLab;       }
75    Double_t        GetSigmaC2() const                   { return fCcc;           }
76    Double_t        GetSigmaTgl2() const                 { return fCtt;           }
77    Double_t        GetSigmaY2() const                   { return fCyy;           }
78    Double_t        GetSigmaZ2() const                   { return fCzz;           }
79    Double_t        GetSnp() const                       { return fX*fC - fE;     }
80    Double_t        GetTgl() const                       { return fT;             }
81    Double_t        GetX() const                         { return fX;             }
82    Double_t        GetY() const                         { return fY;             }
83    Double_t        GetZ() const                         { return fZ;             }
84    Int_t*          GetBackupIndexes()                   { return fIndexBackup;   }
85    Int_t*          GetIndexes()                         { return fIndex;         }
86
87    Double_t        GetYat(Double_t xk) const; 
88    Int_t           GetProlongation(Double_t xk, Double_t &y, Double_t &z);
89
90    void            SetStop(Bool_t stop)                 { fStopped        = stop;   }
91    Bool_t          GetStop() const                      { return fStopped;          }
92
93    Int_t           PropagateTo(Double_t xr, Double_t x0=8.72, Double_t rho=5.86e-3);
94    Int_t           PropagateToX(Double_t xr, Double_t step);
95    Int_t           PropagateToR(Double_t xr, Double_t step);
96    void            ResetCovariance();   
97    void            ResetCovariance(Float_t mult);   
98    void            ResetClusters()                      { SetChi2(0.); SetNumberOfClusters(0); }
99    Int_t           Rotate(Double_t angle, Bool_t absolute=kFALSE);
100
101    void            SetdEdx(Float_t dedx)                { fdEdx           = dedx;   }  
102    void            SetPIDsignals(Float_t dedx, Int_t iPlane, Int_t iSlice) 
103                                                         { fdEdxPlane[iPlane][iSlice] = dedx; }
104    void            SetPIDTimBin(Int_t timbin, Int_t i)  { fTimBinPlane[i] = timbin; }
105    void            SetLikelihoodElectron(Float_t l)     { fLhElectron     = l;      }
106
107    void            SetSampledEdx(Float_t q, Int_t i);
108    void            SetSampledEdx(Float_t q);
109    void            SetSeedLabel(Int_t lab)              { fSeedLab        = lab;    }
110
111    Int_t           Update(const AliTRDcluster* c, Double_t chi2, UInt_t i, Double_t h01);
112    Int_t           UpdateMI(const AliTRDcluster* c, Double_t chi2, UInt_t i, Double_t h01, Int_t plane);
113    Int_t           UpdateMI(const AliTRDtracklet & tracklet);
114
115    void            AddNWrong()                          { fNWrong++;                }
116   
117    Int_t           GetNWrong() const                    { return fNWrong;           }
118    Int_t           GetNRotate() const                   { return fNRotate;          }
119    Int_t           GetNCross() const                    { return fNCross;           }
120    void            IncCross()                           { fNCross++; if (fBackupTrack) fBackupTrack->IncCross(); }
121    AliTRDtrack*    GetBackupTrack()                     { return fBackupTrack;      }
122    void            MakeBackupTrack();
123
124  protected:
125
126    inline void     GetXYZ(Float_t r[3]) const;
127
128    Double_t        GetPredictedChi2(const AliCluster*/*c*/) const                  { return 0.0; }
129    Int_t           Update(const AliCluster*/*c*/, Double_t /*chi2*/, UInt_t /*i*/) { return 0;   }
130
131    Int_t           fSeedLab;                               // track label taken from seeding  
132    Float_t         fdEdx;                                  // dE/dx 
133    Float_t         fdEdxT;                                 // dE/dx  - truncated mean
134    Float_t         fDE;                                    // integrated delta energy
135    Float_t         fdEdxPlane[kNplane][kNslice];           // dE/dx from all 6 planes in 3 slices each
136    Int_t           fTimBinPlane[kNplane];                  // time bin of Max cluster from all 6 planes
137
138    Double_t        fAlpha;                                 // rotation angle
139    Double_t        fX;                                     // running local X-coordinate of the track (time bin)
140    Bool_t          fStopped;                               // track stop indication
141
142    Double_t        fY;                                     // Y-coordinate of the track
143    Double_t        fZ;                                     // Z-coordinate of the track
144    Double_t        fE;                                     // C*x0
145    Double_t        fT;                                     // tangent of the track momentum dip angle
146    Double_t        fC;                                     // track curvature
147
148    Double_t        fCyy;                                   // covariance
149    Double_t        fCzy, fCzz;                             // matrix
150    Double_t        fCey, fCez, fCee;                       // of the
151    Double_t        fCty, fCtz, fCte, fCtt;                 // track
152    Double_t        fCcy, fCcz, fCce, fCct, fCcc;           // parameters   
153    
154    Int_t           fIndex[kMAXCLUSTERSPERTRACK];           // global indexes of clusters  
155    Int_t           fIndexBackup[kMAXCLUSTERSPERTRACK];     // backup indexes of clusters - used in iterations
156    Float_t         fdQdl[kMAXCLUSTERSPERTRACK];            // cluster amplitudes corrected for track angles    
157                            
158    Float_t         fLhElectron;                            // Likelihood to be an electron    
159    Int_t           fNWrong;                                // number of wrong clusters
160    Int_t           fNRotate;                               // number of rotation
161    Int_t           fNCross;                                // number of the cross materials
162    Int_t           fNExpected;                             // expected number of cluster
163    Int_t           fNLast;                                 // number of clusters in last 2 layers
164    Int_t           fNExpectedLast;                         // number of expected clusters on last 2 layers
165    Int_t           fNdedx;                                 // number of clusters for dEdx measurment
166    Float_t         fChi2Last;                              // chi2 in the  last 2 layers
167    AliTRDtracklet  fTracklets[6];                          // tracklets
168    Float_t         fBudget[3];                             // integrated material budget
169    AliTRDtrack    *fBackupTrack;                           //! backup track
170
171    ClassDef(AliTRDtrack,5)                                 // TRD reconstructed tracks
172
173 };                     
174
175 #endif