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