]>
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 | ||
e4f2f73d | 38 | class TTreeSRedirector; |
39 | ||
40 | class AliRieman; | |
41 | ||
eb38ed55 | 42 | class AliTRDtrackingChamber; |
f3d3af1b | 43 | class AliTRDtrackV1; |
3a039a31 | 44 | class AliTRDReconstructor; |
3e778975 | 45 | class AliTRDseedV1 : public AliTRDtrackletBase |
46 | { | |
e3cf3d02 | 47 | public: |
48 | enum ETRDtrackletBuffers { | |
8d2bec9e | 49 | kNtb = 31 // max clusters/pad row |
50 | ,kNclusters = 2*kNtb // max number of clusters/tracklet | |
51 | ,kNslices = 10 // max dEdx slices | |
e44586fb | 52 | }; |
e3cf3d02 | 53 | |
2e2915e7 | 54 | // bits from 0-13 are reserved by ROOT (see TObject.h) |
e3cf3d02 | 55 | enum ETRDtrackletStatus { |
f29f13a6 | 56 | kOwner = BIT(14) // owner of its clusters |
57 | ,kRowCross = BIT(15) // pad row cross tracklet | |
58 | ,kCalib = BIT(16) // calibrated tracklet | |
59 | ,kKink = BIT(17) // kink prolongation tracklet | |
60 | ,kStandAlone = BIT(18) | |
e44586fb | 61 | }; |
62 | ||
ae4e8b84 | 63 | AliTRDseedV1(Int_t det = -1); |
e44586fb | 64 | ~AliTRDseedV1(); |
65 | AliTRDseedV1(const AliTRDseedV1 &ref); | |
66 | AliTRDseedV1& operator=(const AliTRDseedV1 &ref); | |
67 | ||
f29f13a6 | 68 | /* Bool_t AttachClustersIter( |
203967fc | 69 | AliTRDtrackingChamber *chamber, Float_t quality, |
f29f13a6 | 70 | Bool_t kZcorr = kFALSE, AliTRDcluster *c=0x0);*/ |
203967fc | 71 | Bool_t AttachClusters( |
b1957d3c | 72 | AliTRDtrackingChamber *chamber, Bool_t tilt = kFALSE); |
203967fc | 73 | void Bootstrap(const AliTRDReconstructor *rec); |
e3cf3d02 | 74 | void Calibrate(); |
203967fc | 75 | void CookdEdx(Int_t nslices); |
e3cf3d02 | 76 | void CookLabels(); |
3e778975 | 77 | Bool_t CookPID(); |
d937ad7a | 78 | Bool_t Fit(Bool_t tilt=kTRUE, Int_t errors = 2); |
f29f13a6 | 79 | // void FitMI(); |
203967fc | 80 | Bool_t Init(AliTRDtrackV1 *track); |
e44586fb | 81 | inline void Init(const AliRieman *fit); |
203967fc | 82 | Bool_t IsEqual(const TObject *inTracklet) const; |
e3cf3d02 | 83 | Bool_t IsCalibrated() const { return TestBit(kCalib);} |
e44586fb | 84 | Bool_t IsOwner() const { return TestBit(kOwner);} |
f29f13a6 | 85 | Bool_t IsKink() const { return TestBit(kKink);} |
3e778975 | 86 | Bool_t IsOK() const { return GetN() > 4 && GetNUsed() < 4;} |
e44586fb | 87 | Bool_t IsRowCross() const { return TestBit(kRowCross);} |
f29f13a6 | 88 | Bool_t IsUsable(Int_t i) const { return fClusters[i] && !fClusters[i]->IsUsed();} |
89 | Bool_t IsStandAlone() const { return TestBit(kStandAlone);} | |
e44586fb | 90 | |
e3cf3d02 | 91 | Float_t GetC() const { return fC; } |
92 | Float_t GetChi2() const { return fChi2; } | |
93 | inline Float_t GetChi2Z() const; | |
94 | inline Float_t GetChi2Y() const; | |
f29f13a6 | 95 | inline Float_t GetChi2Phi() const; |
d937ad7a | 96 | static void GetClusterXY(const AliTRDcluster *c, Double_t &x, Double_t &y); |
e44586fb | 97 | void GetCovAt(Double_t x, Double_t *cov) const; |
d937ad7a | 98 | void GetCovXY(Double_t *cov) const { memcpy(cov, &fCov[0], 3*sizeof(Double_t));} |
ac6764f5 | 99 | void GetCovRef(Double_t *cov) const { memcpy(cov, &fRefCov[0], 3*sizeof(Double_t));} |
203967fc | 100 | Float_t GetdX() const { return fdX;} |
101 | Float_t* GetdEdx() { return &fdEdx[0];} | |
e44586fb | 102 | Float_t GetdQdl(Int_t ic) 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];} |
203967fc | 112 | Double_t GetMomentum() const { return fMom;} |
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; |
e3cf3d02 | 118 | Float_t GetPadLength() const { return fPadLength;} |
ae4e8b84 | 119 | Int_t GetPlane() const { return AliTRDgeometry::GetLayer(fDet); } |
120 | ||
3e778975 | 121 | Float_t* GetProbability(Bool_t force=kFALSE); |
122 | inline Double_t GetPID(Int_t is=-1) const; | |
e3cf3d02 | 123 | Float_t GetS2Y() const { return fS2Y;} |
124 | Float_t GetS2Z() const { return fS2Z;} | |
125 | Float_t GetSigmaY() const { return fS2Y > 0. ? TMath::Sqrt(fS2Y) : 0.2;} | |
126 | Float_t GetSnp() const { return fYref[1]/TMath::Sqrt(1+fYref[1]*fYref[1]);} | |
127 | Float_t GetTgl() const { return fZref[1];} | |
128 | Float_t GetTilt() const { return fTilt;} | |
3e778975 | 129 | UInt_t GetTrackletWord() const { return 0;} |
e3cf3d02 | 130 | Float_t GetX0() const { return fX0;} |
131 | Float_t GetX() const { return fX0 - fX;} | |
5a7a515d | 132 | Float_t GetY() const { return fYfit[0] - fYfit[1] * fX;} |
b1957d3c | 133 | Double_t GetYat(Double_t x) const { return fYfit[0] - fYfit[1] * (fX0-x);} |
e3cf3d02 | 134 | Float_t GetYfit(Int_t id) const { return fYfit[id];} |
135 | Float_t GetYref(Int_t id) const { return fYref[id];} | |
3658afdc | 136 | Float_t GetZ() const { return fZfit[0] - fZfit[1] * fX;} |
b1957d3c | 137 | Double_t GetZat(Double_t x) const { return fZfit[0] - fZfit[1] * (fX0-x);} |
e3cf3d02 | 138 | Float_t GetZfit(Int_t id) const { return fZfit[id];} |
139 | Float_t GetZref(Int_t id) const { return fZref[id];} | |
3e778975 | 140 | Int_t GetYbin() const { return Int_t(GetY()/0.016);} |
141 | Int_t GetZbin() const { return Int_t(GetZ()/fPadLength);} | |
e3cf3d02 | 142 | |
ae4e8b84 | 143 | inline AliTRDcluster* NextCluster(); |
71ea19a3 | 144 | inline AliTRDcluster* PrevCluster(); |
e44586fb | 145 | void Print(Option_t *o = "") const; |
71ea19a3 | 146 | inline void ResetClusterIter(Bool_t forward = kTRUE); |
e3cf3d02 | 147 | void Reset(); |
ae4e8b84 | 148 | |
e3cf3d02 | 149 | void SetC(Float_t c) { fC = c;} |
150 | void SetChi2(Float_t chi2) { fChi2 = chi2;} | |
0849f128 | 151 | void SetCovRef(const Double_t *cov) { memcpy(&fRefCov[0], cov, 3*sizeof(Double_t));} |
e3cf3d02 | 152 | void SetIndexes(Int_t i, Int_t idx) { fIndexes[i] = idx; } |
153 | void SetLabels(Int_t *lbls) { memcpy(fLabels, lbls, 3*sizeof(Int_t)); } | |
f29f13a6 | 154 | void SetKink(Bool_t k) { SetBit(kKink, k);} |
155 | void SetStandAlone(Bool_t st) { SetBit(kStandAlone, st); } | |
203967fc | 156 | void SetMomentum(Double_t mom){ fMom = mom;} |
29b87567 | 157 | void SetOwner(); |
e3cf3d02 | 158 | void SetTilt(Float_t tilt) { fTilt = tilt; } |
159 | void SetPadLength(Float_t len){ fPadLength = len;} | |
203967fc | 160 | void SetDetector(Int_t d) { fDet = d; } |
bee2b41e | 161 | void SetDX(Float_t inDX) { fdX = inDX;} |
3a039a31 | 162 | void SetReconstructor(const AliTRDReconstructor *rec) {fReconstructor = rec;} |
e3cf3d02 | 163 | void SetX0(Float_t x0) { fX0 = x0; } |
164 | void SetYref(Int_t i, Float_t y) { fYref[i] = y;} | |
165 | void SetZref(Int_t i, Float_t z) { fZref[i] = z;} | |
f29f13a6 | 166 | // void SetUsabilityMap(Long_t um) { fUsable = um; } |
b1957d3c | 167 | void UpDate(const AliTRDtrackV1* trk); |
e3cf3d02 | 168 | void UpdateUsed(); |
169 | void UseClusters(); | |
e4f2f73d | 170 | |
d937ad7a | 171 | protected: |
3e778975 | 172 | void Copy(TObject &ref) const; |
e4f2f73d | 173 | |
e44586fb | 174 | private: |
3e778975 | 175 | inline void SetN(Int_t n); |
176 | inline void SetNUsed(Int_t n); | |
177 | inline void SetNShared(Int_t n); | |
178 | ||
0ae89c5d | 179 | const AliTRDReconstructor *fReconstructor;//! local reconstructor |
e3cf3d02 | 180 | AliTRDcluster **fClusterIter; //! clusters iterator |
8d2bec9e | 181 | Int_t fIndexes[kNclusters]; //! Indexes |
e3cf3d02 | 182 | Float_t fExB; //! tg(a_L) @ tracklet location |
183 | Float_t fVD; //! drift velocity @ tracklet location | |
184 | Float_t fT0; //! time 0 @ tracklet location | |
185 | Float_t fS2PRF; //! sigma^2 PRF for xd->0 and phi=a_L | |
186 | Float_t fDiffL; //! longitudinal diffusion coefficient | |
187 | Float_t fDiffT; //! transversal diffusion coefficient | |
71ea19a3 | 188 | Char_t fClusterIdx; //! clusters iterator |
f29f13a6 | 189 | // ULong_t fUsable; //! bit map of usable clusters |
3e778975 | 190 | UShort_t fN; // number of clusters attached/used/shared |
e3cf3d02 | 191 | Short_t fDet; // TRD detector |
192 | Float_t fTilt; // local tg of the tilt angle | |
193 | Float_t fPadLength; // local pad length | |
8d2bec9e | 194 | AliTRDcluster *fClusters[kNclusters]; // Clusters |
e3cf3d02 | 195 | Float_t fYref[2]; // Reference y |
196 | Float_t fZref[2]; // Reference z | |
197 | Float_t fYfit[2]; // Y fit position +derivation | |
198 | Float_t fZfit[2]; // Z fit position | |
199 | Float_t fMom; // Momentum estimate @ tracklet [GeV/c] | |
e44586fb | 200 | Float_t fdX; // length of time bin |
e3cf3d02 | 201 | Float_t fX0; // anode wire position |
202 | Float_t fX; // radial position of the tracklet | |
203 | Float_t fY; // r-phi position of the tracklet | |
204 | Float_t fZ; // z position of the tracklet | |
205 | Float_t fS2Y; // estimated resolution in the r-phi direction | |
206 | Float_t fS2Z; // estimated resolution in the z direction | |
207 | Float_t fC; // Curvature | |
208 | Float_t fChi2; // Global chi2 | |
8d2bec9e | 209 | Float_t fdEdx[kNslices]; // dE/dx measurements for tracklet |
e3cf3d02 | 210 | Float_t fProb[AliPID::kSPECIES]; // PID probabilities |
211 | Int_t fLabels[3]; // most frequent MC labels and total number of different labels | |
6e4d4425 | 212 | Double_t fRefCov[3]; // covariance matrix of the track in the yz plane |
d937ad7a | 213 | Double_t fCov[3]; // covariance matrix of the tracklet in the xy plane |
e4f2f73d | 214 | |
3e778975 | 215 | ClassDef(AliTRDseedV1, 6) // The offline TRD tracklet |
e4f2f73d | 216 | }; |
217 | ||
218 | //____________________________________________________________ | |
e3cf3d02 | 219 | inline Float_t AliTRDseedV1::GetChi2Z() const |
e4f2f73d | 220 | { |
e3cf3d02 | 221 | Double_t dz = fZref[0]-fZfit[0]; dz*=dz; |
222 | Double_t cov[3]; GetCovAt(fX, cov); | |
223 | Double_t s2 = fRefCov[2]+cov[2]; | |
224 | return s2 > 0. ? dz/s2 : 0.; | |
e4f2f73d | 225 | } |
226 | ||
227 | //____________________________________________________________ | |
e3cf3d02 | 228 | inline Float_t AliTRDseedV1::GetChi2Y() const |
e4f2f73d | 229 | { |
e3cf3d02 | 230 | Double_t dy = fYref[0]-fYfit[0]; dy*=dy; |
231 | Double_t cov[3]; GetCovAt(fX, cov); | |
232 | Double_t s2 = fRefCov[0]+cov[0]; | |
233 | return s2 > 0. ? dy/s2 : 0.; | |
e4f2f73d | 234 | } |
235 | ||
f29f13a6 | 236 | //____________________________________________________________ |
237 | inline Float_t AliTRDseedV1::GetChi2Phi() const | |
238 | { | |
239 | Double_t dphi = fYref[1]-fYfit[1]; dphi*=dphi; | |
240 | Double_t cov[3]; GetCovAt(fX, cov); | |
241 | Double_t s2 = fRefCov[2]+cov[2]; | |
242 | return s2 > 0. ? dphi/s2 : 0.; | |
243 | } | |
244 | ||
3e778975 | 245 | //____________________________________________________________ |
246 | inline Double_t AliTRDseedV1::GetPID(Int_t is) const | |
247 | { | |
248 | if(is<0) return fProb[AliPID::kElectron]; | |
249 | if(is<AliPID::kSPECIES) return fProb[is]; | |
250 | return 0.; | |
251 | } | |
252 | ||
e4f2f73d | 253 | //____________________________________________________________ |
0906e73e | 254 | inline void AliTRDseedV1::Init(const AliRieman *rieman) |
e4f2f73d | 255 | { |
e44586fb | 256 | fZref[0] = rieman->GetZat(fX0); |
257 | fZref[1] = rieman->GetDZat(fX0); | |
258 | fYref[0] = rieman->GetYat(fX0); | |
259 | fYref[1] = rieman->GetDYat(fX0); | |
55ef6967 | 260 | fC = rieman->GetC(); |
261 | fChi2 = rieman->GetChi2(); | |
e4f2f73d | 262 | } |
263 | ||
ae4e8b84 | 264 | //____________________________________________________________ |
265 | inline AliTRDcluster* AliTRDseedV1::NextCluster() | |
266 | { | |
71ea19a3 | 267 | // Mimic the usage of STL iterators. |
268 | // Forward iterator | |
269 | ||
ae4e8b84 | 270 | fClusterIdx++; fClusterIter++; |
8d2bec9e | 271 | while(fClusterIdx < kNclusters){ |
71ea19a3 | 272 | if(!(*fClusterIter)){ |
273 | fClusterIdx++; | |
274 | fClusterIter++; | |
275 | continue; | |
276 | } | |
277 | return *fClusterIter; | |
278 | } | |
279 | return 0x0; | |
280 | } | |
281 | ||
282 | //____________________________________________________________ | |
283 | inline AliTRDcluster* AliTRDseedV1::PrevCluster() | |
284 | { | |
285 | // Mimic the usage of STL iterators. | |
286 | // Backward iterator | |
287 | ||
288 | fClusterIdx--; fClusterIter--; | |
289 | while(fClusterIdx >= 0){ | |
290 | if(!(*fClusterIter)){ | |
291 | fClusterIdx--; | |
292 | fClusterIter--; | |
293 | continue; | |
294 | } | |
295 | return *fClusterIter; | |
296 | } | |
297 | return 0x0; | |
298 | } | |
299 | ||
300 | //____________________________________________________________ | |
301 | inline void AliTRDseedV1::ResetClusterIter(Bool_t forward) | |
302 | { | |
303 | // Mimic the usage of STL iterators. | |
304 | // Facilitate the usage of NextCluster for forward like | |
305 | // iterator (kTRUE) and PrevCluster for backward like iterator (kFALSE) | |
306 | ||
307 | if(forward){ | |
308 | fClusterIter = &fClusters[0]; fClusterIter--; | |
309 | fClusterIdx=-1; | |
310 | } else { | |
8d2bec9e | 311 | fClusterIter = &fClusters[kNclusters-1]; fClusterIter++; |
312 | fClusterIdx=kNclusters; | |
71ea19a3 | 313 | } |
ae4e8b84 | 314 | } |
315 | ||
3e778975 | 316 | //____________________________________________________________ |
317 | inline void AliTRDseedV1::SetN(Int_t n) | |
318 | { | |
319 | if(n<0 || n>= (1<<5)) return; | |
320 | fN &= ~0x1f; | |
321 | fN |= n; | |
322 | } | |
323 | ||
324 | //____________________________________________________________ | |
325 | inline void AliTRDseedV1::SetNUsed(Int_t n) | |
326 | { | |
327 | if(n<0 || n>= (1<<5)) return; | |
328 | fN &= ~(0x1f<<5); | |
329 | n <<= 5; fN |= n; | |
330 | } | |
331 | ||
332 | //____________________________________________________________ | |
333 | inline void AliTRDseedV1::SetNShared(Int_t n) | |
334 | { | |
335 | if(n<0 || n>= (1<<5)) return; | |
336 | fN &= ~(0x1f<<10); | |
337 | n <<= 10; fN |= n; | |
338 | } | |
339 | ||
340 | ||
e4f2f73d | 341 | #endif |
342 | ||
47d5d320 | 343 | |
6e49cfdb | 344 |