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