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