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