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"
30 #include "AliTPCcalibDB.h"
38 AliTPCseed::AliTPCseed():
41 fClusterOwner(kFALSE),
45 fCurrentSigmaY2(1e10),
46 fCurrentSigmaZ2(1e10),
47 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
48 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
49 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
50 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
55 fCurrentClusterIndex1(-1),
70 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
71 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
72 for (Int_t i=0;i<3;i++) fKinkIndexes[i]=0;
73 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=0.2;
74 for (Int_t i=0;i<4;i++) {
79 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
80 // for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
81 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
82 fClusterMap.ResetAllBits(kFALSE);
83 fSharedMap.ResetAllBits(kFALSE);
87 AliTPCseed::AliTPCseed(const AliTPCseed &s, Bool_t clusterOwner):
90 fClusterOwner(clusterOwner),
96 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
97 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
98 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
99 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
102 fCurrentCluster(0x0),
103 fCurrentClusterIndex1(-1),
114 fClusterMap(s.fClusterMap),
115 fSharedMap(s.fSharedMap)
117 //---------------------
118 // dummy copy constructor
119 //-------------------------
120 for (Int_t i=0;i<160;i++) {
121 fClusterPointer[i]=0;
123 if (s.fClusterPointer[i])
124 fClusterPointer[i] = new AliTPCclusterMI(*(s.fClusterPointer[i]));
126 fClusterPointer[i] = s.fClusterPointer[i];
128 fTrackPoints[i] = s.fTrackPoints[i];
130 for (Int_t i=0;i<160;i++) fIndex[i] = s.fIndex[i];
131 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=s.fTPCr[i];
132 for (Int_t i=0;i<4;i++) {
133 fDEDX[i] = s.fDEDX[i];
134 fSDEDX[i] = s.fSDEDX[i];
135 fNCDEDX[i] = s.fNCDEDX[i];
137 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = s.fOverlapLabels[i];
142 AliTPCseed::AliTPCseed(const AliTPCtrack &t):
145 fClusterOwner(kFALSE),
151 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
152 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
153 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
154 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
157 fCurrentCluster(0x0),
158 fCurrentClusterIndex1(-1),
173 // Constructor from AliTPCtrack
176 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
177 for (Int_t i=0;i<160;i++) {
178 fClusterPointer[i] = 0;
179 Int_t index = t.GetClusterIndex(i);
181 SetClusterIndex2(i,index);
184 SetClusterIndex2(i,-3);
187 for (Int_t i=0;i<4;i++) {
192 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
194 //for (Int_t i=0;i<160;i++) fClusterMap[i]=kFALSE;
195 //for (Int_t i=0;i<160;i++) fSharedMap[i]=kFALSE;
196 fClusterMap.ResetAllBits(kFALSE);
197 fSharedMap.ResetAllBits(kFALSE);
201 AliTPCseed::AliTPCseed(Double_t xr, Double_t alpha, const Double_t xx[5],
202 const Double_t cc[15], Int_t index):
203 AliTPCtrack(xr, alpha, xx, cc, index),
205 fClusterOwner(kFALSE),
211 fCMeanSigmaY2p30(-1.), //! current mean sigma Y2 - mean30%
212 fCMeanSigmaZ2p30(-1.), //! current mean sigma Z2 - mean30%
213 fCMeanSigmaY2p30R(-1.), //! current mean sigma Y2 - mean2%
214 fCMeanSigmaZ2p30R(-1.), //! current mean sigma Z2 - mean2%
217 fCurrentCluster(0x0),
218 fCurrentClusterIndex1(-1),
236 for (Int_t i=0;i<160;i++) SetClusterIndex2(i,-3);
237 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
238 for (Int_t i=0;i<5;i++) fTPCr[i]=0.2;
239 for (Int_t i=0;i<4;i++) {
244 for (Int_t i=0;i<12;i++) fOverlapLabels[i] = -1;
247 AliTPCseed::~AliTPCseed(){
252 for (Int_t icluster=0; icluster<160; icluster++){
253 delete fClusterPointer[icluster];
258 //_________________________________________________
259 AliTPCseed & AliTPCseed::operator=(const AliTPCseed ¶m)
262 // assignment operator
265 AliTPCtrack::operator=(param);
267 for(Int_t i = 0;i<160;++i)fClusterPointer[i] = param.fClusterPointer[i]; // this is not allocated by AliTPCSeed
268 fClusterOwner = param.fClusterOwner;
269 // leave out fPoint, they are also not copied in the copy ctor...
270 // but deleted in the dtor... strange...
272 fSector = param.fSector;
273 fRelativeSector = param.fRelativeSector;
274 fCurrentSigmaY2 = param.fCurrentSigmaY2;
275 fCurrentSigmaZ2 = param.fCurrentSigmaZ2;
276 fErrorY2 = param.fErrorY2;
277 fErrorZ2 = param.fErrorZ2;
278 fCurrentCluster = param.fCurrentCluster; // this is not allocated by AliTPCSeed
279 fCurrentClusterIndex1 = param.fCurrentClusterIndex1;
280 fInDead = param.fInDead;
281 fIsSeeding = param.fIsSeeding;
282 fNoCluster = param.fNoCluster;
284 fBSigned = param.fBSigned;
285 for(Int_t i = 0;i<4;++i){
286 fDEDX[i] = param.fDEDX[i];
287 fSDEDX[i] = param.fSDEDX[i];
288 fNCDEDX[i] = param.fNCDEDX[i];
290 for(Int_t i = 0;i<AliPID::kSPECIES;++i)fTPCr[i] = param.fTPCr[i];
292 fSeedType = param.fSeedType;
293 fSeed1 = param.fSeed1;
294 fSeed2 = param.fSeed2;
295 for(Int_t i = 0;i<12;++i)fOverlapLabels[i] = param.fOverlapLabels[i];
296 fMAngular = param.fMAngular;
297 fCircular = param.fCircular;
298 for(int i = 0;i<160;++i)fTrackPoints[i] = param.fTrackPoints[i];
299 fClusterMap = param.fClusterMap;
300 fSharedMap = param.fSharedMap;
304 //____________________________________________________
305 AliTPCTrackerPoint * AliTPCseed::GetTrackPoint(Int_t i)
309 return &fTrackPoints[i];
314 Double_t AliTPCseed::GetDensityFirst(Int_t n)
318 // return cluster for n rows bellow first point
319 Int_t nfoundable = 1;
321 for (Int_t i=fLastPoint-1;i>0&&nfoundable<n; i--){
322 Int_t index = GetClusterIndex2(i);
323 if (index!=-1) nfoundable++;
324 if (index>0) nfound++;
326 if (nfoundable<n) return 0;
327 return Double_t(nfound)/Double_t(nfoundable);
332 void AliTPCseed::GetClusterStatistic(Int_t first, Int_t last, Int_t &found, Int_t &foundable, Int_t &shared, Bool_t plus2)
334 // get cluster stat. on given region
339 for (Int_t i=first;i<last; i++){
340 Int_t index = GetClusterIndex2(i);
341 if (index!=-1) foundable++;
342 if (index&0x8000) continue;
343 if (fClusterPointer[i]) {
349 if (fClusterPointer[i]->IsUsed(10)) {
353 if (!plus2) continue; //take also neighborhoud
355 if ( (i>0) && fClusterPointer[i-1]){
356 if (fClusterPointer[i-1]->IsUsed(10)) {
361 if ( fClusterPointer[i+1]){
362 if (fClusterPointer[i+1]->IsUsed(10)) {
370 //Error("AliTPCseed::GetClusterStatistic","problem\n");
378 void AliTPCseed::Reset(Bool_t all)
382 SetNumberOfClusters(0);
385 ResetCovariance(10.);
388 for (Int_t i=0;i<8;i++){
389 delete [] fTrackPoints[i];
397 for (Int_t i=0;i<200;i++) SetClusterIndex2(i,-3);
398 for (Int_t i=0;i<160;i++) fClusterPointer[i]=0;
404 void AliTPCseed::Modify(Double_t factor)
407 //------------------------------------------------------------------
408 //This function makes a track forget its history :)
409 //------------------------------------------------------------------
411 ResetCovariance(10.);
414 ResetCovariance(factor);
416 SetNumberOfClusters(0);
420 fCurrentSigmaY2 = 0.000005;
421 fCurrentSigmaZ2 = 0.000005;
430 Int_t AliTPCseed::GetProlongation(Double_t xk, Double_t &y, Double_t & z) const
432 //-----------------------------------------------------------------
433 // This function find proloncation of a track to a reference plane x=xk.
434 // doesn't change internal state of the track
435 //-----------------------------------------------------------------
437 Double_t x1=GetX(), x2=x1+(xk-x1), dx=x2-x1;
439 if (TMath::Abs(GetSnp()+GetC()*dx) >= AliTPCReconstructor::GetMaxSnpTrack()) {
443 // Double_t y1=fP0, z1=fP1;
444 Double_t c1=GetSnp(), r1=sqrt(1.- c1*c1);
445 Double_t c2=c1 + GetC()*dx, r2=sqrt(1.- c2*c2);
449 //y += dx*(c1+c2)/(r1+r2);
450 //z += dx*(c1+c2)/(c1*r2 + c2*r1)*fP3;
452 Double_t dy = dx*(c1+c2)/(r1+r2);
455 Double_t delta = GetC()*dx*(c1+c2)/(c1*r2 + c2*r1);
457 if (TMath::Abs(delta)>0.0001){
458 dz = fP3*TMath::ASin(delta)/fP4;
460 dz = dx*fP3*(c1+c2)/(c1*r2 + c2*r1);
463 // dz = fP3*AliTPCFastMath::FastAsin(delta)/fP4;
464 dz = GetTgl()*TMath::ASin(delta)/GetC();
474 //_____________________________________________________________________________
475 Double_t AliTPCseed::GetPredictedChi2(const AliCluster *c) const
477 //-----------------------------------------------------------------
478 // This function calculates a predicted chi2 increment.
479 //-----------------------------------------------------------------
480 Double_t p[2]={c->GetY(), c->GetZ()};
481 Double_t cov[3]={fErrorY2, 0., fErrorZ2};
482 return AliExternalTrackParam::GetPredictedChi2(p,cov);
485 //_________________________________________________________________________________________
488 Int_t AliTPCseed::Compare(const TObject *o) const {
489 //-----------------------------------------------------------------
490 // This function compares tracks according to the sector - for given sector according z
491 //-----------------------------------------------------------------
492 AliTPCseed *t=(AliTPCseed*)o;
495 if (t->fRelativeSector>fRelativeSector) return -1;
496 if (t->fRelativeSector<fRelativeSector) return 1;
497 Double_t z2 = t->GetZ();
498 Double_t z1 = GetZ();
500 if (z2<z1) return -1;
505 f2 = 1-20*TMath::Sqrt(t->GetSigma1Pt2())/(t->OneOverPt()+0.0066);
506 if (t->fBConstrain) f2=1.2;
509 f1 = 1-20*TMath::Sqrt(GetSigma1Pt2())/(OneOverPt()+0.0066);
511 if (fBConstrain) f1=1.2;
513 if (t->GetNumberOfClusters()*f2 <GetNumberOfClusters()*f1) return -1;
521 //_____________________________________________________________________________
522 Bool_t AliTPCseed::Update(const AliCluster *c, Double_t chisq, Int_t index)
524 //-----------------------------------------------------------------
525 // This function associates a cluster with this track.
526 //-----------------------------------------------------------------
527 Int_t n=GetNumberOfClusters();
528 Int_t idx=GetClusterIndex(n); // save the current cluster index
530 AliCluster cl(*c); cl.SetSigmaY2(fErrorY2); cl.SetSigmaZ2(fErrorZ2);
531 if (!AliTPCtrack::Update(&cl,chisq,index)) return kFALSE;
533 if (fCMeanSigmaY2p30<0){
534 fCMeanSigmaY2p30= c->GetSigmaY2(); //! current mean sigma Y2 - mean30%
535 fCMeanSigmaZ2p30= c->GetSigmaZ2(); //! current mean sigma Z2 - mean30%
536 fCMeanSigmaY2p30R = 1; //! current mean sigma Y2 - mean5%
537 fCMeanSigmaZ2p30R = 1; //! current mean sigma Z2 - mean5%
540 fCMeanSigmaY2p30= 0.70*fCMeanSigmaY2p30 +0.30*c->GetSigmaY2();
541 fCMeanSigmaZ2p30= 0.70*fCMeanSigmaZ2p30 +0.30*c->GetSigmaZ2();
542 if (fCurrentSigmaY2>0){
543 fCMeanSigmaY2p30R = 0.7*fCMeanSigmaY2p30R +0.3*c->GetSigmaY2()/fCurrentSigmaY2;
544 fCMeanSigmaZ2p30R = 0.7*fCMeanSigmaZ2p30R +0.3*c->GetSigmaZ2()/fCurrentSigmaZ2;
548 SetClusterIndex(n,idx); // restore the current cluster index
554 //_____________________________________________________________________________
555 Float_t AliTPCseed::CookdEdx(Double_t low, Double_t up,Int_t i1, Int_t i2, Bool_t onlyused) {
556 //-----------------------------------------------------------------
557 // This funtion calculates dE/dX within the "low" and "up" cuts.
558 //-----------------------------------------------------------------
561 Float_t angular[200];
565 Float_t meanlog = 100.;
567 Float_t mean[4] = {0,0,0,0};
568 Float_t sigma[4] = {1000,1000,1000,1000};
569 Int_t nc[4] = {0,0,0,0};
570 Float_t norm[4] = {1000,1000,1000,1000};
575 for (Int_t of =0; of<4; of++){
576 for (Int_t i=of+i1;i<i2;i+=4)
578 Int_t index = fIndex[i];
579 if (index<0||index&0x8000) continue;
581 //AliTPCTrackPoint * point = (AliTPCTrackPoint *) arr.At(i);
582 AliTPCTrackerPoint * point = GetTrackPoint(i);
583 //AliTPCTrackerPoint * pointm = GetTrackPoint(i-1);
584 //AliTPCTrackerPoint * pointp = 0;
585 //if (i<159) pointp = GetTrackPoint(i+1);
587 if (point==0) continue;
588 AliTPCclusterMI * cl = fClusterPointer[i];
590 if (onlyused && (!cl->IsUsed(10))) continue;
591 if (cl->IsUsed(11)) {
595 Int_t type = cl->GetType();
596 //if (point->fIsShared){
601 // if (pointm->fIsShared) continue;
603 // if (pointp->fIsShared) continue;
605 if (type<0) continue;
606 //if (type>10) continue;
607 //if (point->GetErrY()==0) continue;
608 //if (point->GetErrZ()==0) continue;
610 //Float_t ddy = (point->GetY()-cl->GetY())/point->GetErrY();
611 //Float_t ddz = (point->GetZ()-cl->GetZ())/point->GetErrZ();
612 //if ((ddy*ddy+ddz*ddz)>10) continue;
615 // if (point->GetCPoint().GetMax()<5) continue;
616 if (cl->GetMax()<5) continue;
617 Float_t angley = point->GetAngleY();
618 Float_t anglez = point->GetAngleZ();
620 Float_t rsigmay2 = point->GetSigmaY();
621 Float_t rsigmaz2 = point->GetSigmaZ();
625 rsigmay += pointm->GetTPoint().GetSigmaY();
626 rsigmaz += pointm->GetTPoint().GetSigmaZ();
630 rsigmay += pointp->GetTPoint().GetSigmaY();
631 rsigmaz += pointp->GetTPoint().GetSigmaZ();
638 Float_t rsigma = TMath::Sqrt(rsigmay2*rsigmaz2);
640 Float_t ampc = 0; // normalization to the number of electrons
642 // ampc = 1.*point->GetCPoint().GetMax();
643 ampc = 1.*cl->GetMax();
644 //ampc = 1.*point->GetCPoint().GetQ();
645 // AliTPCClusterPoint & p = point->GetCPoint();
646 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.6)) - TMath::Abs(p.GetY()/0.6)+0.5);
647 // Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
649 // TMath::Abs( Int_t(iz) - iz + 0.5);
650 //ampc *= 1.15*(1-0.3*dy);
651 //ampc *= 1.15*(1-0.3*dz);
652 // Float_t zfactor = (AliTPCReconstructor::GetCtgRange()-0.0004*TMath::Abs(point->GetCPoint().GetZ()));
656 //ampc = 1.0*point->GetCPoint().GetMax();
657 ampc = 1.0*cl->GetMax();
658 //ampc = 1.0*point->GetCPoint().GetQ();
659 //AliTPCClusterPoint & p = point->GetCPoint();
660 // Float_t dy = TMath::Abs(Int_t( TMath::Abs(p.GetY()/0.4)) - TMath::Abs(p.GetY()/0.4)+0.5);
661 //Float_t iz = (250.0-TMath::Abs(p.GetZ())+0.11)/0.566;
663 // TMath::Abs( Int_t(iz) - iz + 0.5);
665 //ampc *= 1.15*(1-0.3*dy);
666 //ampc *= 1.15*(1-0.3*dz);
667 // Float_t zfactor = (1.02-0.000*TMath::Abs(point->GetCPoint().GetZ()));
671 ampc *= 2.0; // put mean value to channel 50
672 //ampc *= 0.58; // put mean value to channel 50
674 // if (type>0) w = 1./(type/2.-0.5);
675 // Float_t z = TMath::Abs(cl->GetZ());
678 //ampc /= (1+0.0008*z);
682 //ampc /= (1+0.0008*z);
684 //ampc /= (1+0.0008*z);
687 if (type<0) { //amp at the border - lower weight
692 if (rsigma>1.5) ampc/=1.3; // if big backround
694 angular[nc[of]] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
699 TMath::Sort(nc[of],amp,index,kFALSE);
703 //meanlog = amp[index[Int_t(nc[of]*0.33)]];
705 for (Int_t i=int(nc[of]*low+0.5);i<int(nc[of]*up+0.5);i++){
706 Float_t ampl = amp[index[i]]/angular[index[i]];
707 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
709 sumw += weight[index[i]];
710 sumamp += weight[index[i]]*ampl;
711 sumamp2 += weight[index[i]]*ampl*ampl;
712 norm[of] += angular[index[i]]*weight[index[i]];
719 mean[of] = sumamp/sumw;
720 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
722 sigma[of] = TMath::Sqrt(sigma[of]);
726 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
727 //mean *=(1-0.02*(sigma/(mean*0.17)-1.));
728 //mean *=(1-0.1*(norm-1.));
735 // mean[0]*= (1-0.05*(sigma[0]/(0.01+mean[1]*0.18)-1));
736 // mean[1]*= (1-0.05*(sigma[1]/(0.01+mean[0]*0.18)-1));
739 // dedx = (mean[0]* TMath::Sqrt((1.+nc[0]))+ mean[1]* TMath::Sqrt((1.+nc[1])) )/
740 // ( TMath::Sqrt((1.+nc[0]))+TMath::Sqrt((1.+nc[1])));
744 for (Int_t i =0;i<4;i++){
745 if (nc[i]>2&&nc[i]<1000){
746 dedx += mean[i] *nc[i];
747 fSdEdx += sigma[i]*(nc[i]-2);
748 fMAngular += norm[i] *nc[i];
753 fSDEDX[i] = sigma[i];
766 // Float_t dedx1 =dedx;
769 for (Int_t i =0;i<4;i++){
770 if (nc[i]>2&&nc[i]<1000){
771 mean[i] = mean[i]*(1-0.12*(sigma[i]/(fSdEdx)-1.));
772 dedx += mean[i] *nc[i];
783 Double_t AliTPCseed::Bethe(Double_t bg){
785 // This is the Bethe-Bloch function normalised to 1 at the minimum
790 bethe=(1.+ bg2)/bg2*(log(5940*bg2) - bg2/(1.+ bg2));
791 else // Density effect ( approximately :)
792 bethe=1.15*(1.+ bg2)/bg2*(log(3.5*5940*bg) - bg2/(1.+ bg2));
796 void AliTPCseed::CookPID()
799 // cook PID information according dEdx
801 Double_t fRange = 10.;
805 Int_t ns=AliPID::kSPECIES;
807 for (Int_t j=0; j<ns; j++) {
808 Double_t mass=AliPID::ParticleMass(j);
810 Double_t dedx=fdEdx/fMIP;
811 Double_t bethe=Bethe(mom/mass);
812 Double_t sigma=fRes*bethe;
814 if (TMath::Abs(dedx-bethe) > fRange*sigma) {
815 fTPCr[j]=TMath::Exp(-0.5*fRange*fRange)/sigma;
819 fTPCr[j]=TMath::Exp(-0.5*(dedx-bethe)*(dedx-bethe)/(sigma*sigma))/sigma;
827 for (Int_t j=0; j<ns; j++) {
828 fTPCr[j]/=sumr; //normalize
833 void AliTPCseed::CookdEdx2(Double_t low, Double_t up) {
834 //-----------------------------------------------------------------
835 // This funtion calculates dE/dX within the "low" and "up" cuts.
836 //-----------------------------------------------------------------
839 Float_t angular[200];
843 for (Int_t i=0;i<200;i++) inlimit[i]=kFALSE;
844 for (Int_t i=0;i<200;i++) amp[i]=10000;
845 for (Int_t i=0;i<200;i++) angular[i]= 1;;
849 Float_t meanlog = 100.;
850 Int_t indexde[4]={0,64,128,160};
857 Float_t mean[4] = {0,0,0,0};
858 Float_t sigma[4] = {1000,1000,1000,1000};
859 Int_t nc[4] = {0,0,0,0};
860 Float_t norm[4] = {1000,1000,1000,1000};
865 // for (Int_t of =0; of<3; of++){
866 // for (Int_t i=indexde[of];i<indexde[of+1];i++)
867 for (Int_t i =0; i<160;i++)
869 AliTPCTrackPoint * point = GetTrackPoint(i);
870 if (point==0) continue;
871 if (point->fIsShared){
875 Int_t type = point->GetCPoint().GetType();
876 if (type<0) continue;
877 if (point->GetCPoint().GetMax()<5) continue;
878 Float_t angley = point->GetTPoint().GetAngleY();
879 Float_t anglez = point->GetTPoint().GetAngleZ();
880 Float_t rsigmay = point->GetCPoint().GetSigmaY();
881 Float_t rsigmaz = point->GetCPoint().GetSigmaZ();
882 Float_t rsigma = TMath::Sqrt(rsigmay*rsigmaz);
884 Float_t ampc = 0; // normalization to the number of electrons
886 ampc = point->GetCPoint().GetMax();
889 ampc = point->GetCPoint().GetMax();
891 ampc *= 2.0; // put mean value to channel 50
892 // ampc *= 0.565; // put mean value to channel 50
895 Float_t z = TMath::Abs(point->GetCPoint().GetZ());
902 if (type<0) { //amp at the border - lower weight
905 if (rsigma>1.5) ampc/=1.3; // if big backround
906 angular[i] = TMath::Sqrt(1.+angley*angley+anglez*anglez);
907 amp[i] = ampc/angular[i];
912 TMath::Sort(159,amp,index,kFALSE);
913 for (Int_t i=int(anc*low+0.5);i<int(anc*up+0.5);i++){
914 inlimit[index[i]] = kTRUE; // take all clusters
917 // meanlog = amp[index[Int_t(anc*0.3)]];
919 for (Int_t of =0; of<3; of++){
923 for (Int_t i=indexde[of];i<indexde[of+1];i++)
925 if (inlimit[i]==kFALSE) continue;
926 Float_t ampl = amp[i];
928 ampl = meanlog*TMath::Log(1.+ampl/meanlog);
931 sumamp += weight[i]*ampl;
932 sumamp2 += weight[i]*ampl*ampl;
933 norm[of] += angular[i]*weight[i];
941 mean[of] = sumamp/sumw;
942 sigma[of] = sumamp2/sumw-mean[of]*mean[of];
944 sigma[of] = TMath::Sqrt(sigma[of]);
947 mean[of] = (TMath::Exp(mean[of]/meanlog)-1)*meanlog;
957 Float_t www[3] = {12.,14.,17.};
958 //Float_t www[3] = {1.,1.,1.};
960 for (Int_t i =0;i<3;i++){
961 if (nc[i]>2&&nc[i]<1000){
962 dedx += mean[i] *nc[i]*www[i]/sigma[i];
963 fSdEdx += sigma[i]*(nc[i]-2)*www[i]/sigma[i];
964 fMAngular += norm[i] *nc[i];
965 norm2 += nc[i]*www[i]/sigma[i];
966 norm3 += (nc[i]-2)*www[i]/sigma[i];
969 fSDEDX[i] = sigma[i];
982 // Float_t dedx1 =dedx;
986 for (Int_t i =0;i<3;i++){
987 if (nc[i]>2&&nc[i]<1000&&sigma[i]>3){
988 //mean[i] = mean[i]*(1+0.08*(sigma[i]/(fSdEdx)-1.));
989 dedx += mean[i] *(nc[i])/(sigma[i]);
990 norm4 += (nc[i])/(sigma[i]);
994 if (norm4>0) dedx /= norm4;
1004 Double_t AliTPCseed::GetYat(Double_t xk) const {
1005 //-----------------------------------------------------------------
1006 // This function calculates the Y-coordinate of a track at the plane x=xk.
1007 //-----------------------------------------------------------------
1008 if (TMath::Abs(GetSnp())>AliTPCReconstructor::GetMaxSnpTrack()) return 0.; //patch 01 jan 06
1009 Double_t c1=GetSnp(), r1=TMath::Sqrt(1.- c1*c1);
1010 Double_t c2=c1+GetC()*(xk-GetX());
1011 if (TMath::Abs(c2)>AliTPCReconstructor::GetMaxSnpTrack()) return 0;
1012 Double_t r2=TMath::Sqrt(1.- c2*c2);
1013 return GetY() + (xk-GetX())*(c1+c2)/(r1+r2);
1016 void AliTPCseed::SetClusterMapBit(int ibit, Bool_t state)
1018 fClusterMap[ibit] = state;
1020 Bool_t AliTPCseed::GetClusterMapBit(int ibit)
1022 return fClusterMap[ibit];
1024 void AliTPCseed::SetSharedMapBit(int ibit, Bool_t state)
1026 fSharedMap[ibit] = state;
1028 Bool_t AliTPCseed::GetSharedMapBit(int ibit)
1030 return fSharedMap[ibit];
1037 Float_t AliTPCseed::CookdEdxNorm(Double_t low, Double_t up, Int_t type, Int_t i1, Int_t i2, AliTPCCalPad * gainMap, Bool_t posNorm){
1040 // calculates dedx using the cluster
1041 // low - up specify trunc mean range - default form 0-0.7
1042 // type - 1 - max charge or 0- total charge in cluster
1043 // //2- max no corr 3- total+ correction
1044 // i1-i2 - the pad-row range used for calculation
1046 // normalization parametrization taken from AliTPCClusterParam
1048 AliTPCClusterParam * parcl = AliTPCClusterParam::Instance();
1049 if (!parcl) parcl = AliTPCcalibDB::Instance()->GetClusterParam();
1050 if (!parcl) return 0;
1056 const Float_t ktany = TMath::Tan(TMath::DegToRad()*10);
1057 const Float_t kedgey =4.;
1060 for (Int_t irow=i1; irow<i2; irow++){
1061 AliTPCclusterMI* cluster = GetClusterPointer(irow);
1062 if (!cluster) continue;
1063 if (TMath::Abs(cluster->GetY())>cluster->GetX()*ktany-kedgey) continue; // edge cluster
1064 Float_t charge= (type%2)? cluster->GetMax():cluster->GetQ();
1065 if (!gainMap) gainMap = AliTPCcalibDB::Instance()->GetDedxGainFactor();
1068 AliTPCCalROC * roc = gainMap->GetCalROC(cluster->GetDetector());
1069 if (irow < 63) { // IROC
1070 factor = roc->GetValue(irow, TMath::Nint(cluster->GetPad()))*1.55;
1072 factor = roc->GetValue(irow - 63, TMath::Nint(cluster->GetPad()));
1074 if (factor>0.5) charge/=factor;
1080 if (irow>62) ipad=1;
1081 if (irow>127) ipad=2;
1084 AliTPCTrackerPoint * point = GetTrackPoint(irow);
1085 Float_t ty = TMath::Abs(point->GetAngleY());
1086 Float_t tz = TMath::Abs(point->GetAngleZ());
1088 Float_t dr = (250.-TMath::Abs(cluster->GetZ()))/250.;
1089 corr = parcl->Qnorm(ipad,type,dr,ty,tz);
1091 amp[ncl]=charge/corr;
1096 corr = parcl->QnormPos(ipad,type, cluster->GetPad(),cluster->GetTimeBin(), cluster->GetZ(),
1097 cluster->GetSigmaY2(),cluster->GetSigmaZ2(),cluster->GetMax(),cluster->GetQ());
1102 amp[ncl] *= 2.0; // put mean value to channel 50
1104 amp[ncl] /= 0.65; // this we will take form OCDB
1113 if (type>3) return ncl;
1114 TMath::Sort(ncl,amp, indexes, kFALSE);
1116 if (ncl<10) return 0;
1120 Int_t icl0=TMath::Nint(ncl*low);
1121 Int_t icl1=TMath::Nint(ncl*up);
1122 for (Int_t icl=icl0; icl<icl1;icl++){
1123 suma+=amp[indexes[icl]];
1130 Double_t AliTPCseed::BetheMass(Double_t mass){
1132 // return bethe-bloch
1134 Float_t bg= P()/mass;
1135 const Double_t kp1=0.76176e-1;
1136 const Double_t kp2=10.632;
1137 const Double_t kp3=0.13279e-4;
1138 const Double_t kp4=1.8631;
1139 const Double_t kp5=1.9479;
1141 Double_t dbg = (Double_t) bg;
1143 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1145 Double_t aa = TMath::Power(beta,kp4);
1146 Double_t bb = TMath::Power(1./dbg,kp5);
1148 bb=TMath::Log(kp3+bb);
1150 return ((Float_t)((kp2-aa-bb)*kp1/aa));
1154 Float_t AliTPCseed::CookShape(Int_t type){
1158 //-----------------------------------------------------------------
1159 // This funtion calculates dE/dX within the "low" and "up" cuts.
1160 //-----------------------------------------------------------------
1163 for (Int_t i =0; i<160;i++) {
1164 AliTPCTrackerPoint * point = GetTrackPoint(i);
1165 if (point==0) continue;
1167 AliTPCclusterMI * cl = fClusterPointer[i];
1168 if (cl==0) continue;
1170 Float_t rsigmay = TMath::Sqrt(point->GetSigmaY());
1171 Float_t rsigmaz = TMath::Sqrt(point->GetSigmaZ());
1172 Float_t rsigma = (rsigmay+rsigmaz)*0.5;
1173 if (type==0) means+=rsigma;
1174 if (type==1) means+=rsigmay;
1175 if (type==2) means+=rsigmaz;
1178 Float_t mean = (meanc>0)? means/meanc:0;