]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDtracker.h
Removing AliBarrelTrack class (Yu.Belikov)
[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 #include "TObjArray.h" 
9
10 class TFile;
11 class TTree;
12 class TParticle;
13 class TParticlePDG;
14
15 class AliTRDgeometry;
16 class AliTRDparameter;
17 class AliTRDtrack;
18 class AliTRDcluster;
19 class AliESD;
20
21 const unsigned kMaxLayersPerSector = 1000;  
22 const unsigned kMaxTimeBinIndex = 216;  // (30 drift + 6 ampl) * 6 planes  
23 const unsigned kMaxClusterPerTimeBin = 7000; 
24 const unsigned kZones = 5; 
25 const Int_t    kTrackingSectors = 18; 
26
27 class AliTRDtracker : public AliTracker { 
28
29  public:
30
31   AliTRDtracker();
32   AliTRDtracker(const TFile *in);
33   virtual ~AliTRDtracker(); 
34
35   Int_t         Clusters2Tracks(AliESD* event);
36   Int_t         PropagateBack(AliESD* event);
37   Int_t         RefitInward(AliESD* event);
38
39   Int_t         LoadClusters(TTree *cTree);
40   void          UnloadClusters();
41   AliCluster   *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL; 
42                                                 return (AliCluster*) fClusters->UncheckedAt(index); };
43   virtual void  CookLabel(AliKalmanTrack *t,Float_t wrong) const;
44   virtual void  UseClusters(const AliKalmanTrack *t, Int_t from=0) const;  
45   
46   void          SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
47   void          SetNoTilt() { fNoTilt = kTRUE; }
48
49   Double_t      GetTiltFactor(const AliTRDcluster* c);
50
51   Int_t         ReadClusters(TObjArray *array, TTree *in) const;
52   Int_t         CookSectorIndex(Int_t gs) const { return kTrackingSectors - 1 - gs; }
53   AliTRDcluster * GetCluster(AliTRDtrack * track, Int_t plane, Int_t timebin);
54   Int_t         GetLastPlane(AliTRDtrack * track); //return last updated plane
55
56   Float_t  GetSeedGap()       const {return fgkSeedGap;}   
57   Int_t    GetMaxGap()        const {return fMaxGap;}   
58   Int_t    GetTimeBinsPerPlane()   const {return fTimeBinsPerPlane;}   
59   Float_t  GetSeedStep()      const {return fgkSeedStep;}
60   Float_t  GetSeedDepth()     const {return fgkSeedDepth;}
61   Float_t  GetSkipDepth()     const {return fgkSkipDepth;}
62   Double_t GetMaxChi2()       const {return fgkMaxChi2;}
63   Float_t  GetMaxSeedC()      const {return fgkMaxSeedC;}
64   Float_t  GetMaxSeedTan()    const {return fgkMaxSeedTan;}
65   Double_t GetSeedErrorSY()   const {return fgkSeedErrorSY;}
66   Double_t GetSeedErrorSY3()  const {return fgkSeedErrorSY3;}
67   Double_t GetSeedErrorSZ()   const {return fgkSeedErrorSZ;}
68   Float_t  GetLabelFraction() const {return fgkLabelFraction;}
69   Float_t  GetWideRoad()      const {return fgkWideRoad;}
70
71   Float_t  GetMinClustersInTrack() const {return fgkMinClustersInTrack;}
72   Float_t  GetMinClustersInSeed()  const {return fgkMinClustersInSeed;} 
73   Float_t  GetMaxSeedDeltaZ()      const {return fgkMaxSeedDeltaZ;}
74   Float_t  GetMaxSeedVertexZ()     const {return fgkMaxSeedVertexZ;}
75
76   // x <-> timebin conversions useful in analysis macros
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
85   class AliTRDpropagationLayer {
86    // *****************  internal class *******************
87    public: 
88      AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho, 
89                             Double_t x0, Int_t tbIndex); 
90
91      ~AliTRDpropagationLayer() { 
92        if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
93      }
94      void InsertCluster(AliTRDcluster *c, UInt_t index);
95      operator       Int_t() const {return fN;}
96      AliTRDcluster* operator[](Int_t i) {return fClusters[i];}
97      UInt_t         GetIndex(Int_t i) const {return fIndex[i];} 
98      Double_t       GetX() const { return fX; }
99      Double_t       GetdX() const { return fdX; }
100      Double_t       GetRho() const { return fRho; }
101      Double_t       GetX0() const { return fX0; }
102      Int_t          GetTimeBinIndex() const { return fTimeBinIndex; }     
103      void           GetPropagationParameters(Double_t y, Double_t z,
104                                 Double_t &dx, Double_t &rho, Double_t &x0, 
105                                 Bool_t &lookForCluster) const;
106      Int_t          GetZone( Double_t z) const;
107      Int_t          Find(Double_t y) const; 
108      void           SetZmax(Int_t cham, Double_t center, Double_t w)
109                       { fZc[cham] = center;  fZmax[cham] = w; }
110      void           SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
111      void           SetHoles(Bool_t* holes);
112      void           SetYmax(Double_t w, Double_t wsensitive) { fYmax = w; fYmaxSensitive = wsensitive; }
113      Double_t       GetYmax() const { return fYmax; }
114      Double_t       GetZmax(Int_t c) const { return fZmax[c]; }
115      Double_t       GetZc(Int_t c) const { return fZc[c]; }
116      
117      void           SetHole(Double_t Zmax, Double_t Ymax,
118                             Double_t rho = 1.29e-3, Double_t x0 = 36.66,
119                             Double_t Yc = 0, Double_t Zc = 0);
120                             
121      Bool_t         IsSensitive() const {return (fTimeBinIndex>=0)? kTRUE: kFALSE;}
122                        
123      void    Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
124      Bool_t  IsHole(Int_t zone) const  { return fIsHole[zone];}              
125    private:     
126
127      Int_t         fN;          // this is fN
128      Int_t         fSec;        // sector mumber
129      AliTRDcluster **fClusters; // array of pointers to clusters
130      UInt_t        *fIndex;     // array of cluster indexes
131      Double_t       fX;         // x coordinate of the middle plane
132      Double_t       fdX;        // radial thickness of the time bin
133      Double_t       fRho;       // default density of the material 
134      Double_t       fX0;        // default radiation length 
135      Int_t          fTimeBinIndex;  // plane * F(local_tb)  
136      Double_t       fZc[kZones];  // Z position of the center for 5 active areas
137      Double_t       fZmax[kZones]; // half of active area length in Z
138      Double_t       fZmaxSensitive[kZones]; //sensitive area for detection Z     
139      Bool_t         fIsHole[kZones]; //is hole in given sector       
140      Double_t       fYmax;        // half of active area length in Y
141      Double_t       fYmaxSensitive;        // half of active area length in Y
142
143      Bool_t         fHole;        // kTRUE if there is a hole in the layer
144      Double_t       fHoleZc;      // Z of the center of the hole 
145      Double_t       fHoleZmax;    // half of the hole length in Z
146      Double_t       fHoleYc;      // Y of the center of the hole 
147      Double_t       fHoleYmax;    // half of the hole length in Y 
148      Double_t       fHoleRho;     // density of the gas in the hole 
149      Double_t       fHoleX0;      // radiation length of the gas in the hole 
150    };
151
152    class AliTRDtrackingSector {
153    public:
154      AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs, AliTRDparameter* par);
155      ~AliTRDtrackingSector() { for(Int_t i=0; i<fN; i++) delete fLayers[i]; }
156      Int_t    GetNumberOfLayers() const { return fN; }
157      Int_t    GetNumberOfTimeBins() const;
158      Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX(); }
159      void     MapTimeBinLayers();
160      Int_t    GetLayerNumber(Double_t x) const;
161      Int_t    GetInnerTimeBin() const;
162      Int_t    GetOuterTimeBin() const;
163      Int_t    GetLayerNumber(Int_t tb) const {return fTimeBinIndex[tb];}
164      Float_t  GetTzeroShift() const { return fTzeroShift; }   
165      Int_t    Find(Double_t x) const; 
166      void     InsertLayer(AliTRDpropagationLayer* pl);
167      //     AliTRDpropagationLayer* operator[](Int_t i) { return fLayers[i]; }
168      AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i]; }
169      Int_t    CookTimeBinIndex(Int_t plane, Int_t localTB) const;     
170
171    private:
172      Int_t                     fN;      // total number of layers
173      AliTRDgeometry            *fGeom;  // geometry
174      AliTRDparameter           *fPar;   // parameter
175      AliTRDpropagationLayer    *fLayers[kMaxLayersPerSector];   // layers   
176      Int_t                     fTimeBinIndex[kMaxTimeBinIndex]; // time bin index
177      Float_t                   fTzeroShift;   // T0 shift in cm
178      Int_t                     fGeomSector;   // sector # in AliTRDgeometry
179    };
180
181  protected:
182
183   AliTRDgeometry     *fGeom;            // Pointer to TRD geometry
184   AliTRDparameter    *fPar;             // Pointer to TRD parameter
185
186   AliTRDtrackingSector *fTrSec[kTrackingSectors];  // array of tracking sectors;    
187   Int_t            fNclusters;        // Number of clusters in TRD 
188   TObjArray        *fClusters;        // List of clusters for all sectors
189
190   Int_t            fNseeds;           // Number of track seeds  
191   TObjArray        *fSeeds;           // List of track seeds
192    
193   Int_t            fNtracks;          // Number of reconstructed tracks 
194   TObjArray        *fTracks;          // List of reconstructed tracks   
195
196   Float_t          fSY2corr;          // Correction coefficient for
197                                       // cluster SigmaY2 
198
199   Float_t          fSZ2corr;          // Correction coefficient for
200                                       // cluster SigmaZ2 
201
202   static const Float_t  fgkSeedGap;   // Distance between inner and outer
203                                       // time bin in seeding 
204                                       // (fraction of all time bins) 
205   
206   static const Float_t  fgkSeedStep;  // Step in iterations
207   static const Float_t  fgkSeedDepth; // Fraction of TRD allocated for seeding
208   static const Float_t  fgkSkipDepth; // Fraction of TRD which can be skipped
209                                       // in track prolongation             
210   Int_t       fTimeBinsPerPlane;      // number of sensitive timebins per plane
211   Int_t       fMaxGap;                // max gap (in time bins) in the track  
212                                       // in track prolongation             
213
214   static const Double_t fgkMaxChi2;   // max increment in track chi2 
215         
216   static const Float_t  fgkMinClustersInTrack; // min number of clusters in track
217                                                // out of total timebins
218
219   static const Float_t  fgkMinFractionOfFoundClusters; // min found clusters 
220                                                        // out of expected  
221
222   static const Float_t  fgkMinClustersInSeed;  // min fraction of clusters in seed
223   static const Float_t  fgkMaxSeedDeltaZ;   // max dZ in MakeSeeds
224   static const Float_t  fgkMaxSeedDeltaZ12; // max abs(z1-z2) in MakeSeeds
225   static const Float_t  fgkMaxSeedC;       // max initial curvature in MakeSeeds
226   static const Float_t  fgkMaxSeedTan;     // max initial Tangens(lambda) in MakeSeeds
227   static const Float_t  fgkMaxSeedVertexZ; // max vertex Z in MakeSeeds
228   static const Double_t fgkSeedErrorSY;    // sy parameter in MakeSeeds
229   static const Double_t fgkSeedErrorSY3;   // sy3 parameter in MakeSeeds
230   static const Double_t fgkSeedErrorSZ;    // sz parameter in MakeSeeds
231   static const Float_t  fgkLabelFraction;  // min fraction of same label
232   static const Float_t  fgkWideRoad;       // max road width in FindProlongation
233
234   Bool_t                fVocal;            // Whatever...
235   Bool_t                fAddTRDseeds;      // Something else
236
237   Bool_t                fNoTilt;           // No tilt, or what?
238   Bool_t                fHoles[5][18];     // holes
239   
240   Bool_t AdjustSector(AliTRDtrack *track); 
241  
242   
243   // Barrel tracks [SR, 03.04.2003]
244
245   static const Int_t fgkFirstPlane;   // Id of the first (innermost) reference plane 
246   static const Int_t fgkLastPlane;    // Id of the last (outermost) reference plane
247
248  private:
249
250   virtual void  MakeSeeds(Int_t inner, Int_t outer, Int_t turn);
251
252   Int_t         FollowProlongation(AliTRDtrack& t, Int_t rf);
253   Int_t         FollowBackProlongation(AliTRDtrack& t);
254   Int_t         Refit(AliTRDtrack& t, Int_t rf);
255   void          CookdEdxTimBin(AliTRDtrack& t);  
256
257   Int_t         PropagateToTPC(AliTRDtrack& t);
258   Int_t         PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
259
260   void          SetSY2corr(Float_t w)    {fSY2corr = w;}
261   void          SetSZ2corr(Float_t w)    {fSZ2corr = w;}
262   Double_t      ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
263   Double_t      ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
264
265   ClassDef(AliTRDtracker,2)           // manager base class  
266
267 };
268
269 #endif