]>
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 | //_________________________________________________ |
316c6cd9 | 242 | AliTPCseed & AliTPCseed::operator=(const AliTPCseed ¶m) |
179c6296 | 243 | { |
244 | // | |
316c6cd9 | 245 | // assignment operator |
179c6296 | 246 | // |
316c6cd9 | 247 | if(this!=¶m){ |
248 | AliTPCtrack::operator=(param); | |
249 | fEsd =param.fEsd; | |
250 | for(Int_t i = 0;i<160;++i)fClusterPointer[i] = param.fClusterPointer[i]; // this is not allocated by AliTPCSeed | |
251 | fClusterOwner = param.fClusterOwner; | |
252 | // leave out fPoint, they are also not copied in the copy ctor... | |
253 | // but deleted in the dtor... strange... | |
254 | // fPoints = | |
255 | // fEPoints = | |
256 | fRow = param.fRow; | |
257 | fSector = param.fSector; | |
258 | fRelativeSector = param.fRelativeSector; | |
259 | fCurrentSigmaY2 = param.fCurrentSigmaY2; | |
260 | fCurrentSigmaZ2 = param.fCurrentSigmaZ2; | |
261 | fErrorY2 = param.fErrorY2; | |
262 | fErrorZ2 = param.fErrorZ2; | |
263 | fCurrentCluster = param.fCurrentCluster; // this is not allocated by AliTPCSeed | |
264 | fCurrentClusterIndex1 = param.fCurrentClusterIndex1; | |
265 | fInDead = param.fInDead; | |
266 | fIsSeeding = param.fIsSeeding; | |
267 | fNoCluster = param.fNoCluster; | |
268 | fSort = param.fSort; | |
269 | fBSigned = param.fBSigned; | |
270 | for(Int_t i = 0;i<4;++i){ | |
271 | fDEDX[i] = param.fDEDX[i]; | |
272 | fSDEDX[i] = param.fSDEDX[i]; | |
273 | fNCDEDX[i] = param.fNCDEDX[i]; | |
274 | } | |
275 | for(Int_t i = 0;i<AliPID::kSPECIES;++i)fTPCr[i] = param.fTPCr[i]; | |
276 | ||
277 | fSeedType = param.fSeedType; | |
278 | fSeed1 = param.fSeed1; | |
279 | fSeed2 = param.fSeed2; | |
280 | for(Int_t i = 0;i<12;++i)fOverlapLabels[i] = param.fOverlapLabels[i]; | |
281 | fMAngular = param.fMAngular; | |
282 | fCircular = param.fCircular; | |
283 | for(int i = 0;i<160;++i)fTrackPoints[i] = param.fTrackPoints[i]; | |
284 | fClusterMap = param.fClusterMap; | |
285 | fSharedMap = param.fSharedMap; | |
286 | } | |
179c6296 | 287 | return (*this); |
288 | } | |
289 | //____________________________________________________ | |
81e97e0d | 290 | AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i) |
291 | { | |
292 | // | |
293 | // | |
294 | return &fTrackPoints[i]; | |
295 | } | |
296 | ||
297 | void AliTPCseed::RebuildSeed() | |
298 | { | |
299 | // | |
300 | // rebuild seed to be ready for storing | |
301 | AliTPCclusterMI cldummy; | |
302 | cldummy.SetQ(0); | |
303 | AliTPCTrackPoint pdummy; | |
b9671574 | 304 | pdummy.GetTPoint().SetShared(10); |
81e97e0d | 305 | for (Int_t i=0;i<160;i++){ |
306 | AliTPCclusterMI * cl0 = fClusterPointer[i]; | |
307 | AliTPCTrackPoint *trpoint = (AliTPCTrackPoint*)fPoints->UncheckedAt(i); | |
308 | if (cl0){ | |
309 | trpoint->GetTPoint() = *(GetTrackPoint(i)); | |
310 | trpoint->GetCPoint() = *cl0; | |
311 | trpoint->GetCPoint().SetQ(TMath::Abs(cl0->GetQ())); | |
312 | } | |
313 | else{ | |
314 | *trpoint = pdummy; | |
315 | trpoint->GetCPoint()= cldummy; | |
316 | } | |
317 | ||
318 | } | |
319 | ||
320 | } | |
321 | ||
322 | ||
323 | Double_t AliTPCseed::GetDensityFirst(Int_t n) | |
324 | { | |
325 | // | |
326 | // | |
327 | // return cluster for n rows bellow first point | |
328 | Int_t nfoundable = 1; | |
329 | Int_t nfound = 1; | |
330 | for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){ | |
331 | Int_t index = GetClusterIndex2(i); | |
332 | if (index!=-1) nfoundable++; | |
333 | if (index>0) nfound++; | |
334 | } | |
335 | if (nfoundable<n) return 0; | |
336 | return Double_t(nfound)/Double_t(nfoundable); | |
337 | ||
338 | } | |
339 | ||
340 | ||
341 | void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2) | |
342 | { | |
343 | // get cluster stat. on given region | |
344 | // | |
345 | found = 0; | |
346 | foundable = 0; | |
347 | shared =0; | |
348 | for (Int_t i=first;i<last; i++){ | |
349 | Int_t index = GetClusterIndex2(i); | |
350 | if (index!=-1) foundable++; | |
351 | if (fClusterPointer[i]) { | |
352 | found++; | |
353 | } | |
354 | else | |
355 | continue; | |
356 | ||
357 | if (fClusterPointer[i]->IsUsed(10)) { | |
358 | shared++; | |
359 | continue; | |
360 | } | |
361 | if (!plus2) continue; //take also neighborhoud | |
362 | // | |
363 | if ( (i>0) && fClusterPointer[i-1]){ | |
364 | if (fClusterPointer[i-1]->IsUsed(10)) { | |
365 | shared++; | |
366 | continue; | |
367 | } | |
368 | } | |
369 | if ( fClusterPointer[i+1]){ | |
370 | if (fClusterPointer[i+1]->IsUsed(10)) { | |
371 | shared++; | |
372 | continue; | |
373 | } | |
374 | } | |
375 | ||
376 | } | |
377 | //if (shared>found){ | |
378 | //Error("AliTPCseed::GetClusterStatistic","problem\n"); | |
379 | //} | |
380 | } | |
381 | ||
382 | ||
383 | ||
384 | ||
385 | ||
386 | void AliTPCseed::Reset(Bool_t all) | |
387 | { | |
388 | // | |
389 | // | |
390 | SetNumberOfClusters(0); | |
391 | fNFoundable = 0; | |
392 | SetChi2(0); | |
6c94f330 | 393 | ResetCovariance(10.); |
81e97e0d | 394 | /* |
395 | if (fTrackPoints){ | |
396 | for (Int_t i=0;i<8;i++){ | |
397 | delete [] fTrackPoints[i]; | |
398 | } | |
399 | delete fTrackPoints; | |
400 | fTrackPoints =0; | |
401 | } | |
402 | */ | |
403 | ||
404 | if (all){ | |
405 | for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3); | |
406 | for (Int_t i=0;i<160;i++) fClusterPointer[i]=0; | |
407 | } | |
408 | ||
409 | } | |
410 | ||
411 | ||
412 | void AliTPCseed::Modify(Double_t factor) | |
413 | { | |
414 | ||
415 | //------------------------------------------------------------------ | |
416 | //This function makes a track forget its history :) | |
417 | //------------------------------------------------------------------ | |
418 | if (factor<=0) { | |
6c94f330 | 419 | ResetCovariance(10.); |
81e97e0d | 420 | return; |
421 | } | |
6c94f330 | 422 | ResetCovariance(factor); |
423 | ||
81e97e0d | 424 | SetNumberOfClusters(0); |
425 | fNFoundable =0; | |
426 | SetChi2(0); | |
427 | fRemoval = 0; | |
428 | fCurrentSigmaY2 = 0.000005; | |
429 | fCurrentSigmaZ2 = 0.000005; | |
430 | fNoCluster = 0; | |
431 | //fFirstPoint = 160; | |
432 | //fLastPoint = 0; | |
433 | } | |
434 | ||
435 | ||
436 | ||
437 | ||
438 | Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const | |
439 | { | |
440 | //----------------------------------------------------------------- | |
441 | // This function find proloncation of a track to a reference plane x=xk. | |
442 | // doesn't change internal state of the track | |
443 | //----------------------------------------------------------------- | |
444 | ||
6c94f330 | 445 | Double_t x1=GetX(), x2=x1+(xk-x1), dx=x2-x1; |
81e97e0d | 446 | |
6c94f330 | 447 | if (TMath::Abs(GetSnp()+GetC()*dx) >= AliTPCReconstructor::GetMaxSnpTrack()) { |
81e97e0d | 448 | return 0; |
449 | } | |
450 | ||
451 | // Double_t y1=fP0, z1=fP1; | |
6c94f330 | 452 | Double_t c1=GetSnp(), r1=sqrt(1.- c1*c1); |
453 | Double_t c2=c1 + GetC()*dx, r2=sqrt(1.- c2*c2); | |
81e97e0d | 454 | |
6c94f330 | 455 | y = GetY(); |
456 | z = GetZ(); | |
81e97e0d | 457 | //y += dx*(c1+c2)/(r1+r2); |
458 | //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3; | |
459 | ||
460 | Double_t dy = dx*(c1+c2)/(r1+r2); | |
461 | Double_t dz = 0; | |
462 | // | |
6c94f330 | 463 | Double_t delta = GetC()*dx*(c1+c2)/(c1*r2 + c2*r1); |
81e97e0d | 464 | /* |
465 | if (TMath::Abs(delta)>0.0001){ | |
466 | dz = fP3*TMath::ASin(delta)/fP4; | |
467 | }else{ | |
468 | dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1); | |
469 | } | |
470 | */ | |
471 | // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4; | |
6c94f330 | 472 | dz = GetTgl()*TMath::ASin(delta)/GetC(); |
81e97e0d | 473 | // |
474 | y+=dy; | |
475 | z+=dz; | |
476 | ||
477 | ||
478 | return 1; | |
479 | } | |
480 | ||
481 | ||
482 | //_____________________________________________________________________________ | |
af32720d | 483 | Double_t AliTPCseed::GetPredictedChi2(const AliCluster *c) const |
81e97e0d | 484 | { |
485 | //----------------------------------------------------------------- | |
486 | // This function calculates a predicted chi2 increment. | |
487 | //----------------------------------------------------------------- | |
6c94f330 | 488 | Double_t p[2]={c->GetY(), c->GetZ()}; |
489 | Double_t cov[3]={fErrorY2, 0., fErrorZ2}; | |
490 | return AliExternalTrackParam::GetPredictedChi2(p,cov); | |
81e97e0d | 491 | } |
492 | ||
81e97e0d | 493 | //_________________________________________________________________________________________ |
494 | ||
495 | ||
496 | Int_t AliTPCseed::Compare(const TObject *o) const { | |
497 | //----------------------------------------------------------------- | |
498 | // This function compares tracks according to the sector - for given sector according z | |
499 | //----------------------------------------------------------------- | |
500 | AliTPCseed *t=(AliTPCseed*)o; | |
6c94f330 | 501 | |
81e97e0d | 502 | if (fSort == 0){ |
503 | if (t->fRelativeSector>fRelativeSector) return -1; | |
504 | if (t->fRelativeSector<fRelativeSector) return 1; | |
505 | Double_t z2 = t->GetZ(); | |
506 | Double_t z1 = GetZ(); | |
507 | if (z2>z1) return 1; | |
508 | if (z2<z1) return -1; | |
509 | return 0; | |
510 | } | |
511 | else { | |
512 | Float_t f2 =1; | |
6c23ffed | 513 | f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066); |
81e97e0d | 514 | if (t->fBConstrain) f2=1.2; |
515 | ||
516 | Float_t f1 =1; | |
6c23ffed | 517 | f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066); |
81e97e0d | 518 | |
519 | if (fBConstrain) f1=1.2; | |
520 | ||
521 | if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1; | |
522 | else return +1; | |
523 | } | |
524 | } | |
525 | ||
526 | ||
527 | ||
528 | ||
529 | //_____________________________________________________________________________ | |
6c94f330 | 530 | Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t /*index*/) |
531 | { | |
81e97e0d | 532 | //----------------------------------------------------------------- |
533 | // This function associates a cluster with this track. | |
534 | //----------------------------------------------------------------- | |
6c94f330 | 535 | Double_t p[2]={c->GetY(), c->GetZ()}; |
536 | Double_t cov[3]={fErrorY2, 0., fErrorZ2}; | |
81e97e0d | 537 | |
6c94f330 | 538 | if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; |
81e97e0d | 539 | |
540 | Int_t n=GetNumberOfClusters(); | |
541 | // fIndex[n]=index; | |
542 | SetNumberOfClusters(n+1); | |
543 | SetChi2(GetChi2()+chisq); | |
544 | ||
6c94f330 | 545 | return kTRUE; |
81e97e0d | 546 | } |
547 | ||
548 | ||
549 | ||
550 | //_____________________________________________________________________________ | |
105b1b81 | 551 | Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t onlyused) { |
81e97e0d | 552 | //----------------------------------------------------------------- |
553 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
554 | //----------------------------------------------------------------- | |
555 | ||
556 | Float_t amp[200]; | |
557 | Float_t angular[200]; | |
558 | Float_t weight[200]; | |
559 | Int_t index[200]; | |
560 | //Int_t nc = 0; | |
561 | // TClonesArray & arr = *fPoints; | |
562 | Float_t meanlog = 100.; | |
563 | ||
564 | Float_t mean[4] = {0,0,0,0}; | |
565 | Float_t sigma[4] = {1000,1000,1000,1000}; | |
566 | Int_t nc[4] = {0,0,0,0}; | |
567 | Float_t norm[4] = {1000,1000,1000,1000}; | |
568 | // | |
569 | // | |
570 | fNShared =0; | |
571 | ||
572 | for (Int_t of =0; of<4; of++){ | |
573 | for (Int_t i=of+i1;i<i2;i+=4) | |
574 | { | |
575 | Int_t index = fIndex[i]; | |
576 | if (index<0||index&0x8000) continue; | |
577 | ||
578 | //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i); | |
579 | AliTPCTrackerPoint * point = GetTrackPoint(i); | |
580 | //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1); | |
581 | //AliTPCTrackerPoint * pointp = 0; | |
582 | //if (i<159) pointp = GetTrackPoint(i+1); | |
583 | ||
584 | if (point==0) continue; | |
585 | AliTPCclusterMI * cl = fClusterPointer[i]; | |
586 | if (cl==0) continue; | |
587 | if (onlyused && (!cl->IsUsed(10))) continue; | |
588 | if (cl->IsUsed(11)) { | |
589 | fNShared++; | |
590 | continue; | |
591 | } | |
592 | Int_t type = cl->GetType(); | |
593 | //if (point->fIsShared){ | |
594 | // fNShared++; | |
595 | // continue; | |
596 | //} | |
597 | //if (pointm) | |
598 | // if (pointm->fIsShared) continue; | |
599 | //if (pointp) | |
600 | // if (pointp->fIsShared) continue; | |
601 | ||
602 | if (type<0) continue; | |
603 | //if (type>10) continue; | |
604 | //if (point->GetErrY()==0) continue; | |
605 | //if (point->GetErrZ()==0) continue; | |
606 | ||
607 | //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY(); | |
608 | //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ(); | |
609 | //if ((ddy*ddy+ddz*ddz)>10) continue; | |
610 | ||
611 | ||
612 | // if (point->GetCPoint().GetMax()<5) continue; | |
613 | if (cl->GetMax()<5) continue; | |
614 | Float_t angley = point->GetAngleY(); | |
615 | Float_t anglez = point->GetAngleZ(); | |
616 | ||
617 | Float_t rsigmay2 = point->GetSigmaY(); | |
618 | Float_t rsigmaz2 = point->GetSigmaZ(); | |
619 | /* | |
620 | Float_t ns = 1.; | |
621 | if (pointm){ | |
622 | rsigmay += pointm->GetTPoint().GetSigmaY(); | |
623 | rsigmaz += pointm->GetTPoint().GetSigmaZ(); | |
624 | ns+=1.; | |
625 | } | |
626 | if (pointp){ | |
627 | rsigmay += pointp->GetTPoint().GetSigmaY(); | |
628 | rsigmaz += pointp->GetTPoint().GetSigmaZ(); | |
629 | ns+=1.; | |
630 | } | |
631 | rsigmay/=ns; | |
632 | rsigmaz/=ns; | |
633 | */ | |
634 | ||
635 | Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2); | |
636 | ||
637 | Float_t ampc = 0; // normalization to the number of electrons | |
638 | if (i>64){ | |
639 | // ampc = 1.*point->GetCPoint().GetMax(); | |
640 | ampc = 1.*cl->GetMax(); | |
641 | //ampc = 1.*point->GetCPoint().GetQ(); | |
642 | // AliTPCClusterPoint & p = point->GetCPoint(); | |
643 | // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5); | |
644 | // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
645 | //Float_t dz = | |
646 | // TMath::Abs( Int_t(iz) - iz + 0.5); | |
647 | //ampc *= 1.15*(1-0.3*dy); | |
648 | //ampc *= 1.15*(1-0.3*dz); | |
649 | // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ())); | |
650 | //ampc *=zfactor; | |
651 | } | |
652 | else{ | |
653 | //ampc = 1.0*point->GetCPoint().GetMax(); | |
654 | ampc = 1.0*cl->GetMax(); | |
655 | //ampc = 1.0*point->GetCPoint().GetQ(); | |
656 | //AliTPCClusterPoint & p = point->GetCPoint(); | |
657 | // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5); | |
658 | //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566; | |
659 | //Float_t dz = | |
660 | // TMath::Abs( Int_t(iz) - iz + 0.5); | |
661 | ||
662 | //ampc *= 1.15*(1-0.3*dy); | |
663 | //ampc *= 1.15*(1-0.3*dz); | |
664 | // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ())); | |
665 | //ampc *=zfactor; | |
666 | ||
667 | } | |
668 | ampc *= 2.0; // put mean value to channel 50 | |
669 | //ampc *= 0.58; // put mean value to channel 50 | |
670 | Float_t w = 1.; | |
671 | // if (type>0) w = 1./(type/2.-0.5); | |
672 | // Float_t z = TMath::Abs(cl->GetZ()); | |
673 | if (i<64) { | |
674 | ampc /= 0.6; | |
675 | //ampc /= (1+0.0008*z); | |
676 | } else | |
677 | if (i>128){ | |
678 | ampc /=1.5; | |
679 | //ampc /= (1+0.0008*z); | |
680 | }else{ | |
681 | //ampc /= (1+0.0008*z); | |
682 | } | |
683 | ||
684 | if (type<0) { //amp at the border - lower weight | |
685 | // w*= 2.; | |
686 | ||
687 | continue; | |
688 | } | |
689 | if (rsigma>1.5) ampc/=1.3; // if big backround | |
690 | amp[nc[of]] = ampc; | |
691 | angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
692 | weight[nc[of]] = w; | |
693 | nc[of]++; | |
694 | } | |
695 | ||
696 | TMath::Sort(nc[of],amp,index,kFALSE); | |
697 | Float_t sumamp=0; | |
698 | Float_t sumamp2=0; | |
699 | Float_t sumw=0; | |
700 | //meanlog = amp[index[Int_t(nc[of]*0.33)]]; | |
701 | meanlog = 50; | |
702 | for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){ | |
703 | Float_t ampl = amp[index[i]]/angular[index[i]]; | |
704 | ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
705 | // | |
706 | sumw += weight[index[i]]; | |
707 | sumamp += weight[index[i]]*ampl; | |
708 | sumamp2 += weight[index[i]]*ampl*ampl; | |
709 | norm[of] += angular[index[i]]*weight[index[i]]; | |
710 | } | |
711 | if (sumw<1){ | |
712 | SetdEdx(0); | |
713 | } | |
714 | else { | |
715 | norm[of] /= sumw; | |
716 | mean[of] = sumamp/sumw; | |
717 | sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
718 | if (sigma[of]>0.1) | |
719 | sigma[of] = TMath::Sqrt(sigma[of]); | |
720 | else | |
721 | sigma[of] = 1000; | |
722 | ||
723 | mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; | |
724 | //mean *=(1-0.02*(sigma/(mean*0.17)-1.)); | |
725 | //mean *=(1-0.1*(norm-1.)); | |
726 | } | |
727 | } | |
728 | ||
729 | Float_t dedx =0; | |
730 | fSdEdx =0; | |
731 | fMAngular =0; | |
732 | // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1)); | |
733 | // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1)); | |
734 | ||
735 | ||
736 | // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/ | |
737 | // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1]))); | |
738 | ||
739 | Int_t norm2 = 0; | |
740 | Int_t norm3 = 0; | |
741 | for (Int_t i =0;i<4;i++){ | |
742 | if (nc[i]>2&&nc[i]<1000){ | |
743 | dedx += mean[i] *nc[i]; | |
744 | fSdEdx += sigma[i]*(nc[i]-2); | |
745 | fMAngular += norm[i] *nc[i]; | |
746 | norm2 += nc[i]; | |
747 | norm3 += nc[i]-2; | |
748 | } | |
749 | fDEDX[i] = mean[i]; | |
750 | fSDEDX[i] = sigma[i]; | |
751 | fNCDEDX[i]= nc[i]; | |
752 | } | |
753 | ||
754 | if (norm3>0){ | |
755 | dedx /=norm2; | |
756 | fSdEdx /=norm3; | |
757 | fMAngular/=norm2; | |
758 | } | |
759 | else{ | |
760 | SetdEdx(0); | |
105b1b81 | 761 | return 0; |
81e97e0d | 762 | } |
763 | // Float_t dedx1 =dedx; | |
764 | /* | |
765 | dedx =0; | |
766 | for (Int_t i =0;i<4;i++){ | |
767 | if (nc[i]>2&&nc[i]<1000){ | |
768 | mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.)); | |
769 | dedx += mean[i] *nc[i]; | |
770 | } | |
771 | fDEDX[i] = mean[i]; | |
772 | } | |
773 | dedx /= norm2; | |
774 | */ | |
775 | ||
776 | ||
777 | SetdEdx(dedx); | |
a2d457f2 | 778 | return dedx; |
81e97e0d | 779 | } |
780 | Double_t AliTPCseed::Bethe(Double_t bg){ | |
781 | // | |
782 | // This is the Bethe-Bloch function normalised to 1 at the minimum | |
783 | // | |
784 | Double_t bg2=bg*bg; | |
785 | Double_t bethe; | |
786 | if (bg<3.5e1) | |
787 | bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2)); | |
788 | else // Density effect ( approximately :) | |
789 | bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2)); | |
790 | return bethe/11.091; | |
791 | } | |
792 | ||
793 | void AliTPCseed::CookPID() | |
794 | { | |
795 | // | |
796 | // cook PID information according dEdx | |
797 | // | |
798 | Double_t fRange = 10.; | |
799 | Double_t fRes = 0.1; | |
800 | Double_t fMIP = 47.; | |
801 | // | |
802 | Int_t ns=AliPID::kSPECIES; | |
803 | Double_t sumr =0; | |
804 | for (Int_t j=0; j<ns; j++) { | |
805 | Double_t mass=AliPID::ParticleMass(j); | |
6c94f330 | 806 | Double_t mom=GetP(); |
81e97e0d | 807 | Double_t dedx=fdEdx/fMIP; |
808 | Double_t bethe=Bethe(mom/mass); | |
809 | Double_t sigma=fRes*bethe; | |
810 | if (sigma>0.001){ | |
811 | if (TMath::Abs(dedx-bethe) > fRange*sigma) { | |
812 | fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma; | |
813 | sumr+=fTPCr[j]; | |
814 | continue; | |
815 | } | |
816 | fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma; | |
817 | sumr+=fTPCr[j]; | |
818 | } | |
819 | else{ | |
820 | fTPCr[j]=1.; | |
821 | sumr+=fTPCr[j]; | |
822 | } | |
823 | } | |
824 | for (Int_t j=0; j<ns; j++) { | |
825 | fTPCr[j]/=sumr; //normalize | |
826 | } | |
827 | } | |
828 | ||
829 | /* | |
830 | void AliTPCseed::CookdEdx2(Double_t low, Double_t up) { | |
831 | //----------------------------------------------------------------- | |
832 | // This funtion calculates dE/dX within the "low" and "up" cuts. | |
833 | //----------------------------------------------------------------- | |
834 | ||
835 | Float_t amp[200]; | |
836 | Float_t angular[200]; | |
837 | Float_t weight[200]; | |
838 | Int_t index[200]; | |
839 | Bool_t inlimit[200]; | |
840 | for (Int_t i=0;i<200;i++) inlimit[i]=kFALSE; | |
841 | for (Int_t i=0;i<200;i++) amp[i]=10000; | |
842 | for (Int_t i=0;i<200;i++) angular[i]= 1;; | |
843 | ||
844 | ||
845 | // | |
846 | Float_t meanlog = 100.; | |
847 | Int_t indexde[4]={0,64,128,160}; | |
848 | ||
849 | Float_t amean =0; | |
850 | Float_t asigma =0; | |
851 | Float_t anc =0; | |
852 | Float_t anorm =0; | |
853 | ||
854 | Float_t mean[4] = {0,0,0,0}; | |
855 | Float_t sigma[4] = {1000,1000,1000,1000}; | |
856 | Int_t nc[4] = {0,0,0,0}; | |
857 | Float_t norm[4] = {1000,1000,1000,1000}; | |
858 | // | |
859 | // | |
860 | fNShared =0; | |
861 | ||
862 | // for (Int_t of =0; of<3; of++){ | |
863 | // for (Int_t i=indexde[of];i<indexde[of+1];i++) | |
864 | for (Int_t i =0; i<160;i++) | |
865 | { | |
866 | AliTPCTrackPoint * point = GetTrackPoint(i); | |
867 | if (point==0) continue; | |
868 | if (point->fIsShared){ | |
869 | fNShared++; | |
870 | continue; | |
871 | } | |
872 | Int_t type = point->GetCPoint().GetType(); | |
873 | if (type<0) continue; | |
874 | if (point->GetCPoint().GetMax()<5) continue; | |
875 | Float_t angley = point->GetTPoint().GetAngleY(); | |
876 | Float_t anglez = point->GetTPoint().GetAngleZ(); | |
877 | Float_t rsigmay = point->GetCPoint().GetSigmaY(); | |
878 | Float_t rsigmaz = point->GetCPoint().GetSigmaZ(); | |
879 | Float_t rsigma = TMath::Sqrt(rsigmay*rsigmaz); | |
880 | ||
881 | Float_t ampc = 0; // normalization to the number of electrons | |
882 | if (i>64){ | |
883 | ampc = point->GetCPoint().GetMax(); | |
884 | } | |
885 | else{ | |
886 | ampc = point->GetCPoint().GetMax(); | |
887 | } | |
888 | ampc *= 2.0; // put mean value to channel 50 | |
889 | // ampc *= 0.565; // put mean value to channel 50 | |
890 | ||
891 | Float_t w = 1.; | |
892 | Float_t z = TMath::Abs(point->GetCPoint().GetZ()); | |
893 | if (i<64) { | |
894 | ampc /= 0.63; | |
895 | } else | |
896 | if (i>128){ | |
897 | ampc /=1.51; | |
898 | } | |
899 | if (type<0) { //amp at the border - lower weight | |
900 | continue; | |
901 | } | |
902 | if (rsigma>1.5) ampc/=1.3; // if big backround | |
903 | angular[i] = TMath::Sqrt(1.+angley*angley+anglez*anglez); | |
904 | amp[i] = ampc/angular[i]; | |
905 | weight[i] = w; | |
906 | anc++; | |
907 | } | |
908 | ||
909 | TMath::Sort(159,amp,index,kFALSE); | |
910 | for (Int_t i=int(anc*low+0.5);i<int(anc*up+0.5);i++){ | |
911 | inlimit[index[i]] = kTRUE; // take all clusters | |
912 | } | |
913 | ||
914 | // meanlog = amp[index[Int_t(anc*0.3)]]; | |
915 | meanlog =10000.; | |
916 | for (Int_t of =0; of<3; of++){ | |
917 | Float_t sumamp=0; | |
918 | Float_t sumamp2=0; | |
919 | Float_t sumw=0; | |
920 | for (Int_t i=indexde[of];i<indexde[of+1];i++) | |
921 | { | |
922 | if (inlimit[i]==kFALSE) continue; | |
923 | Float_t ampl = amp[i]; | |
924 | ///angular[i]; | |
925 | ampl = meanlog*TMath::Log(1.+ampl/meanlog); | |
926 | // | |
927 | sumw += weight[i]; | |
928 | sumamp += weight[i]*ampl; | |
929 | sumamp2 += weight[i]*ampl*ampl; | |
930 | norm[of] += angular[i]*weight[i]; | |
931 | nc[of]++; | |
932 | } | |
933 | if (sumw<1){ | |
934 | SetdEdx(0); | |
935 | } | |
936 | else { | |
937 | norm[of] /= sumw; | |
938 | mean[of] = sumamp/sumw; | |
939 | sigma[of] = sumamp2/sumw-mean[of]*mean[of]; | |
940 | if (sigma[of]>0.1) | |
941 | sigma[of] = TMath::Sqrt(sigma[of]); | |
942 | else | |
943 | sigma[of] = 1000; | |
944 | mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog; | |
945 | } | |
946 | } | |
947 | ||
948 | Float_t dedx =0; | |
949 | fSdEdx =0; | |
950 | fMAngular =0; | |
951 | // | |
952 | Int_t norm2 = 0; | |
953 | Int_t norm3 = 0; | |
954 | Float_t www[3] = {12.,14.,17.}; | |
955 | //Float_t www[3] = {1.,1.,1.}; | |
956 | ||
957 | for (Int_t i =0;i<3;i++){ | |
958 | if (nc[i]>2&&nc[i]<1000){ | |
959 | dedx += mean[i] *nc[i]*www[i]/sigma[i]; | |
960 | fSdEdx += sigma[i]*(nc[i]-2)*www[i]/sigma[i]; | |
961 | fMAngular += norm[i] *nc[i]; | |
962 | norm2 += nc[i]*www[i]/sigma[i]; | |
963 | norm3 += (nc[i]-2)*www[i]/sigma[i]; | |
964 | } | |
965 | fDEDX[i] = mean[i]; | |
966 | fSDEDX[i] = sigma[i]; | |
967 | fNCDEDX[i]= nc[i]; | |
968 | } | |
969 | ||
970 | if (norm3>0){ | |
971 | dedx /=norm2; | |
972 | fSdEdx /=norm3; | |
973 | fMAngular/=norm2; | |
974 | } | |
975 | else{ | |
976 | SetdEdx(0); | |
977 | return; | |
978 | } | |
979 | // Float_t dedx1 =dedx; | |
980 | ||
981 | dedx =0; | |
982 | Float_t norm4 = 0; | |
983 | for (Int_t i =0;i<3;i++){ | |
984 | if (nc[i]>2&&nc[i]<1000&&sigma[i]>3){ | |
985 | //mean[i] = mean[i]*(1+0.08*(sigma[i]/(fSdEdx)-1.)); | |
986 | dedx += mean[i] *(nc[i])/(sigma[i]); | |
987 | norm4 += (nc[i])/(sigma[i]); | |
988 | } | |
989 | fDEDX[i] = mean[i]; | |
990 | } | |
991 | if (norm4>0) dedx /= norm4; | |
992 | ||
993 | ||
994 | ||
995 | SetdEdx(dedx); | |
996 | ||
997 | //mi deDX | |
998 | ||
999 | } | |
1000 | */ | |
6c94f330 | 1001 | Double_t AliTPCseed::GetYat(Double_t xk) const { |
1002 | //----------------------------------------------------------------- | |
1003 | // This function calculates the Y-coordinate of a track at the plane x=xk. | |
1004 | //----------------------------------------------------------------- | |
1005 | if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06 | |
1006 | Double_t c1=GetSnp(), r1=TMath::Sqrt(1.- c1*c1); | |
1007 | Double_t c2=c1+GetC()*(xk-GetX()); | |
1008 | if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0; | |
1009 | Double_t r2=TMath::Sqrt(1.- c2*c2); | |
1010 | return GetY() + (xk-GetX())*(c1+c2)/(r1+r2); | |
1011 | } | |
1012 | ||
19b00333 | 1013 | void AliTPCseed::SetClusterMapBit(int ibit, Bool_t state) |
1014 | { | |
1015 | fClusterMap[ibit] = state; | |
1016 | } | |
1017 | Bool_t AliTPCseed::GetClusterMapBit(int ibit) | |
1018 | { | |
1019 | return fClusterMap[ibit]; | |
1020 | } | |
1021 | void AliTPCseed::SetSharedMapBit(int ibit, Bool_t state) | |
1022 | { | |
1023 | fSharedMap[ibit] = state; | |
1024 | } | |
1025 | Bool_t AliTPCseed::GetSharedMapBit(int ibit) | |
1026 | { | |
1027 | return fSharedMap[ibit]; | |
1028 | } |