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