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