]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtracker.h
First implementation of calibration scheme by Jan Fiete
[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;
7ad19338 18class AliTRDtracklet;
5443e65e 19class AliTRDcluster;
b7a0917f 20class AliESD;
7ad19338 21class TTreeSRedirector;
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
69b55c55 29class AliTRDseed : public TObject{
30 friend class AliTRDtracker;
31 public:
32 AliTRDseed(); // default constructor
33 ~AliTRDseed(){}; // default constructor
34 static void EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh);
35 static Float_t FitRiemanTilt(AliTRDseed * seed, Bool_t error);
36 void UseClusters(); // use clusters
37 void Update(); // update information - without tilt correction
38 void CookLabels(); // cook label
39 void UpdateUsed();
40 void Reset(); // reset seed
41 Bool_t isOK(){return fN2>8;}
42 private:
43 Float_t fTilt; // tilting angle
44 Float_t fPadLength; // pad length
45 Float_t fX0; // x0 position
46 Float_t fX[25]; // !x position
47 Float_t fY[25]; // !y position
48 Float_t fZ[25]; // !z position
49 Int_t fIndexes[25]; // !indexes
50 AliTRDcluster *fClusters[25]; // !clusters
51 Bool_t fUsable[25]; // !indication - usable cluster
52 Float_t fYref[2]; // reference y
53 Float_t fZref[2]; // reference z
54 Float_t fYfit[2]; // y fit position +derivation
55 Float_t fYfitR[2]; // y fit position +derivation
56 Float_t fZfit[2]; // z fit position
57 Float_t fZfitR[2]; // z fit position
58 Float_t fSigmaY; // "robust" sigma in Y - constant fit
59 Float_t fSigmaY2; // "robust" sigma in Y - line fit
60 Float_t fMeanz; // mean vaue of z
61 Float_t fZProb; // max probbable z
62 Int_t fLabels[2]; // labels
63 Int_t fN; // number of associated clusters
64 Int_t fN2; // number of not crossed
65 Int_t fNUsed; // number of used clusters
66 Int_t fFreq; // freq
67 Int_t fNChange; // change z counter
68 Float_t fMPads; // mean number of pads per cluster
69 // global
70 //
71 Float_t fC; // curvature
72 Float_t fCC; // curvature with constrain
73 Float_t fChi2; // global chi2
74 Float_t fChi2Z; // global chi2
75 private:
76 ClassDef(AliTRDseed,1)
77};
7ad19338 78
79
c630aafd 80class AliTRDtracker : public AliTracker {
46d29e70 81
82 public:
83
7ad19338 84
89f05372 85 AliTRDtracker();
5443e65e 86 AliTRDtracker(const TFile *in);
029cd327 87 virtual ~AliTRDtracker();
69b55c55 88 static Int_t Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);
c630aafd 89 Int_t Clusters2Tracks(AliESD* event);
c630aafd 90 Int_t PropagateBack(AliESD* event);
1e9bb598 91 Int_t RefitInward(AliESD* event);
7ad19338 92
c630aafd 93 Int_t LoadClusters(TTree *cTree);
b7a0917f 94 void UnloadClusters();
029cd327 95 AliCluster *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL;
96 return (AliCluster*) fClusters->UncheckedAt(index); };
3551db50 97 Bool_t GetTrackPoint(Int_t index, AliTrackPoint& p) const;
5443e65e 98 virtual void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
99 virtual void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
100
5443e65e 101 void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
b8dc2353 102 void SetNoTilt() { fNoTilt = kTRUE; }
5443e65e 103
fd621f36 104 Double_t GetTiltFactor(const AliTRDcluster* c);
105
b7a0917f 106 Int_t ReadClusters(TObjArray *array, TTree *in) const;
029cd327 107 Int_t CookSectorIndex(Int_t gs) const { return kTrackingSectors - 1 - gs; }
7ad19338 108 AliTRDcluster * GetCluster(AliTRDtrack * track, Int_t plane, Int_t timebin, UInt_t &index);
3c625a9b 109 Int_t GetLastPlane(AliTRDtrack * track); //return last updated plane
7ad19338 110 Int_t FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack * track, Int_t *clusters, AliTRDtracklet& tracklet);
5443e65e 111
029cd327 112 Float_t GetSeedGap() const {return fgkSeedGap;}
5443e65e 113 Int_t GetMaxGap() const {return fMaxGap;}
114 Int_t GetTimeBinsPerPlane() const {return fTimeBinsPerPlane;}
029cd327 115 Float_t GetSeedStep() const {return fgkSeedStep;}
116 Float_t GetSeedDepth() const {return fgkSeedDepth;}
117 Float_t GetSkipDepth() const {return fgkSkipDepth;}
118 Double_t GetMaxChi2() const {return fgkMaxChi2;}
119 Float_t GetMaxSeedC() const {return fgkMaxSeedC;}
120 Float_t GetMaxSeedTan() const {return fgkMaxSeedTan;}
121 Double_t GetSeedErrorSY() const {return fgkSeedErrorSY;}
122 Double_t GetSeedErrorSY3() const {return fgkSeedErrorSY3;}
123 Double_t GetSeedErrorSZ() const {return fgkSeedErrorSZ;}
124 Float_t GetLabelFraction() const {return fgkLabelFraction;}
125 Float_t GetWideRoad() const {return fgkWideRoad;}
126
127 Float_t GetMinClustersInTrack() const {return fgkMinClustersInTrack;}
128 Float_t GetMinClustersInSeed() const {return fgkMinClustersInSeed;}
129 Float_t GetMaxSeedDeltaZ() const {return fgkMaxSeedDeltaZ;}
130 Float_t GetMaxSeedVertexZ() const {return fgkMaxSeedVertexZ;}
5443e65e 131
132 // x <-> timebin conversions useful in analysis macros
029cd327 133 Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const;
5443e65e 134 Double_t GetX(Int_t sec, Int_t pl) const {
135 return fTrSec[sec]->GetLayer(pl)->GetX(); }
029cd327 136 Int_t GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const {
137 return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
5443e65e 138 Double_t GetLayerNumber(Int_t sec, Double_t x) const {
139 return fTrSec[sec]->GetLayerNumber(x); }
140
029cd327 141 class AliTRDpropagationLayer {
5443e65e 142 // ***************** internal class *******************
143 public:
144 AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho,
029cd327 145 Double_t x0, Int_t tbIndex);
5443e65e 146
147 ~AliTRDpropagationLayer() {
148 if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
149 }
029cd327 150 void InsertCluster(AliTRDcluster *c, UInt_t index);
5443e65e 151 operator Int_t() const {return fN;}
152 AliTRDcluster* operator[](Int_t i) {return fClusters[i];}
153 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
154 Double_t GetX() const { return fX; }
155 Double_t GetdX() const { return fdX; }
156 Double_t GetRho() const { return fRho; }
157 Double_t GetX0() const { return fX0; }
158 Int_t GetTimeBinIndex() const { return fTimeBinIndex; }
7ad19338 159 Bool_t GetPropagationParameters(Double_t y, Double_t z,
b8dc2353 160 Double_t &dx, Double_t &rho, Double_t &x0,
7ad19338 161 Bool_t &lookForCluster) const;
3c625a9b 162 Int_t GetZone( Double_t z) const;
69b55c55 163 Int_t Find(Float_t y) const;
64a6f6e9 164 Int_t FindNearestCluster(Float_t y, Float_t z, Float_t maxroad, Float_t maxroadz) const;
5443e65e 165 void SetZmax(Int_t cham, Double_t center, Double_t w)
166 { fZc[cham] = center; fZmax[cham] = w; }
3c625a9b 167 void SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
168 void SetHoles(Bool_t* holes);
169 void SetYmax(Double_t w, Double_t wsensitive) { fYmax = w; fYmaxSensitive = wsensitive; }
5443e65e 170 Double_t GetYmax() const { return fYmax; }
171 Double_t GetZmax(Int_t c) const { return fZmax[c]; }
172 Double_t GetZc(Int_t c) const { return fZc[c]; }
173
174 void SetHole(Double_t Zmax, Double_t Ymax,
b8dc2353 175 Double_t rho = 1.29e-3, Double_t x0 = 36.66,
176 Double_t Yc = 0, Double_t Zc = 0);
177
029cd327 178 Bool_t IsSensitive() const {return (fTimeBinIndex>=0)? kTRUE: kFALSE;}
9c9d2487 179
5443e65e 180 void Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
3c625a9b 181 Bool_t IsHole(Int_t zone) const { return fIsHole[zone];}
5443e65e 182 private:
183
029cd327 184 Int_t fN; // this is fN
3c625a9b 185 Int_t fSec; // sector mumber
5443e65e 186 AliTRDcluster **fClusters; // array of pointers to clusters
187 UInt_t *fIndex; // array of cluster indexes
188 Double_t fX; // x coordinate of the middle plane
189 Double_t fdX; // radial thickness of the time bin
190 Double_t fRho; // default density of the material
191 Double_t fX0; // default radiation length
192 Int_t fTimeBinIndex; // plane * F(local_tb)
029cd327 193 Double_t fZc[kZones]; // Z position of the center for 5 active areas
194 Double_t fZmax[kZones]; // half of active area length in Z
3c625a9b 195 Double_t fZmaxSensitive[kZones]; //sensitive area for detection Z
196 Bool_t fIsHole[kZones]; //is hole in given sector
5443e65e 197 Double_t fYmax; // half of active area length in Y
3c625a9b 198 Double_t fYmaxSensitive; // half of active area length in Y
5443e65e 199
200 Bool_t fHole; // kTRUE if there is a hole in the layer
201 Double_t fHoleZc; // Z of the center of the hole
202 Double_t fHoleZmax; // half of the hole length in Z
203 Double_t fHoleYc; // Y of the center of the hole
204 Double_t fHoleYmax; // half of the hole length in Y
205 Double_t fHoleRho; // density of the gas in the hole
206 Double_t fHoleX0; // radiation length of the gas in the hole
207 };
208
209 class AliTRDtrackingSector {
210 public:
211 AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs, AliTRDparameter* par);
212 ~AliTRDtrackingSector() { for(Int_t i=0; i<fN; i++) delete fLayers[i]; }
213 Int_t GetNumberOfLayers() const { return fN; }
214 Int_t GetNumberOfTimeBins() const;
215 Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX(); }
216 void MapTimeBinLayers();
217 Int_t GetLayerNumber(Double_t x) const;
218 Int_t GetInnerTimeBin() const;
219 Int_t GetOuterTimeBin() const;
220 Int_t GetLayerNumber(Int_t tb) const {return fTimeBinIndex[tb];}
221 Float_t GetTzeroShift() const { return fTzeroShift; }
222 Int_t Find(Double_t x) const;
223 void InsertLayer(AliTRDpropagationLayer* pl);
224 // AliTRDpropagationLayer* operator[](Int_t i) { return fLayers[i]; }
225 AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i]; }
029cd327 226 Int_t CookTimeBinIndex(Int_t plane, Int_t localTB) const;
5443e65e 227
228 private:
229 Int_t fN; // total number of layers
029cd327 230 AliTRDgeometry *fGeom; // geometry
231 AliTRDparameter *fPar; // parameter
232 AliTRDpropagationLayer *fLayers[kMaxLayersPerSector]; // layers
233 Int_t fTimeBinIndex[kMaxTimeBinIndex]; // time bin index
5443e65e 234 Float_t fTzeroShift; // T0 shift in cm
235 Int_t fGeomSector; // sector # in AliTRDgeometry
236 };
237
46d29e70 238 protected:
239
7ad19338 240 friend class AliTRDtracker::AliTRDtrackingSector;
241
5443e65e 242 AliTRDgeometry *fGeom; // Pointer to TRD geometry
029cd327 243 AliTRDparameter *fPar; // Pointer to TRD parameter
bbf92647 244
029cd327 245 AliTRDtrackingSector *fTrSec[kTrackingSectors]; // array of tracking sectors;
46d29e70 246 Int_t fNclusters; // Number of clusters in TRD
247 TObjArray *fClusters; // List of clusters for all sectors
248
249 Int_t fNseeds; // Number of track seeds
250 TObjArray *fSeeds; // List of track seeds
251
252 Int_t fNtracks; // Number of reconstructed tracks
253 TObjArray *fTracks; // List of reconstructed tracks
254
a819a5f7 255 Float_t fSY2corr; // Correction coefficient for
256 // cluster SigmaY2
257
5443e65e 258 Float_t fSZ2corr; // Correction coefficient for
259 // cluster SigmaZ2
260
029cd327 261 static const Float_t fgkSeedGap; // Distance between inner and outer
0a29d0f1 262 // time bin in seeding
b8dc2353 263 // (fraction of all time bins)
bbf92647 264
029cd327 265 static const Float_t fgkSeedStep; // Step in iterations
266 static const Float_t fgkSeedDepth; // Fraction of TRD allocated for seeding
267 static const Float_t fgkSkipDepth; // Fraction of TRD which can be skipped
c630aafd 268 // in track prolongation
5443e65e 269 Int_t fTimeBinsPerPlane; // number of sensitive timebins per plane
270 Int_t fMaxGap; // max gap (in time bins) in the track
c630aafd 271 // in track prolongation
5443e65e 272
029cd327 273 static const Double_t fgkMaxChi2; // max increment in track chi2
c630aafd 274
029cd327 275 static const Float_t fgkMinClustersInTrack; // min number of clusters in track
276 // out of total timebins
277
278 static const Float_t fgkMinFractionOfFoundClusters; // min found clusters
279 // out of expected
280
281 static const Float_t fgkMinClustersInSeed; // min fraction of clusters in seed
282 static const Float_t fgkMaxSeedDeltaZ; // max dZ in MakeSeeds
283 static const Float_t fgkMaxSeedDeltaZ12; // max abs(z1-z2) in MakeSeeds
284 static const Float_t fgkMaxSeedC; // max initial curvature in MakeSeeds
285 static const Float_t fgkMaxSeedTan; // max initial Tangens(lambda) in MakeSeeds
286 static const Float_t fgkMaxSeedVertexZ; // max vertex Z in MakeSeeds
287 static const Double_t fgkSeedErrorSY; // sy parameter in MakeSeeds
288 static const Double_t fgkSeedErrorSY3; // sy3 parameter in MakeSeeds
289 static const Double_t fgkSeedErrorSZ; // sz parameter in MakeSeeds
290 static const Float_t fgkLabelFraction; // min fraction of same label
291 static const Float_t fgkWideRoad; // max road width in FindProlongation
7ad19338 292 //
293 static const Double_t fgkDriftCorrection; // correction coeficients for drift velocity
294 static const Double_t fgkOffset; // correction coeficients
295 static const Double_t fgkOffsetX; // correction coeficients offset in X
296 static const Double_t fgkCoef; // correction coeficients
297 static const Double_t fgkMean; // correction coeficients
298 static const Double_t fgkExB; // correction coeficients
029cd327 299
300 Bool_t fVocal; // Whatever...
301 Bool_t fAddTRDseeds; // Something else
302
303 Bool_t fNoTilt; // No tilt, or what?
3c625a9b 304 Bool_t fHoles[5][18]; // holes
9c9d2487 305
306 Bool_t AdjustSector(AliTRDtrack *track);
307
308
309 // Barrel tracks [SR, 03.04.2003]
310
029cd327 311 static const Int_t fgkFirstPlane; // Id of the first (innermost) reference plane
312 static const Int_t fgkLastPlane; // Id of the last (outermost) reference plane
029cd327 313
314 private:
69b55c55 315 AliTRDtrack * RegisterSeed(AliTRDseed * seeds, Double_t *params);
029cd327 316 virtual void MakeSeeds(Int_t inner, Int_t outer, Int_t turn);
69b55c55 317 void MakeSeedsMI(Int_t inner, Int_t outer, AliESD *esd=0);
029cd327 318
319 Int_t FollowProlongation(AliTRDtrack& t, Int_t rf);
8979685e 320 Int_t FollowProlongationG(AliTRDtrack& t, Int_t rf);
029cd327 321 Int_t FollowBackProlongation(AliTRDtrack& t);
8979685e 322 Int_t FollowBackProlongationG(AliTRDtrack& t);
1e9bb598 323 Int_t Refit(AliTRDtrack& t, Int_t rf);
eab5961e 324 void CookdEdxTimBin(AliTRDtrack& t);
029cd327 325
326 Int_t PropagateToTPC(AliTRDtrack& t);
327 Int_t PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
9c9d2487 328
029cd327 329 void SetSY2corr(Float_t w) {fSY2corr = w;}
330 void SetSZ2corr(Float_t w) {fSZ2corr = w;}
331 Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
332 Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
7ad19338 333 TTreeSRedirector *fDebugStreamer; //!debug streamer
24de2d6d 334 ClassDef(AliTRDtracker,2) // manager base class
46d29e70 335
336};
337
338#endif