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