1 #ifndef ALITRDTRACKER_H
2 #define ALITRDTRACKER_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 #include "AliTracker.h"
9 #include "AliBarrelTrack.h"
18 class AliTRDparameter;
23 const unsigned kMaxLayersPerSector = 1000;
24 const unsigned kMaxTimeBinIndex = 216; // (30 drift + 6 ampl) * 6 planes
25 const unsigned kMaxClusterPerTimeBin = 7000;
26 const unsigned kZones = 5;
27 const Int_t kTrackingSectors = 18;
29 class AliTRDtracker : public AliTracker {
33 AliTRDtracker():AliTracker() {}
34 AliTRDtracker(const TFile *in);
35 virtual ~AliTRDtracker();
37 Int_t Clusters2Tracks(const TFile *in, TFile *out);
38 Int_t Clusters2Tracks(AliESD* event);
39 Int_t PropagateBack(const TFile *in, TFile *out);
40 Int_t PropagateBack(AliESD* event);
41 Int_t RefitInward(AliESD* /*event*/) {return 0;}
43 Int_t LoadClusters(TTree *cTree);
44 void UnloadClusters(){UnloadEvent();}
45 AliCluster *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL;
46 return (AliCluster*) fClusters->UncheckedAt(index); };
47 virtual void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
48 virtual void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
50 void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
51 void SetNoTilt() { fNoTilt = kTRUE; }
53 Double_t GetTiltFactor(const AliTRDcluster* c);
55 void ReadClusters(TObjArray *array, const Char_t *filename);
56 Int_t ReadClusters(TObjArray *array, TTree *in);
57 Int_t CookSectorIndex(Int_t gs) const { return kTrackingSectors - 1 - gs; }
60 Float_t GetSeedGap() const {return fgkSeedGap;}
61 Int_t GetMaxGap() const {return fMaxGap;}
62 Int_t GetTimeBinsPerPlane() const {return fTimeBinsPerPlane;}
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;}
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;}
80 // x <-> timebin conversions useful in analysis macros
81 Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) 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 localTB) const {
85 return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
86 Double_t GetLayerNumber(Int_t sec, Double_t x) const {
87 return fTrSec[sec]->GetLayerNumber(x); }
89 class AliTRDpropagationLayer {
90 // ***************** internal class *******************
92 AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho,
93 Double_t x0, Int_t tbIndex);
95 ~AliTRDpropagationLayer() {
96 if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
98 void InsertCluster(AliTRDcluster *c, UInt_t index);
99 operator Int_t() const {return fN;}
100 AliTRDcluster* operator[](Int_t i) {return fClusters[i];}
101 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
102 Double_t GetX() const { return fX; }
103 Double_t GetdX() const { return fdX; }
104 Double_t GetRho() const { return fRho; }
105 Double_t GetX0() const { return fX0; }
106 Int_t GetTimeBinIndex() const { return fTimeBinIndex; }
107 void GetPropagationParameters(Double_t y, Double_t z,
108 Double_t &dx, Double_t &rho, Double_t &x0,
109 Bool_t &lookForCluster) const;
110 Int_t Find(Double_t y) const;
111 void SetZmax(Int_t cham, Double_t center, Double_t w)
112 { fZc[cham] = center; fZmax[cham] = w; }
113 void SetYmax(Double_t w) { fYmax = w; }
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]; }
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);
122 Bool_t IsSensitive() const {return (fTimeBinIndex>=0)? kTRUE: kFALSE;}
124 void Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
128 Int_t fN; // this is fN
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 fYmax; // half of active area length in Y
140 Bool_t fHole; // kTRUE if there is a hole in the layer
141 Double_t fHoleZc; // Z of the center of the hole
142 Double_t fHoleZmax; // half of the hole length in Z
143 Double_t fHoleYc; // Y of the center of the hole
144 Double_t fHoleYmax; // half of the hole length in Y
145 Double_t fHoleRho; // density of the gas in the hole
146 Double_t fHoleX0; // radiation length of the gas in the hole
149 class AliTRDtrackingSector {
151 AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs, AliTRDparameter* par);
152 ~AliTRDtrackingSector() { for(Int_t i=0; i<fN; i++) delete fLayers[i]; }
153 Int_t GetNumberOfLayers() const { return fN; }
154 Int_t GetNumberOfTimeBins() const;
155 Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX(); }
156 void MapTimeBinLayers();
157 Int_t GetLayerNumber(Double_t x) const;
158 Int_t GetInnerTimeBin() const;
159 Int_t GetOuterTimeBin() const;
160 Int_t GetLayerNumber(Int_t tb) const {return fTimeBinIndex[tb];}
161 Float_t GetTzeroShift() const { return fTzeroShift; }
162 Int_t Find(Double_t x) const;
163 void InsertLayer(AliTRDpropagationLayer* pl);
164 // AliTRDpropagationLayer* operator[](Int_t i) { return fLayers[i]; }
165 AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i]; }
166 Int_t CookTimeBinIndex(Int_t plane, Int_t localTB) const;
169 Int_t fN; // total number of layers
170 AliTRDgeometry *fGeom; // geometry
171 AliTRDparameter *fPar; // parameter
172 AliTRDpropagationLayer *fLayers[kMaxLayersPerSector]; // layers
173 Int_t fTimeBinIndex[kMaxTimeBinIndex]; // time bin index
174 Float_t fTzeroShift; // T0 shift in cm
175 Int_t fGeomSector; // sector # in AliTRDgeometry
180 AliTRDgeometry *fGeom; // Pointer to TRD geometry
181 AliTRDparameter *fPar; // Pointer to TRD parameter
183 AliTRDtrackingSector *fTrSec[kTrackingSectors]; // array of tracking sectors;
185 Int_t fNclusters; // Number of clusters in TRD
186 TObjArray *fClusters; // List of clusters for all sectors
188 Int_t fNseeds; // Number of track seeds
189 TObjArray *fSeeds; // List of track seeds
191 Int_t fNtracks; // Number of reconstructed tracks
192 TObjArray *fTracks; // List of reconstructed tracks
194 Float_t fSY2corr; // Correction coefficient for
197 Float_t fSZ2corr; // Correction coefficient for
200 static const Float_t fgkSeedGap; // Distance between inner and outer
201 // time bin in seeding
202 // (fraction of all time bins)
204 static const Float_t fgkSeedStep; // Step in iterations
205 static const Float_t fgkSeedDepth; // Fraction of TRD allocated for seeding
206 static const Float_t fgkSkipDepth; // Fraction of TRD which can be skipped
207 // in track prolongation
208 Int_t fTimeBinsPerPlane; // number of sensitive timebins per plane
209 Int_t fMaxGap; // max gap (in time bins) in the track
210 // in track prolongation
212 static const Double_t fgkMaxChi2; // max increment in track chi2
214 static const Float_t fgkMinClustersInTrack; // min number of clusters in track
215 // out of total timebins
217 static const Float_t fgkMinFractionOfFoundClusters; // min found clusters
220 static const Float_t fgkMinClustersInSeed; // min fraction of clusters in seed
221 static const Float_t fgkMaxSeedDeltaZ; // max dZ in MakeSeeds
222 static const Float_t fgkMaxSeedDeltaZ12; // max abs(z1-z2) in MakeSeeds
223 static const Float_t fgkMaxSeedC; // max initial curvature in MakeSeeds
224 static const Float_t fgkMaxSeedTan; // max initial Tangens(lambda) in MakeSeeds
225 static const Float_t fgkMaxSeedVertexZ; // max vertex Z in MakeSeeds
226 static const Double_t fgkSeedErrorSY; // sy parameter in MakeSeeds
227 static const Double_t fgkSeedErrorSY3; // sy3 parameter in MakeSeeds
228 static const Double_t fgkSeedErrorSZ; // sz parameter in MakeSeeds
229 static const Float_t fgkLabelFraction; // min fraction of same label
230 static const Float_t fgkWideRoad; // max road width in FindProlongation
232 Bool_t fVocal; // Whatever...
233 Bool_t fAddTRDseeds; // Something else
235 Bool_t fNoTilt; // No tilt, or what?
238 Bool_t AdjustSector(AliTRDtrack *track);
241 // Barrel tracks [SR, 03.04.2003]
243 static const Int_t fgkFirstPlane; // Id of the first (innermost) reference plane
244 static const Int_t fgkLastPlane; // Id of the last (outermost) reference plane
246 void SetBarrelTree(const char *mode);
247 void StoreBarrelTrack(AliTRDtrack *ps, Int_t refPlane, Int_t isIn);
249 TFile *fBarrelFile; // Some kind of barrel file
250 TTree *fBarrelTree; // And a barrel tree
251 TClonesArray *fBarrelArray; // Wow, there even an array for that barrel
252 AliBarrelTrack *fBarrelTrack; // And, finally, the track
259 virtual void MakeSeeds(Int_t inner, Int_t outer, Int_t turn);
261 Int_t FollowProlongation(AliTRDtrack& t, Int_t rf);
262 Int_t FollowBackProlongation(AliTRDtrack& t);
263 //Int_t FolowRefitInward(AliTRDtrack *seed, AliTPCtrack *track);
265 Int_t PropagateToTPC(AliTRDtrack& t);
266 Int_t PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
269 void ReadClusters(TObjArray *array, const TFile *in=0);
271 void SetSY2corr(Float_t w) {fSY2corr = w;}
272 void SetSZ2corr(Float_t w) {fSZ2corr = w;}
273 Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
274 Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
276 ClassDef(AliTRDtracker,1) // manager base class