]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtracker.h
Modified file access mode
[u/mrichter/AliRoot.git] / TRD / AliTRDtracker.h
1 #ifndef ALITRDTRACKER_H
2 #define ALITRDTRACKER_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 //  The TRD tracker                                                       //
12 //                                                                        //
13 ////////////////////////////////////////////////////////////////////////////
14
15 #ifndef ROOT_TObjArray
16 #include "TObjArray.h" 
17 #endif
18
19 #ifndef ALITRACKER_H
20 #include "AliTracker.h" 
21 #endif
22
23 #ifndef ALITRDPROPAGATIONLAYER_H
24 #include "AliTRDpropagationLayer.h"
25 #endif
26
27 class TFile;
28 class TTree;
29 class TH1D;
30 class TH2D;
31 class TParticle;
32 class TParticlePDG;
33 class TTreeSRedirector;
34
35 class AliTRDgeometry;
36 class AliTRDtrack;
37 class AliTRDtracklet;
38 class AliTRDcluster;
39 class AliTRDseed;
40 class AliESDEvent;
41 class AliTRDpropagationLayer;
42
43 ///////////////////////////////////////////////////////////////////////////////
44 //                                                                           //
45 //  The standard TRD tracker                                                 //  
46 //  Based on Kalman filltering approach                                      //
47 //                                                                           //
48 ///////////////////////////////////////////////////////////////////////////////
49
50 class AliTRDtracker : public AliTracker { 
51
52  public:
53
54   void InitLogHists();
55   void SaveLogHists();
56
57   enum { kMaxLayersPerSector   = 1000
58        , kMaxTimeBinIndex      = 216
59        , kTrackingSectors      = 18   };
60   
61   AliTRDtracker();
62   AliTRDtracker(const AliTRDtracker &t);
63   AliTRDtracker(const TFile *in);
64   virtual         ~AliTRDtracker(); 
65   AliTRDtracker   &operator=(const AliTRDtracker &/*t*/) { return *this;          } 
66   
67   void             SetAddTRDseeds()               { fAddTRDseeds = kTRUE;         }
68   void             SetNoTilt()                    { fNoTilt      = kTRUE;         }
69   
70   Int_t            GetTimeBinsPerPlane() const    { return fTimeBinsPerPlane;     }   
71   Double_t         GetMaxChi2() const             { return fgkMaxChi2;            }
72   Float_t          GetLabelFraction() const       { return fgkLabelFraction;      }
73   Float_t          GetMinClustersInTrack() const  { return fgkMinClustersInTrack; }
74   Int_t            GetLastPlane(AliTRDtrack *track);
75   Double_t         GetTiltFactor(const AliTRDcluster *c);
76   virtual Bool_t   GetTrackPoint(Int_t index, AliTrackPoint& p) const;
77   Double_t         GetX(Int_t sec, Int_t plane, Int_t localTB) const;
78   Double_t         GetX(Int_t sec, Int_t pl) const
79                                                   { return fTrSec[sec]->GetLayer(pl)->GetX();            }
80   Int_t            GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const 
81                                                   { return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
82   Double_t         GetLayerNumber(Int_t sec, Double_t x) const 
83                                                   { return fTrSec[sec]->GetLayerNumber(x);               }
84   AliCluster      *GetCluster(Int_t index) const  { if (index >= fNclusters) return NULL; 
85                                                     return (AliCluster *) fClusters->UncheckedAt(index); }
86   
87   static Int_t     Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);    
88   Int_t            Clusters2Tracks(AliESDEvent *event);
89   Int_t            PropagateBack(AliESDEvent *event);
90   Int_t            RefitInward(AliESDEvent *event);
91   
92   virtual void     CookLabel(AliKalmanTrack *t, Float_t wrong) const;
93   
94   Int_t            LocalToGlobalID(Int_t lid);
95   Int_t            GlobalToLocalID(Int_t gid);
96   
97   Int_t            LoadClusters(TTree *cTree);
98   void             UnloadClusters();
99   virtual void     UseClusters(const AliKalmanTrack *t, Int_t from = 0) const;  
100   Int_t            ReadClusters(TObjArray *array, TTree *in) const;
101   AliTRDcluster   *GetCluster(AliTRDtrack *track, Int_t plane, Int_t timebin, UInt_t &index);
102   Int_t            FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack *track
103                               , Int_t *clusters, AliTRDtracklet &tracklet);  
104   
105  protected:
106
107   Bool_t           AdjustSector(AliTRDtrack *track); 
108   AliTRDtrack     *RegisterSeed(AliTRDseed *seeds, Double_t *params);
109   Int_t            FollowBackProlongation(AliTRDtrack &t);
110   //void             MakeSeedsMI(Int_t inner, Int_t outer, AliESDEvent *esd = 0);
111   
112  protected:
113
114   //__________________________________________________________________________________________________
115   class AliTRDtrackingSector {
116     
117    public:
118     
119     AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs);
120     AliTRDtrackingSector(const AliTRDtrackingSector &/*t*/);
121     ~AliTRDtrackingSector();
122     
123     AliTRDtrackingSector &operator=(const AliTRDtrackingSector &/*t*/) { return *this; }
124     
125     Int_t    GetNumberOfLayers() const             { return fN; }
126     Int_t    GetNumberOfTimeBins() const;
127     Int_t    GetLayerNumber(Double_t x) const;
128     Int_t    GetInnerTimeBin() const;
129     Int_t    GetOuterTimeBin() const;
130     Int_t    GetLayerNumber(Int_t tb) const        { return fTimeBinIndex[tb];   }
131     Double_t GetX(Int_t pl) const                  { return fLayers[pl]->GetX(); }
132     AliTRDpropagationLayer* GetLayer(Int_t i)      { return fLayers[i];          }
133     Int_t    GetSector() const {return fGeomSector;}    
134     
135     void     MapTimeBinLayers();
136     Int_t    Find(Double_t x) const; 
137     void     InsertLayer(AliTRDpropagationLayer *pl);
138     Int_t    CookTimeBinIndex(Int_t plane, Int_t localTB) const;     
139     
140    private:
141     
142     Int_t                   fN;                              // Total number of layers
143     AliTRDgeometry         *fGeom;                           // Geometry
144     AliTRDpropagationLayer *fLayers[kMaxLayersPerSector];    // Layers   
145     Int_t                   fTimeBinIndex[kMaxTimeBinIndex]; // Time bin index
146     Int_t                   fGeomSector;                     // Sector# in AliTRDgeometry
147     
148   };
149   
150  protected:
151
152   AliTRDgeometry          *fGeom;                          // Pointer to TRD geometry
153   AliTRDtrackingSector    *fTrSec[kTrackingSectors];       // Array of tracking sectors;    
154   Int_t                    fNclusters;                     // Number of clusters in TRD 
155   TObjArray               *fClusters;                      // List of clusters for all sectors
156   Int_t                    fNseeds;                        // Number of track seeds  
157   TObjArray               *fSeeds;                         // List of track seeds
158   Int_t                    fNtracks;                       // Number of reconstructed tracks 
159   TObjArray               *fTracks;                        // List of reconstructed tracks   
160   Int_t                    fTimeBinsPerPlane;              // Timebins per plane in track prolongation 
161   
162   static const Double_t    fgkMaxChi2;                     // Max increment in track chi2 
163   static const Float_t     fgkMinClustersInTrack;          // Min number of clusters in track
164   static const Float_t     fgkLabelFraction;               // Min fraction of same label
165   static const Double_t    fgkMaxSnp;                      // Maximal snp for tracking
166   static const Double_t    fgkMaxStep;                     // Maximal step for tracking  
167   
168   Bool_t                   fAddTRDseeds;                   // Something else
169   Bool_t                   fNoTilt;                        // No tilt, or what?
170
171   // Histograms
172   TH1D                    *fHBackfit;                      // QA histogram
173   TH1D                    *fHClSearch;                     // QA histogram
174   TH1D                    *fHRefit;                        // QA histogram
175   TH1D                    *fHX;                            // QA histogram
176   TH1D                    *fHNCl;                          // QA histogram
177   TH1D                    *fHNClTrack;                     // QA histogram
178   TH1D                    *fHFindCl[4];                    // QA histogram
179   TH1D                    *fHMinYPos;                      // QA histogram
180   TH1D                    *fHMinYNeg;                      // QA histogram
181   TH1D                    *fHMinZ;                         // QA histogram
182   TH2D                    *fHMinD;                         // QA histogram
183   TH1D                    *fHDeltaX;                       // QA histogram
184   TH1D                    *fHXCl;                          // QA histogram
185
186  protected:
187
188   Int_t            FollowProlongation(AliTRDtrack &t);
189   Int_t            PropagateToX(AliTRDtrack &t, Double_t xToGo, Double_t maxStep);
190   Double_t         ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
191   Double_t         ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
192
193  
194   TTreeSRedirector        *fDebugStreamer;                 //!Debug streamer
195   
196   ClassDef(AliTRDtracker, 4)                               // TRD tracker
197     
198 };
199
200
201 #endif