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