1 #ifndef ALITRDTRACKER_H
2 #define ALITRDTRACKER_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 #include "AliTracker.h"
16 class AliTRDparameter;
21 class TTreeSRedirector;
23 const unsigned kMaxLayersPerSector = 1000;
24 const unsigned kMaxTimeBinIndex = 216; // (30 drift + 6 ampl) * 6 planes
25 const unsigned kMaxClusterPerTimeBin = 7000;
26 const unsigned kZones = 5;
27 const Int_t kTrackingSectors = 18;
29 class AliTRDseed : public TObject{
30 friend class AliTRDtracker;
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
40 void Reset(); // reset seed
41 Bool_t isOK(){return fN2>8;}
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
67 Int_t fNChange; // change z counter
68 Float_t fMPads; // mean number of pads per cluster
71 Float_t fC; // curvature
72 Float_t fCC; // curvature with constrain
73 Float_t fChi2; // global chi2
74 Float_t fChi2Z; // global chi2
76 ClassDef(AliTRDseed,1)
80 class AliTRDtracker : public AliTracker {
86 AliTRDtracker(const TFile *in);
87 virtual ~AliTRDtracker();
88 static Int_t Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);
89 Int_t Clusters2Tracks(AliESD* event);
90 Int_t PropagateBack(AliESD* event);
91 Int_t RefitInward(AliESD* event);
93 Int_t LoadClusters(TTree *cTree);
94 void UnloadClusters();
95 AliCluster *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL;
96 return (AliCluster*) fClusters->UncheckedAt(index); };
97 Bool_t GetTrackPoint(Int_t index, AliTrackPoint& p) const;
98 virtual void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
99 virtual void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
101 void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
102 void SetNoTilt() { fNoTilt = kTRUE; }
104 Double_t GetTiltFactor(const AliTRDcluster* c);
106 Int_t ReadClusters(TObjArray *array, TTree *in) const;
107 Int_t CookSectorIndex(Int_t gs) const { return kTrackingSectors - 1 - gs; }
108 AliTRDcluster * GetCluster(AliTRDtrack * track, Int_t plane, Int_t timebin, UInt_t &index);
109 Int_t GetLastPlane(AliTRDtrack * track); //return last updated plane
110 Int_t FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack * track, Int_t *clusters, AliTRDtracklet& tracklet);
112 Int_t GetTimeBinsPerPlane() const {return fTimeBinsPerPlane;}
113 Double_t GetMaxChi2() const {return fgkMaxChi2;}
114 Float_t GetLabelFraction() const {return fgkLabelFraction;}
116 Float_t GetMinClustersInTrack() const {return fgkMinClustersInTrack;}
118 // x <-> timebin conversions useful in analysis macros
119 Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const;
120 Double_t GetX(Int_t sec, Int_t pl) const {
121 return fTrSec[sec]->GetLayer(pl)->GetX(); }
122 Int_t GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const {
123 return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
124 Double_t GetLayerNumber(Int_t sec, Double_t x) const {
125 return fTrSec[sec]->GetLayerNumber(x); }
127 class AliTRDpropagationLayer {
128 // ***************** internal class *******************
130 AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho,
131 Double_t x0, Int_t tbIndex);
133 ~AliTRDpropagationLayer() {
134 if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
136 void InsertCluster(AliTRDcluster *c, UInt_t index);
137 operator Int_t() const {return fN;}
138 AliTRDcluster* operator[](Int_t i) {return fClusters[i];}
139 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
140 Double_t GetX() const { return fX; }
141 Double_t GetdX() const { return fdX; }
142 Double_t GetRho() const { return fRho; }
143 Double_t GetX0() const { return fX0; }
144 Int_t GetTimeBinIndex() const { return fTimeBinIndex; }
145 Bool_t GetPropagationParameters(Double_t y, Double_t z,
146 Double_t &dx, Double_t &rho, Double_t &x0,
147 Bool_t &lookForCluster) const;
148 Int_t GetZone( Double_t z) const;
149 Int_t Find(Float_t y) const;
150 Int_t FindNearestCluster(Float_t y, Float_t z, Float_t maxroad, Float_t maxroadz) const;
151 void SetZmax(Int_t cham, Double_t center, Double_t w)
152 { fZc[cham] = center; fZmax[cham] = w; }
153 void SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
154 void SetHoles(Bool_t* holes);
155 void SetYmax(Double_t w, Double_t wsensitive) { fYmax = w; fYmaxSensitive = wsensitive; }
156 Double_t GetYmax() const { return fYmax; }
157 Double_t GetZmax(Int_t c) const { return fZmax[c]; }
158 Double_t GetZc(Int_t c) const { return fZc[c]; }
160 void SetHole(Double_t Zmax, Double_t Ymax,
161 Double_t rho = 1.29e-3, Double_t x0 = 36.66,
162 Double_t Yc = 0, Double_t Zc = 0);
164 Bool_t IsSensitive() const {return (fTimeBinIndex>=0)? kTRUE: kFALSE;}
166 void Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
167 Bool_t IsHole(Int_t zone) const { return fIsHole[zone];}
170 Int_t fN; // this is fN
171 Int_t fSec; // sector mumber
172 AliTRDcluster **fClusters; // array of pointers to clusters
173 UInt_t *fIndex; // array of cluster indexes
174 Double_t fX; // x coordinate of the middle plane
175 Double_t fdX; // radial thickness of the time bin
176 Double_t fRho; // default density of the material
177 Double_t fX0; // default radiation length
178 Int_t fTimeBinIndex; // plane * F(local_tb)
179 Double_t fZc[kZones]; // Z position of the center for 5 active areas
180 Double_t fZmax[kZones]; // half of active area length in Z
181 Double_t fZmaxSensitive[kZones]; //sensitive area for detection Z
182 Bool_t fIsHole[kZones]; //is hole in given sector
183 Double_t fYmax; // half of active area length in Y
184 Double_t fYmaxSensitive; // half of active area length in Y
186 Bool_t fHole; // kTRUE if there is a hole in the layer
187 Double_t fHoleZc; // Z of the center of the hole
188 Double_t fHoleZmax; // half of the hole length in Z
189 Double_t fHoleYc; // Y of the center of the hole
190 Double_t fHoleYmax; // half of the hole length in Y
191 Double_t fHoleRho; // density of the gas in the hole
192 Double_t fHoleX0; // radiation length of the gas in the hole
195 class AliTRDtrackingSector {
197 AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs, AliTRDparameter* par);
198 ~AliTRDtrackingSector() { for(Int_t i=0; i<fN; i++) delete fLayers[i]; }
199 Int_t GetNumberOfLayers() const { return fN; }
200 Int_t GetNumberOfTimeBins() const;
201 Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX(); }
202 void MapTimeBinLayers();
203 Int_t GetLayerNumber(Double_t x) const;
204 Int_t GetInnerTimeBin() const;
205 Int_t GetOuterTimeBin() const;
206 Int_t GetLayerNumber(Int_t tb) const {return fTimeBinIndex[tb];}
207 Int_t Find(Double_t x) const;
208 void InsertLayer(AliTRDpropagationLayer* pl);
209 // AliTRDpropagationLayer* operator[](Int_t i) { return fLayers[i]; }
210 AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i]; }
211 Int_t CookTimeBinIndex(Int_t plane, Int_t localTB) const;
214 Int_t fN; // total number of layers
215 AliTRDgeometry *fGeom; // geometry
216 AliTRDparameter *fPar; // parameter
217 AliTRDpropagationLayer *fLayers[kMaxLayersPerSector]; // layers
218 Int_t fTimeBinIndex[kMaxTimeBinIndex]; // time bin index
219 Int_t fGeomSector; // sector # in AliTRDgeometry
224 friend class AliTRDtracker::AliTRDtrackingSector;
226 AliTRDgeometry *fGeom; // Pointer to TRD geometry
227 AliTRDparameter *fPar; // Pointer to TRD parameter
229 AliTRDtrackingSector *fTrSec[kTrackingSectors]; // array of tracking sectors;
230 Int_t fNclusters; // Number of clusters in TRD
231 TObjArray *fClusters; // List of clusters for all sectors
233 Int_t fNseeds; // Number of track seeds
234 TObjArray *fSeeds; // List of track seeds
236 Int_t fNtracks; // Number of reconstructed tracks
237 TObjArray *fTracks; // List of reconstructed tracks
240 Int_t fTimeBinsPerPlane; // number of sensitive timebins per plane
241 // in track prolongation
243 static const Double_t fgkMaxChi2; // max increment in track chi2
245 static const Float_t fgkMinClustersInTrack; // min number of clusters in track
246 // out of total timebins
248 static const Float_t fgkLabelFraction; // min fraction of same label
250 static const Double_t fgkDriftCorrection; // correction coeficients for drift velocity
251 static const Double_t fgkOffset; // correction coeficients
252 static const Double_t fgkOffsetX; // correction coeficients offset in X
253 static const Double_t fgkCoef; // correction coeficients
254 static const Double_t fgkMean; // correction coeficients
255 static const Double_t fgkExB; // correction coeficients
257 Bool_t fAddTRDseeds; // Something else
259 Bool_t fNoTilt; // No tilt, or what?
260 Bool_t fHoles[5][18]; // holes
262 Bool_t AdjustSector(AliTRDtrack *track);
265 AliTRDtrack * RegisterSeed(AliTRDseed * seeds, Double_t *params);
266 void MakeSeedsMI(Int_t inner, Int_t outer, AliESD *esd=0);
268 Int_t FollowProlongation(AliTRDtrack& t, Int_t rf);
269 Int_t FollowBackProlongation(AliTRDtrack& t);
270 Int_t Refit(AliTRDtrack& t, Int_t rf);
271 void CookdEdxTimBin(AliTRDtrack& t);
273 Int_t PropagateToTPC(AliTRDtrack& t);
274 Int_t PropagateToOuterPlane(AliTRDtrack& t, Double_t x);
276 Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
277 Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
278 TTreeSRedirector *fDebugStreamer; //!debug streamer
279 ClassDef(AliTRDtracker,2) // manager base class