1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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"
26 #include "AliTPCReconstructor.h"
27 #include "AliTPCClusterParam.h"
28 #include "AliTPCCalPad.h"
29 #include "AliTPCCalROC.h"
37 AliTPCseed::AliTPCseed():
40 fClusterOwner(kFALSE),
44 fCurrentSigmaY2(1e10),
45 fCurrentSigmaZ2(1e10),
46 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
47 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
48 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
49 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
54 fCurrentClusterIndex1(-1),
69 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
70 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
71 for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0;
72 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0.2;
73 for (Int_t i=0;i<4;i++) {
78 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
79 // for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
80 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
81 fClusterMap.ResetAllBits(kFALSE);
82 fSharedMap.ResetAllBits(kFALSE);
86 AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner):
89 fClusterOwner(clusterOwner),
95 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
96 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
97 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
98 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
101 fCurrentCluster(0x0),
102 fCurrentClusterIndex1(-1),
113 fClusterMap(s.fClusterMap),
114 fSharedMap(s.fSharedMap)
116 //---------------------
117 // dummy copy constructor
118 //-------------------------
119 for (Int_t i=0;i<160;i++) {
120 fClusterPointer[i]=0;
122 if (s.fClusterPointer[i])
123 fClusterPointer[i] = new AliTPCclusterMI(*(s.fClusterPointer[i]));
125 fClusterPointer[i] = s.fClusterPointer[i];
127 fTrackPoints[i] = s.fTrackPoints[i];
129 for (Int_t i=0;i<160;i++) fIndex[i] = s.fIndex[i];
130 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=s.fTPCr[i];
131 for (Int_t i=0;i<4;i++) {
132 fDEDX[i] = s.fDEDX[i];
133 fSDEDX[i] = s.fSDEDX[i];
134 fNCDEDX[i] = s.fNCDEDX[i];
136 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = s.fOverlapLabels[i];
141 AliTPCseed::AliTPCseed(const AliTPCtrack &t):
144 fClusterOwner(kFALSE),
150 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
151 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
152 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
153 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
156 fCurrentCluster(0x0),
157 fCurrentClusterIndex1(-1),
172 // Constructor from AliTPCtrack
175 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
176 for (Int_t i=0;i<160;i++) {
177 fClusterPointer[i] = 0;
178 Int_t index = t.GetClusterIndex(i);
180 SetClusterIndex2(i,index);
183 SetClusterIndex2(i,-3);
186 for (Int_t i=0;i<4;i++) {
191 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
193 //for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
194 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
195 fClusterMap.ResetAllBits(kFALSE);
196 fSharedMap.ResetAllBits(kFALSE);
200 AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5],
201 const Double_t cc[15], Int_t index):
202 AliTPCtrack(xr, alpha, xx, cc, index),
204 fClusterOwner(kFALSE),
210 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
211 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
212 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
213 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
216 fCurrentCluster(0x0),
217 fCurrentClusterIndex1(-1),
235 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
236 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
237 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
238 for (Int_t i=0;i<4;i++) {
243 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
246 AliTPCseed::~AliTPCseed(){
251 for (Int_t icluster=0; icluster<160; icluster++){
252 delete fClusterPointer[icluster];
257 //_________________________________________________
258 AliTPCseed & AliTPCseed::operator=(const AliTPCseed ¶m)
261 // assignment operator
264 AliTPCtrack::operator=(param);
266 for(Int_t i = 0;i<160;++i)fClusterPointer[i] = param.fClusterPointer[i]; // this is not allocated by AliTPCSeed
267 fClusterOwner = param.fClusterOwner;
268 // leave out fPoint, they are also not copied in the copy ctor...
269 // but deleted in the dtor... strange...
271 fSector = param.fSector;
272 fRelativeSector = param.fRelativeSector;
273 fCurrentSigmaY2 = param.fCurrentSigmaY2;
274 fCurrentSigmaZ2 = param.fCurrentSigmaZ2;
275 fErrorY2 = param.fErrorY2;
276 fErrorZ2 = param.fErrorZ2;
277 fCurrentCluster = param.fCurrentCluster; // this is not allocated by AliTPCSeed
278 fCurrentClusterIndex1 = param.fCurrentClusterIndex1;
279 fInDead = param.fInDead;
280 fIsSeeding = param.fIsSeeding;
281 fNoCluster = param.fNoCluster;
283 fBSigned = param.fBSigned;
284 for(Int_t i = 0;i<4;++i){
285 fDEDX[i] = param.fDEDX[i];
286 fSDEDX[i] = param.fSDEDX[i];
287 fNCDEDX[i] = param.fNCDEDX[i];
289 for(Int_t i = 0;i<AliPID::kSPECIES;++i)fTPCr[i] = param.fTPCr[i];
291 fSeedType = param.fSeedType;
292 fSeed1 = param.fSeed1;
293 fSeed2 = param.fSeed2;
294 for(Int_t i = 0;i<12;++i)fOverlapLabels[i] = param.fOverlapLabels[i];
295 fMAngular = param.fMAngular;
296 fCircular = param.fCircular;
297 for(int i = 0;i<160;++i)fTrackPoints[i] = param.fTrackPoints[i];
298 fClusterMap = param.fClusterMap;
299 fSharedMap = param.fSharedMap;
303 //____________________________________________________
304 AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i)
308 return &fTrackPoints[i];
313 Double_t AliTPCseed::GetDensityFirst(Int_t n)
317 // return cluster for n rows bellow first point
318 Int_t nfoundable = 1;
320 for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){
321 Int_t index = GetClusterIndex2(i);
322 if (index!=-1) nfoundable++;
323 if (index>0) nfound++;
325 if (nfoundable<n) return 0;
326 return Double_t(nfound)/Double_t(nfoundable);
331 void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2)
333 // get cluster stat. on given region
338 for (Int_t i=first;i<last; i++){
339 Int_t index = GetClusterIndex2(i);
340 if (index!=-1) foundable++;
341 if (index&0x8000) continue;
342 if (fClusterPointer[i]) {
348 if (fClusterPointer[i]->IsUsed(10)) {
352 if (!plus2) continue; //take also neighborhoud
354 if ( (i>0) && fClusterPointer[i-1]){
355 if (fClusterPointer[i-1]->IsUsed(10)) {
360 if ( fClusterPointer[i+1]){
361 if (fClusterPointer[i+1]->IsUsed(10)) {
369 //Error("AliTPCseed::GetClusterStatistic","problem\n");
377 void AliTPCseed::Reset(Bool_t all)
381 SetNumberOfClusters(0);
384 ResetCovariance(10.);
387 for (Int_t i=0;i<8;i++){
388 delete [] fTrackPoints[i];
396 for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3);
397 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
403 void AliTPCseed::Modify(Double_t factor)
406 //------------------------------------------------------------------
407 //This function makes a track forget its history :)
408 //------------------------------------------------------------------
410 ResetCovariance(10.);
413 ResetCovariance(factor);
415 SetNumberOfClusters(0);
419 fCurrentSigmaY2 = 0.000005;
420 fCurrentSigmaZ2 = 0.000005;
429 Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const
431 //-----------------------------------------------------------------
432 // This function find proloncation of a track to a reference plane x=xk.
433 // doesn't change internal state of the track
434 //-----------------------------------------------------------------
436 Double_t x1=GetX(), x2=x1+(xk-x1), dx=x2-x1;
438 if (TMath::Abs(GetSnp()+GetC()*dx) >= AliTPCReconstructor::GetMaxSnpTrack()) {
442 // Double_t y1=fP0, z1=fP1;
443 Double_t c1=GetSnp(), r1=sqrt(1.- c1*c1);
444 Double_t c2=c1 + GetC()*dx, r2=sqrt(1.- c2*c2);
448 //y += dx*(c1+c2)/(r1+r2);
449 //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3;
451 Double_t dy = dx*(c1+c2)/(r1+r2);
454 Double_t delta = GetC()*dx*(c1+c2)/(c1*r2 + c2*r1);
456 if (TMath::Abs(delta)>0.0001){
457 dz = fP3*TMath::ASin(delta)/fP4;
459 dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1);
462 // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4;
463 dz = GetTgl()*TMath::ASin(delta)/GetC();
473 //_____________________________________________________________________________
474 Double_t AliTPCseed::GetPredictedChi2(const AliCluster *c) const
476 //-----------------------------------------------------------------
477 // This function calculates a predicted chi2 increment.
478 //-----------------------------------------------------------------
479 Double_t p[2]={c->GetY(), c->GetZ()};
480 Double_t cov[3]={fErrorY2, 0., fErrorZ2};
481 return AliExternalTrackParam::GetPredictedChi2(p,cov);
484 //_________________________________________________________________________________________
487 Int_t AliTPCseed::Compare(const TObject *o) const {
488 //-----------------------------------------------------------------
489 // This function compares tracks according to the sector - for given sector according z
490 //-----------------------------------------------------------------
491 AliTPCseed *t=(AliTPCseed*)o;
494 if (t->fRelativeSector>fRelativeSector) return -1;
495 if (t->fRelativeSector<fRelativeSector) return 1;
496 Double_t z2 = t->GetZ();
497 Double_t z1 = GetZ();
499 if (z2<z1) return -1;
504 f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066);
505 if (t->fBConstrain) f2=1.2;
508 f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066);
510 if (fBConstrain) f1=1.2;
512 if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1;
520 //_____________________________________________________________________________
521 Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t index)
523 //-----------------------------------------------------------------
524 // This function associates a cluster with this track.
525 //-----------------------------------------------------------------
526 Int_t n=GetNumberOfClusters();
527 Int_t idx=GetClusterIndex(n); // save the current cluster index
529 AliCluster cl(*c); cl.SetSigmaY2(fErrorY2); cl.SetSigmaZ2(fErrorZ2);
530 if (!AliTPCtrack::Update(&cl,chisq,index)) return kFALSE;
532 if (fCMeanSigmaY2p30<0){
533 fCMeanSigmaY2p30= c->GetSigmaY2(); //! current mean sigma Y2 - mean30%
534 fCMeanSigmaZ2p30= c->GetSigmaZ2(); //! current mean sigma Z2 - mean30%
535 fCMeanSigmaY2p30R = 1; //! current mean sigma Y2 - mean5%
536 fCMeanSigmaZ2p30R = 1; //! current mean sigma Z2 - mean5%
539 fCMeanSigmaY2p30= 0.70*fCMeanSigmaY2p30 +0.30*c->GetSigmaY2();
540 fCMeanSigmaZ2p30= 0.70*fCMeanSigmaZ2p30 +0.30*c->GetSigmaZ2();
541 if (fCurrentSigmaY2>0){
542 fCMeanSigmaY2p30R = 0.7*fCMeanSigmaY2p30R +0.3*c->GetSigmaY2()/fCurrentSigmaY2;
543 fCMeanSigmaZ2p30R = 0.7*fCMeanSigmaZ2p30R +0.3*c->GetSigmaZ2()/fCurrentSigmaZ2;
547 SetClusterIndex(n,idx); // restore the current cluster index
553 //_____________________________________________________________________________
554 Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t onlyused) {
555 //-----------------------------------------------------------------
556 // This funtion calculates dE/dX within the "low" and "up" cuts.
557 //-----------------------------------------------------------------
560 Float_t angular[200];
564 Float_t meanlog = 100.;
566 Float_t mean[4] = {0,0,0,0};
567 Float_t sigma[4] = {1000,1000,1000,1000};
568 Int_t nc[4] = {0,0,0,0};
569 Float_t norm[4] = {1000,1000,1000,1000};
574 for (Int_t of =0; of<4; of++){
575 for (Int_t i=of+i1;i<i2;i+=4)
577 Int_t index = fIndex[i];
578 if (index<0||index&0x8000) continue;
580 //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i);
581 AliTPCTrackerPoint * point = GetTrackPoint(i);
582 //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1);
583 //AliTPCTrackerPoint * pointp = 0;
584 //if (i<159) pointp = GetTrackPoint(i+1);
586 if (point==0) continue;
587 AliTPCclusterMI * cl = fClusterPointer[i];
589 if (onlyused && (!cl->IsUsed(10))) continue;
590 if (cl->IsUsed(11)) {
594 Int_t type = cl->GetType();
595 //if (point->fIsShared){
600 // if (pointm->fIsShared) continue;
602 // if (pointp->fIsShared) continue;
604 if (type<0) continue;
605 //if (type>10) continue;
606 //if (point->GetErrY()==0) continue;
607 //if (point->GetErrZ()==0) continue;
609 //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY();
610 //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ();
611 //if ((ddy*ddy+ddz*ddz)>10) continue;
614 // if (point->GetCPoint().GetMax()<5) continue;
615 if (cl->GetMax()<5) continue;
616 Float_t angley = point->GetAngleY();
617 Float_t anglez = point->GetAngleZ();
619 Float_t rsigmay2 = point->GetSigmaY();
620 Float_t rsigmaz2 = point->GetSigmaZ();
624 rsigmay += pointm->GetTPoint().GetSigmaY();
625 rsigmaz += pointm->GetTPoint().GetSigmaZ();
629 rsigmay += pointp->GetTPoint().GetSigmaY();
630 rsigmaz += pointp->GetTPoint().GetSigmaZ();
637 Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2);
639 Float_t ampc = 0; // normalization to the number of electrons
641 // ampc = 1.*point->GetCPoint().GetMax();
642 ampc = 1.*cl->GetMax();
643 //ampc = 1.*point->GetCPoint().GetQ();
644 // AliTPCClusterPoint & p = point->GetCPoint();
645 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5);
646 // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
648 // TMath::Abs( Int_t(iz) - iz + 0.5);
649 //ampc *= 1.15*(1-0.3*dy);
650 //ampc *= 1.15*(1-0.3*dz);
651 // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ()));
655 //ampc = 1.0*point->GetCPoint().GetMax();
656 ampc = 1.0*cl->GetMax();
657 //ampc = 1.0*point->GetCPoint().GetQ();
658 //AliTPCClusterPoint & p = point->GetCPoint();
659 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5);
660 //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
662 // TMath::Abs( Int_t(iz) - iz + 0.5);
664 //ampc *= 1.15*(1-0.3*dy);
665 //ampc *= 1.15*(1-0.3*dz);
666 // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ()));
670 ampc *= 2.0; // put mean value to channel 50
671 //ampc *= 0.58; // put mean value to channel 50
673 // if (type>0) w = 1./(type/2.-0.5);
674 // Float_t z = TMath::Abs(cl->GetZ());
677 //ampc /= (1+0.0008*z);
681 //ampc /= (1+0.0008*z);
683 //ampc /= (1+0.0008*z);
686 if (type<0) { //amp at the border - lower weight
691 if (rsigma>1.5) ampc/=1.3; // if big backround
693 angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
698 TMath::Sort(nc[of],amp,index,kFALSE);
702 //meanlog = amp[index[Int_t(nc[of]*0.33)]];
704 for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){
705 Float_t ampl = amp[index[i]]/angular[index[i]];
706 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
708 sumw += weight[index[i]];
709 sumamp += weight[index[i]]*ampl;
710 sumamp2 += weight[index[i]]*ampl*ampl;
711 norm[of] += angular[index[i]]*weight[index[i]];
718 mean[of] = sumamp/sumw;
719 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
721 sigma[of] = TMath::Sqrt(sigma[of]);
725 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
726 //mean *=(1-0.02*(sigma/(mean*0.17)-1.));
727 //mean *=(1-0.1*(norm-1.));
734 // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1));
735 // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1));
738 // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/
739 // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1])));
743 for (Int_t i =0;i<4;i++){
744 if (nc[i]>2&&nc[i]<1000){
745 dedx += mean[i] *nc[i];
746 fSdEdx += sigma[i]*(nc[i]-2);
747 fMAngular += norm[i] *nc[i];
752 fSDEDX[i] = sigma[i];
765 // Float_t dedx1 =dedx;
768 for (Int_t i =0;i<4;i++){
769 if (nc[i]>2&&nc[i]<1000){
770 mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.));
771 dedx += mean[i] *nc[i];
782 Double_t AliTPCseed::Bethe(Double_t bg){
784 // This is the Bethe-Bloch function normalised to 1 at the minimum
789 bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2));
790 else // Density effect ( approximately :)
791 bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2));
795 void AliTPCseed::CookPID()
798 // cook PID information according dEdx
800 Double_t fRange = 10.;
804 Int_t ns=AliPID::kSPECIES;
806 for (Int_t j=0; j<ns; j++) {
807 Double_t mass=AliPID::ParticleMass(j);
809 Double_t dedx=fdEdx/fMIP;
810 Double_t bethe=Bethe(mom/mass);
811 Double_t sigma=fRes*bethe;
813 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
814 fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
818 fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
826 for (Int_t j=0; j<ns; j++) {
827 fTPCr[j]/=sumr; //normalize
832 void AliTPCseed::CookdEdx2(Double_t low, Double_t up) {
833 //-----------------------------------------------------------------
834 // This funtion calculates dE/dX within the "low" and "up" cuts.
835 //-----------------------------------------------------------------
838 Float_t angular[200];
842 for (Int_t i=0;i<200;i++) inlimit[i]=kFALSE;
843 for (Int_t i=0;i<200;i++) amp[i]=10000;
844 for (Int_t i=0;i<200;i++) angular[i]= 1;;
848 Float_t meanlog = 100.;
849 Int_t indexde[4]={0,64,128,160};
856 Float_t mean[4] = {0,0,0,0};
857 Float_t sigma[4] = {1000,1000,1000,1000};
858 Int_t nc[4] = {0,0,0,0};
859 Float_t norm[4] = {1000,1000,1000,1000};
864 // for (Int_t of =0; of<3; of++){
865 // for (Int_t i=indexde[of];i<indexde[of+1];i++)
866 for (Int_t i =0; i<160;i++)
868 AliTPCTrackPoint * point = GetTrackPoint(i);
869 if (point==0) continue;
870 if (point->fIsShared){
874 Int_t type = point->GetCPoint().GetType();
875 if (type<0) continue;
876 if (point->GetCPoint().GetMax()<5) continue;
877 Float_t angley = point->GetTPoint().GetAngleY();
878 Float_t anglez = point->GetTPoint().GetAngleZ();
879 Float_t rsigmay = point->GetCPoint().GetSigmaY();
880 Float_t rsigmaz = point->GetCPoint().GetSigmaZ();
881 Float_t rsigma = TMath::Sqrt(rsigmay*rsigmaz);
883 Float_t ampc = 0; // normalization to the number of electrons
885 ampc = point->GetCPoint().GetMax();
888 ampc = point->GetCPoint().GetMax();
890 ampc *= 2.0; // put mean value to channel 50
891 // ampc *= 0.565; // put mean value to channel 50
894 Float_t z = TMath::Abs(point->GetCPoint().GetZ());
901 if (type<0) { //amp at the border - lower weight
904 if (rsigma>1.5) ampc/=1.3; // if big backround
905 angular[i] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
906 amp[i] = ampc/angular[i];
911 TMath::Sort(159,amp,index,kFALSE);
912 for (Int_t i=int(anc*low+0.5);i<int(anc*up+0.5);i++){
913 inlimit[index[i]] = kTRUE; // take all clusters
916 // meanlog = amp[index[Int_t(anc*0.3)]];
918 for (Int_t of =0; of<3; of++){
922 for (Int_t i=indexde[of];i<indexde[of+1];i++)
924 if (inlimit[i]==kFALSE) continue;
925 Float_t ampl = amp[i];
927 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
930 sumamp += weight[i]*ampl;
931 sumamp2 += weight[i]*ampl*ampl;
932 norm[of] += angular[i]*weight[i];
940 mean[of] = sumamp/sumw;
941 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
943 sigma[of] = TMath::Sqrt(sigma[of]);
946 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
956 Float_t www[3] = {12.,14.,17.};
957 //Float_t www[3] = {1.,1.,1.};
959 for (Int_t i =0;i<3;i++){
960 if (nc[i]>2&&nc[i]<1000){
961 dedx += mean[i] *nc[i]*www[i]/sigma[i];
962 fSdEdx += sigma[i]*(nc[i]-2)*www[i]/sigma[i];
963 fMAngular += norm[i] *nc[i];
964 norm2 += nc[i]*www[i]/sigma[i];
965 norm3 += (nc[i]-2)*www[i]/sigma[i];
968 fSDEDX[i] = sigma[i];
981 // Float_t dedx1 =dedx;
985 for (Int_t i =0;i<3;i++){
986 if (nc[i]>2&&nc[i]<1000&&sigma[i]>3){
987 //mean[i] = mean[i]*(1+0.08*(sigma[i]/(fSdEdx)-1.));
988 dedx += mean[i] *(nc[i])/(sigma[i]);
989 norm4 += (nc[i])/(sigma[i]);
993 if (norm4>0) dedx /= norm4;
1003 Double_t AliTPCseed::GetYat(Double_t xk) const {
1004 //-----------------------------------------------------------------
1005 // This function calculates the Y-coordinate of a track at the plane x=xk.
1006 //-----------------------------------------------------------------
1007 if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06
1008 Double_t c1=GetSnp(), r1=TMath::Sqrt(1.- c1*c1);
1009 Double_t c2=c1+GetC()*(xk-GetX());
1010 if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0;
1011 Double_t r2=TMath::Sqrt(1.- c2*c2);
1012 return GetY() + (xk-GetX())*(c1+c2)/(r1+r2);
1015 void AliTPCseed::SetClusterMapBit(int ibit, Bool_t state)
1017 fClusterMap[ibit] = state;
1019 Bool_t AliTPCseed::GetClusterMapBit(int ibit)
1021 return fClusterMap[ibit];
1023 void AliTPCseed::SetSharedMapBit(int ibit, Bool_t state)
1025 fSharedMap[ibit] = state;
1027 Bool_t AliTPCseed::GetSharedMapBit(int ibit)
1029 return fSharedMap[ibit];
1036 Float_t AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2, AliTPCCalPad * gainMap){
1039 // calculates dedx using the cluster
1040 // low - up specify trunc mean range - default form 0-0.7
1041 // type - 1 - max charge or 0- total charge in cluster
1042 // //2- max no corr 3- total+ correction
1043 // i1-i2 - the pad-row range used for calculation
1045 // normalization parametrization taken from AliTPCClusterParam
1047 AliTPCClusterParam * parcl = AliTPCClusterParam::Instance();
1048 if (!parcl) return 0;
1054 const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
1055 const Float_t kedgey =4.;
1058 for (Int_t irow=i1; irow<i2; irow++){
1059 AliTPCclusterMI* cluster = GetClusterPointer(irow);
1060 if (!cluster) continue;
1061 if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
1062 Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ();
1065 AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector());
1066 if (irow < 63) { // IROC
1067 factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad()))*1.55;
1069 factor = roc->GetValue(irow - 63, TMath::Nint(cluster->GetPad()));
1071 if (factor>0.5) charge/=factor;
1077 if (irow>62) ipad=1;
1078 if (irow>127) ipad=2;
1081 AliTPCTrackerPoint * point = GetTrackPoint(irow);
1082 Float_t ty = TMath::Abs(point->GetAngleY());
1083 Float_t tz = TMath::Abs(point->GetAngleZ());
1085 Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.;
1086 corr = parcl->Qnorm(ipad,type,dr,ty,tz);
1088 amp[ncl]=charge/corr;
1090 amp[ncl] *= 2.0; // put mean value to channel 50
1092 amp[ncl] /= 0.65; // this we will take form OCDB
1101 if (type>3) return ncl;
1102 TMath::Sort(ncl,amp, indexes, kFALSE);
1104 if (ncl<10) return 0;
1108 Int_t icl0=TMath::Nint(ncl*low);
1109 Int_t icl1=TMath::Nint(ncl*up);
1110 for (Int_t icl=icl0; icl<icl1;icl++){
1111 suma+=amp[indexes[icl]];
1118 Double_t AliTPCseed::BetheMass(Double_t mass){
1120 // return bethe-bloch
1122 Float_t bg= P()/mass;
1123 const Double_t kp1=0.76176e-1;
1124 const Double_t kp2=10.632;
1125 const Double_t kp3=0.13279e-4;
1126 const Double_t kp4=1.8631;
1127 const Double_t kp5=1.9479;
1129 Double_t dbg = (Double_t) bg;
1131 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1133 Double_t aa = TMath::Power(beta,kp4);
1134 Double_t bb = TMath::Power(1./dbg,kp5);
1136 bb=TMath::Log(kp3+bb);
1138 return ((Float_t)((kp2-aa-bb)*kp1/aa));
1142 Float_t AliTPCseed::CookShape(Int_t type){
1146 //-----------------------------------------------------------------
1147 // This funtion calculates dE/dX within the "low" and "up" cuts.
1148 //-----------------------------------------------------------------
1151 for (Int_t i =0; i<160;i++) {
1152 AliTPCTrackerPoint * point = GetTrackPoint(i);
1153 if (point==0) continue;
1155 AliTPCclusterMI * cl = fClusterPointer[i];
1156 if (cl==0) continue;
1158 Float_t rsigmay = TMath::Sqrt(point->GetSigmaY());
1159 Float_t rsigmaz = TMath::Sqrt(point->GetSigmaZ());
1160 Float_t rsigma = (rsigmay+rsigmaz)*0.5;
1161 if (type==0) means+=rsigma;
1162 if (type==1) means+=rsigmay;
1163 if (type==2) means+=rsigmaz;
1166 Float_t mean = (meanc>0)? means/meanc:0;