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"
33 AliTPCseed::AliTPCseed():
36 fClusterOwner(kFALSE),
42 fCurrentSigmaY2(1e10),
43 fCurrentSigmaZ2(1e10),
47 fCurrentClusterIndex1(-1),
62 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
63 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
64 for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0;
65 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0.2;
66 for (Int_t i=0;i<4;i++) {
71 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
72 // for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
73 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
74 fClusterMap.ResetAllBits(kFALSE);
75 fSharedMap.ResetAllBits(kFALSE);
79 AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner):
82 fClusterOwner(clusterOwner),
88 fCurrentSigmaY2(1e10),
89 fCurrentSigmaZ2(1e10),
93 fCurrentClusterIndex1(-1),
104 fClusterMap(s.fClusterMap),
105 fSharedMap(s.fSharedMap)
107 //---------------------
108 // dummy copy constructor
109 //-------------------------
110 for (Int_t i=0;i<160;i++) {
111 fClusterPointer[i]=0;
113 if (s.fClusterPointer[i])
114 fClusterPointer[i] = new AliTPCclusterMI(*(s.fClusterPointer[i]));
116 fClusterPointer[i] = s.fClusterPointer[i];
118 fTrackPoints[i] = s.fTrackPoints[i];
120 for (Int_t i=0;i<160;i++) fIndex[i] = s.fIndex[i];
121 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=s.fTPCr[i];
122 for (Int_t i=0;i<4;i++) {
123 fDEDX[i] = s.fDEDX[i];
124 fSDEDX[i] = s.fSDEDX[i];
125 fNCDEDX[i] = s.fNCDEDX[i];
127 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = s.fOverlapLabels[i];
132 AliTPCseed::AliTPCseed(const AliTPCtrack &t):
135 fClusterOwner(kFALSE),
141 fCurrentSigmaY2(1e10),
142 fCurrentSigmaZ2(1e10),
145 fCurrentCluster(0x0),
146 fCurrentClusterIndex1(-1),
161 // Constructor from AliTPCtrack
164 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
165 for (Int_t i=0;i<160;i++) {
166 fClusterPointer[i] = 0;
167 Int_t index = t.GetClusterIndex(i);
169 SetClusterIndex2(i,index);
172 SetClusterIndex2(i,-3);
175 for (Int_t i=0;i<4;i++) {
180 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
182 //for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
183 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
184 fClusterMap.ResetAllBits(kFALSE);
185 fSharedMap.ResetAllBits(kFALSE);
189 AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5],
190 const Double_t cc[15], Int_t index):
191 AliTPCtrack(xr, alpha, xx, cc, index),
193 fClusterOwner(kFALSE),
199 fCurrentSigmaY2(1e10),
200 fCurrentSigmaZ2(1e10),
203 fCurrentCluster(0x0),
204 fCurrentClusterIndex1(-1),
222 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
223 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
224 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
225 for (Int_t i=0;i<4;i++) {
230 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
233 AliTPCseed::~AliTPCseed(){
236 if (fPoints) delete fPoints;
238 if (fEPoints) delete fEPoints;
242 for (Int_t icluster=0; icluster<160; icluster++){
243 delete fClusterPointer[icluster];
248 //_________________________________________________
249 AliTPCseed & AliTPCseed::operator=(const AliTPCseed ¶m)
252 // assignment operator
255 AliTPCtrack::operator=(param);
257 for(Int_t i = 0;i<160;++i)fClusterPointer[i] = param.fClusterPointer[i]; // this is not allocated by AliTPCSeed
258 fClusterOwner = param.fClusterOwner;
259 // leave out fPoint, they are also not copied in the copy ctor...
260 // but deleted in the dtor... strange...
264 fSector = param.fSector;
265 fRelativeSector = param.fRelativeSector;
266 fCurrentSigmaY2 = param.fCurrentSigmaY2;
267 fCurrentSigmaZ2 = param.fCurrentSigmaZ2;
268 fErrorY2 = param.fErrorY2;
269 fErrorZ2 = param.fErrorZ2;
270 fCurrentCluster = param.fCurrentCluster; // this is not allocated by AliTPCSeed
271 fCurrentClusterIndex1 = param.fCurrentClusterIndex1;
272 fInDead = param.fInDead;
273 fIsSeeding = param.fIsSeeding;
274 fNoCluster = param.fNoCluster;
276 fBSigned = param.fBSigned;
277 for(Int_t i = 0;i<4;++i){
278 fDEDX[i] = param.fDEDX[i];
279 fSDEDX[i] = param.fSDEDX[i];
280 fNCDEDX[i] = param.fNCDEDX[i];
282 for(Int_t i = 0;i<AliPID::kSPECIES;++i)fTPCr[i] = param.fTPCr[i];
284 fSeedType = param.fSeedType;
285 fSeed1 = param.fSeed1;
286 fSeed2 = param.fSeed2;
287 for(Int_t i = 0;i<12;++i)fOverlapLabels[i] = param.fOverlapLabels[i];
288 fMAngular = param.fMAngular;
289 fCircular = param.fCircular;
290 for(int i = 0;i<160;++i)fTrackPoints[i] = param.fTrackPoints[i];
291 fClusterMap = param.fClusterMap;
292 fSharedMap = param.fSharedMap;
296 //____________________________________________________
297 AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i)
301 return &fTrackPoints[i];
304 void AliTPCseed::RebuildSeed()
307 // rebuild seed to be ready for storing
308 AliTPCclusterMI cldummy;
310 AliTPCTrackPoint pdummy;
311 pdummy.GetTPoint().SetShared(10);
312 for (Int_t i=0;i<160;i++){
313 AliTPCclusterMI * cl0 = fClusterPointer[i];
314 AliTPCTrackPoint *trpoint = (AliTPCTrackPoint*)fPoints->UncheckedAt(i);
316 trpoint->GetTPoint() = *(GetTrackPoint(i));
317 trpoint->GetCPoint() = *cl0;
318 trpoint->GetCPoint().SetQ(TMath::Abs(cl0->GetQ()));
322 trpoint->GetCPoint()= cldummy;
330 Double_t AliTPCseed::GetDensityFirst(Int_t n)
334 // return cluster for n rows bellow first point
335 Int_t nfoundable = 1;
337 for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){
338 Int_t index = GetClusterIndex2(i);
339 if (index!=-1) nfoundable++;
340 if (index>0) nfound++;
342 if (nfoundable<n) return 0;
343 return Double_t(nfound)/Double_t(nfoundable);
348 void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2)
350 // get cluster stat. on given region
355 for (Int_t i=first;i<last; i++){
356 Int_t index = GetClusterIndex2(i);
357 if (index!=-1) foundable++;
358 if (index&0x8000) continue;
359 if (fClusterPointer[i]) {
365 if (fClusterPointer[i]->IsUsed(10)) {
369 if (!plus2) continue; //take also neighborhoud
371 if ( (i>0) && fClusterPointer[i-1]){
372 if (fClusterPointer[i-1]->IsUsed(10)) {
377 if ( fClusterPointer[i+1]){
378 if (fClusterPointer[i+1]->IsUsed(10)) {
386 //Error("AliTPCseed::GetClusterStatistic","problem\n");
394 void AliTPCseed::Reset(Bool_t all)
398 SetNumberOfClusters(0);
401 ResetCovariance(10.);
404 for (Int_t i=0;i<8;i++){
405 delete [] fTrackPoints[i];
413 for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3);
414 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
420 void AliTPCseed::Modify(Double_t factor)
423 //------------------------------------------------------------------
424 //This function makes a track forget its history :)
425 //------------------------------------------------------------------
427 ResetCovariance(10.);
430 ResetCovariance(factor);
432 SetNumberOfClusters(0);
436 fCurrentSigmaY2 = 0.000005;
437 fCurrentSigmaZ2 = 0.000005;
446 Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const
448 //-----------------------------------------------------------------
449 // This function find proloncation of a track to a reference plane x=xk.
450 // doesn't change internal state of the track
451 //-----------------------------------------------------------------
453 Double_t x1=GetX(), x2=x1+(xk-x1), dx=x2-x1;
455 if (TMath::Abs(GetSnp()+GetC()*dx) >= AliTPCReconstructor::GetMaxSnpTrack()) {
459 // Double_t y1=fP0, z1=fP1;
460 Double_t c1=GetSnp(), r1=sqrt(1.- c1*c1);
461 Double_t c2=c1 + GetC()*dx, r2=sqrt(1.- c2*c2);
465 //y += dx*(c1+c2)/(r1+r2);
466 //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3;
468 Double_t dy = dx*(c1+c2)/(r1+r2);
471 Double_t delta = GetC()*dx*(c1+c2)/(c1*r2 + c2*r1);
473 if (TMath::Abs(delta)>0.0001){
474 dz = fP3*TMath::ASin(delta)/fP4;
476 dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1);
479 // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4;
480 dz = GetTgl()*TMath::ASin(delta)/GetC();
490 //_____________________________________________________________________________
491 Double_t AliTPCseed::GetPredictedChi2(const AliCluster *c) const
493 //-----------------------------------------------------------------
494 // This function calculates a predicted chi2 increment.
495 //-----------------------------------------------------------------
496 Double_t p[2]={c->GetY(), c->GetZ()};
497 Double_t cov[3]={fErrorY2, 0., fErrorZ2};
498 return AliExternalTrackParam::GetPredictedChi2(p,cov);
501 //_________________________________________________________________________________________
504 Int_t AliTPCseed::Compare(const TObject *o) const {
505 //-----------------------------------------------------------------
506 // This function compares tracks according to the sector - for given sector according z
507 //-----------------------------------------------------------------
508 AliTPCseed *t=(AliTPCseed*)o;
511 if (t->fRelativeSector>fRelativeSector) return -1;
512 if (t->fRelativeSector<fRelativeSector) return 1;
513 Double_t z2 = t->GetZ();
514 Double_t z1 = GetZ();
516 if (z2<z1) return -1;
521 f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066);
522 if (t->fBConstrain) f2=1.2;
525 f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066);
527 if (fBConstrain) f1=1.2;
529 if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1;
537 //_____________________________________________________________________________
538 Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t /*index*/)
540 //-----------------------------------------------------------------
541 // This function associates a cluster with this track.
542 //-----------------------------------------------------------------
543 Double_t p[2]={c->GetY(), c->GetZ()};
544 Double_t cov[3]={fErrorY2, 0., fErrorZ2};
546 if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
548 Int_t n=GetNumberOfClusters();
550 SetNumberOfClusters(n+1);
551 SetChi2(GetChi2()+chisq);
558 //_____________________________________________________________________________
559 Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t onlyused) {
560 //-----------------------------------------------------------------
561 // This funtion calculates dE/dX within the "low" and "up" cuts.
562 //-----------------------------------------------------------------
565 Float_t angular[200];
569 // TClonesArray & arr = *fPoints;
570 Float_t meanlog = 100.;
572 Float_t mean[4] = {0,0,0,0};
573 Float_t sigma[4] = {1000,1000,1000,1000};
574 Int_t nc[4] = {0,0,0,0};
575 Float_t norm[4] = {1000,1000,1000,1000};
580 for (Int_t of =0; of<4; of++){
581 for (Int_t i=of+i1;i<i2;i+=4)
583 Int_t index = fIndex[i];
584 if (index<0||index&0x8000) continue;
586 //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i);
587 AliTPCTrackerPoint * point = GetTrackPoint(i);
588 //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1);
589 //AliTPCTrackerPoint * pointp = 0;
590 //if (i<159) pointp = GetTrackPoint(i+1);
592 if (point==0) continue;
593 AliTPCclusterMI * cl = fClusterPointer[i];
595 if (onlyused && (!cl->IsUsed(10))) continue;
596 if (cl->IsUsed(11)) {
600 Int_t type = cl->GetType();
601 //if (point->fIsShared){
606 // if (pointm->fIsShared) continue;
608 // if (pointp->fIsShared) continue;
610 if (type<0) continue;
611 //if (type>10) continue;
612 //if (point->GetErrY()==0) continue;
613 //if (point->GetErrZ()==0) continue;
615 //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY();
616 //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ();
617 //if ((ddy*ddy+ddz*ddz)>10) continue;
620 // if (point->GetCPoint().GetMax()<5) continue;
621 if (cl->GetMax()<5) continue;
622 Float_t angley = point->GetAngleY();
623 Float_t anglez = point->GetAngleZ();
625 Float_t rsigmay2 = point->GetSigmaY();
626 Float_t rsigmaz2 = point->GetSigmaZ();
630 rsigmay += pointm->GetTPoint().GetSigmaY();
631 rsigmaz += pointm->GetTPoint().GetSigmaZ();
635 rsigmay += pointp->GetTPoint().GetSigmaY();
636 rsigmaz += pointp->GetTPoint().GetSigmaZ();
643 Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2);
645 Float_t ampc = 0; // normalization to the number of electrons
647 // ampc = 1.*point->GetCPoint().GetMax();
648 ampc = 1.*cl->GetMax();
649 //ampc = 1.*point->GetCPoint().GetQ();
650 // AliTPCClusterPoint & p = point->GetCPoint();
651 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5);
652 // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
654 // TMath::Abs( Int_t(iz) - iz + 0.5);
655 //ampc *= 1.15*(1-0.3*dy);
656 //ampc *= 1.15*(1-0.3*dz);
657 // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ()));
661 //ampc = 1.0*point->GetCPoint().GetMax();
662 ampc = 1.0*cl->GetMax();
663 //ampc = 1.0*point->GetCPoint().GetQ();
664 //AliTPCClusterPoint & p = point->GetCPoint();
665 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5);
666 //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
668 // TMath::Abs( Int_t(iz) - iz + 0.5);
670 //ampc *= 1.15*(1-0.3*dy);
671 //ampc *= 1.15*(1-0.3*dz);
672 // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ()));
676 ampc *= 2.0; // put mean value to channel 50
677 //ampc *= 0.58; // put mean value to channel 50
679 // if (type>0) w = 1./(type/2.-0.5);
680 // Float_t z = TMath::Abs(cl->GetZ());
683 //ampc /= (1+0.0008*z);
687 //ampc /= (1+0.0008*z);
689 //ampc /= (1+0.0008*z);
692 if (type<0) { //amp at the border - lower weight
697 if (rsigma>1.5) ampc/=1.3; // if big backround
699 angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
704 TMath::Sort(nc[of],amp,index,kFALSE);
708 //meanlog = amp[index[Int_t(nc[of]*0.33)]];
710 for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){
711 Float_t ampl = amp[index[i]]/angular[index[i]];
712 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
714 sumw += weight[index[i]];
715 sumamp += weight[index[i]]*ampl;
716 sumamp2 += weight[index[i]]*ampl*ampl;
717 norm[of] += angular[index[i]]*weight[index[i]];
724 mean[of] = sumamp/sumw;
725 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
727 sigma[of] = TMath::Sqrt(sigma[of]);
731 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
732 //mean *=(1-0.02*(sigma/(mean*0.17)-1.));
733 //mean *=(1-0.1*(norm-1.));
740 // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1));
741 // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1));
744 // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/
745 // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1])));
749 for (Int_t i =0;i<4;i++){
750 if (nc[i]>2&&nc[i]<1000){
751 dedx += mean[i] *nc[i];
752 fSdEdx += sigma[i]*(nc[i]-2);
753 fMAngular += norm[i] *nc[i];
758 fSDEDX[i] = sigma[i];
771 // Float_t dedx1 =dedx;
774 for (Int_t i =0;i<4;i++){
775 if (nc[i]>2&&nc[i]<1000){
776 mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.));
777 dedx += mean[i] *nc[i];
788 Double_t AliTPCseed::Bethe(Double_t bg){
790 // This is the Bethe-Bloch function normalised to 1 at the minimum
795 bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2));
796 else // Density effect ( approximately :)
797 bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2));
801 void AliTPCseed::CookPID()
804 // cook PID information according dEdx
806 Double_t fRange = 10.;
810 Int_t ns=AliPID::kSPECIES;
812 for (Int_t j=0; j<ns; j++) {
813 Double_t mass=AliPID::ParticleMass(j);
815 Double_t dedx=fdEdx/fMIP;
816 Double_t bethe=Bethe(mom/mass);
817 Double_t sigma=fRes*bethe;
819 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
820 fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
824 fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
832 for (Int_t j=0; j<ns; j++) {
833 fTPCr[j]/=sumr; //normalize
838 void AliTPCseed::CookdEdx2(Double_t low, Double_t up) {
839 //-----------------------------------------------------------------
840 // This funtion calculates dE/dX within the "low" and "up" cuts.
841 //-----------------------------------------------------------------
844 Float_t angular[200];
848 for (Int_t i=0;i<200;i++) inlimit[i]=kFALSE;
849 for (Int_t i=0;i<200;i++) amp[i]=10000;
850 for (Int_t i=0;i<200;i++) angular[i]= 1;;
854 Float_t meanlog = 100.;
855 Int_t indexde[4]={0,64,128,160};
862 Float_t mean[4] = {0,0,0,0};
863 Float_t sigma[4] = {1000,1000,1000,1000};
864 Int_t nc[4] = {0,0,0,0};
865 Float_t norm[4] = {1000,1000,1000,1000};
870 // for (Int_t of =0; of<3; of++){
871 // for (Int_t i=indexde[of];i<indexde[of+1];i++)
872 for (Int_t i =0; i<160;i++)
874 AliTPCTrackPoint * point = GetTrackPoint(i);
875 if (point==0) continue;
876 if (point->fIsShared){
880 Int_t type = point->GetCPoint().GetType();
881 if (type<0) continue;
882 if (point->GetCPoint().GetMax()<5) continue;
883 Float_t angley = point->GetTPoint().GetAngleY();
884 Float_t anglez = point->GetTPoint().GetAngleZ();
885 Float_t rsigmay = point->GetCPoint().GetSigmaY();
886 Float_t rsigmaz = point->GetCPoint().GetSigmaZ();
887 Float_t rsigma = TMath::Sqrt(rsigmay*rsigmaz);
889 Float_t ampc = 0; // normalization to the number of electrons
891 ampc = point->GetCPoint().GetMax();
894 ampc = point->GetCPoint().GetMax();
896 ampc *= 2.0; // put mean value to channel 50
897 // ampc *= 0.565; // put mean value to channel 50
900 Float_t z = TMath::Abs(point->GetCPoint().GetZ());
907 if (type<0) { //amp at the border - lower weight
910 if (rsigma>1.5) ampc/=1.3; // if big backround
911 angular[i] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
912 amp[i] = ampc/angular[i];
917 TMath::Sort(159,amp,index,kFALSE);
918 for (Int_t i=int(anc*low+0.5);i<int(anc*up+0.5);i++){
919 inlimit[index[i]] = kTRUE; // take all clusters
922 // meanlog = amp[index[Int_t(anc*0.3)]];
924 for (Int_t of =0; of<3; of++){
928 for (Int_t i=indexde[of];i<indexde[of+1];i++)
930 if (inlimit[i]==kFALSE) continue;
931 Float_t ampl = amp[i];
933 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
936 sumamp += weight[i]*ampl;
937 sumamp2 += weight[i]*ampl*ampl;
938 norm[of] += angular[i]*weight[i];
946 mean[of] = sumamp/sumw;
947 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
949 sigma[of] = TMath::Sqrt(sigma[of]);
952 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
962 Float_t www[3] = {12.,14.,17.};
963 //Float_t www[3] = {1.,1.,1.};
965 for (Int_t i =0;i<3;i++){
966 if (nc[i]>2&&nc[i]<1000){
967 dedx += mean[i] *nc[i]*www[i]/sigma[i];
968 fSdEdx += sigma[i]*(nc[i]-2)*www[i]/sigma[i];
969 fMAngular += norm[i] *nc[i];
970 norm2 += nc[i]*www[i]/sigma[i];
971 norm3 += (nc[i]-2)*www[i]/sigma[i];
974 fSDEDX[i] = sigma[i];
987 // Float_t dedx1 =dedx;
991 for (Int_t i =0;i<3;i++){
992 if (nc[i]>2&&nc[i]<1000&&sigma[i]>3){
993 //mean[i] = mean[i]*(1+0.08*(sigma[i]/(fSdEdx)-1.));
994 dedx += mean[i] *(nc[i])/(sigma[i]);
995 norm4 += (nc[i])/(sigma[i]);
999 if (norm4>0) dedx /= norm4;
1009 Double_t AliTPCseed::GetYat(Double_t xk) const {
1010 //-----------------------------------------------------------------
1011 // This function calculates the Y-coordinate of a track at the plane x=xk.
1012 //-----------------------------------------------------------------
1013 if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06
1014 Double_t c1=GetSnp(), r1=TMath::Sqrt(1.- c1*c1);
1015 Double_t c2=c1+GetC()*(xk-GetX());
1016 if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0;
1017 Double_t r2=TMath::Sqrt(1.- c2*c2);
1018 return GetY() + (xk-GetX())*(c1+c2)/(r1+r2);
1021 void AliTPCseed::SetClusterMapBit(int ibit, Bool_t state)
1023 fClusterMap[ibit] = state;
1025 Bool_t AliTPCseed::GetClusterMapBit(int ibit)
1027 return fClusterMap[ibit];
1029 void AliTPCseed::SetSharedMapBit(int ibit, Bool_t state)
1031 fSharedMap[ibit] = state;
1033 Bool_t AliTPCseed::GetSharedMapBit(int ibit)
1035 return fSharedMap[ibit];
1042 Float_t AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2){
1045 // calculates dedx using the cluster
1046 // low - up specify trunc mean range - default form 0-0.7
1047 // type - 0 - max charge or 1- total charge in cluster 2- max no corr 3- total+ correction
1048 // i1-i2 - the pad-row range used for calculation
1050 // normalization parametrization taken from AliTPCClusterParam
1052 AliTPCClusterParam * parcl = AliTPCClusterParam::Instance();
1053 if (!parcl) return 0;
1059 const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
1060 const Float_t kedgey =4.;
1062 for (Int_t irow=i1; irow<i2; irow++){
1063 AliTPCclusterMI* cluster = GetClusterPointer(irow);
1064 if (!cluster) continue;
1065 if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
1066 Float_t charge= (type%2)? cluster->GetQ():cluster->GetMax();
1071 if (irow>63) ipad=1;
1072 if (irow>128) ipad=2;
1074 AliTPCTrackerPoint * point = GetTrackPoint(irow);
1075 Float_t ty = TMath::Abs(point->GetAngleY());
1076 Float_t tz = TMath::Abs(point->GetAngleZ());
1078 Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.;
1079 corr = parcl->Qnorm(ipad,type,dr,ty,tz);
1081 amp[ncl]=charge/corr;
1084 if (type>3) return ncl;
1085 TMath::Sort(ncl,amp, indexes, kFALSE);
1087 if (ncl<40) return 0;
1091 Int_t icl0=TMath::Nint(ncl*low);
1092 Int_t icl1=TMath::Nint(ncl*up);
1093 for (Int_t icl=icl0; icl<icl1;icl++){
1094 suma+=amp[indexes[icl]];
1101 Double_t AliTPCseed::BetheMass(Double_t mass){
1103 // return bethe-bloch
1105 Float_t bg= P()/mass;
1106 const Double_t kp1=0.76176e-1;
1107 const Double_t kp2=10.632;
1108 const Double_t kp3=0.13279e-4;
1109 const Double_t kp4=1.8631;
1110 const Double_t kp5=1.9479;
1112 Double_t dbg = (Double_t) bg;
1114 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1116 Double_t aa = TMath::Power(beta,kp4);
1117 Double_t bb = TMath::Power(1./dbg,kp5);
1119 bb=TMath::Log(kp3+bb);
1121 return ((Float_t)((kp2-aa-bb)*kp1/aa));
1125 Float_t AliTPCseed::CookShape(Int_t type){
1129 //-----------------------------------------------------------------
1130 // This funtion calculates dE/dX within the "low" and "up" cuts.
1131 //-----------------------------------------------------------------
1134 for (Int_t i =0; i<160;i++) {
1135 AliTPCTrackerPoint * point = GetTrackPoint(i);
1136 if (point==0) continue;
1138 AliTPCclusterMI * cl = fClusterPointer[i];
1139 if (cl==0) continue;
1141 Float_t rsigmay = TMath::Sqrt(point->GetSigmaY());
1142 Float_t rsigmaz = TMath::Sqrt(point->GetSigmaZ());
1143 Float_t rsigma = (rsigmay+rsigmaz)*0.5;
1144 if (type==0) means+=rsigma;
1145 if (type==1) means+=rsigmay;
1146 if (type==2) means+=rsigmaz;
1149 Float_t mean = (meanc>0)? means/meanc:0;