]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtracker.h
Clean-up. (A. Gheata)
[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
5443e65e 7#include "AliTracker.h"
e24ea474 8#include "TObjArray.h"
46d29e70 9
10class TFile;
c630aafd 11class TTree;
bbf92647 12class TParticle;
13class TParticlePDG;
46d29e70 14
15class AliTRDgeometry;
5443e65e 16class AliTRDparameter;
46d29e70 17class AliTRDtrack;
5443e65e 18class AliTRDcluster;
b7a0917f 19class AliBarrelTrack;
20class AliESD;
46d29e70 21
029cd327 22const unsigned kMaxLayersPerSector = 1000;
23const unsigned kMaxTimeBinIndex = 216; // (30 drift + 6 ampl) * 6 planes
24const unsigned kMaxClusterPerTimeBin = 7000;
25const unsigned kZones = 5;
26const Int_t kTrackingSectors = 18;
5443e65e 27
c630aafd 28class AliTRDtracker : public AliTracker {
46d29e70 29
30 public:
31
89f05372 32 AliTRDtracker();
5443e65e 33 AliTRDtracker(const TFile *in);
029cd327 34 virtual ~AliTRDtracker();
5443e65e 35
c630aafd 36 Int_t Clusters2Tracks(AliESD* event);
c630aafd 37 Int_t PropagateBack(AliESD* event);
1e9bb598 38 Int_t RefitInward(AliESD* event);
9c9d2487 39
c630aafd 40 Int_t LoadClusters(TTree *cTree);
b7a0917f 41 void UnloadClusters();
029cd327 42 AliCluster *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL;
43 return (AliCluster*) fClusters->UncheckedAt(index); };
5443e65e 44 virtual void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
45 virtual void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
46
5443e65e 47 void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
b8dc2353 48 void SetNoTilt() { fNoTilt = kTRUE; }
5443e65e 49
fd621f36 50 Double_t GetTiltFactor(const AliTRDcluster* c);
51
b7a0917f 52 Int_t ReadClusters(TObjArray *array, TTree *in) const;
029cd327 53 Int_t CookSectorIndex(Int_t gs) const { return kTrackingSectors - 1 - gs; }
46e2d86c 54 AliTRDcluster * GetCluster(AliTRDtrack * track, Int_t plane, Int_t timebin);
3c625a9b 55 Int_t GetLastPlane(AliTRDtrack * track); //return last updated plane
5443e65e 56
029cd327 57 Float_t GetSeedGap() const {return fgkSeedGap;}
5443e65e 58 Int_t GetMaxGap() const {return fMaxGap;}
59 Int_t GetTimeBinsPerPlane() const {return fTimeBinsPerPlane;}
029cd327 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;}
5443e65e 76
77 // x <-> timebin conversions useful in analysis macros
029cd327 78 Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const;
5443e65e 79 Double_t GetX(Int_t sec, Int_t pl) const {
80 return fTrSec[sec]->GetLayer(pl)->GetX(); }
029cd327 81 Int_t GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const {
82 return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
5443e65e 83 Double_t GetLayerNumber(Int_t sec, Double_t x) const {
84 return fTrSec[sec]->GetLayerNumber(x); }
85
029cd327 86 class AliTRDpropagationLayer {
5443e65e 87 // ***************** internal class *******************
88 public:
89 AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho,
029cd327 90 Double_t x0, Int_t tbIndex);
5443e65e 91
92 ~AliTRDpropagationLayer() {
93 if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
94 }
029cd327 95 void InsertCluster(AliTRDcluster *c, UInt_t index);
5443e65e 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,
b8dc2353 105 Double_t &dx, Double_t &rho, Double_t &x0,
5443e65e 106 Bool_t &lookForCluster) const;
3c625a9b 107 Int_t GetZone( Double_t z) const;
5443e65e 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; }
3c625a9b 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; }
5443e65e 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,
b8dc2353 119 Double_t rho = 1.29e-3, Double_t x0 = 36.66,
120 Double_t Yc = 0, Double_t Zc = 0);
121
029cd327 122 Bool_t IsSensitive() const {return (fTimeBinIndex>=0)? kTRUE: kFALSE;}
9c9d2487 123
5443e65e 124 void Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
3c625a9b 125 Bool_t IsHole(Int_t zone) const { return fIsHole[zone];}
5443e65e 126 private:
127
029cd327 128 Int_t fN; // this is fN
3c625a9b 129 Int_t fSec; // sector mumber
5443e65e 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)
029cd327 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
3c625a9b 139 Double_t fZmaxSensitive[kZones]; //sensitive area for detection Z
140 Bool_t fIsHole[kZones]; //is hole in given sector
5443e65e 141 Double_t fYmax; // half of active area length in Y
3c625a9b 142 Double_t fYmaxSensitive; // half of active area length in Y
5443e65e 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]; }
029cd327 170 Int_t CookTimeBinIndex(Int_t plane, Int_t localTB) const;
5443e65e 171
172 private:
173 Int_t fN; // total number of layers
029cd327 174 AliTRDgeometry *fGeom; // geometry
175 AliTRDparameter *fPar; // parameter
176 AliTRDpropagationLayer *fLayers[kMaxLayersPerSector]; // layers
177 Int_t fTimeBinIndex[kMaxTimeBinIndex]; // time bin index
5443e65e 178 Float_t fTzeroShift; // T0 shift in cm
179 Int_t fGeomSector; // sector # in AliTRDgeometry
180 };
181
46d29e70 182 protected:
183
5443e65e 184 AliTRDgeometry *fGeom; // Pointer to TRD geometry
029cd327 185 AliTRDparameter *fPar; // Pointer to TRD parameter
bbf92647 186
029cd327 187 AliTRDtrackingSector *fTrSec[kTrackingSectors]; // array of tracking sectors;
46d29e70 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
a819a5f7 197 Float_t fSY2corr; // Correction coefficient for
198 // cluster SigmaY2
199
5443e65e 200 Float_t fSZ2corr; // Correction coefficient for
201 // cluster SigmaZ2
202
029cd327 203 static const Float_t fgkSeedGap; // Distance between inner and outer
0a29d0f1 204 // time bin in seeding
b8dc2353 205 // (fraction of all time bins)
bbf92647 206
029cd327 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
c630aafd 210 // in track prolongation
5443e65e 211 Int_t fTimeBinsPerPlane; // number of sensitive timebins per plane
212 Int_t fMaxGap; // max gap (in time bins) in the track
c630aafd 213 // in track prolongation
5443e65e 214
029cd327 215 static const Double_t fgkMaxChi2; // max increment in track chi2
c630aafd 216
029cd327 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?
3c625a9b 239 Bool_t fHoles[5][18]; // holes
9c9d2487 240
241 Bool_t AdjustSector(AliTRDtrack *track);
242
243
244 // Barrel tracks [SR, 03.04.2003]
245
029cd327 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
9c9d2487 248
249 void SetBarrelTree(const char *mode);
250 void StoreBarrelTrack(AliTRDtrack *ps, Int_t refPlane, Int_t isIn);
251
029cd327 252 TFile *fBarrelFile; // Some kind of barrel file
253 TTree *fBarrelTree; // And a barrel tree
254 TClonesArray *fBarrelArray; // Wow, there even an array for that barrel
255 AliBarrelTrack *fBarrelTrack; // And, finally, the track
256
257 private:
258
029cd327 259 virtual void MakeSeeds(Int_t inner, Int_t outer, Int_t turn);
260
261 Int_t FollowProlongation(AliTRDtrack& t, Int_t rf);
262 Int_t FollowBackProlongation(AliTRDtrack& t);
1e9bb598 263 Int_t Refit(AliTRDtrack& t, Int_t rf);
029cd327 264
265 Int_t PropagateToTPC(AliTRDtrack& t);
266 Int_t PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
9c9d2487 267
029cd327 268 void SetSY2corr(Float_t w) {fSY2corr = w;}
269 void SetSZ2corr(Float_t w) {fSZ2corr = w;}
270 Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
271 Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
9c9d2487 272
46d29e70 273 ClassDef(AliTRDtracker,1) // manager base class
274
275};
276
277#endif