]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtracker.h
Removing AliMUONTransientDigit and adding AliMUONObjectPair class (Laurent)
[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 #include "AliTracker.h" 
16 #include "TObjArray.h" 
17
18 class TFile;
19 class TTree;
20 class TParticle;
21 class TParticlePDG;
22
23 class AliTRDgeometry;
24 class AliTRDtrack;
25 class AliTRDtracklet;
26 class AliTRDcluster;
27 class AliTRDseed;
28 class AliESD;
29 class TTreeSRedirector;
30
31 ///////////////////////////////////////////////////////////////////////////////
32 //                                                                           //
33 //  The standard TRD tracker                                                 //  
34 //  Based on Kalman filltering approach                                      //
35 //                                                                           //
36 ///////////////////////////////////////////////////////////////////////////////
37
38 class AliTRDtracker : public AliTracker { 
39
40  public:
41
42   enum { kMaxLayersPerSector   = 1000
43        , kMaxTimeBinIndex      = 216
44        , kMaxClusterPerTimeBin = 2300
45        , kZones                = 5
46        , kTrackingSectors      = 18   };
47
48   AliTRDtracker();
49   AliTRDtracker(const AliTRDtracker &t);
50   AliTRDtracker(const TFile *in);
51   virtual         ~AliTRDtracker(); 
52   AliTRDtracker   &operator=(const AliTRDtracker &/*t*/)  { return *this;                 } 
53
54           void     SetAddTRDseeds()                       { fAddTRDseeds = kTRUE;         }
55           void     SetNoTilt()                            { fNoTilt      = kTRUE;         }
56
57           Int_t    GetTimeBinsPerPlane() const            { return fTimeBinsPerPlane;     }   
58           Double_t GetMaxChi2() const                     { return fgkMaxChi2;            }
59           Float_t  GetLabelFraction() const               { return fgkLabelFraction;      }
60           Float_t  GetMinClustersInTrack() const          { return fgkMinClustersInTrack; }
61           Int_t    GetLastPlane(AliTRDtrack *track);
62           Double_t GetTiltFactor(const AliTRDcluster *c);
63           Bool_t   GetTrackPoint(Int_t index, AliTrackPoint& p) const;
64           Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const;
65           Double_t GetX(Int_t sec, Int_t pl) const        { return fTrSec[sec]->GetLayer(pl)->GetX();            }
66           Int_t    GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const 
67                                                           { return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
68           Double_t GetLayerNumber(Int_t sec, Double_t x) const 
69                                                           { return fTrSec[sec]->GetLayerNumber(x);               }
70           AliCluster    *GetCluster(Int_t index) const    { if (index >= fNclusters) return NULL; 
71                                                             return (AliCluster *) fClusters->UncheckedAt(index); }
72
73   static  Int_t    Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);    
74           Int_t    Clusters2Tracks(AliESD *event);
75           Int_t    PropagateBack(AliESD *event);
76           Int_t    RefitInward(AliESD *event);
77
78   virtual void     CookLabel(AliKalmanTrack *t, Float_t wrong) const;
79           Int_t    CookSectorIndex(Int_t gs) const        { return kTrackingSectors - 1 - gs;                    }
80
81           Int_t    LocalToGlobalID(Int_t lid);
82           Int_t    GlobalToLocalID(Int_t gid);
83           Bool_t   Transform(AliTRDcluster *cluster);
84   
85           Int_t    LoadClusters(TTree *cTree);
86           void     UnloadClusters();
87   virtual void     UseClusters(const AliKalmanTrack *t, Int_t from = 0) const;  
88           Int_t    ReadClusters(TObjArray *array, TTree *in) const;
89           AliTRDcluster *GetCluster(AliTRDtrack *track, Int_t plane, Int_t timebin, UInt_t &index);
90           Int_t    FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack *track
91                               , Int_t *clusters, AliTRDtracklet &tracklet);
92
93  protected:
94
95   class AliTRDpropagationLayer {
96
97    public: 
98
99     AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho
100                          , Double_t x0, Int_t tbIndex, Int_t plane); 
101     AliTRDpropagationLayer(const AliTRDpropagationLayer &/*p*/);
102     ~AliTRDpropagationLayer()                                          { if (fTimeBinIndex >= 0) { 
103                                                                            delete[] fClusters; 
104                                                                            delete[] fIndex; 
105                                                                          }                              }
106     AliTRDpropagationLayer &operator=(const AliTRDpropagationLayer &/*p*/) 
107                                                                        { return *this;                  }
108                             operator Int_t() const                     { return fN;                     }
109             AliTRDcluster  *operator[](Int_t i)                        { return fClusters[i];           }
110
111             void     SetZmax(Int_t cham, Double_t center, Double_t w)  { fZc[cham]      = center;  
112                                                                          fZmax[cham]    = w;            }
113             void     SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
114             void     SetHoles(Bool_t* holes);
115             void     SetYmax(Double_t w, Double_t wsensitive)          { fYmax          = w;
116                                                                          fYmaxSensitive = wsensitive;   }
117      
118             void     SetHole(Double_t Zmax, Double_t Ymax
119                            , Double_t rho = 1.29e-3, Double_t x0 = 36.66
120                            , Double_t Yc = 0.0, Double_t Zc = 0.0);
121
122             Double_t GetYmax() const                                   { return fYmax;                  }
123             Double_t GetZmax(Int_t c) const                            { return fZmax[c];               }
124             Double_t GetZc(Int_t c) const                              { return fZc[c];                 }
125             UInt_t   GetIndex(Int_t i) const                           { return fIndex[i];              }  
126             Double_t GetX() const                                      { return fX;                     }
127             Double_t GetdX() const                                     { return fdX;                    }
128             Int_t    GetTimeBinIndex() const                           { return fTimeBinIndex;          }     
129             Int_t    GetPlane() const                                  { return fPlane;                 }
130             Bool_t   IsHole(Int_t zone) const                          { return fIsHole[zone];          }              
131             Bool_t   IsSensitive() const                               { return (fTimeBinIndex >= 0) 
132                                                                                ? kTRUE 
133                                                                                : kFALSE;                }
134             void     Clear()                                           { for (Int_t i = 0; i < fN; i++) 
135                                                                            fClusters[i] = NULL;
136                                                                          fN = 0;                        }
137
138             void     InsertCluster(AliTRDcluster *c, UInt_t index);
139             Int_t    Find(Float_t y) const; 
140             Int_t    FindNearestCluster(Float_t y, Float_t z, Float_t maxroad, Float_t maxroadz) const;
141
142    private:     
143
144             Int_t                     fN;                            // This is fN
145             Int_t                     fSec;                          // Sector mumber
146             AliTRDcluster           **fClusters;                     // Array of pointers to clusters
147             UInt_t                   *fIndex;                        // Array of cluster indexes
148             Double_t                  fX;                            // X coordinate of the middle plane
149             Double_t                  fdX;                           // Radial thickness of the time bin
150             Double_t                  fRho;                          // Default density of the material 
151             Double_t                  fX0;                           // Default radiation length 
152             Int_t                     fTimeBinIndex;                 // Plane * F(local_tb)  
153             Int_t                     fPlane;                        // Plane number
154             Double_t                  fZc[kZones];                   // Z position of the center for 5 active areas
155             Double_t                  fZmax[kZones];                 // Half of active area length in Z
156             Double_t                  fZmaxSensitive[kZones];        // Sensitive area for detection Z     
157             Bool_t                    fIsHole[kZones];               // Is hole in given sector       
158             Double_t                  fYmax;                         // Half of active area length in Y
159             Double_t                  fYmaxSensitive;                // Half of active area length in Y
160
161             Bool_t                    fHole;                         // kTRUE if there is a hole in the layer
162             Double_t                  fHoleZc;                       // Z of the center of the hole 
163             Double_t                  fHoleZmax;                     // Half of the hole length in Z
164             Double_t                  fHoleYc;                       // Y of the center of the hole 
165             Double_t                  fHoleYmax;                     // Half of the hole length in Y 
166             Double_t                  fHoleRho;                      // Density of the gas in the hole 
167             Double_t                  fHoleX0;                       // Radiation length of the gas in the hole 
168
169   };
170
171   class AliTRDtrackingSector {
172
173    public:
174
175      AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs);
176      AliTRDtrackingSector(const AliTRDtrackingSector &/*t*/);
177      ~AliTRDtrackingSector()                                           { for (Int_t i = 0; i < fN; i++) 
178                                                                            delete fLayers[i];           }
179
180      AliTRDtrackingSector &operator=(const AliTRDtrackingSector &/*t*/){ return *this;                  }
181
182             Int_t    GetNumberOfLayers() const                         { return fN;                     }
183             Int_t    GetNumberOfTimeBins() const;
184             Int_t    GetLayerNumber(Double_t x) const;
185             Int_t    GetInnerTimeBin() const;
186             Int_t    GetOuterTimeBin() const;
187             Int_t    GetLayerNumber(Int_t tb) const                    { return fTimeBinIndex[tb];      }
188             Double_t GetX(Int_t pl) const                              { return fLayers[pl]->GetX();    }
189             AliTRDpropagationLayer* GetLayer(Int_t i)                  { return fLayers[i];             }
190
191             void     MapTimeBinLayers();
192             Int_t    Find(Double_t x) const; 
193             void     InsertLayer(AliTRDpropagationLayer *pl);
194             Int_t    CookTimeBinIndex(Int_t plane, Int_t localTB) const;     
195
196    private:
197
198             Int_t                   fN;                              // Total number of layers
199             AliTRDgeometry         *fGeom;                           // Geometry
200             AliTRDpropagationLayer *fLayers[kMaxLayersPerSector];    // Layers   
201             Int_t                   fTimeBinIndex[kMaxTimeBinIndex]; // Time bin index
202             Int_t                   fGeomSector;                     // Sector# in AliTRDgeometry
203
204   };
205
206           AliTRDgeometry          *fGeom;                          // Pointer to TRD geometry
207           AliTRDtrackingSector    *fTrSec[kTrackingSectors];       // Array of tracking sectors;    
208           Int_t                    fNclusters;                     // Number of clusters in TRD 
209           TObjArray               *fClusters;                      // List of clusters for all sectors
210           Int_t                    fNseeds;                        // Number of track seeds  
211           TObjArray               *fSeeds;                         // List of track seeds
212           Int_t                    fNtracks;                       // Number of reconstructed tracks 
213           TObjArray               *fTracks;                        // List of reconstructed tracks   
214           Int_t                    fTimeBinsPerPlane;              // Timebins per plane in track prolongation 
215
216           static const Double_t    fgkMaxChi2;                     // Max increment in track chi2 
217           static const Float_t     fgkMinClustersInTrack;          // Min number of clusters in track
218           static const Float_t     fgkLabelFraction;               // Min fraction of same label
219           static const Double_t    fgkMaxSnp;                      // Maximal snp for tracking
220           static const Double_t    fgkMaxStep;                     // Maximal step for tracking  
221
222           Bool_t                   fAddTRDseeds;                   // Something else
223           Bool_t                   fNoTilt;                        // No tilt, or what?
224           Bool_t                   fHoles[5][18];                  // Holes
225   
226           Bool_t   AdjustSector(AliTRDtrack *track); 
227
228  private:
229
230           AliTRDtrack *RegisterSeed(AliTRDseed *seeds, Double_t *params);
231           void     MakeSeedsMI(Int_t inner, Int_t outer, AliESD *esd = 0);
232
233           Int_t    FollowBackProlongation(AliTRDtrack &t);
234           Int_t    FollowProlongation(AliTRDtrack &t);
235           void     CookdEdxTimBin(AliTRDtrack &t);  
236           Int_t    PropagateToX(AliTRDtrack &t, Double_t xToGo, Double_t maxStep);
237           Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
238           Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
239
240           TTreeSRedirector        *fDebugStreamer;                 //!Debug streamer
241
242   ClassDef(AliTRDtracker,2)                                        // TRD tracker
243
244 };
245 #endif