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