]>
Commit | Line | Data |
---|---|---|
81e97e0d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | ||
17 | ||
18 | ||
19 | //----------------------------------------------------------------- | |
20 | // Implementation of the TPC seed class | |
21 | // This class is used by the AliTPCtrackerMI class | |
22 | // Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch | |
23 | //----------------------------------------------------------------- | |
24 | #include "TClonesArray.h" | |
25 | #include "AliTPCseed.h" | |
3f82c4f2 | 26 | #include "AliTPCReconstructor.h" |
81e97e0d | 27 | |
28 | ClassImp(AliTPCseed) | |
29 | ||
30 | ||
31 | ||
32fab534 | 32 | AliTPCseed::AliTPCseed(): |
33 | AliTPCtrack(), | |
34 | fEsd(0x0), | |
2928bdf0 | 35 | fClusterOwner(kFALSE), |
32fab534 | 36 | fPoints(0x0), |
37 | fEPoints(0x0), | |
38 | fRow(0), | |
39 | fSector(-1), | |
40 | fRelativeSector(-1), | |
41 | fCurrentSigmaY2(1e10), | |
42 | fCurrentSigmaZ2(1e10), | |
43 | fErrorY2(1e10), | |
44 | fErrorZ2(1e10), | |
45 | fCurrentCluster(0x0), | |
46 | fCurrentClusterIndex1(-1), | |
47 | fInDead(kFALSE), | |
48 | fIsSeeding(kFALSE), | |
49 | fNoCluster(0), | |
50 | fSort(0), | |
51 | fBSigned(kFALSE), | |
52 | fSeedType(0), | |
53 | fSeed1(-1), | |
54 | fSeed2(-1), | |
55 | fMAngular(0), | |
19b00333 | 56 | fCircular(0), |
57 | fClusterMap(159), | |
58 | fSharedMap(159) | |
32fab534 | 59 | { |
81e97e0d | 60 | // |
5c09947e | 61 | for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3); |
81e97e0d | 62 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; |
63 | for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0; | |
32fab534 | 64 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0.2; |
65 | for (Int_t i=0;i<4;i++) { | |
66 | fDEDX[i] = 0.; | |
67 | fSDEDX[i] = 1e10; | |
68 | fNCDEDX[i] = 0; | |
69 | } | |
70 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1; | |
19b00333 | 71 | for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE; |
72 | for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE; | |
81e97e0d | 73 | } |
32fab534 | 74 | |
2928bdf0 | 75 | AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner): |
32fab534 | 76 | AliTPCtrack(s), |
77 | fEsd(0x0), | |
2928bdf0 | 78 | fClusterOwner(clusterOwner), |
32fab534 | 79 | fPoints(0x0), |
80 | fEPoints(0x0), | |
81 | fRow(0), | |
82 | fSector(-1), | |
83 | fRelativeSector(-1), | |
84 | fCurrentSigmaY2(1e10), | |
85 | fCurrentSigmaZ2(1e10), | |
86 | fErrorY2(1e10), | |
87 | fErrorZ2(1e10), | |
88 | fCurrentCluster(0x0), | |
89 | fCurrentClusterIndex1(-1), | |
90 | fInDead(kFALSE), | |
91 | fIsSeeding(kFALSE), | |
92 | fNoCluster(0), | |
93 | fSort(0), | |
94 | fBSigned(kFALSE), | |
95 | fSeedType(0), | |
96 | fSeed1(-1), | |
97 | fSeed2(-1), | |
98 | fMAngular(0), | |
19b00333 | 99 | fCircular(0), |
100 | fClusterMap(s.fClusterMap), | |
101 | fSharedMap(s.fSharedMap) | |
32fab534 | 102 | { |
81e97e0d | 103 | //--------------------- |
104 | // dummy copy constructor | |
105 | //------------------------- | |
2928bdf0 | 106 | for (Int_t i=0;i<160;i++) { |
107 | fClusterPointer[i]=0; | |
108 | if (fClusterOwner){ | |
109 | if (s.fClusterPointer[i]) | |
110 | fClusterPointer[i] = new AliTPCclusterMI(*(s.fClusterPointer[i])); | |
111 | }else{ | |
112 | fClusterPointer[i] = s.fClusterPointer[i]; | |
113 | } | |
114 | fTrackPoints[i] = s.fTrackPoints[i]; | |
115 | } | |
81e97e0d | 116 | for (Int_t i=0;i<160;i++) fIndex[i] = s.fIndex[i]; |
5c09947e | 117 | for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=s.fTPCr[i]; |
118 | for (Int_t i=0;i<4;i++) { | |
119 | fDEDX[i] = s.fDEDX[i]; | |
120 | fSDEDX[i] = s.fSDEDX[i]; | |
121 | fNCDEDX[i] = s.fNCDEDX[i]; | |
122 | } | |
123 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = s.fOverlapLabels[i]; | |
19b00333 | 124 | |
81e97e0d | 125 | } |
5c09947e | 126 | |
127 | ||
32fab534 | 128 | AliTPCseed::AliTPCseed(const AliTPCtrack &t): |
129 | AliTPCtrack(t), | |
130 | fEsd(0x0), | |
2928bdf0 | 131 | fClusterOwner(kFALSE), |
32fab534 | 132 | fPoints(0x0), |
133 | fEPoints(0x0), | |
134 | fRow(0), | |
135 | fSector(-1), | |
136 | fRelativeSector(-1), | |
137 | fCurrentSigmaY2(1e10), | |
138 | fCurrentSigmaZ2(1e10), | |
139 | fErrorY2(1e10), | |
140 | fErrorZ2(1e10), | |
141 | fCurrentCluster(0x0), | |
142 | fCurrentClusterIndex1(-1), | |
143 | fInDead(kFALSE), | |
144 | fIsSeeding(kFALSE), | |
145 | fNoCluster(0), | |
146 | fSort(0), | |
147 | fBSigned(kFALSE), | |
148 | fSeedType(0), | |
149 | fSeed1(-1), | |
150 | fSeed2(-1), | |
151 | fMAngular(0), | |
19b00333 | 152 | fCircular(0), |
153 | fClusterMap(159), | |
154 | fSharedMap(159) | |
32fab534 | 155 | { |
81e97e0d | 156 | // |
32fab534 | 157 | // Constructor from AliTPCtrack |
158 | // | |
159 | fFirstPoint =0; | |
105b1b81 | 160 | for (Int_t i=0;i<5;i++) fTPCr[i]=0.2; |
81e97e0d | 161 | for (Int_t i=0;i<160;i++) { |
162 | fClusterPointer[i] = 0; | |
163 | Int_t index = t.GetClusterIndex(i); | |
164 | if (index>=-1){ | |
165 | SetClusterIndex2(i,index); | |
166 | } | |
167 | else{ | |
168 | SetClusterIndex2(i,-3); | |
169 | } | |
170 | } | |
32fab534 | 171 | for (Int_t i=0;i<4;i++) { |
172 | fDEDX[i] = 0.; | |
173 | fSDEDX[i] = 1e10; | |
174 | fNCDEDX[i] = 0; | |
175 | } | |
176 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1; | |
19b00333 | 177 | for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE; |
178 | for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE; | |
81e97e0d | 179 | } |
180 | ||
6c94f330 | 181 | AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5], |
182 | const Double_t cc[15], Int_t index): | |
183 | AliTPCtrack(xr, alpha, xx, cc, index), | |
32fab534 | 184 | fEsd(0x0), |
2928bdf0 | 185 | fClusterOwner(kFALSE), |
32fab534 | 186 | fPoints(0x0), |
187 | fEPoints(0x0), | |
188 | fRow(0), | |
189 | fSector(-1), | |
190 | fRelativeSector(-1), | |
191 | fCurrentSigmaY2(1e10), | |
192 | fCurrentSigmaZ2(1e10), | |
193 | fErrorY2(1e10), | |
194 | fErrorZ2(1e10), | |
195 | fCurrentCluster(0x0), | |
196 | fCurrentClusterIndex1(-1), | |
197 | fInDead(kFALSE), | |
198 | fIsSeeding(kFALSE), | |
199 | fNoCluster(0), | |
200 | fSort(0), | |
201 | fBSigned(kFALSE), | |
202 | fSeedType(0), | |
203 | fSeed1(-1), | |
204 | fSeed2(-1), | |
205 | fMAngular(0), | |
19b00333 | 206 | fCircular(0), |
207 | fClusterMap(159), | |
208 | fSharedMap(159) | |
32fab534 | 209 | { |
210 | // | |
211 | // Constructor | |
81e97e0d | 212 | // |
32fab534 | 213 | fFirstPoint =0; |
5c09947e | 214 | for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3); |
81e97e0d | 215 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; |
81e97e0d | 216 | for (Int_t i=0;i<5;i++) fTPCr[i]=0.2; |
32fab534 | 217 | for (Int_t i=0;i<4;i++) { |
218 | fDEDX[i] = 0.; | |
219 | fSDEDX[i] = 1e10; | |
220 | fNCDEDX[i] = 0; | |
221 | } | |
222 | for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1; | |
81e97e0d | 223 | } |
224 | ||
225 | AliTPCseed::~AliTPCseed(){ | |
226 | // | |
227 | // destructor | |
228 | if (fPoints) delete fPoints; | |
229 | fPoints =0; | |
230 | if (fEPoints) delete fEPoints; | |
231 | fEPoints = 0; | |
232 | fNoCluster =0; | |
2928bdf0 | 233 | if (fClusterOwner){ |
234 | for (Int_t icluster=0; icluster<160; icluster++){ | |
235 | delete fClusterPointer[icluster]; | |
236 | } | |
237 | } | |
19b00333 | 238 | for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE; |
239 | for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE; | |
81e97e0d | 240 | } |
179c6296 | 241 | //_________________________________________________ |
242 | AliTPCseed & AliTPCseed::operator =(const AliTPCseed & param) | |
243 | { | |
244 | // | |
245 | // assignment operator - dummy | |
246 | // | |
247 | fRow=param.fRow; | |
248 | return (*this); | |
249 | } | |
250 | //____________________________________________________ | |
81e97e0d | 251 | AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i) |
252 | { | |
253 | // | |
254 | // | |
255 | return &fTrackPoints[i]; | |
256 | } | |
257 | ||
258 | void AliTPCseed::RebuildSeed() | |
259 | { | |
260 | // | |
261 | // rebuild seed to be ready for storing | |
262 | AliTPCclusterMI cldummy; | |
263 | cldummy.SetQ(0); | |
264 | AliTPCTrackPoint pdummy; | |
b9671574 | 265 | pdummy.GetTPoint().SetShared(10); |
81e97e0d | 266 | for (Int_t i=0;i<160;i++){ |
267 | AliTPCclusterMI * cl0 = fClusterPointer[i]; | |
268 | AliTPCTrackPoint *trpoint = (AliTPCTrackPoint*)fPoints->UncheckedAt(i); | |
269 | if (cl0){ | |
270 | trpoint->GetTPoint() = *(GetTrackPoint(i)); | |
271 | trpoint->GetCPoint() = *cl0; | |
272 | trpoint->GetCPoint().SetQ(TMath::Abs(cl0->GetQ())); | |
273 | } | |
274 | else{ | |
275 | *trpoint = pdummy; | |
276 | trpoint->GetCPoint()= cldummy; | |
277 | } | |
278 | ||
279 | } | |
280 | ||
281 | } | |
282 | ||
283 | ||
284 | Double_t AliTPCseed::GetDensityFirst(Int_t n) | |
285 | { | |
286 | // | |
287 | // | |
288 | // return cluster for n rows bellow first point | |
289 | Int_t nfoundable = 1; | |
290 | Int_t nfound = 1; | |
291 | for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){ | |
292 | Int_t index = GetClusterIndex2(i); | |
293 | if (index!=-1) nfoundable++; | |
294 | if (index>0) nfound++; | |
295 | } | |
296 | if (nfoundable<n) return 0; | |
297 | return Double_t(nfound)/Double_t(nfoundable); | |
298 | ||
299 | } | |
300 | ||
301 | ||
302 | void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2) | |
303 | { | |
304 | // get cluster stat. on given region | |
305 | // | |
306 | found = 0; | |
307 | foundable = 0; | |
308 | shared =0; | |
309 | for (Int_t i=first;i<last; i++){ | |
310 | Int_t index = GetClusterIndex2(i); | |
311 | if (index!=-1) foundable++; | |
312 | if (fClusterPointer[i]) { | |
313 | found++; | |
314 | } | |
315 | else | |
316 | continue; | |
317 | ||
318 | if (fClusterPointer[i]->IsUsed(10)) { | |
319 | shared++; | |
320 | continue; | |
321 | } | |
322 | if (!plus2) continue; //take also neighborhoud | |
323 | // | |
324 | if ( (i>0) && fClusterPointer[i-1]){ | |
325 | if (fClusterPointer[i-1]->IsUsed(10)) { | |
326 | shared++; | |
327 | continue; | |
328 | } | |
329 | } | |
330 | if ( fClusterPointer[i+1]){ | |
331 | if (fClusterPointer[i+1]->IsUsed(10)) { | |
332 | shared++; | |
333 | continue; | |
334 | } | |
335 | } | |
336 | ||
337 | } | |
338 | //if (shared>found){ | |
339 | //Error("AliTPCseed::GetClusterStatistic","problem\n"); | |
340 | //} | |
341 | } | |
342 | ||
343 | ||
344 | ||
345 | ||
346 | ||
347 | void AliTPCseed::Reset(Bool_t all) | |
348 | { | |
349 | // | |
350 | // | |
351 | SetNumberOfClusters(0); | |
352 | fNFoundable = 0; | |
353 | SetChi2(0); | |
6c94f330 | 354 | ResetCovariance(10.); |
81e97e0d | 355 | /* |
356 | if (fTrackPoints){ | |
357 | for (Int_t i=0;i<8;i++){ | |
358 | delete [] fTrackPoints[i]; | |
359 | } | |
360 | delete fTrackPoints; | |
361 | fTrackPoints =0; | |
362 | } | |
363 | */ | |
364 | ||
365 | if (all){ | |
366 | for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3); | |
367 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; | |
368 | } | |
369 | ||
370 | } | |
371 | ||
372 | ||
373 | void AliTPCseed::Modify(Double_t factor) | |
374 | { | |
375 | ||
376 | //------------------------------------------------------------------ | |
377 | //This function makes a track forget its history :) | |
378 | //------------------------------------------------------------------ | |
379 | if (factor<=0) { | |
6c94f330 | 380 | ResetCovariance(10.); |
81e97e0d | 381 | return; |
382 | } | |
6c94f330 | 383 | ResetCovariance(factor); |
384 | ||
81e97e0d | 385 | SetNumberOfClusters(0); |
386 | fNFoundable =0; | |
387 | SetChi2(0); | |
388 | fRemoval = 0; | |
389 | fCurrentSigmaY2 = 0.000005; | |
390 | fCurrentSigmaZ2 = 0.000005; | |
391 | fNoCluster = 0; | |
392 | //fFirstPoint = 160; | |
393 | //fLastPoint = 0; | |
394 | } | |
395 | ||
396 | ||
397 | ||
398 | ||
399 | Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const | |
400 | { | |
401 | //----------------------------------------------------------------- | |
402 | // This function find proloncation of a track to a reference plane x=xk. | |
403 | // doesn't change internal state of the track | |
404 | //----------------------------------------------------------------- | |
405 | ||
6c94f330 | 406 | Double_t x1=GetX(), x2=x1+(xk-x1), dx=x2-x1; |
81e97e0d | 407 | |
6c94f330 | 408 | if (TMath::Abs(GetSnp()+GetC()*dx) >= AliTPCReconstructor::GetMaxSnpTrack()) { |
81e97e0d | 409 | return 0; |
410 | } | |
411 | ||
412 | // Double_t y1=fP0, z1=fP1; | |
6c94f330 | 413 | Double_t c1=GetSnp(), r1=sqrt(1.- c1*c1); |
414 | Double_t c2=c1 + GetC()*dx, r2=sqrt(1.- c2*c2); | |
81e97e0d | 415 | |
6c94f330 | 416 | y = GetY(); |
417 | z = GetZ(); | |
81e97e0d | 418 | //y += dx*(c1+c2)/(r1+r2); |
419 | //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3; | |
420 | ||
421 | Double_t dy = dx*(c1+c2)/(r1+r2); | |
422 | Double_t dz = 0; | |
423 | // | |
6c94f330 | 424 | Double_t delta = GetC()*dx*(c1+c2)/(c1*r2 + c2*r1); |
81e97e0d | 425 | /* |
426 | if (TMath::Abs(delta)>0.0001){ | |
427 | dz = fP3*TMath::ASin(delta)/fP4; | |
428 | }else{ | |
429 | dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1); | |
430 | } | |
431 | */ | |
432 | // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4; | |
6c94f330 | 433 | dz = GetTgl()*TMath::ASin(delta)/GetC(); |
81e97e0d | 434 | // |
435 | y+=dy; | |
436 | z+=dz; | |
437 | ||
438 | ||
439 | return 1; | |
440 | } | |
441 | ||
442 | ||
443 | //_____________________________________________________________________________ | |
af32720d | 444 | Double_t AliTPCseed::GetPredictedChi2(const AliCluster *c) const |
81e97e0d | 445 | { |
446 | //----------------------------------------------------------------- | |
447 | // This function calculates a predicted chi2 increment. | |
448 | //----------------------------------------------------------------- | |
6c94f330 | 449 | Double_t p[2]={c->GetY(), c->GetZ()}; |
450 | Double_t cov[3]={fErrorY2, 0., fErrorZ2}; | |
451 | return AliExternalTrackParam::GetPredictedChi2(p,cov); | |
81e97e0d | 452 | } |
453 | ||
81e97e0d | 454 | //_________________________________________________________________________________________ |
455 | ||
456 | ||
457 | Int_t AliTPCseed::Compare(const TObject *o) const { | |
458 | //----------------------------------------------------------------- | |
459 | // This function compares tracks according to the sector - for given sector according z | |
460 | //----------------------------------------------------------------- | |
461 | AliTPCseed *t=(AliTPCseed*)o; | |
6c94f330 | 462 | |
81e97e0d | 463 | if (fSort == 0){ |
464 | if (t->fRelativeSector>fRelativeSector) return -1; | |
465 | if (t->fRelativeSector<fRelativeSector) return 1; | |
466 | Double_t z2 = t->GetZ(); | |
467 | Double_t z1 = GetZ(); | |
468 | if (z2>z1) return 1; | |
469 | if (z2<z1) return -1; | |
470 | return 0; | |
471 | } | |
472 | else { | |
473 | Float_t f2 =1; | |
6c23ffed | 474 | f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066); |
81e97e0d | 475 | if (t->fBConstrain) f2=1.2; |
476 | ||
477 | Float_t f1 =1; | |
6c23ffed | 478 | f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066); |
81e97e0d | 479 | |
480 | if (fBConstrain) f1=1.2; | |
481 | ||
482 | if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1; | |
483 | else return +1; | |
484 | } | |
485 | } | |
486 | ||
487 | ||
488 | ||
489 | ||
490 | //_____________________________________________________________________________ | |
6c94f330 | 491 | Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t /*index*/) |
492 | { | |
81e97e0d | 493 | //----------------------------------------------------------------- |
494 | // This function associates a cluster with this track. | |
495 | //----------------------------------------------------------------- | |
6c94f330 | 496 | Double_t p[2]={c->GetY(), c->GetZ()}; |
497 | Double_t cov[3]={fErrorY2, 0., fErrorZ2}; | |
81e97e0d | 498 | |
6c94f330 | 499 | if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; |
81e97e0d | 500 | |
501 | Int_t n=GetNumberOfClusters(); | |
502 | // fIndex[n]=index; | |
503 | SetNumberOfClusters(n+1); | |
504 | SetChi2(GetChi2()+chisq); | |
505 | ||
6c94f330 | 506 | return kTRUE; |
81e97e0d | 507 | } |
508 | ||
509 | ||
510 | ||
511 | //_____________________________________________________________________________ | |
105b1b81 | 512 | Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t onlyused) { |
81e97e0d | 513 | //----------------------------------------------------------------- |
514 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
515 | //----------------------------------------------------------------- | |
516 | ||
517 | Float_t amp[200]; | |
518 | Float_t angular[200]; | |
519 | Float_t weight[200]; | |
520 | Int_t index[200]; | |
521 | //Int_t nc = 0; | |
522 | // TClonesArray & arr = *fPoints; | |
523 | Float_t meanlog = 100.; | |
524 | ||
525 | Float_t mean[4] = {0,0,0,0}; | |
526 | Float_t sigma[4] = {1000,1000,1000,1000}; | |
527 | Int_t nc[4] = {0,0,0,0}; | |
528 | Float_t norm[4] = {1000,1000,1000,1000}; | |
529 | // | |
530 | // | |
531 | fNShared =0; | |
532 | ||
533 | for (Int_t of =0; of<4; of++){ | |
534 | for (Int_t i=of+i1;i<i2;i+=4) | |
535 | { | |
536 | Int_t index = fIndex[i]; | |
537 | if (index<0||index&0x8000) continue; | |
538 | ||
539 | //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i); | |
540 | AliTPCTrackerPoint * point = GetTrackPoint(i); | |
541 | //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1); | |
542 | //AliTPCTrackerPoint * pointp = 0; | |
543 | //if (i<159) pointp = GetTrackPoint(i+1); | |
544 | ||
545 | if (point==0) continue; | |
546 | AliTPCclusterMI * cl = fClusterPointer[i]; | |
547 | if (cl==0) continue; | |
548 | if (onlyused && (!cl->IsUsed(10))) continue; | |
549 | if (cl->IsUsed(11)) { | |
550 | fNShared++; | |
551 | continue; | |
552 | } | |
553 | Int_t type = cl->GetType(); | |
554 | //if (point->fIsShared){ | |
555 | // fNShared++; | |
556 | // continue; | |
557 | //} | |
558 | //if (pointm) | |
559 | // if (pointm->fIsShared) continue; | |
560 | //if (pointp) | |
561 | // if (pointp->fIsShared) continue; | |
562 | ||
563 | if (type<0) continue; | |
564 | //if (type>10) continue; | |
565 | //if (point->GetErrY()==0) continue; | |
566 | //if (point->GetErrZ()==0) continue; | |
567 | ||
568 | //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY(); | |
569 | //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ(); | |
570 | //if ((ddy*ddy+ddz*ddz)>10) continue; | |
571 | ||
572 | ||
573 | // if (point->GetCPoint().GetMax()<5) continue; | |
574 | if (cl->GetMax()<5) continue; | |
575 | Float_t angley = point->GetAngleY(); | |
576 | Float_t anglez = point->GetAngleZ(); | |
577 | ||
578 | Float_t rsigmay2 = point->GetSigmaY(); | |
579 | Float_t rsigmaz2 = point->GetSigmaZ(); | |
580 | /* | |
581 | Float_t ns = 1.; | |
582 | if (pointm){ | |
583 | rsigmay += pointm->GetTPoint().GetSigmaY(); | |
584 | rsigmaz += pointm->GetTPoint().GetSigmaZ(); | |
585 | ns+=1.; | |
586 | } | |
587 | if (pointp){ | |
588 | rsigmay += pointp->GetTPoint().GetSigmaY(); | |
589 | rsigmaz += pointp->GetTPoint().GetSigmaZ(); | |
590 | ns+=1.; | |
591 | } | |
592 | rsigmay/=ns; | |
593 | rsigmaz/=ns; | |
594 | */ | |
595 | ||
596 | Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2); | |
597 | ||
598 | Float_t ampc = 0; // normalization to the number of electrons | |
599 | if (i>64){ | |
600 | // ampc = 1.*point->GetCPoint().GetMax(); | |
601 | ampc = 1.*cl->GetMax(); | |
602 | //ampc = 1.*point->GetCPoint().GetQ(); | |
603 | // AliTPCClusterPoint & p = point->GetCPoint(); | |
604 | // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5); | |
605 | // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
606 | //Float_t dz = | |
607 | // TMath::Abs( Int_t(iz) - iz + 0.5); | |
608 | //ampc *= 1.15*(1-0.3*dy); | |
609 | //ampc *= 1.15*(1-0.3*dz); | |
610 | // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ())); | |
611 | //ampc *=zfactor; | |
612 | } | |
613 | else{ | |
614 | //ampc = 1.0*point->GetCPoint().GetMax(); | |
615 | ampc = 1.0*cl->GetMax(); | |
616 | //ampc = 1.0*point->GetCPoint().GetQ(); | |
617 | //AliTPCClusterPoint & p = point->GetCPoint(); | |
618 | // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5); | |
619 | //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
620 | //Float_t dz = | |
621 | // TMath::Abs( Int_t(iz) - iz + 0.5); | |
622 | ||
623 | //ampc *= 1.15*(1-0.3*dy); | |
624 | //ampc *= 1.15*(1-0.3*dz); | |
625 | // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ())); | |
626 | //ampc *=zfactor; | |
627 | ||
628 | } | |
629 | ampc *= 2.0; // put mean value to channel 50 | |
630 | //ampc *= 0.58; // put mean value to channel 50 | |
631 | Float_t w = 1.; | |
632 | // if (type>0) w = 1./(type/2.-0.5); | |
633 | // Float_t z = TMath::Abs(cl->GetZ()); | |
634 | if (i<64) { | |
635 | ampc /= 0.6; | |
636 | //ampc /= (1+0.0008*z); | |
637 | } else | |
638 | if (i>128){ | |
639 | ampc /=1.5; | |
640 | //ampc /= (1+0.0008*z); | |
641 | }else{ | |
642 | //ampc /= (1+0.0008*z); | |
643 | } | |
644 | ||
645 | if (type<0) { //amp at the border - lower weight | |
646 | // w*= 2.; | |
647 | ||
648 | continue; | |
649 | } | |
650 | if (rsigma>1.5) ampc/=1.3; // if big backround | |
651 | amp[nc[of]] = ampc; | |
652 | angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
653 | weight[nc[of]] = w; | |
654 | nc[of]++; | |
655 | } | |
656 | ||
657 | TMath::Sort(nc[of],amp,index,kFALSE); | |
658 | Float_t sumamp=0; | |
659 | Float_t sumamp2=0; | |
660 | Float_t sumw=0; | |
661 | //meanlog = amp[index[Int_t(nc[of]*0.33)]]; | |
662 | meanlog = 50; | |
663 | for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){ | |
664 | Float_t ampl = amp[index[i]]/angular[index[i]]; | |
665 | ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
666 | // | |
667 | sumw += weight[index[i]]; | |
668 | sumamp += weight[index[i]]*ampl; | |
669 | sumamp2 += weight[index[i]]*ampl*ampl; | |
670 | norm[of] += angular[index[i]]*weight[index[i]]; | |
671 | } | |
672 | if (sumw<1){ | |
673 | SetdEdx(0); | |
674 | } | |
675 | else { | |
676 | norm[of] /= sumw; | |
677 | mean[of] = sumamp/sumw; | |
678 | sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
679 | if (sigma[of]>0.1) | |
680 | sigma[of] = TMath::Sqrt(sigma[of]); | |
681 | else | |
682 | sigma[of] = 1000; | |
683 | ||
684 | mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; | |
685 | //mean *=(1-0.02*(sigma/(mean*0.17)-1.)); | |
686 | //mean *=(1-0.1*(norm-1.)); | |
687 | } | |
688 | } | |
689 | ||
690 | Float_t dedx =0; | |
691 | fSdEdx =0; | |
692 | fMAngular =0; | |
693 | // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1)); | |
694 | // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1)); | |
695 | ||
696 | ||
697 | // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/ | |
698 | // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1]))); | |
699 | ||
700 | Int_t norm2 = 0; | |
701 | Int_t norm3 = 0; | |
702 | for (Int_t i =0;i<4;i++){ | |
703 | if (nc[i]>2&&nc[i]<1000){ | |
704 | dedx += mean[i] *nc[i]; | |
705 | fSdEdx += sigma[i]*(nc[i]-2); | |
706 | fMAngular += norm[i] *nc[i]; | |
707 | norm2 += nc[i]; | |
708 | norm3 += nc[i]-2; | |
709 | } | |
710 | fDEDX[i] = mean[i]; | |
711 | fSDEDX[i] = sigma[i]; | |
712 | fNCDEDX[i]= nc[i]; | |
713 | } | |
714 | ||
715 | if (norm3>0){ | |
716 | dedx /=norm2; | |
717 | fSdEdx /=norm3; | |
718 | fMAngular/=norm2; | |
719 | } | |
720 | else{ | |
721 | SetdEdx(0); | |
105b1b81 | 722 | return 0; |
81e97e0d | 723 | } |
724 | // Float_t dedx1 =dedx; | |
725 | /* | |
726 | dedx =0; | |
727 | for (Int_t i =0;i<4;i++){ | |
728 | if (nc[i]>2&&nc[i]<1000){ | |
729 | mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.)); | |
730 | dedx += mean[i] *nc[i]; | |
731 | } | |
732 | fDEDX[i] = mean[i]; | |
733 | } | |
734 | dedx /= norm2; | |
735 | */ | |
736 | ||
737 | ||
738 | SetdEdx(dedx); | |
a2d457f2 | 739 | return dedx; |
81e97e0d | 740 | } |
741 | Double_t AliTPCseed::Bethe(Double_t bg){ | |
742 | // | |
743 | // This is the Bethe-Bloch function normalised to 1 at the minimum | |
744 | // | |
745 | Double_t bg2=bg*bg; | |
746 | Double_t bethe; | |
747 | if (bg<3.5e1) | |
748 | bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2)); | |
749 | else // Density effect ( approximately :) | |
750 | bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2)); | |
751 | return bethe/11.091; | |
752 | } | |
753 | ||
754 | void AliTPCseed::CookPID() | |
755 | { | |
756 | // | |
757 | // cook PID information according dEdx | |
758 | // | |
759 | Double_t fRange = 10.; | |
760 | Double_t fRes = 0.1; | |
761 | Double_t fMIP = 47.; | |
762 | // | |
763 | Int_t ns=AliPID::kSPECIES; | |
764 | Double_t sumr =0; | |
765 | for (Int_t j=0; j<ns; j++) { | |
766 | Double_t mass=AliPID::ParticleMass(j); | |
6c94f330 | 767 | Double_t mom=GetP(); |
81e97e0d | 768 | Double_t dedx=fdEdx/fMIP; |
769 | Double_t bethe=Bethe(mom/mass); | |
770 | Double_t sigma=fRes*bethe; | |
771 | if (sigma>0.001){ | |
772 | if (TMath::Abs(dedx-bethe) > fRange*sigma) { | |
773 | fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma; | |
774 | sumr+=fTPCr[j]; | |
775 | continue; | |
776 | } | |
777 | fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma; | |
778 | sumr+=fTPCr[j]; | |
779 | } | |
780 | else{ | |
781 | fTPCr[j]=1.; | |
782 | sumr+=fTPCr[j]; | |
783 | } | |
784 | } | |
785 | for (Int_t j=0; j<ns; j++) { | |
786 | fTPCr[j]/=sumr; //normalize | |
787 | } | |
788 | } | |
789 | ||
790 | /* | |
791 | void AliTPCseed::CookdEdx2(Double_t low, Double_t up) { | |
792 | //----------------------------------------------------------------- | |
793 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
794 | //----------------------------------------------------------------- | |
795 | ||
796 | Float_t amp[200]; | |
797 | Float_t angular[200]; | |
798 | Float_t weight[200]; | |
799 | Int_t index[200]; | |
800 | Bool_t inlimit[200]; | |
801 | for (Int_t i=0;i<200;i++) inlimit[i]=kFALSE; | |
802 | for (Int_t i=0;i<200;i++) amp[i]=10000; | |
803 | for (Int_t i=0;i<200;i++) angular[i]= 1;; | |
804 | ||
805 | ||
806 | // | |
807 | Float_t meanlog = 100.; | |
808 | Int_t indexde[4]={0,64,128,160}; | |
809 | ||
810 | Float_t amean =0; | |
811 | Float_t asigma =0; | |
812 | Float_t anc =0; | |
813 | Float_t anorm =0; | |
814 | ||
815 | Float_t mean[4] = {0,0,0,0}; | |
816 | Float_t sigma[4] = {1000,1000,1000,1000}; | |
817 | Int_t nc[4] = {0,0,0,0}; | |
818 | Float_t norm[4] = {1000,1000,1000,1000}; | |
819 | // | |
820 | // | |
821 | fNShared =0; | |
822 | ||
823 | // for (Int_t of =0; of<3; of++){ | |
824 | // for (Int_t i=indexde[of];i<indexde[of+1];i++) | |
825 | for (Int_t i =0; i<160;i++) | |
826 | { | |
827 | AliTPCTrackPoint * point = GetTrackPoint(i); | |
828 | if (point==0) continue; | |
829 | if (point->fIsShared){ | |
830 | fNShared++; | |
831 | continue; | |
832 | } | |
833 | Int_t type = point->GetCPoint().GetType(); | |
834 | if (type<0) continue; | |
835 | if (point->GetCPoint().GetMax()<5) continue; | |
836 | Float_t angley = point->GetTPoint().GetAngleY(); | |
837 | Float_t anglez = point->GetTPoint().GetAngleZ(); | |
838 | Float_t rsigmay = point->GetCPoint().GetSigmaY(); | |
839 | Float_t rsigmaz = point->GetCPoint().GetSigmaZ(); | |
840 | Float_t rsigma = TMath::Sqrt(rsigmay*rsigmaz); | |
841 | ||
842 | Float_t ampc = 0; // normalization to the number of electrons | |
843 | if (i>64){ | |
844 | ampc = point->GetCPoint().GetMax(); | |
845 | } | |
846 | else{ | |
847 | ampc = point->GetCPoint().GetMax(); | |
848 | } | |
849 | ampc *= 2.0; // put mean value to channel 50 | |
850 | // ampc *= 0.565; // put mean value to channel 50 | |
851 | ||
852 | Float_t w = 1.; | |
853 | Float_t z = TMath::Abs(point->GetCPoint().GetZ()); | |
854 | if (i<64) { | |
855 | ampc /= 0.63; | |
856 | } else | |
857 | if (i>128){ | |
858 | ampc /=1.51; | |
859 | } | |
860 | if (type<0) { //amp at the border - lower weight | |
861 | continue; | |
862 | } | |
863 | if (rsigma>1.5) ampc/=1.3; // if big backround | |
864 | angular[i] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
865 | amp[i] = ampc/angular[i]; | |
866 | weight[i] = w; | |
867 | anc++; | |
868 | } | |
869 | ||
870 | TMath::Sort(159,amp,index,kFALSE); | |
871 | for (Int_t i=int(anc*low+0.5);i<int(anc*up+0.5);i++){ | |
872 | inlimit[index[i]] = kTRUE; // take all clusters | |
873 | } | |
874 | ||
875 | // meanlog = amp[index[Int_t(anc*0.3)]]; | |
876 | meanlog =10000.; | |
877 | for (Int_t of =0; of<3; of++){ | |
878 | Float_t sumamp=0; | |
879 | Float_t sumamp2=0; | |
880 | Float_t sumw=0; | |
881 | for (Int_t i=indexde[of];i<indexde[of+1];i++) | |
882 | { | |
883 | if (inlimit[i]==kFALSE) continue; | |
884 | Float_t ampl = amp[i]; | |
885 | ///angular[i]; | |
886 | ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
887 | // | |
888 | sumw += weight[i]; | |
889 | sumamp += weight[i]*ampl; | |
890 | sumamp2 += weight[i]*ampl*ampl; | |
891 | norm[of] += angular[i]*weight[i]; | |
892 | nc[of]++; | |
893 | } | |
894 | if (sumw<1){ | |
895 | SetdEdx(0); | |
896 | } | |
897 | else { | |
898 | norm[of] /= sumw; | |
899 | mean[of] = sumamp/sumw; | |
900 | sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
901 | if (sigma[of]>0.1) | |
902 | sigma[of] = TMath::Sqrt(sigma[of]); | |
903 | else | |
904 | sigma[of] = 1000; | |
905 | mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; | |
906 | } | |
907 | } | |
908 | ||
909 | Float_t dedx =0; | |
910 | fSdEdx =0; | |
911 | fMAngular =0; | |
912 | // | |
913 | Int_t norm2 = 0; | |
914 | Int_t norm3 = 0; | |
915 | Float_t www[3] = {12.,14.,17.}; | |
916 | //Float_t www[3] = {1.,1.,1.}; | |
917 | ||
918 | for (Int_t i =0;i<3;i++){ | |
919 | if (nc[i]>2&&nc[i]<1000){ | |
920 | dedx += mean[i] *nc[i]*www[i]/sigma[i]; | |
921 | fSdEdx += sigma[i]*(nc[i]-2)*www[i]/sigma[i]; | |
922 | fMAngular += norm[i] *nc[i]; | |
923 | norm2 += nc[i]*www[i]/sigma[i]; | |
924 | norm3 += (nc[i]-2)*www[i]/sigma[i]; | |
925 | } | |
926 | fDEDX[i] = mean[i]; | |
927 | fSDEDX[i] = sigma[i]; | |
928 | fNCDEDX[i]= nc[i]; | |
929 | } | |
930 | ||
931 | if (norm3>0){ | |
932 | dedx /=norm2; | |
933 | fSdEdx /=norm3; | |
934 | fMAngular/=norm2; | |
935 | } | |
936 | else{ | |
937 | SetdEdx(0); | |
938 | return; | |
939 | } | |
940 | // Float_t dedx1 =dedx; | |
941 | ||
942 | dedx =0; | |
943 | Float_t norm4 = 0; | |
944 | for (Int_t i =0;i<3;i++){ | |
945 | if (nc[i]>2&&nc[i]<1000&&sigma[i]>3){ | |
946 | //mean[i] = mean[i]*(1+0.08*(sigma[i]/(fSdEdx)-1.)); | |
947 | dedx += mean[i] *(nc[i])/(sigma[i]); | |
948 | norm4 += (nc[i])/(sigma[i]); | |
949 | } | |
950 | fDEDX[i] = mean[i]; | |
951 | } | |
952 | if (norm4>0) dedx /= norm4; | |
953 | ||
954 | ||
955 | ||
956 | SetdEdx(dedx); | |
957 | ||
958 | //mi deDX | |
959 | ||
960 | } | |
961 | */ | |
6c94f330 | 962 | Double_t AliTPCseed::GetYat(Double_t xk) const { |
963 | //----------------------------------------------------------------- | |
964 | // This function calculates the Y-coordinate of a track at the plane x=xk. | |
965 | //----------------------------------------------------------------- | |
966 | if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06 | |
967 | Double_t c1=GetSnp(), r1=TMath::Sqrt(1.- c1*c1); | |
968 | Double_t c2=c1+GetC()*(xk-GetX()); | |
969 | if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0; | |
970 | Double_t r2=TMath::Sqrt(1.- c2*c2); | |
971 | return GetY() + (xk-GetX())*(c1+c2)/(r1+r2); | |
972 | } | |
973 | ||
19b00333 | 974 | void AliTPCseed::SetClusterMapBit(int ibit, Bool_t state) |
975 | { | |
976 | fClusterMap[ibit] = state; | |
977 | } | |
978 | Bool_t AliTPCseed::GetClusterMapBit(int ibit) | |
979 | { | |
980 | return fClusterMap[ibit]; | |
981 | } | |
982 | void AliTPCseed::SetSharedMapBit(int ibit, Bool_t state) | |
983 | { | |
984 | fSharedMap[ibit] = state; | |
985 | } | |
986 | Bool_t AliTPCseed::GetSharedMapBit(int ibit) | |
987 | { | |
988 | return fSharedMap[ibit]; | |
989 | } |