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