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"
20 class TTreeSRedirector;
22 const unsigned kMaxLayersPerSector = 1000;
23 const unsigned kMaxTimeBinIndex = 216; // (30 drift + 6 ampl) * 6 planes
24 const unsigned kMaxClusterPerTimeBin = 7000;
25 const unsigned kZones = 5;
26 const Int_t kTrackingSectors = 18;
28 class AliTRDseed : public TObject{
29 friend class AliTRDtracker;
31 AliTRDseed(); // default constructor
32 ~AliTRDseed(){}; // default constructor
33 static void EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh);
34 static Float_t FitRiemanTilt(AliTRDseed * seed, Bool_t error);
35 void UseClusters(); // use clusters
36 void Update(); // update information - without tilt correction
37 void CookLabels(); // cook label
39 void Reset(); // reset seed
40 Bool_t isOK(){return fN2>8;}
42 Float_t fTilt; // tilting angle
43 Float_t fPadLength; // pad length
44 Float_t fX0; // x0 position
45 Float_t fX[25]; // !x position
46 Float_t fY[25]; // !y position
47 Float_t fZ[25]; // !z position
48 Int_t fIndexes[25]; // !indexes
49 AliTRDcluster *fClusters[25]; // !clusters
50 Bool_t fUsable[25]; // !indication - usable cluster
51 Float_t fYref[2]; // reference y
52 Float_t fZref[2]; // reference z
53 Float_t fYfit[2]; // y fit position +derivation
54 Float_t fYfitR[2]; // y fit position +derivation
55 Float_t fZfit[2]; // z fit position
56 Float_t fZfitR[2]; // z fit position
57 Float_t fSigmaY; // "robust" sigma in Y - constant fit
58 Float_t fSigmaY2; // "robust" sigma in Y - line fit
59 Float_t fMeanz; // mean vaue of z
60 Float_t fZProb; // max probbable z
61 Int_t fLabels[2]; // labels
62 Int_t fN; // number of associated clusters
63 Int_t fN2; // number of not crossed
64 Int_t fNUsed; // number of used clusters
66 Int_t fNChange; // change z counter
67 Float_t fMPads; // mean number of pads per cluster
70 Float_t fC; // curvature
71 Float_t fCC; // curvature with constrain
72 Float_t fChi2; // global chi2
73 Float_t fChi2Z; // global chi2
75 ClassDef(AliTRDseed,1)
79 class AliTRDtracker : public AliTracker {
85 AliTRDtracker(const TFile *in);
86 virtual ~AliTRDtracker();
87 static Int_t Freq(Int_t n, const Int_t *inlist, Int_t *outlist, Bool_t down);
88 Int_t Clusters2Tracks(AliESD* event);
89 Int_t PropagateBack(AliESD* event);
90 Int_t RefitInward(AliESD* event);
92 Int_t LocalToGlobalID(Int_t lid);
93 Int_t GlobalToLocalID(Int_t gid);
94 Bool_t Transform(AliTRDcluster * cluster);
96 Int_t LoadClusters(TTree *cTree);
97 void UnloadClusters();
98 AliCluster *GetCluster(Int_t index) const { if (index >= fNclusters) return NULL;
99 return (AliCluster*) fClusters->UncheckedAt(index); };
100 Bool_t GetTrackPoint(Int_t index, AliTrackPoint& p) const;
101 virtual void CookLabel(AliKalmanTrack *t,Float_t wrong) const;
102 virtual void UseClusters(const AliKalmanTrack *t, Int_t from=0) const;
104 void SetAddTRDseeds() { fAddTRDseeds = kTRUE; }
105 void SetNoTilt() { fNoTilt = kTRUE; }
107 Double_t GetTiltFactor(const AliTRDcluster* c);
109 Int_t ReadClusters(TObjArray *array, TTree *in) const;
110 Int_t CookSectorIndex(Int_t gs) const { return kTrackingSectors - 1 - gs; }
111 AliTRDcluster * GetCluster(AliTRDtrack * track, Int_t plane, Int_t timebin, UInt_t &index);
112 Int_t GetLastPlane(AliTRDtrack * track); //return last updated plane
113 Int_t FindClusters(Int_t sector, Int_t t0, Int_t t1, AliTRDtrack * track, Int_t *clusters, AliTRDtracklet& tracklet);
115 Int_t GetTimeBinsPerPlane() const {return fTimeBinsPerPlane;}
116 Double_t GetMaxChi2() const {return fgkMaxChi2;}
117 Float_t GetLabelFraction() const {return fgkLabelFraction;}
119 Float_t GetMinClustersInTrack() const {return fgkMinClustersInTrack;}
121 // x <-> timebin conversions useful in analysis macros
122 Double_t GetX(Int_t sec, Int_t plane, Int_t localTB) const;
123 Double_t GetX(Int_t sec, Int_t pl) const {
124 return fTrSec[sec]->GetLayer(pl)->GetX(); }
125 Int_t GetGlobalTimeBin(Int_t sec, Int_t plane, Int_t localTB) const {
126 return fTrSec[sec]->CookTimeBinIndex(plane,localTB); }
127 Double_t GetLayerNumber(Int_t sec, Double_t x) const {
128 return fTrSec[sec]->GetLayerNumber(x); }
130 class AliTRDpropagationLayer {
131 // ***************** internal class *******************
133 AliTRDpropagationLayer(Double_t x, Double_t dx, Double_t rho,
134 Double_t x0, Int_t tbIndex, Int_t plane);
136 ~AliTRDpropagationLayer() {
137 if(fTimeBinIndex >= 0) { delete[] fClusters; delete[] fIndex; }
139 void InsertCluster(AliTRDcluster *c, UInt_t index);
140 operator Int_t() const {return fN;}
141 AliTRDcluster* operator[](Int_t i) {return fClusters[i];}
142 UInt_t GetIndex(Int_t i) const {return fIndex[i];}
143 Double_t GetX() const { return fX; }
144 Double_t GetdX() const { return fdX; }
145 Int_t GetTimeBinIndex() const { return fTimeBinIndex; }
146 Int_t GetPlane() const { return fPlane;}
147 Int_t Find(Float_t y) const;
148 Int_t FindNearestCluster(Float_t y, Float_t z, Float_t maxroad, Float_t maxroadz) const;
149 void SetZmax(Int_t cham, Double_t center, Double_t w)
150 { fZc[cham] = center; fZmax[cham] = w; }
151 void SetZ(Double_t* center, Double_t *w, Double_t *wsensitive);
152 void SetHoles(Bool_t* holes);
153 void SetYmax(Double_t w, Double_t wsensitive) { fYmax = w; fYmaxSensitive = wsensitive; }
154 Double_t GetYmax() const { return fYmax; }
155 Double_t GetZmax(Int_t c) const { return fZmax[c]; }
156 Double_t GetZc(Int_t c) const { return fZc[c]; }
158 void SetHole(Double_t Zmax, Double_t Ymax,
159 Double_t rho = 1.29e-3, Double_t x0 = 36.66,
160 Double_t Yc = 0, Double_t Zc = 0);
162 Bool_t IsSensitive() const {return (fTimeBinIndex>=0)? kTRUE: kFALSE;}
164 void Clear() {for(Int_t i=0; i<fN; i++) fClusters[i] = NULL; fN = 0;}
165 Bool_t IsHole(Int_t zone) const { return fIsHole[zone];}
168 Int_t fN; // this is fN
169 Int_t fSec; // sector mumber
170 AliTRDcluster **fClusters; // array of pointers to clusters
171 UInt_t *fIndex; // array of cluster indexes
172 Double_t fX; // x coordinate of the middle plane
173 Double_t fdX; // radial thickness of the time bin
174 Double_t fRho; // default density of the material
175 Double_t fX0; // default radiation length
176 Int_t fTimeBinIndex; // plane * F(local_tb)
177 Int_t fPlane; // plane number
178 Double_t fZc[kZones]; // Z position of the center for 5 active areas
179 Double_t fZmax[kZones]; // half of active area length in Z
180 Double_t fZmaxSensitive[kZones]; //sensitive area for detection Z
181 Bool_t fIsHole[kZones]; //is hole in given sector
182 Double_t fYmax; // half of active area length in Y
183 Double_t fYmaxSensitive; // half of active area length in Y
185 Bool_t fHole; // kTRUE if there is a hole in the layer
186 Double_t fHoleZc; // Z of the center of the hole
187 Double_t fHoleZmax; // half of the hole length in Z
188 Double_t fHoleYc; // Y of the center of the hole
189 Double_t fHoleYmax; // half of the hole length in Y
190 Double_t fHoleRho; // density of the gas in the hole
191 Double_t fHoleX0; // radiation length of the gas in the hole
194 class AliTRDtrackingSector {
196 AliTRDtrackingSector(AliTRDgeometry* geo, Int_t gs);
197 ~AliTRDtrackingSector() { for(Int_t i=0; i<fN; i++) delete fLayers[i]; }
198 Int_t GetNumberOfLayers() const { return fN; }
199 Int_t GetNumberOfTimeBins() const;
200 Double_t GetX(Int_t pl) const { return fLayers[pl]->GetX(); }
201 void MapTimeBinLayers();
202 Int_t GetLayerNumber(Double_t x) const;
203 Int_t GetInnerTimeBin() const;
204 Int_t GetOuterTimeBin() const;
205 Int_t GetLayerNumber(Int_t tb) const {return fTimeBinIndex[tb];}
206 Int_t Find(Double_t x) const;
207 void InsertLayer(AliTRDpropagationLayer* pl);
208 // AliTRDpropagationLayer* operator[](Int_t i) { return fLayers[i]; }
209 AliTRDpropagationLayer* GetLayer(Int_t i) { return fLayers[i]; }
210 Int_t CookTimeBinIndex(Int_t plane, Int_t localTB) const;
213 Int_t fN; // total number of layers
214 AliTRDgeometry *fGeom; // geometry
215 AliTRDpropagationLayer *fLayers[kMaxLayersPerSector]; // layers
216 Int_t fTimeBinIndex[kMaxTimeBinIndex]; // time bin index
217 Int_t fGeomSector; // sector # in AliTRDgeometry
222 friend class AliTRDtracker::AliTRDtrackingSector;
224 AliTRDgeometry *fGeom; // Pointer to TRD geometry
226 AliTRDtrackingSector *fTrSec[kTrackingSectors]; // array of tracking sectors;
227 Int_t fNclusters; // Number of clusters in TRD
228 TObjArray *fClusters; // List of clusters for all sectors
230 Int_t fNseeds; // Number of track seeds
231 TObjArray *fSeeds; // List of track seeds
233 Int_t fNtracks; // Number of reconstructed tracks
234 TObjArray *fTracks; // List of reconstructed tracks
237 Int_t fTimeBinsPerPlane; // number of sensitive timebins per plane
238 // in track prolongation
240 static const Double_t fgkMaxChi2; // max increment in track chi2
242 static const Float_t fgkMinClustersInTrack; // min number of clusters in track
243 // out of total timebins
245 static const Float_t fgkLabelFraction; // min fraction of same label
247 static const Double_t fgkMaxSnp; // maximal snp for tracking
248 static const Double_t fgkMaxStep; // maximal step for tracking
250 Bool_t fAddTRDseeds; // Something else
252 Bool_t fNoTilt; // No tilt, or what?
253 Bool_t fHoles[5][18]; // holes
255 Bool_t AdjustSector(AliTRDtrack *track);
258 AliTRDtrack * RegisterSeed(AliTRDseed * seeds, Double_t *params);
259 void MakeSeedsMI(Int_t inner, Int_t outer, AliESD *esd=0);
261 Int_t FollowProlongation(AliTRDtrack& t, Int_t rf);
262 Int_t FollowBackProlongation(AliTRDtrack& t);
263 void CookdEdxTimBin(AliTRDtrack& t);
265 Int_t PropagateToX(AliTRDtrack& t, Double_t xToGo, Double_t maxStep);
267 Double_t ExpectedSigmaY2(Double_t r, Double_t tgl, Double_t pt) const;
268 Double_t ExpectedSigmaZ2(Double_t r, Double_t tgl) const;
269 TTreeSRedirector *fDebugStreamer; //!debug streamer
270 ClassDef(AliTRDtracker,2) // manager base class