Transition to NewIO
[u/mrichter/AliRoot.git] / TRD / AliTRDtracker.h
CommitLineData
46d29e70 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
88cb7938 7/* $Id$ */
8
5443e65e 9#include "AliTracker.h"
e24ea474 10#include "TObjArray.h"
9c9d2487 11#include "AliBarrelTrack.h"
88cb7938 12
13#include <TNamed.h>
14#include <TH1.h>
46d29e70 15
16class TFile;
bbf92647 17class TParticle;
18class TParticlePDG;
46d29e70 19
20class AliTRDgeometry;
5443e65e 21class AliTRDparameter;
46d29e70 22class AliTRDtrack;
5443e65e 23class AliTRDcluster;
bbf92647 24class AliTRDmcTrack;
46d29e70 25
5443e65e 26const unsigned kMAX_LAYERS_PER_SECTOR = 1000;
27const unsigned kMAX_TIME_BIN_INDEX = 216; // (30 drift + 6 ampl) * 6 planes
b8dc2353 28const unsigned kMAX_CLUSTER_PER_TIME_BIN = 7000;
5443e65e 29const unsigned kZONES = 5;
30const Int_t kTRACKING_SECTORS = 18;
31
88cb7938 32class AliTRDtracker : public AliTracker {
46d29e70 33
34 public:
35
5443e65e 36 AliTRDtracker():AliTracker() {}
37 AliTRDtracker(const TFile *in);
38 ~AliTRDtracker();
39
40 Int_t Clusters2Tracks(const TFile *in, TFile *out);
41 Int_t PropagateBack(const TFile *in, TFile *out);
88cb7938 42 Int_t PropagateBack();//Almost empty see .cxx for more comments
43 Int_t Clusters2Tracks();//Almost empty see .cxx for more comments
9c9d2487 44
e24ea474 45 Int_t LoadClusters() {LoadEvent(); return 0;};
46 void UnloadClusters() {UnloadEvent();};
88cb7938 47 AliCluster *GetCluster(Int_t index) const { return (AliCluster*) fClusters->UncheckedAt(index); };
5443e65e 48 virtual void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
49 virtual void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
50
5443e65e 51 void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
b8dc2353 52 void SetNoTilt() { fNoTilt = kTRUE; }
5443e65e 53
fd621f36 54 Double_t GetTiltFactor(const AliTRDcluster* c);
55
5443e65e 56 void ReadClusters(TObjArray *array, const Char_t *filename);
57 Int_t CookSectorIndex(Int_t gs) { return kTRACKING_SECTORS - 1 - gs; }
58
59
88cb7938 60 Float_t GetSeedGap() const {return fgkSeedGap;}
5443e65e 61 Int_t GetMaxGap() const {return fMaxGap;}
62 Int_t GetTimeBinsPerPlane() const {return fTimeBinsPerPlane;}
88cb7938 63 Float_t GetSeedStep() const {return fgkSeedStep;}
64 Float_t GetSeedDepth() const {return fgkSeedDepth;}
65 Float_t GetSkipDepth() const {return fgkSkipDepth;}
66 Double_t GetMaxChi2() const {return fgkMaxChi2;}
67 Float_t GetMaxSeedC() const {return fgkMaxSeedC;}
68 Float_t GetMaxSeedTan() const {return fgkMaxSeedTan;}
69 Double_t GetSeedErrorSY() const {return fgkSeedErrorSY;}
70 Double_t GetSeedErrorSY3() const {return fgkSeedErrorSY3;}
71 Double_t GetSeedErrorSZ() const {return fgkSeedErrorSZ;}
72 Float_t GetLabelFraction() const {return fgkLabelFraction;}
73 Float_t GetWideRoad() const {return fgkWideRoad;}
74
75 Float_t GetMinClustersInTrack() const {return fgkMinClustersInTrack;}
76 Float_t GetMinClustersInSeed() const {return fgkMinClustersInSeed;}
77 Float_t GetMaxSeedDeltaZ() const {return fgkMaxSeedDeltaZ;}
78 Float_t GetMaxSeedVertexZ() const {return fgkMaxSeedVertexZ;}
5443e65e 79
80 // x <-> timebin conversions useful in analysis macros
81 Double_t GetX(Int_t sec, Int_t plane, Int_t local_tb) const;
82 Double_t GetX(Int_t sec, Int_t pl) const {
83 return fTrSec[sec]->GetLayer(pl)->GetX(); }
84 Int_t GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t local_tb) const {
85 return fTrSec[sec]->CookTimeBinIndex(plane,local_tb); }
86 Double_t GetLayerNumber(Int_t sec, Double_t x) const {
87 return fTrSec[sec]->GetLayerNumber(x); }
88
89 public:
90 class AliTRDpropagationLayer {
91 // ***************** internal class *******************
92 public:
93 AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho,
b8dc2353 94 Double_t x0, Int_t tb_index);
5443e65e 95
96 ~AliTRDpropagationLayer() {
97 if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
98 }
99 void InsertCluster(AliTRDcluster*, UInt_t);
100 operator Int_t() const {return fN;}
101 AliTRDcluster* operator[](Int_t i) {return fClusters[i];}
102 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
103 Double_t GetX() const { return fX; }
104 Double_t GetdX() const { return fdX; }
105 Double_t GetRho() const { return fRho; }
106 Double_t GetX0() const { return fX0; }
107 Int_t GetTimeBinIndex() const { return fTimeBinIndex; }
108 void GetPropagationParameters(Double_t y, Double_t z,
b8dc2353 109 Double_t &dx, Double_t &rho, Double_t &x0,
5443e65e 110 Bool_t &lookForCluster) const;
111 Int_t Find(Double_t y) const;
112 void SetZmax(Int_t cham, Double_t center, Double_t w)
113 { fZc[cham] = center; fZmax[cham] = w; }
114 void SetYmax(Double_t w) { fYmax = w; }
115 Double_t GetYmax() const { return fYmax; }
116 Double_t GetZmax(Int_t c) const { return fZmax[c]; }
117 Double_t GetZc(Int_t c) const { return fZc[c]; }
118
119 void SetHole(Double_t Zmax, Double_t Ymax,
b8dc2353 120 Double_t rho = 1.29e-3, Double_t x0 = 36.66,
121 Double_t Yc = 0, Double_t Zc = 0);
122
9c9d2487 123 Bool_t IsSensitive() {return (fTimeBinIndex>=0)? kTRUE: kFALSE;}
124
5443e65e 125 void Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
126
127 private:
128
129 Int_t fN;
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 fYmax; // half of active area length in Y
140
141 Bool_t fHole; // kTRUE if there is a hole in the layer
142 Double_t fHoleZc; // Z of the center of the hole
143 Double_t fHoleZmax; // half of the hole length in Z
144 Double_t fHoleYc; // Y of the center of the hole
145 Double_t fHoleYmax; // half of the hole length in Y
146 Double_t fHoleRho; // density of the gas in the hole
147 Double_t fHoleX0; // radiation length of the gas in the hole
148 };
149
150 class AliTRDtrackingSector {
151 public:
152 AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs, AliTRDparameter* par);
153 ~AliTRDtrackingSector() { for(Int_t i=0; i<fN; i++) delete fLayers[i]; }
154 Int_t GetNumberOfLayers() const { return fN; }
155 Int_t GetNumberOfTimeBins() const;
156 Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX(); }
157 void MapTimeBinLayers();
158 Int_t GetLayerNumber(Double_t x) const;
159 Int_t GetInnerTimeBin() const;
160 Int_t GetOuterTimeBin() const;
161 Int_t GetLayerNumber(Int_t tb) const {return fTimeBinIndex[tb];}
162 Float_t GetTzeroShift() const { return fTzeroShift; }
163 Int_t Find(Double_t x) const;
164 void InsertLayer(AliTRDpropagationLayer* pl);
165 // AliTRDpropagationLayer* operator[](Int_t i) { return fLayers[i]; }
166 AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i]; }
167 Int_t CookTimeBinIndex(Int_t plane, Int_t local_tb) const;
168
169 private:
170 Int_t fN; // total number of layers
171 AliTRDgeometry *fGeom;
172 AliTRDparameter *fPar;
173 AliTRDpropagationLayer *fLayers[kMAX_LAYERS_PER_SECTOR];
174 Int_t fTimeBinIndex[kMAX_TIME_BIN_INDEX];
175 Float_t fTzeroShift; // T0 shift in cm
176 Int_t fGeomSector; // sector # in AliTRDgeometry
177 };
178
179 private:
180
181 void LoadEvent();
182 void UnloadEvent();
183
184 virtual void MakeSeeds(Int_t inner, Int_t outer, Int_t turn);
185
186 Int_t FollowProlongation(AliTRDtrack& t, Int_t rf);
187 Int_t FollowBackProlongation(AliTRDtrack& t);
9c9d2487 188 //Int_t FolowRefitInward(AliTRDtrack *seed, AliTPCtrack *track);
5443e65e 189
190 Int_t PropagateToTPC(AliTRDtrack& t);
191 Int_t PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
192
193 Int_t WriteTracks();
194 void ReadClusters(TObjArray *array, const TFile *in = 0);
195
196 void SetSY2corr(Float_t w) {fSY2corr = w;}
197 void SetSZ2corr(Float_t w) {fSZ2corr = w;}
198 Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt);
199 Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl);
200
46d29e70 201
202 protected:
203
5443e65e 204 AliTRDgeometry *fGeom; // Pointer to TRD geometry
205 AliTRDparameter *fPar;
bbf92647 206
5443e65e 207 AliTRDtrackingSector *fTrSec[kTRACKING_SECTORS];
208 // array of tracking sectors;
209
46d29e70 210 Int_t fNclusters; // Number of clusters in TRD
211 TObjArray *fClusters; // List of clusters for all sectors
212
213 Int_t fNseeds; // Number of track seeds
214 TObjArray *fSeeds; // List of track seeds
215
216 Int_t fNtracks; // Number of reconstructed tracks
217 TObjArray *fTracks; // List of reconstructed tracks
218
a819a5f7 219 Float_t fSY2corr; // Correction coefficient for
220 // cluster SigmaY2
221
5443e65e 222 Float_t fSZ2corr; // Correction coefficient for
223 // cluster SigmaZ2
224
88cb7938 225 static const Float_t fgkSeedGap; // Distance between inner and outer
0a29d0f1 226 // time bin in seeding
b8dc2353 227 // (fraction of all time bins)
bbf92647 228
88cb7938 229 static const Float_t fgkSeedStep; // Step in iterations
230 static const Float_t fgkSeedDepth; // Fraction of TRD allocated fgkor seeding
231 static const Float_t fgkSkipDepth; // Fraction of TRD which can be skipped
232 // in track prolongation
5443e65e 233 Int_t fTimeBinsPerPlane; // number of sensitive timebins per plane
234 Int_t fMaxGap; // max gap (in time bins) in the track
88cb7938 235 // in track prolongation
5443e65e 236
88cb7938 237 static const Double_t fgkMaxChi2; // max increment in track chi2
238
239 static const Float_t fgkMinClustersInTrack; // min number of clusters in track
5443e65e 240 // out of total timebins
241
88cb7938 242 static const Float_t fgkMinFractionOfFoundClusters; // min fgkound clusters
5443e65e 243 // out of expected
244
88cb7938 245 static const Float_t fgkMinClustersInSeed; // min fgkraction of clusters in seed
246 static const Float_t fgkMaxSeedDeltaZ; // max dZ in MakeSeeds
247 static const Float_t fgkMaxSeedDeltaZ12; // max abs(z1-z2) in MakeSeeds
248 static const Float_t fgkMaxSeedC; // max initial curvature in MakeSeeds
249 static const Float_t fgkMaxSeedTan; // max initial Tangens(lambda) in MakeSeeds
250 static const Float_t fgkMaxSeedVertexZ; // max vertex Z in MakeSeeds
251 static const Double_t fgkSeedErrorSY; // sy parameter in MakeSeeds
252 static const Double_t fgkSeedErrorSY3; // sy3 parameter in MakeSeeds
253 static const Double_t fgkSeedErrorSZ; // sz parameter in MakeSeeds
254 static const Float_t fgkLabelFraction; // min fgkraction of same label
255 static const Float_t fgkWideRoad; // max road width in FindProlongation
5443e65e 256
257 Bool_t fVocal;
258 Bool_t fAddTRDseeds;
88cb7938 259
b8dc2353 260 Bool_t fNoTilt;
bbf92647 261
9c9d2487 262
263 Bool_t AdjustSector(AliTRDtrack *track);
264
265
266 // Barrel tracks [SR, 03.04.2003]
267
268 static const Int_t kFirstPlane; // Id of the first (innermost) reference plane
269 static const Int_t kLastPlane; // Id of the last (outermost) reference plane
270
271 void SetBarrelTree(const char *mode);
272 void StoreBarrelTrack(AliTRDtrack *ps, Int_t refPlane, Int_t isIn);
273
274 TFile *fBarrelFile;
275 TTree *fBarrelTree;
276 TClonesArray *fBarrelArray;
277 AliBarrelTrack *fBarrelTrack;
278
279
46d29e70 280 ClassDef(AliTRDtracker,1) // manager base class
281
282};
283
284#endif