Coding convention + var inizialization corrected
[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 /* $Id$ */
8
9 ///////////////////////////////////////////////////////////////////////////////
10 //                                                                           //
11 //  Represents a reconstructed TRD track                                     //
12 //                                                                           //
13 ///////////////////////////////////////////////////////////////////////////////
14
15 #include "AliKalmanTrack.h"
16
17 #include "AliTRDtracklet.h"
18
19 class AliESDtrack;
20 class AliTrackReference;
21 class AliTRDcluster;
22
23 const unsigned kMAXCLUSTERSPERTRACK = 210;
24
25 class AliTRDtrack : public AliKalmanTrack {
26
27  public:
28    
29   enum { kNdet     = 540
30        , kNstacks   =  90
31        , kNplane    =   6
32        , kNcham     =   5
33        , kNsect     =  18
34        , kNslice    =   3};
35
36    AliTRDtrack();
37    AliTRDtrack(/*const */AliTRDcluster *c, Int_t index, const Double_t xx[5], const Double_t cc[15], Double_t xr, Double_t alpha);
38    AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner = kTRUE*/);    
39    AliTRDtrack(const AliESDtrack &t);
40    ~AliTRDtrack();
41    AliTRDtrack(const AliKalmanTrack &t, Double_t alpha); 
42
43            void     ResetClusters()                                         { SetChi2(0.0); 
44                                                                               SetNumberOfClusters(0);              }
45            Int_t    Compare(const TObject *o) const;
46            void     AddNWrong()                                             { fNWrong++;                           }  
47            void     IncCross()                                              { fNCross++; 
48                                                                               if (fBackupTrack) fBackupTrack->IncCross();  }
49
50            Int_t    GetSector() const;
51            Float_t  GetClusterdQdl(Int_t i) const                           { return fdQdl[i];                     }    
52            Double_t GetdEdx() const                                         { return fdEdx;                        }
53            Int_t    GetNdedx() const                                        { return fNdedx;                       }
54            Double_t GetPIDsignal() const                                    { return GetdEdx();                    }
55            Int_t    GetClusterIndex(Int_t i) const                          { return fIndex[i];                    }
56            Double_t GetC() const                                            { return AliExternalTrackParam::GetC(GetBz()); }
57            Double_t GetPredictedChi2(const AliTRDcluster *c, Double_t h01) const;
58            Float_t  GetPIDsignals(Int_t iPlane, Int_t iSlice) const         { return fdEdxPlane[iPlane][iSlice];   }
59            Int_t    GetPIDTimBin(Int_t i) const                             { return fTimBinPlane[i];              }
60            Double_t GetLikelihoodElectron() const                           { return fLhElectron;                  }
61            Int_t    GetSeedLabel() const                                    { return fSeedLab;                     }
62            Int_t   *GetBackupIndexes()                                      { return fIndexBackup;                 }
63            Int_t   *GetIndexes()                                            { return fIndex;                       }
64            Int_t    GetProlongation(Double_t xk, Double_t &y, Double_t &z);
65            Bool_t   GetStop() const                                         { return fStopped;                     }
66            Int_t    GetNRotate() const                                      { return fNRotate;                     }
67            Int_t    GetNWrong() const                                       { return fNWrong;                      }
68            Int_t    GetNCross() const                                       { return fNCross;                      }
69            Int_t    GetNExpected() const                                    { return fNExpected;                   }
70            Int_t    GetNLast() const                                        { return fNLast;                       }
71            Int_t    GetNExpectedLast() const                                { return fNExpectedLast;               }
72   AliTRDtracklet    GetTracklets(Int_t i) const                             { return fTracklets[i];                }
73            Float_t  GetBudget(Int_t i) const                                { return fBudget[i];                   }
74            Float_t  GetChi2Last() const                                     { return fChi2Last;                    }
75   AliTRDtrack      *GetBackupTrack()                                        { return fBackupTrack;                 }
76
77            void     SetdEdx(Double_t dedx)                                  { fdEdx                      = dedx;   }
78            void     SetStop(Bool_t stop)                                    { fStopped                   = stop;   }
79            void     SetPIDsignals(Float_t dedx, Int_t iPlane, Int_t iSlice) { fdEdxPlane[iPlane][iSlice] = dedx;   }
80            void     SetPIDTimBin(Int_t timbin, Int_t i)                     { fTimBinPlane[i]            = timbin; }
81            void     SetLikelihoodElectron(Float_t l)                        { fLhElectron                = l;      }
82            void     SetSampledEdx(Float_t q, Int_t i);
83            void     SetSampledEdx(Float_t q);
84            void     SetSeedLabel(Int_t lab)                                 { fSeedLab                   = lab;    }
85            void     SetNWrong(Int_t nwrong)                                 { fNWrong                    = nwrong; }
86            void     SetNCross(Int_t ncross)                                 { fNCross                    = ncross; }
87            void     SetNExpected(Int_t nexp)                                { fNExpected                 = nexp;   }
88            void     SetNLast(Int_t nlast)                                   { fNLast                     = nlast;  }
89            void     SetNExpectedLast(Int_t nexp)                            { fNExpectedLast             = nexp;   }
90            void     SetChi2Last(Float_t chi2)                               { fChi2Last                  = chi2;   }
91            void     SetTracklets(Int_t i, AliTRDtracklet t)                 { fTracklets[i]              = t;      }
92                                          void     SetBudget(Int_t i, Float_t budget)                      { fBudget[i]                 = budget; }
93
94 // A. Bercuci new functions
95                                         void            SetTrackSegmentDirMom(const Int_t plane);
96                                         void            CookdEdx(Double_t low = 0.05, Double_t up = 0.7);
97                                         void            CookdEdxTimBin();
98                                         Int_t           CookPID(AliESDtrack *p);
99                                         void            SetCluster(AliTRDcluster* cl, Int_t index = -1) {fClusters[(index == -1) ? GetNumberOfClusters()-1 : index] = cl;}
100         inline  AliTRDcluster* GetCluster(Int_t layer){ return (layer >= 0 && layer < GetNumberOfClusters()) ?  fClusters[layer] : 0x0;}
101         inline  Float_t GetMomentumPlane(Int_t plane) const {return (plane >= 0 && plane < kNplane) ? fMom[plane] : 0.;}
102         inline  Float_t GetSnpPlane(Int_t plane) const {return (plane >= 0 && plane < kNplane) ? fSnp[plane] : 0.;}
103         inline  Float_t GetTglPlane(Int_t plane) const {return (plane >= 0 && plane < kNplane) ? fTgl[plane] : 0.;}
104                 Float_t GetTrackLengthPlane(Int_t plane) const;
105 //end A.Bercuci
106
107                                          void     MakeBackupTrack();
108            Bool_t   PropagateTo(Double_t xr, Double_t x0 = 8.72, Double_t rho = 5.86e-3);
109            Int_t    PropagateToR(Double_t xr, Double_t step);
110            Int_t    PropagateToX(Double_t xr, Double_t step);
111            Bool_t   Rotate(Double_t angle, Bool_t absolute = kFALSE);
112            Float_t  StatusForTOF();
113            Bool_t   Update(const AliTRDcluster *c, Double_t chi2, Int_t i, Double_t h01);
114            Int_t    UpdateMI(/*const */AliTRDcluster *c, Double_t chi2, Int_t i, Double_t h01, Int_t plane);
115  
116  protected:
117
118   AliTRDtrack      &operator=(const AliTRDtrack &t);
119
120            Double_t GetBz() const;
121            Bool_t   Update(const AliCluster */*c*/, Double_t /*chi2*/, Int_t /*idx*/) { return 0;   }
122            Double_t GetPredictedChi2(const AliCluster* /*c*/) const                   { return 0.0; }
123
124            Int_t    fSeedLab;                           //  Track label taken from seeding  
125            Float_t  fdEdx;                              //  dE/dx (truncated mean)
126            Float_t  fDE;                                //  Integrated delta energy
127            Float_t  fdEdxPlane[kNplane][kNslice];       //  dE/dx from all 6 planes in 3 slices each
128            Int_t    fTimBinPlane[kNplane];              //  Time bin of Max cluster from all 6 planes
129
130                                         // A.Bercuci
131                                          Float_t  fMom[kNplane];                      //  Track momentum at chamber entrance
132                                          Float_t  fSnp[kNplane];                   //  track direction
133                                          Float_t  fTgl[kNplane];                   //  track direction
134            AliTRDcluster*   fClusters[kMAXCLUSTERSPERTRACK];
135            Bool_t   fClusterOwner;         // indicates the track is owner of cluster
136            // end A.Bercuci
137                                          
138                                          Bool_t   fStopped;                           //  Track stop indication
139            Int_t    fIndex[kMAXCLUSTERSPERTRACK];       //  Global indexes of clusters  
140            Int_t    fIndexBackup[kMAXCLUSTERSPERTRACK]; //  Backup indexes of clusters - used in iterations
141            Float_t  fdQdl[kMAXCLUSTERSPERTRACK];        //  Cluster amplitudes corrected for track angles    
142            
143                                          Float_t  fLhElectron;                        //  Likelihood to be an electron
144            Int_t    fNWrong;                            //  Number of wrong clusters
145            Int_t    fNRotate;                           //  Number of rotation
146            Int_t    fNCross;                            //  Number of the cross materials
147            Int_t    fNExpected;                         //  Expected number of cluster
148            Int_t    fNLast;                             //  Number of clusters in last 2 layers
149            Int_t    fNExpectedLast;                     //  Number of expected clusters on last 2 layers
150            Int_t    fNdedx;                             //  Number of clusters for dEdx measurment
151            Float_t  fChi2Last;                          //  Chi2 in the  last 2 layers
152    AliTRDtracklet   fTracklets[6];                      //  Tracklets
153            Float_t  fBudget[3];                         //  Integrated material budget
154    AliTRDtrack     *fBackupTrack;                       //! Backup track
155
156    ClassDef(AliTRDtrack,8)                              //  TRD reconstructed tracks
157
158 };                     
159
160 #endif