]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtracker.h
Add tracking without tilted pads as option
[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 #include "AliTracker.h" 
8
9 class TFile;
10 class TParticle;
11 class TParticlePDG;
12 class TObjArray;
13
14 class AliTRDgeometry;
15 class AliTRDparameter;
16 class AliTRDtrack;
17 class AliTRDcluster;
18 class AliTRDmcTrack;
19
20 const unsigned kMAX_LAYERS_PER_SECTOR = 1000;  
21 const unsigned kMAX_TIME_BIN_INDEX = 216;  // (30 drift + 6 ampl) * 6 planes  
22 const unsigned kMAX_CLUSTER_PER_TIME_BIN = 7000; 
23 const unsigned kZONES = 5; 
24 const Int_t kTRACKING_SECTORS = 18; 
25
26 class AliTRDtracker : public AliTracker { 
27
28  public:
29
30   AliTRDtracker():AliTracker() {} 
31   AliTRDtracker(const TFile *in);
32   ~AliTRDtracker(); 
33
34   Int_t         Clusters2Tracks(const TFile *in, TFile *out);
35   Int_t         PropagateBack(const TFile *in, TFile *out);
36   AliCluster   *GetCluster(Int_t index) const { return NULL; };
37   virtual void  CookLabel(AliKalmanTrack *t,Float_t wrong) const;
38   virtual void  UseClusters(const AliKalmanTrack *t, Int_t from=0) const;  
39   
40   void          SetEventNumber(Int_t event) { fEvent = event; }
41   void          SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
42   void          SetNoTilt() { fNoTilt = kTRUE; }
43
44   Double_t      GetTiltFactor(const AliTRDcluster* c);
45
46   void          ReadClusters(TObjArray *array, const Char_t *filename); 
47   Int_t         CookSectorIndex(Int_t gs) { return kTRACKING_SECTORS - 1 - gs; }
48
49
50   Float_t  GetSeedGap()       const {return fSeedGap;}   
51   Int_t    GetMaxGap()        const {return fMaxGap;}   
52   Int_t    GetTimeBinsPerPlane()   const {return fTimeBinsPerPlane;}   
53   Float_t  GetSeedStep()      const {return fSeedStep;}
54   Float_t  GetSeedDepth()     const {return fSeedDepth;}
55   Float_t  GetSkipDepth()     const {return fSkipDepth;}
56   Double_t GetMaxChi2()       const {return fMaxChi2;}
57   Float_t  GetMaxSeedC()      const {return fMaxSeedC;}
58   Float_t  GetMaxSeedTan()    const {return fMaxSeedTan;}
59   Double_t GetSeedErrorSY()   const {return fSeedErrorSY;}
60   Double_t GetSeedErrorSY3()  const {return fSeedErrorSY3;}
61   Double_t GetSeedErrorSZ()   const {return fSeedErrorSZ;}
62   Float_t  GetLabelFraction() const {return fLabelFraction;}
63   Float_t  GetWideRoad()      const {return fWideRoad;}
64
65   Float_t  GetMinClustersInTrack() const {return fMinClustersInTrack;}
66   Float_t  GetMinClustersInSeed()  const {return fMinClustersInSeed;} 
67   Float_t  GetMaxSeedDeltaZ()      const {return fMaxSeedDeltaZ;}
68   Float_t  GetMaxSeedVertexZ()     const {return fMaxSeedVertexZ;}
69
70   // x <-> timebin conversions useful in analysis macros
71   Double_t GetX(Int_t sec, Int_t plane, Int_t local_tb) const;
72   Double_t GetX(Int_t sec, Int_t pl) const { 
73     return fTrSec[sec]->GetLayer(pl)->GetX(); }
74   Int_t GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t local_tb) const {
75     return fTrSec[sec]->CookTimeBinIndex(plane,local_tb); }
76   Double_t GetLayerNumber(Int_t sec, Double_t x) const {
77     return fTrSec[sec]->GetLayerNumber(x); }
78
79  public:
80    class AliTRDpropagationLayer {
81    // *****************  internal class *******************
82    public: 
83      AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho, 
84                             Double_t x0, Int_t tb_index); 
85
86      ~AliTRDpropagationLayer() { 
87        if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
88      }
89      void InsertCluster(AliTRDcluster*, UInt_t);
90      operator       Int_t() const {return fN;}
91      AliTRDcluster* operator[](Int_t i) {return fClusters[i];}
92      UInt_t         GetIndex(Int_t i) const {return fIndex[i];} 
93      Double_t       GetX() const { return fX; }
94      Double_t       GetdX() const { return fdX; }
95      Double_t       GetRho() const { return fRho; }
96      Double_t       GetX0() const { return fX0; }
97      Int_t          GetTimeBinIndex() const { return fTimeBinIndex; }     
98      void           GetPropagationParameters(Double_t y, Double_t z,
99                                 Double_t &dx, Double_t &rho, Double_t &x0, 
100                                 Bool_t &lookForCluster) const;
101      Int_t          Find(Double_t y) const; 
102      void           SetZmax(Int_t cham, Double_t center, Double_t w)
103                       { fZc[cham] = center;  fZmax[cham] = w; }
104      void           SetYmax(Double_t w) { fYmax = w; }
105      Double_t       GetYmax() const { return fYmax; }
106      Double_t       GetZmax(Int_t c) const { return fZmax[c]; }
107      Double_t       GetZc(Int_t c) const { return fZc[c]; }
108      
109      void           SetHole(Double_t Zmax, Double_t Ymax,
110                             Double_t rho = 1.29e-3, Double_t x0 = 36.66,
111                             Double_t Yc = 0, Double_t Zc = 0);
112                             
113      void    Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
114                    
115    private:     
116
117      Int_t         fN;
118      AliTRDcluster **fClusters; // array of pointers to clusters
119      UInt_t        *fIndex;     // array of cluster indexes
120      Double_t       fX;         // x coordinate of the middle plane
121      Double_t       fdX;        // radial thickness of the time bin
122      Double_t       fRho;       // default density of the material 
123      Double_t       fX0;        // default radiation length 
124      Int_t          fTimeBinIndex;  // plane * F(local_tb)  
125      Double_t       fZc[kZONES];  // Z position of the center for 5 active areas
126      Double_t       fZmax[kZONES]; // half of active area length in Z
127      Double_t       fYmax;        // half of active area length in Y
128
129      Bool_t         fHole;        // kTRUE if there is a hole in the layer
130      Double_t       fHoleZc;      // Z of the center of the hole 
131      Double_t       fHoleZmax;    // half of the hole length in Z
132      Double_t       fHoleYc;      // Y of the center of the hole 
133      Double_t       fHoleYmax;    // half of the hole length in Y 
134      Double_t       fHoleRho;     // density of the gas in the hole 
135      Double_t       fHoleX0;      // radiation length of the gas in the hole 
136    };
137
138    class AliTRDtrackingSector {
139    public:
140      AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs, AliTRDparameter* par);
141      ~AliTRDtrackingSector() { for(Int_t i=0; i<fN; i++) delete fLayers[i]; }
142      Int_t    GetNumberOfLayers() const { return fN; }
143      Int_t    GetNumberOfTimeBins() const;
144      Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX(); }
145      void     MapTimeBinLayers();
146      Int_t    GetLayerNumber(Double_t x) const;
147      Int_t    GetInnerTimeBin() const;
148      Int_t    GetOuterTimeBin() const;
149      Int_t    GetLayerNumber(Int_t tb) const {return fTimeBinIndex[tb];}
150      Float_t  GetTzeroShift() const { return fTzeroShift; }   
151      Int_t    Find(Double_t x) const; 
152      void     InsertLayer(AliTRDpropagationLayer* pl);
153      //     AliTRDpropagationLayer* operator[](Int_t i) { return fLayers[i]; }
154      AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i]; }
155      Int_t    CookTimeBinIndex(Int_t plane, Int_t local_tb) const;     
156
157    private:
158      Int_t                     fN;      // total number of layers
159      AliTRDgeometry            *fGeom;     
160      AliTRDparameter           *fPar;     
161      AliTRDpropagationLayer    *fLayers[kMAX_LAYERS_PER_SECTOR];     
162      Int_t                     fTimeBinIndex[kMAX_TIME_BIN_INDEX];     
163      Float_t                   fTzeroShift;   // T0 shift in cm
164      Int_t                     fGeomSector;   // sector # in AliTRDgeometry
165    };
166
167  private:
168
169   void          LoadEvent();
170   void          UnloadEvent();
171
172   virtual void  MakeSeeds(Int_t inner, Int_t outer, Int_t turn);
173
174   Int_t         FollowProlongation(AliTRDtrack& t, Int_t rf);
175   Int_t         FollowBackProlongation(AliTRDtrack& t);
176
177   Int_t         PropagateToTPC(AliTRDtrack& t);
178   Int_t         PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
179
180   Int_t         WriteTracks(); 
181   void          ReadClusters(TObjArray *array, const TFile *in = 0);
182
183   void          SetSY2corr(Float_t w)    {fSY2corr = w;}
184   void          SetSZ2corr(Float_t w)    {fSZ2corr = w;}
185   Double_t      ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt);
186   Double_t      ExpectedSigmaZ2(Double_t r, Double_t tgl);
187
188
189  protected:
190
191   Int_t              fEvent;            // Event number
192
193   AliTRDgeometry     *fGeom;            // Pointer to TRD geometry
194   AliTRDparameter    *fPar;     
195
196   AliTRDtrackingSector *fTrSec[kTRACKING_SECTORS];       
197                                        // array of tracking sectors;    
198   
199   Int_t            fNclusters;        // Number of clusters in TRD 
200   TObjArray        *fClusters;        // List of clusters for all sectors
201
202   Int_t            fNseeds;           // Number of track seeds  
203   TObjArray        *fSeeds;           // List of track seeds
204    
205   Int_t            fNtracks;          // Number of reconstructed tracks 
206   TObjArray        *fTracks;          // List of reconstructed tracks   
207
208   Float_t          fSY2corr;          // Correction coefficient for
209                                       // cluster SigmaY2 
210
211   Float_t          fSZ2corr;          // Correction coefficient for
212                                       // cluster SigmaZ2 
213
214   static const Float_t  fSeedGap;     // Distance between inner and outer
215                                       // time bin in seeding 
216                                       // (fraction of all time bins) 
217   
218   static const Float_t  fSeedStep;    // Step in iterations
219   static const Float_t  fSeedDepth;   // Fraction of TRD allocated for seeding
220   static const Float_t  fSkipDepth;   // Fraction of TRD which can be skipped
221                                       // in track prolongation             
222   Int_t       fTimeBinsPerPlane;      // number of sensitive timebins per plane
223   Int_t       fMaxGap;                // max gap (in time bins) in the track  
224                                       // in track prolongation             
225
226   static const Double_t fMaxChi2;     // max increment in track chi2 
227         
228   static const Float_t  fMinClustersInTrack; // min number of clusters in track
229                                              // out of total timebins
230
231   static const Float_t  fMinFractionOfFoundClusters; // min found clusters 
232                                                      // out of expected  
233
234   static const Float_t  fMinClustersInSeed;  // min fraction of clusters in seed
235   static const Float_t  fMaxSeedDeltaZ;   // max dZ in MakeSeeds
236   static const Float_t  fMaxSeedDeltaZ12; // max abs(z1-z2) in MakeSeeds
237   static const Float_t  fMaxSeedC;       // max initial curvature in MakeSeeds
238   static const Float_t  fMaxSeedTan;     // max initial Tangens(lambda) in MakeSeeds
239   static const Float_t  fMaxSeedVertexZ; // max vertex Z in MakeSeeds
240   static const Double_t fSeedErrorSY;    // sy parameter in MakeSeeds
241   static const Double_t fSeedErrorSY3;   // sy3 parameter in MakeSeeds
242   static const Double_t fSeedErrorSZ;    // sz parameter in MakeSeeds
243   static const Float_t  fLabelFraction;  // min fraction of same label
244   static const Float_t  fWideRoad;       // max road width in FindProlongation
245
246   Bool_t                fVocal;   
247   Bool_t                fAddTRDseeds;
248
249   Bool_t                fNoTilt;
250  
251   ClassDef(AliTRDtracker,1)           // manager base class  
252
253 };
254
255 #endif