]>
Commit | Line | Data |
---|---|---|
e4f2f73d | 1 | #ifndef ALITRDSEEDV1_H |
2 | #define ALITRDSEEDV1_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
e44586fb | 4 | * See cxx source for full Copyright notice */ |
e4f2f73d | 5 | |
6 | /* $Id$ */ | |
7 | ||
8 | //////////////////////////////////////////////////////////////////////////// | |
9 | // // | |
3e778975 | 10 | // The TRD offline tracklet // |
e4f2f73d | 11 | // // |
12 | //////////////////////////////////////////////////////////////////////////// | |
13 | ||
3e778975 | 14 | #ifndef ALITRDTRACKLETBASE_H |
15 | #include "AliTRDtrackletBase.h" | |
e3cf3d02 | 16 | #endif |
17 | ||
18 | #ifndef ROOT_TMath | |
19 | #include "TMath.h" | |
e4f2f73d | 20 | #endif |
21 | ||
ae4e8b84 | 22 | #ifndef ALITRDGEOMETRY_H |
23 | #include "AliTRDgeometry.h" | |
24 | #endif | |
25 | ||
0906e73e | 26 | #ifndef ALIPID_H |
27 | #include "AliPID.h" | |
28 | #endif | |
29 | ||
e4f2f73d | 30 | #ifndef ALIRIEMAN_H |
31 | #include "AliRieman.h" | |
32 | #endif | |
33 | ||
f29f13a6 | 34 | #ifndef ALITRDCLUSTER_H |
35 | #include "AliTRDcluster.h" | |
36 | #endif | |
37 | ||
d07eec70 | 38 | #include "AliTRDReconstructor.h" |
39 | ||
e4f2f73d | 40 | class TTreeSRedirector; |
41 | ||
42 | class AliRieman; | |
43 | ||
eb38ed55 | 44 | class AliTRDtrackingChamber; |
f3d3af1b | 45 | class AliTRDtrackV1; |
eb2b4f91 | 46 | class AliTRDpadPlane; |
3e778975 | 47 | class AliTRDseedV1 : public AliTRDtrackletBase |
48 | { | |
e3cf3d02 | 49 | public: |
50 | enum ETRDtrackletBuffers { | |
8d2bec9e | 51 | kNtb = 31 // max clusters/pad row |
52 | ,kNclusters = 2*kNtb // max number of clusters/tracklet | |
53 | ,kNslices = 10 // max dEdx slices | |
e44586fb | 54 | }; |
e3cf3d02 | 55 | |
2e2915e7 | 56 | // bits from 0-13 are reserved by ROOT (see TObject.h) |
e3cf3d02 | 57 | enum ETRDtrackletStatus { |
f29f13a6 | 58 | kOwner = BIT(14) // owner of its clusters |
59 | ,kRowCross = BIT(15) // pad row cross tracklet | |
e20bef2b | 60 | ,kPID = BIT(16) // PID contributor |
61 | ,kCalib = BIT(17) // calibrated tracklet | |
62 | ,kKink = BIT(18) // kink prolongation tracklet | |
1fd9389f | 63 | ,kStandAlone = BIT(19) // tracklet build during stand alone track finding |
e44586fb | 64 | }; |
65 | ||
ae4e8b84 | 66 | AliTRDseedV1(Int_t det = -1); |
e44586fb | 67 | ~AliTRDseedV1(); |
68 | AliTRDseedV1(const AliTRDseedV1 &ref); | |
69 | AliTRDseedV1& operator=(const AliTRDseedV1 &ref); | |
70 | ||
1fd9389f | 71 | Bool_t AttachClusters(AliTRDtrackingChamber *chamber, Bool_t tilt = kFALSE); |
203967fc | 72 | void Bootstrap(const AliTRDReconstructor *rec); |
e3cf3d02 | 73 | void Calibrate(); |
203967fc | 74 | void CookdEdx(Int_t nslices); |
e3cf3d02 | 75 | void CookLabels(); |
3e778975 | 76 | Bool_t CookPID(); |
b72f4eaf | 77 | Bool_t Fit(Bool_t tilt=kFALSE, Bool_t zcorr=kFALSE); |
203967fc | 78 | Bool_t Init(AliTRDtrackV1 *track); |
e44586fb | 79 | inline void Init(const AliRieman *fit); |
203967fc | 80 | Bool_t IsEqual(const TObject *inTracklet) const; |
e3cf3d02 | 81 | Bool_t IsCalibrated() const { return TestBit(kCalib);} |
e44586fb | 82 | Bool_t IsOwner() const { return TestBit(kOwner);} |
f29f13a6 | 83 | Bool_t IsKink() const { return TestBit(kKink);} |
e20bef2b | 84 | Bool_t HasPID() const { return TestBit(kPID);} |
3e778975 | 85 | Bool_t IsOK() const { return GetN() > 4 && GetNUsed() < 4;} |
e44586fb | 86 | Bool_t IsRowCross() const { return TestBit(kRowCross);} |
f29f13a6 | 87 | Bool_t IsUsable(Int_t i) const { return fClusters[i] && !fClusters[i]->IsUsed();} |
88 | Bool_t IsStandAlone() const { return TestBit(kStandAlone);} | |
e44586fb | 89 | |
e3cf3d02 | 90 | Float_t GetC() const { return fC; } |
91 | Float_t GetChi2() const { return fChi2; } | |
92 | inline Float_t GetChi2Z() const; | |
93 | inline Float_t GetChi2Y() const; | |
f29f13a6 | 94 | inline Float_t GetChi2Phi() const; |
e44586fb | 95 | void GetCovAt(Double_t x, Double_t *cov) const; |
d937ad7a | 96 | void GetCovXY(Double_t *cov) const { memcpy(cov, &fCov[0], 3*sizeof(Double_t));} |
16cca13f | 97 | void GetCovRef(Double_t *cov) const { memcpy(cov, &fRefCov, 7*sizeof(Double_t));} |
bb2db46c | 98 | static Double_t GetCovSqrt(Double_t *c, Double_t *d); |
99 | static Double_t GetCovInv(Double_t *c, Double_t *d); | |
203967fc | 100 | Float_t GetdX() const { return fdX;} |
101 | Float_t* GetdEdx() { return &fdEdx[0];} | |
0b433f72 | 102 | Float_t GetdQdl(Int_t ic, Float_t *dx=0x0) const; |
3e778975 | 103 | Float_t GetdYdX() const { return fYfit[1]; } |
104 | Float_t GetdZdX() const { return fZref[1]; } | |
105 | Int_t GetdY() const { return Int_t(GetY()/0.014);} | |
203967fc | 106 | Int_t GetDetector() const { return fDet;} |
e3cf3d02 | 107 | void GetCalibParam(Float_t &exb, Float_t &vd, Float_t &t0, Float_t &s2, Float_t &dl, Float_t &dt) const { |
108 | exb = fExB; vd = fVD; t0 = fT0; s2 = fS2PRF; dl = fDiffL; dt = fDiffT;} | |
8d2bec9e | 109 | AliTRDcluster* GetClusters(Int_t i) const { return i<0 || i>=kNclusters ? 0x0 : fClusters[i];} |
110 | Int_t GetIndexes(Int_t i) const{ return i<0 || i>=kNclusters ? -1 : fIndexes[i];} | |
e3cf3d02 | 111 | Int_t GetLabels(Int_t i) const { return fLabels[i];} |
0b433f72 | 112 | Float_t GetMomentum(Float_t *err = 0x0) const; |
3e778975 | 113 | Int_t GetN() const { return (Int_t)fN&0x1f;} |
114 | Int_t GetN2() const { return GetN();} | |
115 | Int_t GetNUsed() const { return Int_t((fN>>5)&0x1f);} | |
116 | Int_t GetNShared() const { return Int_t((fN>>10)&0x1f);} | |
e44586fb | 117 | Float_t GetQuality(Bool_t kZcorr) const; |
dd8059a8 | 118 | Float_t GetPadLength() const { return fPad[0];} |
119 | Float_t GetPadWidth() const { return fPad[1];} | |
ae4e8b84 | 120 | Int_t GetPlane() const { return AliTRDgeometry::GetLayer(fDet); } |
121 | ||
3e778975 | 122 | Float_t* GetProbability(Bool_t force=kFALSE); |
b25a5e9e | 123 | Float_t GetPt() const { return fPt; } |
3e778975 | 124 | inline Double_t GetPID(Int_t is=-1) const; |
e3cf3d02 | 125 | Float_t GetS2Y() const { return fS2Y;} |
126 | Float_t GetS2Z() const { return fS2Z;} | |
127 | Float_t GetSigmaY() const { return fS2Y > 0. ? TMath::Sqrt(fS2Y) : 0.2;} | |
128 | Float_t GetSnp() const { return fYref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);} | |
1fd9389f | 129 | Float_t GetTgl() const { return fZref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);} |
dd8059a8 | 130 | Float_t GetTilt() const { return fPad[2];} |
3e778975 | 131 | UInt_t GetTrackletWord() const { return 0;} |
b72f4eaf | 132 | UShort_t GetVolumeId() const; |
e3cf3d02 | 133 | Float_t GetX0() const { return fX0;} |
134 | Float_t GetX() const { return fX0 - fX;} | |
5a7a515d | 135 | Float_t GetY() const { return fYfit[0] - fYfit[1] * fX;} |
b1957d3c | 136 | Double_t GetYat(Double_t x) const { return fYfit[0] - fYfit[1] * (fX0-x);} |
1fd9389f | 137 | Float_t GetYfit(Int_t id) const { return fYfit[id];} |
138 | Float_t GetYref(Int_t id) const { return fYref[id];} | |
139 | Float_t GetZ() const { return fZfit[0] - fZfit[1] * fX;} | |
b1957d3c | 140 | Double_t GetZat(Double_t x) const { return fZfit[0] - fZfit[1] * (fX0-x);} |
1fd9389f | 141 | Float_t GetZfit(Int_t id) const { return fZfit[id];} |
142 | Float_t GetZref(Int_t id) const { return fZref[id];} | |
143 | Int_t GetYbin() const { return Int_t(GetY()/0.016);} | |
144 | Int_t GetZbin() const { return Int_t(GetZ()/fPad[0]);} | |
e3cf3d02 | 145 | |
ae4e8b84 | 146 | inline AliTRDcluster* NextCluster(); |
71ea19a3 | 147 | inline AliTRDcluster* PrevCluster(); |
e44586fb | 148 | void Print(Option_t *o = "") const; |
71ea19a3 | 149 | inline void ResetClusterIter(Bool_t forward = kTRUE); |
e3cf3d02 | 150 | void Reset(); |
ae4e8b84 | 151 | |
1fd9389f | 152 | void SetC(Float_t c) { fC = c;} |
153 | void SetChi2(Float_t chi2) { fChi2 = chi2;} | |
16cca13f | 154 | inline void SetCovRef(const Double_t *cov); |
e3cf3d02 | 155 | void SetIndexes(Int_t i, Int_t idx) { fIndexes[i] = idx; } |
156 | void SetLabels(Int_t *lbls) { memcpy(fLabels, lbls, 3*sizeof(Int_t)); } | |
e20bef2b | 157 | void SetKink(Bool_t k = kTRUE){ SetBit(kKink, k);} |
158 | void SetPID(Bool_t k = kTRUE) { SetBit(kPID, k);} | |
f29f13a6 | 159 | void SetStandAlone(Bool_t st) { SetBit(kStandAlone, st); } |
b25a5e9e | 160 | void SetPt(Double_t pt) { fPt = pt;} |
29b87567 | 161 | void SetOwner(); |
eb2b4f91 | 162 | void SetPadPlane(AliTRDpadPlane *p); |
dd8059a8 | 163 | void SetPadLength(Float_t l) { fPad[0] = l;} |
164 | void SetPadWidth(Float_t w) { fPad[1] = w;} | |
cbe97468 | 165 | void SetTilt(Float_t tilt) { fPad[2] = tilt; } |
203967fc | 166 | void SetDetector(Int_t d) { fDet = d; } |
bee2b41e | 167 | void SetDX(Float_t inDX) { fdX = inDX;} |
3a039a31 | 168 | void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;} |
e3cf3d02 | 169 | void SetX0(Float_t x0) { fX0 = x0; } |
170 | void SetYref(Int_t i, Float_t y) { fYref[i] = y;} | |
171 | void SetZref(Int_t i, Float_t z) { fZref[i] = z;} | |
f29f13a6 | 172 | // void SetUsabilityMap(Long_t um) { fUsable = um; } |
16cca13f | 173 | void Update(const AliTRDtrackV1* trk); |
e3cf3d02 | 174 | void UpdateUsed(); |
175 | void UseClusters(); | |
e4f2f73d | 176 | |
d937ad7a | 177 | protected: |
3e778975 | 178 | void Copy(TObject &ref) const; |
e4f2f73d | 179 | |
e44586fb | 180 | private: |
3e778975 | 181 | inline void SetN(Int_t n); |
182 | inline void SetNUsed(Int_t n); | |
183 | inline void SetNShared(Int_t n); | |
184 | ||
0ae89c5d | 185 | const AliTRDReconstructor *fReconstructor;//! local reconstructor |
e3cf3d02 | 186 | AliTRDcluster **fClusterIter; //! clusters iterator |
8d2bec9e | 187 | Int_t fIndexes[kNclusters]; //! Indexes |
e3cf3d02 | 188 | Float_t fExB; //! tg(a_L) @ tracklet location |
189 | Float_t fVD; //! drift velocity @ tracklet location | |
190 | Float_t fT0; //! time 0 @ tracklet location | |
191 | Float_t fS2PRF; //! sigma^2 PRF for xd->0 and phi=a_L | |
192 | Float_t fDiffL; //! longitudinal diffusion coefficient | |
193 | Float_t fDiffT; //! transversal diffusion coefficient | |
71ea19a3 | 194 | Char_t fClusterIdx; //! clusters iterator |
dd8059a8 | 195 | UShort_t fN; // number of clusters attached/used/shared |
e3cf3d02 | 196 | Short_t fDet; // TRD detector |
8d2bec9e | 197 | AliTRDcluster *fClusters[kNclusters]; // Clusters |
dd8059a8 | 198 | Float_t fPad[3]; // local pad definition : length/width/tilt |
1fd9389f | 199 | Float_t fYref[2]; // Reference y, dydx |
200 | Float_t fZref[2]; // Reference z, dz/dx | |
201 | Float_t fYfit[2]; // Fit y, dy/dx | |
202 | Float_t fZfit[2]; // Fit z | |
16cca13f | 203 | Float_t fPt; // Pt estimate @ tracklet [GeV/c] |
e44586fb | 204 | Float_t fdX; // length of time bin |
e3cf3d02 | 205 | Float_t fX0; // anode wire position |
206 | Float_t fX; // radial position of the tracklet | |
207 | Float_t fY; // r-phi position of the tracklet | |
208 | Float_t fZ; // z position of the tracklet | |
209 | Float_t fS2Y; // estimated resolution in the r-phi direction | |
210 | Float_t fS2Z; // estimated resolution in the z direction | |
211 | Float_t fC; // Curvature | |
212 | Float_t fChi2; // Global chi2 | |
8d2bec9e | 213 | Float_t fdEdx[kNslices]; // dE/dx measurements for tracklet |
1fd9389f | 214 | Float_t fProb[AliPID::kSPECIES]; // PID probabilities |
e3cf3d02 | 215 | Int_t fLabels[3]; // most frequent MC labels and total number of different labels |
16cca13f | 216 | Double_t fRefCov[7]; // covariance matrix of the track in the yz plane + the rest of the diagonal elements |
d937ad7a | 217 | Double_t fCov[3]; // covariance matrix of the tracklet in the xy plane |
e4f2f73d | 218 | |
16cca13f | 219 | ClassDef(AliTRDseedV1, 7) // The offline TRD tracklet |
e4f2f73d | 220 | }; |
221 | ||
222 | //____________________________________________________________ | |
e3cf3d02 | 223 | inline Float_t AliTRDseedV1::GetChi2Z() const |
e4f2f73d | 224 | { |
e3cf3d02 | 225 | Double_t dz = fZref[0]-fZfit[0]; dz*=dz; |
226 | Double_t cov[3]; GetCovAt(fX, cov); | |
227 | Double_t s2 = fRefCov[2]+cov[2]; | |
228 | return s2 > 0. ? dz/s2 : 0.; | |
e4f2f73d | 229 | } |
230 | ||
231 | //____________________________________________________________ | |
e3cf3d02 | 232 | inline Float_t AliTRDseedV1::GetChi2Y() const |
e4f2f73d | 233 | { |
e3cf3d02 | 234 | Double_t dy = fYref[0]-fYfit[0]; dy*=dy; |
235 | Double_t cov[3]; GetCovAt(fX, cov); | |
236 | Double_t s2 = fRefCov[0]+cov[0]; | |
237 | return s2 > 0. ? dy/s2 : 0.; | |
e4f2f73d | 238 | } |
239 | ||
f29f13a6 | 240 | //____________________________________________________________ |
241 | inline Float_t AliTRDseedV1::GetChi2Phi() const | |
242 | { | |
243 | Double_t dphi = fYref[1]-fYfit[1]; dphi*=dphi; | |
244 | Double_t cov[3]; GetCovAt(fX, cov); | |
245 | Double_t s2 = fRefCov[2]+cov[2]; | |
246 | return s2 > 0. ? dphi/s2 : 0.; | |
247 | } | |
248 | ||
16cca13f | 249 | |
250 | ||
3e778975 | 251 | //____________________________________________________________ |
252 | inline Double_t AliTRDseedV1::GetPID(Int_t is) const | |
253 | { | |
254 | if(is<0) return fProb[AliPID::kElectron]; | |
255 | if(is<AliPID::kSPECIES) return fProb[is]; | |
256 | return 0.; | |
257 | } | |
258 | ||
e4f2f73d | 259 | //____________________________________________________________ |
0906e73e | 260 | inline void AliTRDseedV1::Init(const AliRieman *rieman) |
e4f2f73d | 261 | { |
e44586fb | 262 | fZref[0] = rieman->GetZat(fX0); |
263 | fZref[1] = rieman->GetDZat(fX0); | |
264 | fYref[0] = rieman->GetYat(fX0); | |
265 | fYref[1] = rieman->GetDYat(fX0); | |
d07eec70 | 266 | if(fReconstructor && fReconstructor->IsHLT()){ |
267 | fRefCov[0] = 1; | |
268 | fRefCov[2] = 10; | |
269 | }else{ | |
270 | fRefCov[0] = rieman->GetErrY(fX0); | |
271 | fRefCov[2] = rieman->GetErrZ(fX0); | |
272 | } | |
55ef6967 | 273 | fC = rieman->GetC(); |
274 | fChi2 = rieman->GetChi2(); | |
e4f2f73d | 275 | } |
276 | ||
ae4e8b84 | 277 | //____________________________________________________________ |
278 | inline AliTRDcluster* AliTRDseedV1::NextCluster() | |
279 | { | |
71ea19a3 | 280 | // Mimic the usage of STL iterators. |
281 | // Forward iterator | |
282 | ||
ae4e8b84 | 283 | fClusterIdx++; fClusterIter++; |
8d2bec9e | 284 | while(fClusterIdx < kNclusters){ |
71ea19a3 | 285 | if(!(*fClusterIter)){ |
286 | fClusterIdx++; | |
287 | fClusterIter++; | |
288 | continue; | |
289 | } | |
290 | return *fClusterIter; | |
291 | } | |
292 | return 0x0; | |
293 | } | |
294 | ||
295 | //____________________________________________________________ | |
296 | inline AliTRDcluster* AliTRDseedV1::PrevCluster() | |
297 | { | |
298 | // Mimic the usage of STL iterators. | |
299 | // Backward iterator | |
300 | ||
301 | fClusterIdx--; fClusterIter--; | |
302 | while(fClusterIdx >= 0){ | |
303 | if(!(*fClusterIter)){ | |
304 | fClusterIdx--; | |
305 | fClusterIter--; | |
306 | continue; | |
307 | } | |
308 | return *fClusterIter; | |
309 | } | |
310 | return 0x0; | |
311 | } | |
312 | ||
313 | //____________________________________________________________ | |
314 | inline void AliTRDseedV1::ResetClusterIter(Bool_t forward) | |
315 | { | |
316 | // Mimic the usage of STL iterators. | |
317 | // Facilitate the usage of NextCluster for forward like | |
318 | // iterator (kTRUE) and PrevCluster for backward like iterator (kFALSE) | |
319 | ||
320 | if(forward){ | |
321 | fClusterIter = &fClusters[0]; fClusterIter--; | |
322 | fClusterIdx=-1; | |
323 | } else { | |
8d2bec9e | 324 | fClusterIter = &fClusters[kNclusters-1]; fClusterIter++; |
325 | fClusterIdx=kNclusters; | |
71ea19a3 | 326 | } |
ae4e8b84 | 327 | } |
328 | ||
16cca13f | 329 | //____________________________________________________________ |
330 | inline void AliTRDseedV1::SetCovRef(const Double_t *cov) | |
331 | { | |
332 | // Copy some "important" covariance matrix elements | |
333 | // var(y) | |
334 | // cov(y,z) var(z) | |
335 | // var(snp) | |
336 | // var(tgl) | |
337 | // cov(tgl, 1/pt) var(1/pt) | |
338 | ||
339 | memcpy(&fRefCov[0], cov, 3*sizeof(Double_t)); // yz full covariance | |
340 | fRefCov[3] = cov[ 5]; // snp variance | |
341 | fRefCov[4] = cov[ 9]; // tgl variance | |
342 | fRefCov[5] = cov[13]; // cov(tgl, 1/pt) | |
343 | fRefCov[6] = cov[14]; // 1/pt variance | |
344 | } | |
345 | ||
346 | ||
3e778975 | 347 | //____________________________________________________________ |
348 | inline void AliTRDseedV1::SetN(Int_t n) | |
349 | { | |
350 | if(n<0 || n>= (1<<5)) return; | |
351 | fN &= ~0x1f; | |
352 | fN |= n; | |
353 | } | |
354 | ||
355 | //____________________________________________________________ | |
356 | inline void AliTRDseedV1::SetNUsed(Int_t n) | |
357 | { | |
358 | if(n<0 || n>= (1<<5)) return; | |
359 | fN &= ~(0x1f<<5); | |
360 | n <<= 5; fN |= n; | |
361 | } | |
362 | ||
363 | //____________________________________________________________ | |
364 | inline void AliTRDseedV1::SetNShared(Int_t n) | |
365 | { | |
366 | if(n<0 || n>= (1<<5)) return; | |
367 | fN &= ~(0x1f<<10); | |
368 | n <<= 10; fN |= n; | |
369 | } | |
370 | ||
371 | ||
e4f2f73d | 372 | #endif |
373 | ||
47d5d320 | 374 | |
6e49cfdb | 375 |