]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtrack.h
Missing ; added.
[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 #ifndef ALIESDTRACK_H
16 #include "AliESDtrack.h"
17 #endif
18
19 #ifndef ALIKALMANTRACK_H
20 #include "AliKalmanTrack.h"
21 #endif
22
23
24 #ifndef ALITRDCALPID_H
25 #include "Cal/AliTRDCalPID.h"
26 #endif
27
28 #ifndef ALITRDTRACKLET
29 #include "AliTRDtracklet.h"
30 #endif
31
32 class AliTrackReference;
33 class AliTRDcluster;
34 class AliTRDtrack : public AliKalmanTrack {
35
36  public:
37
38   enum { kMAXCLUSTERSPERTRACK = 210 };
39    
40   enum { kNdet      = 540
41        , kNstacks   =  90
42        , kNplane    =   AliESDtrack::kTRDnPlanes
43        , kNcham     =   5
44        , kNsect     =  18 };
45   
46   enum AliTRDPIDMethod {
47          kNN = 0
48        , kLQ = 1 };
49
50          AliTRDtrack();
51          AliTRDtrack(/*const*/ AliTRDcluster *c, Int_t index
52                    , const Double_t xx[5], const Double_t cc[15]
53                    , Double_t xr, Double_t alpha);
54          AliTRDtrack(const AliTRDtrack &t/*, const Bool_t owner = kTRUE*/);    
55          AliTRDtrack(const AliESDtrack &t);
56  virtual ~AliTRDtrack();
57          AliTRDtrack(const AliKalmanTrack &t, Double_t alpha); 
58
59          void            ResetClusters()                              { SetChi2(0.0); 
60                                                                         SetNumberOfClusters(0);              }
61          Int_t           Compare(const TObject *o) const;
62          void            AddNWrong()                                  { fNWrong++;                           }  
63          void            IncCross()                                   { fNCross++; 
64                                                                         if (fBackupTrack) 
65                                                                           fBackupTrack->IncCross();          }
66
67          Int_t           GetSector() const;
68          Float_t         GetClusterdQdl(Int_t i) const                { return fdQdl[i];                     }    
69          Double_t        GetdEdx() const                              { return fdEdx;                        }
70          Int_t           GetNdedx() const                             { return fNdedx;                       }
71          Double_t        GetPIDsignal() const                         { return GetdEdx();                    }
72          Int_t           GetClusterIndex(Int_t i) const               { return fIndex[i];                    }
73          using AliExternalTrackParam::GetC;
74          Double_t        GetC() const                                 { return AliExternalTrackParam
75                                                                              ::GetC(GetBz());                }
76          Double_t        GetPredictedChi2(const AliTRDcluster *c
77                                         , Double_t h01) const;
78          AliTRDPIDMethod GetPIDMethod() const                         { return fPIDmethod;                   }
79          Float_t         GetPIDsignals(Int_t iPlane
80                                      , Int_t iSlice) const            { return fdEdxPlane[iPlane][iSlice];   }
81          Int_t           GetPIDTimBin(Int_t i) const                  { return fTimBinPlane[i];              }
82          Double_t        GetLikelihoodElectron() const                { return fLhElectron;                  }
83          Int_t           GetSeedLabel() const                         { return fSeedLab;                     }
84          const Int_t    *GetBackupIndexes() const                     { return fIndexBackup;                 }
85          const Int_t    *GetIndexes() const                           { return fIndex;                       }
86          Int_t           GetProlongation(Double_t xk
87                                        , Double_t &y
88                                        , Double_t &z);
89          Bool_t          GetStop() const                              { return fStopped;                     }
90          Int_t           GetNRotate() const                           { return fNRotate;                     }
91          Int_t           GetNWrong() const                            { return fNWrong;                      }
92          Int_t           GetNCross() const                            { return fNCross;                      }
93          Int_t           GetNExpected() const                         { return fNExpected;                   }
94          Int_t           GetNLast() const                             { return fNLast;                       }
95          Int_t           GetNExpectedLast() const                     { return fNExpectedLast;               }
96          AliTRDtracklet  GetTracklets(Int_t i) const                  { return fTracklets[i];                }
97          Float_t         GetBudget(Int_t i) const                     { return fBudget[i];                   }
98          Float_t         GetChi2Last() const                          { return fChi2Last;                    }
99          AliTRDtrack    *GetBackupTrack() const                       { return fBackupTrack;                 }
100          // dummy to bridge the function in AliTRDtrackV1
101          //Int_t          GetNumberOfClusters() const                   { printf("AliTRDtrack::GetNumberOfClusters()\n"); 
102          //                                                               return AliKalmanTrack::GetNumberOfClusters();   }
103  inline virtual Int_t    GetNumberOfTracklets() const;
104  virtual Int_t           GetTrackletIndex(Int_t plane) const          { return plane>=0 && plane<6 
105                                                                              ? fTrackletIndex[plane] : -1;   } 
106
107
108          void            SetdEdx(Double_t dedx)                       { fdEdx                      = dedx;   }
109          void            SetStop(Bool_t stop)                         { fStopped                   = stop;   }
110          void            SetPIDsignals(Float_t dedx
111                                      , Int_t iPlane
112                                      , Int_t iSlice)                  { fdEdxPlane[iPlane][iSlice] = dedx;   }
113          void            SetPIDTimBin(Int_t timbin, Int_t i)          { fTimBinPlane[i]            = timbin; }
114          void            SetLikelihoodElectron(Float_t l)             { fLhElectron                = l;      }
115          void            SetSampledEdx(Float_t q, Int_t i);
116          void            SetSampledEdx(Float_t q);
117          void            SetSeedLabel(Int_t lab)                      { fSeedLab                   = lab;    }
118          void            SetNWrong(Int_t nwrong)                      { fNWrong                    = nwrong; }
119          void            SetNCross(Int_t ncross)                      { fNCross                    = ncross; }
120          void            SetNExpected(Int_t nexp)                     { fNExpected                 = nexp;   }
121          void            SetNLast(Int_t nlast)                        { fNLast                     = nlast;  }
122          void            SetNExpectedLast(Int_t nexp)                 { fNExpectedLast             = nexp;   }
123          void            SetChi2Last(Float_t chi2)                    { fChi2Last                  = chi2;   }
124          void            SetTracklets(Int_t i, AliTRDtracklet t)      { fTracklets[i]              = t;      }
125          void            SetBudget(Int_t i, Float_t budget)           { fBudget[i]                 = budget; }
126          void            SetPIDMethod(AliTRDPIDMethod method)         { fPIDmethod                 = method; }
127
128          void              SetTrackSegmentDirMom(const Int_t plane);
129          void            CookdEdx(Double_t low = 0.05, Double_t up = 0.7);
130          void            CookdEdxTimBin(const Int_t tid);
131          Bool_t          CookPID(Int_t &pidQuality); 
132          void            SetCluster(AliTRDcluster * const cl
133                                   , Int_t index = -1)                 { fClusters[(index == -1) 
134                                                                                   ? GetNumberOfClusters()-1 
135                                                                                   : index]         = cl;     }
136          AliTRDcluster*  GetCluster(Int_t layer) const                { return (layer >= 0 &&
137                                                                                 layer <  GetNumberOfClusters()) 
138                                                                              ? fClusters[layer] 
139                                                                              : 0x0;                          }
140          Float_t         GetMomentumPlane(Int_t plane) const          { return (plane >= 0 && 
141                                                                                 plane <  kNplane) 
142                                                                              ? fMom[plane] 
143                                                                              : 0.0;                          }
144    const Double_t*       GetPID() const                               { return fPID;                         }
145          Float_t         GetSnpPlane(Int_t plane) const               { return (plane >= 0 && 
146                                                                                 plane <  kNplane) 
147                                                                              ? fSnp[plane] 
148                                                                              : 0.0;                          }
149          Float_t         GetTglPlane(Int_t plane) const               { return (plane >= 0 && 
150                                                                                 plane <  kNplane) 
151                                                                              ? fTgl[plane]  
152                                                                              : 0.0;                          }
153          Float_t         GetTrackLengthPlane(Int_t plane) const;
154
155          void            MakeBackupTrack();
156          Bool_t          PropagateTo(Double_t xr, Double_t x0 = 8.72, Double_t rho = 5.86e-3);
157          Int_t           PropagateToR(Double_t xr, Double_t step);
158          Int_t           PropagateToX(Double_t xr, Double_t step);
159          Bool_t          Rotate(Double_t angle, Bool_t absolute = kFALSE);
160          Float_t         StatusForTOF();
161          Bool_t          Update(const AliTRDcluster *c, Double_t chi2, Int_t index, Double_t h01);
162          Bool_t          Update(const AliTRDtracklet &tracklet, Double_t chi2, Int_t index);
163          Int_t           UpdateMI(/*const */AliTRDcluster *c, Double_t chi2
164                                 , Int_t index, Double_t h01
165                                 , Int_t plane, Int_t tid = 0);
166
167  protected:
168
169          AliTRDtrack           &operator=(const AliTRDtrack &t);
170
171                void                CookdEdxNN(Float_t *dedx);
172          Double_t        GetBz() const;
173          Bool_t          Update(const AliCluster */*c*/, Double_t /*chi2*/, Int_t /*idx*/) { return 0;   }
174          Double_t        GetPredictedChi2(const AliCluster* /*c*/) const                   { return 0.0; }
175
176  protected:
177
178          Int_t    fSeedLab;                           //  Track label taken from seeding  
179          Float_t  fdEdx;                              //  dE/dx (truncated mean)
180          Float_t  fDE;                                //  Integrated delta energy
181          Float_t  fdEdxPlane[kNplane][AliTRDCalPID::kNSlicesLQ];  //  dE/dx from all 6 planes in 3 slices each
182          Int_t    fTimBinPlane[kNplane];              //  Time bin of Max cluster from all 6 planes
183          UChar_t  fPIDquality;                        //  No of planes used for PID calculation 
184          Double_t fPID[AliPID::kSPECIES];             //  PID probabilities
185                Float_t  fMom[kNplane];                      //  Track momentum at chamber entrance
186                Float_t  fSnp[kNplane];                      //  Track direction
187                Float_t  fTgl[kNplane];                      //  Track direction
188          AliTRDcluster  *fClusters[kMAXCLUSTERSPERTRACK];    //  List of assigned clusters
189          Bool_t   fClusterOwner;                      //  Indicates the track is owner of cluster
190          AliTRDPIDMethod fPIDmethod;                  //  Switch between different PID methods
191          Bool_t   fStopped;                           //  Track stop indication
192          Int_t    fIndex[kMAXCLUSTERSPERTRACK];       //  Global indexes of clusters  
193          Int_t    fIndexBackup[kMAXCLUSTERSPERTRACK]; //  Backup indexes of clusters - used in iterations
194          Float_t  fdQdl[kMAXCLUSTERSPERTRACK];        //  Cluster amplitudes corrected for track angles    
195            
196                Float_t  fLhElectron;                        //  Likelihood to be an electron
197          Int_t    fNWrong;                            //  Number of wrong clusters
198          Int_t    fNRotate;                           //  Number of rotation
199          Int_t    fNCross;                            //  Number of the cross materials
200          Int_t    fNExpected;                         //  Expected number of cluster
201          Int_t    fNLast;                             //  Number of clusters in last 2 layers
202          Int_t    fNExpectedLast;                     //  Number of expected clusters on last 2 layers
203          Int_t    fNdedx;                             //  Number of clusters for dEdx measurment
204          Float_t  fChi2Last;                          //  Chi2 in the  last 2 layers
205          AliTRDtracklet  fTracklets[6];               //  Tracklets
206          Float_t  fBudget[3];                         //  Integrated material budget
207          AliTRDtrack    *fBackupTrack;                //! Backup track
208         
209          Int_t    fTrackletIndex[6];                  //  Tracklets index in the tracker list
210
211   ClassDef(AliTRDtrack,9)                             //  TRD reconstructed tracks
212
213 };                     
214
215 //___________________________________________________________
216 inline Int_t AliTRDtrack::GetNumberOfTracklets() const
217 {
218         Int_t ntrklt = 0;
219         for(int ip=0; ip<6; ip++) if(fTrackletIndex[ip] >= 0) ntrklt++;
220         return ntrklt;
221 }
222
223
224 #endif   
225