]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDtracker.h
kZDiElectron forcing Z->e+e- added.
[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
ad670fba 7/* $Id$ */
8
9////////////////////////////////////////////////////////////////////////////
10// //
11// The TRD tracker //
12// //
13////////////////////////////////////////////////////////////////////////////
14
5443e65e 15#include "AliTracker.h"
e24ea474 16#include "TObjArray.h"
46d29e70 17
18class TFile;
c630aafd 19class TTree;
7e448bcc 20class TH1D;
21class TH2D;
ad670fba 22class TParticle;
23class TParticlePDG;
46d29e70 24
25class AliTRDgeometry;
46d29e70 26class AliTRDtrack;
7ad19338 27class AliTRDtracklet;
5443e65e 28class AliTRDcluster;
75bd7f81 29class AliTRDseed;
af885e0f 30class AliESDEvent;
7ad19338 31class TTreeSRedirector;
46d29e70 32
75bd7f81 33///////////////////////////////////////////////////////////////////////////////
34// //
35// The standard TRD tracker //
36// Based on Kalman filltering approach //
37// //
38///////////////////////////////////////////////////////////////////////////////
7ad19338 39
c630aafd 40class AliTRDtracker : public AliTracker {
46d29e70 41
4e009ce4 42 // Histograms
43 TH1D *fHBackfit; // Histogram for back propagation
44 TH1D *fHClSearch; // Cluster search
7e448bcc 45 TH1D *fHRefit;
46
47 TH1D *fHX;
48 TH1D *fHNCl;
49 TH1D *fHNClTrack;
50 TH1D *fHFindCl[4];
51 TH1D *fHMinYPos;
52 TH1D *fHMinYNeg;
53 TH1D *fHMinZ;
54
55 TH2D *fHMinD;
56 TH1D *fHDeltaX;
57
58 TH1D *fHXCl;
59
60 void InitLogHists();
61 void SaveLogHists();
62
46d29e70 63 public:
64
75bd7f81 65 enum { kMaxLayersPerSector = 1000
7e448bcc 66 , kMaxTimeBinIndex = 216
67 , kMaxClusterPerTimeBin = 2300
68 , kZones = 5
69 , kTrackingSectors = 18 };
70
89f05372 71 AliTRDtracker();
ad670fba 72 AliTRDtracker(const AliTRDtracker &t);
5443e65e 73 AliTRDtracker(const TFile *in);
ad670fba 74 virtual ~AliTRDtracker();
75 AliTRDtracker &operator=(const AliTRDtracker &/*t*/) { return *this; }
7e448bcc 76
77 void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
78 void SetNoTilt() { fNoTilt = kTRUE; }
79
80 Int_t GetTimeBinsPerPlane() const { return fTimeBinsPerPlane; }
81 Double_t GetMaxChi2() const { return fgkMaxChi2; }
82 Float_t GetLabelFraction() const { return fgkLabelFraction; }
83 Float_t GetMinClustersInTrack() const { return fgkMinClustersInTrack; }
84 Int_t GetLastPlane(AliTRDtrack *track);
85 Double_t GetTiltFactor(const AliTRDcluster *c);
86 Bool_t GetTrackPoint(Int_t index, AliTrackPoint& p) const;
87 Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const;
88 Double_t GetX(Int_t sec, Int_t pl) const { return fTrSec[sec]->GetLayer(pl)->GetX(); }
89 Int_t GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const
90 { return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
91 Double_t GetLayerNumber(Int_t sec, Double_t x) const
92 { return fTrSec[sec]->GetLayerNumber(x); }
93 AliCluster *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL;
94 return (AliCluster *) fClusters->UncheckedAt(index); }
95
ad670fba 96 static Int_t Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);
af885e0f 97 Int_t Clusters2Tracks(AliESDEvent *event);
98 Int_t PropagateBack(AliESDEvent *event);
99 Int_t RefitInward(AliESDEvent *event);
7e448bcc 100
ad670fba 101 virtual void CookLabel(AliKalmanTrack *t, Float_t wrong) const;
7e448bcc 102
103 Int_t LocalToGlobalID(Int_t lid);
104 Int_t GlobalToLocalID(Int_t gid);
105 Bool_t Transform(AliTRDcluster *cluster);
5443e65e 106
7e448bcc 107 Int_t LoadClusters(TTree *cTree);
108 void UnloadClusters();
ad670fba 109 virtual void UseClusters(const AliKalmanTrack *t, Int_t from = 0) const;
7e448bcc 110 Int_t ReadClusters(TObjArray *array, TTree *in) const;
111 AliTRDcluster *GetCluster(AliTRDtrack *track, Int_t plane, Int_t timebin, UInt_t &index);
112 Int_t FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack *track
ad670fba 113 , Int_t *clusters, AliTRDtracklet &tracklet);
7e448bcc 114
75bd7f81 115 protected:
7e448bcc 116
029cd327 117 class AliTRDpropagationLayer {
7e448bcc 118
119 public:
120
ad670fba 121 AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho
7e448bcc 122 , Double_t x0, Int_t tbIndex, Int_t plane);
ad670fba 123 AliTRDpropagationLayer(const AliTRDpropagationLayer &/*p*/);
7e448bcc 124 ~AliTRDpropagationLayer() {
125 if (fTimeBinIndex >= 0) {
126 delete[] fClusters;
127 delete[] fIndex;
128 }
129 }
ad670fba 130 AliTRDpropagationLayer &operator=(const AliTRDpropagationLayer &/*p*/)
7e448bcc 131 {return *this;}
132
133 operator Int_t() const {return fN;}
134 AliTRDcluster *operator[](Int_t i) {return fClusters[i];}
135
136 void SetZmax(Int_t cham, Double_t center, Double_t w) {
137 fZc[cham] = center;
138 fZmax[cham] = w;
139 }
140 void SetYmax(Double_t w, Double_t wsensitive) {
141 fYmax = w;
142 fYmaxSensitive = wsensitive;
143 }
144
145 void SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
146 void SetHoles(Bool_t* holes);
147 void SetHole(Double_t Zmax, Double_t Ymax
148 , Double_t rho = 1.29e-3, Double_t x0 = 36.66
149 , Double_t Yc = 0.0, Double_t Zc = 0.0);
150
151 Double_t GetYmax() const { return fYmax; }
152 Double_t GetZmax(Int_t c) const { return fZmax[c]; }
153 Double_t GetZc(Int_t c) const { return fZc[c]; }
154 UInt_t GetIndex(Int_t i) const { return fIndex[i]; }
155 Double_t GetX() const { return fX; }
156 Double_t GetdX() const { return fdX; }
157 Int_t GetTimeBinIndex() const { return fTimeBinIndex; }
158 Int_t GetPlane() const { return fPlane; }
159 Bool_t IsHole(Int_t zone) const { return fIsHole[zone]; }
160 Bool_t IsSensitive() const { return (fTimeBinIndex >= 0)? kTRUE : kFALSE;}
161
162 void Clear() {
163 for (Int_t i = 0; i < fN; i++) fClusters[i] = NULL;
164 fN = 0;
165 }
166
167 void InsertCluster(AliTRDcluster *c, UInt_t index);
168 Int_t Find(Float_t y) const;
169 Int_t FindNearestCluster(Float_t y, Float_t z, Float_t maxroad, Float_t maxroadz) const;
170
171 void SetX(Double_t x) {fX = x;}
172
173
174 private:
175
176 Int_t fN; // This is fN
177 Int_t fSec; // Sector mumber
178 AliTRDcluster **fClusters; // Array of pointers to clusters
179 UInt_t *fIndex; // Array of cluster indexes
180 Double_t fX; // X coordinate of the middle plane
181 Double_t fdX; // Radial thickness of the time bin
182 Double_t fRho; // Default density of the material
183 Double_t fX0; // Default radiation length
184 Int_t fTimeBinIndex; // Plane * F(local_tb)
185 Int_t fPlane; // Plane number
186 Double_t fZc[kZones]; // Z position of the center for 5 active areas
187 Double_t fZmax[kZones]; // Half of active area length in Z
188 Double_t fZmaxSensitive[kZones]; // Sensitive area for detection Z
189 Bool_t fIsHole[kZones]; // Is hole in given sector
190 Double_t fYmax; // Half of active area length in Y
191 Double_t fYmaxSensitive; // Half of active area length in Y
192
193 Bool_t fHole; // kTRUE if there is a hole in the layer
194 Double_t fHoleZc; // Z of the center of the hole
195 Double_t fHoleZmax; // Half of the hole length in Z
196 Double_t fHoleYc; // Y of the center of the hole
197 Double_t fHoleYmax; // Half of the hole length in Y
198 Double_t fHoleRho; // Density of the gas in the hole
199 Double_t fHoleX0; // Radiation length of the gas in the hole
200
75bd7f81 201 };
7e448bcc 202
75bd7f81 203 class AliTRDtrackingSector {
7e448bcc 204
5443e65e 205 public:
7e448bcc 206
207 AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs);
208 AliTRDtrackingSector(const AliTRDtrackingSector &/*t*/);
209 ~AliTRDtrackingSector() {
210 for (Int_t i = 0; i < fN; i++) delete fLayers[i];
211 }
212
213 AliTRDtrackingSector &operator=(const AliTRDtrackingSector &/*t*/){ return *this;}
214
215 Int_t GetNumberOfLayers() const { return fN;}
216 Int_t GetNumberOfTimeBins() const;
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 Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX();}
222 AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i];}
223
224 void MapTimeBinLayers();
225 Int_t Find(Double_t x) const;
226 void InsertLayer(AliTRDpropagationLayer *pl);
227 Int_t CookTimeBinIndex(Int_t plane, Int_t localTB) const;
228
229 private:
230
231 Int_t fN; // Total number of layers
232 AliTRDgeometry *fGeom; // Geometry
233 AliTRDpropagationLayer *fLayers[kMaxLayersPerSector]; // Layers
234 Int_t fTimeBinIndex[kMaxTimeBinIndex]; // Time bin index
235 Int_t fGeomSector; // Sector# in AliTRDgeometry
236
75bd7f81 237 };
9c9d2487 238
7e448bcc 239 AliTRDgeometry *fGeom; // Pointer to TRD geometry
240 AliTRDtrackingSector *fTrSec[kTrackingSectors]; // Array of tracking sectors;
241 Int_t fNclusters; // Number of clusters in TRD
242 TObjArray *fClusters; // List of clusters for all sectors
243 Int_t fNseeds; // Number of track seeds
244 TObjArray *fSeeds; // List of track seeds
245 Int_t fNtracks; // Number of reconstructed tracks
246 TObjArray *fTracks; // List of reconstructed tracks
247 Int_t fTimeBinsPerPlane; // Timebins per plane in track prolongation
248
249 static const Double_t fgkMaxChi2; // Max increment in track chi2
250 static const Float_t fgkMinClustersInTrack; // Min number of clusters in track
251 static const Float_t fgkLabelFraction; // Min fraction of same label
252 static const Double_t fgkMaxSnp; // Maximal snp for tracking
253 static const Double_t fgkMaxStep; // Maximal step for tracking
254
255 Bool_t fAddTRDseeds; // Something else
256 Bool_t fNoTilt; // No tilt, or what?
257 Bool_t fHoles[5][18]; // Holes
258
259 Bool_t AdjustSector(AliTRDtrack *track);
260
029cd327 261 private:
7e448bcc 262
263 AliTRDtrack *RegisterSeed(AliTRDseed *seeds, Double_t *params);
af885e0f 264 void MakeSeedsMI(Int_t inner, Int_t outer, AliESDEvent *esd = 0);
7e448bcc 265
266 Int_t FollowBackProlongation(AliTRDtrack &t);
267 Int_t FollowProlongation(AliTRDtrack &t);
7e448bcc 268 Int_t PropagateToX(AliTRDtrack &t, Double_t xToGo, Double_t maxStep);
269 Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
270 Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
271
272 TTreeSRedirector *fDebugStreamer; //!Debug streamer
273
ad670fba 274 ClassDef(AliTRDtracker,2) // TRD tracker
7e448bcc 275
276 };
46d29e70 277#endif