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