LCOV - code coverage report
Current view: top level - TPC/TPCrec - AliTPCtrack.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 242 286 84.6 %
Date: 2016-06-14 17:26:59 Functions: 10 18 55.6 %

          Line data    Source code
       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             : /* $Id$ */
      17             : 
      18             : //-----------------------------------------------------------------
      19             : //           Implementation of the TPC track class
      20             : //        This class is used by the AliTPCtracker class
      21             : //      Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch
      22             : //-----------------------------------------------------------------
      23             : 
      24             : #include <Riostream.h>
      25             : 
      26             : #include "AliTPCtrack.h"
      27             : #include "AliCluster.h"
      28             : #include "AliTracker.h"
      29             : #include "AliESDtrack.h"
      30             : #include "AliESDVertex.h"
      31             : #include "TTreeStream.h"
      32             : #include  "AliTPCRecoParam.h"
      33             : #include  "AliTPCReconstructor.h"
      34          16 : ClassImp(AliTPCtrack)
      35             : 
      36             : //_________________________________________________________________________
      37             : AliTPCtrack::AliTPCtrack(): 
      38       14838 :   AliKalmanTrack(),
      39       14838 :   fdEdx(0),
      40       14838 :   fSdEdx(1e10),
      41       14838 :   fNFoundable(0),
      42       14838 :   fBConstrain(kFALSE),
      43       14838 :   fLastPoint(-1),
      44       14838 :   fFirstPoint(-1),
      45       14838 :   fRemoval(0),
      46       14838 :   fTrackType(0),
      47       14838 :   fLab2(-1),
      48       14838 :   fNShared(0),
      49       14838 :   fReference()
      50       44514 : {
      51             :   //-------------------------------------------------
      52             :   // default constructor
      53             :   //-------------------------------------------------
      54     4748160 :   for (Int_t i=kMaxRow;i--;) fIndex[i]=-2;
      55      148380 :   for (Int_t i=0; i<4;i++) fPoints[i]=0.;
      56      385788 :   for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.;
      57      118704 :   for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0;
      58      118704 :   for (Int_t i=0; i<3;i++) fV0Indexes[i]=0;
      59       14838 : }
      60             : 
      61             : //_________________________________________________________________________
      62             : 
      63             : 
      64             : 
      65             : AliTPCtrack::AliTPCtrack(Double_t x, Double_t alpha, const Double_t p[5],
      66             :                          const Double_t cov[15], Int_t index) :
      67         700 :   AliKalmanTrack(),
      68         700 :   fdEdx(0),
      69         700 :   fSdEdx(1e10),
      70         700 :   fNFoundable(0),
      71         700 :   fBConstrain(kFALSE),
      72         700 :   fLastPoint(0),
      73         700 :   fFirstPoint(0),
      74         700 :   fRemoval(0),
      75         700 :   fTrackType(0),
      76         700 :   fLab2(0),
      77         700 :   fNShared(0),
      78         700 :   fReference()
      79        2100 : {
      80             :   //-----------------------------------------------------------------
      81             :   // This is the main track constructor.
      82             :   //-----------------------------------------------------------------
      83        1400 :   Double_t cnv=1./(AliTracker::GetBz()*kB2C); // RS: avoid extra field calculations
      84             : 
      85        4200 :   Double_t pp[5]={
      86         700 :     p[0],
      87         700 :     p[1],
      88         700 :     x*p[4] - p[2],
      89         700 :     p[3],
      90         700 :     p[4]*cnv
      91             :   };
      92             : 
      93         700 :   Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[5];
      94         700 :   Double_t c32 = x*cov[13] - cov[8];
      95         700 :   Double_t c20 = x*cov[10] - cov[3], 
      96         700 :            c21 = x*cov[11] - cov[4], c42 = x*cov[14] - cov[12];
      97             : 
      98        8400 :   Double_t cc[15]={
      99         700 :     cov[0 ],
     100        1400 :     cov[1 ],     cov[2 ],
     101             :     c20,         c21,         c22,
     102        2100 :     cov[6 ],     cov[7 ],     c32,     cov[9 ],
     103        3500 :     cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv
     104             :   };
     105             : 
     106         700 :   Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
     107         700 :   Double_t p0=TMath::Sign(1/mostProbablePt,pp[4]);
     108         700 :   Double_t w0=cc[14]/(cc[14] + p0*p0), w1=p0*p0/(cc[14] + p0*p0);
     109         700 :   pp[4] = w0*p0 + w1*pp[4]; 
     110         700 :   cc[10]*=w1; cc[11]*=w1; cc[12]*=w1; cc[13]*=w1; cc[14]*=w1;
     111             : 
     112         700 :   Set(x,alpha,pp,cc);
     113             : 
     114         700 :   SetNumberOfClusters(1);
     115             :   
     116         700 :   fIndex[0]=index;
     117      222600 :   for (Int_t i=1; i<kMaxRow;i++) fIndex[i]=-2;
     118        7000 :   for (Int_t i=0; i<4;i++) fPoints[i]=0.;
     119       18200 :   for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.;
     120        5600 :   for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0;
     121        5600 :   for (Int_t i=0; i<3;i++) fV0Indexes[i]=0;
     122         700 : }
     123             : 
     124             : //_____________________________________________________________________________
     125             : AliTPCtrack::AliTPCtrack(const AliESDtrack& t, TTreeSRedirector *pcstream) :
     126         272 :   AliKalmanTrack(),
     127         544 :   fdEdx(t.GetTPCsignal()),
     128         272 :   fSdEdx(1e10),
     129         272 :   fNFoundable(0),
     130         272 :   fBConstrain(kFALSE),
     131         272 :   fLastPoint(0),
     132         272 :   fFirstPoint(0),
     133         272 :   fRemoval(0),
     134         272 :   fTrackType(0),
     135         272 :   fLab2(0),
     136         272 :   fNShared(0),
     137         272 :   fReference()
     138        1360 : {
     139             :   //-----------------------------------------------------------------
     140             :   // Conversion AliESDtrack -> AliTPCtrack.
     141             :   //-----------------------------------------------------------------
     142             :   const Double_t kmaxC[4]={10,10,0.1,0.1};  // cuts on the rms /fP0,fP1,fP2,fP3
     143             :   const double kMatLarge[15]={
     144             :     25.,
     145             :     0.,25.,
     146             :     0.,0.,0.5,
     147             :     0.,0.,0.,0.5,
     148             :     0.,0.,0.,0.,1.0};
     149         544 :   SetNumberOfClusters(t.GetTPCclusters(fIndex));
     150         544 :   SetLabel(t.GetLabel());
     151         544 :   SetMass(t.GetMassForTracking());
     152        2720 :   for (Int_t i=0; i<4;i++) fPoints[i]=0.;
     153        7072 :   for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.;
     154        2176 :   for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0;
     155        2176 :   for (Int_t i=0; i<3;i++) fV0Indexes[i]=0;
     156             :   //
     157             :   // choose parameters to start
     158             :   //
     159         272 :   const AliTPCRecoParam * recoParam = AliTPCReconstructor::GetRecoParam();
     160         272 :   Int_t reject=0;
     161         272 :   AliExternalTrackParam param(t);
     162             : 
     163         816 :   const AliExternalTrackParam  *tpcout=(t.GetFriendTrack())? ((AliESDfriendTrack*)(t.GetFriendTrack()))->GetTPCOut():0;
     164         272 :   const AliExternalTrackParam  *tpcin = t.GetInnerParam();
     165         272 :   const AliExternalTrackParam  *tpc=(tpcout)?tpcout:tpcin;
     166         272 :   Bool_t isBackProp = tpcout==0; // is this backpropagation?
     167         272 :   if (!tpc) tpc=&param;
     168             : 
     169         272 :   Bool_t isOK = 
     170         272 :     (recoParam->GetUseOuterDetectors() && t.IsOn(AliESDtrack::kTRDrefit)) || 
     171         410 :     (isBackProp && t.IsOn(AliESDtrack::kITSout));
     172         354 :   if (isOK && 
     173          82 :       (param.GetCovariance()[0]>kmaxC[0]*kmaxC[0] ||
     174          82 :        param.GetCovariance()[2]>kmaxC[1]*kmaxC[1] ||
     175          82 :        param.GetCovariance()[5]>kmaxC[2]*kmaxC[2] ||
     176          82 :        param.GetCovariance()[9]>kmaxC[3]*kmaxC[3])
     177           0 :       ) isOK=kFALSE;
     178             :   //
     179         518 :   if (isOK) isOK &= param.Rotate(tpc->GetAlpha()); // using external seed
     180         272 :   Double_t oldX=param.GetX(),  oldY=param.GetY(),  oldZ=param.GetZ();
     181         272 :   if (!isOK ){
     182         190 :     param=*tpc;
     183             :     isOK=kTRUE;
     184         190 :     reject=1;
     185         190 :   }
     186             :   else { // using external seed
     187             :     //  param.Rotate(tpc->GetAlpha()); // not needed
     188         328 :     if (!AliTracker::PropagateTrackToBxByBz(&param,tpc->GetX(),GetMass(),2.,kFALSE) ||
     189          82 :         param.GetCovariance()[0]>kmaxC[0]*kmaxC[0] ||
     190          82 :         param.GetCovariance()[2]>kmaxC[1]*kmaxC[1] ||
     191          82 :         param.GetCovariance()[5]>kmaxC[2]*kmaxC[2] ||
     192          82 :         param.GetCovariance()[9]>kmaxC[3]*kmaxC[3]) isOK=kFALSE;
     193             :   }
     194         272 :   if (isOK) {
     195         272 :     Double_t chi2= param.GetPredictedChi2(tpc);
     196         272 :     if (isBackProp) {
     197         140 :       if (chi2>recoParam->GetMaxChi2TPCITS()) isOK=kFALSE; // protection against outliers in the ITS
     198             :     }
     199         134 :     else if (chi2>recoParam->GetMaxChi2TPCTRD()) isOK=kFALSE; // protection against outliers in the TRD
     200         272 :   }
     201             : 
     202         272 :   if (!isOK){
     203           2 :     param=*tpc;
     204             :     isOK=kTRUE;
     205           2 :     reject=2;
     206           2 :   }
     207         272 :   if (reject>0){
     208             :     //    param.ResetCovariance(4.);  // reset covariance if start from backup param
     209         192 :     double *cov = (double*)param.GetCovariance(); // reset matrix
     210         192 :     memcpy(cov,kMatLarge,15*sizeof(double));
     211         192 :     double ep4 = param.GetParameter()[4]*kMatLarge[14];
     212         192 :     cov[14] = ep4*ep4;
     213         192 :   }
     214             :   //
     215             :   //
     216         272 :   if (pcstream){
     217           0 :     AliExternalTrackParam dummy;
     218             :     AliExternalTrackParam *ptpc=(AliExternalTrackParam *)tpc;
     219             :     //    if (!ptpc) ptpc=&dummy;
     220             :     AliESDtrack *esd= (AliESDtrack *)&t;
     221           0 :     (*pcstream)<<"trackP"<<
     222           0 :       "reject="<<reject<<   // flag - rejection of current esd track parameters
     223           0 :       "esd.="<<esd<<        // original esd track
     224           0 :       "tr.="<<&param<<      // starting track parameters
     225           0 :       "out.="<<ptpc<<       // backup tpc parameters
     226             :       "\n";
     227           0 :   }
     228             : 
     229         272 :   Set(param.GetX(),param.GetAlpha(),param.GetParameter(),param.GetCovariance());
     230             : 
     231         544 :   if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return;
     232         272 :   StartTimeIntegral();
     233         272 :   Double_t times[AliPID::kSPECIESC]; 
     234         272 :   t.GetIntegratedTimes(times,AliPID::kSPECIESC); 
     235         272 :   SetIntegratedTimes(times);
     236         544 :   SetIntegratedLength(t.GetIntegratedLength());
     237             : 
     238         544 :   if (GetX()>oldX) {
     239         328 :      Double_t dX=GetX()-oldX, dY=GetY()-oldY, dZ=GetZ()-oldZ;
     240          82 :      Double_t d=TMath::Sqrt(dX*dX + dY*dY + dZ*dZ);
     241          82 :      AddTimeStep(d);
     242          82 :   }
     243         816 : }
     244             : 
     245             : //_____________________________________________________________________________
     246             : AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) :
     247         436 :   AliKalmanTrack(t),
     248         436 :   fdEdx(t.fdEdx),
     249         436 :   fSdEdx(t.fSdEdx),
     250         436 :   fNFoundable(t.fNFoundable),
     251         436 :   fBConstrain(t.fBConstrain),
     252         436 :   fLastPoint(t.fLastPoint),
     253         436 :   fFirstPoint(t.fFirstPoint),
     254         436 :   fRemoval(t.fRemoval),
     255         436 :   fTrackType(t.fTrackType),
     256         436 :   fLab2(t.fLab2),
     257         436 :   fNShared(t.fNShared),
     258         436 :   fReference(t.fReference)
     259             : 
     260        1308 : {
     261             :   //-----------------------------------------------------------------
     262             :   // This is a track copy constructor.
     263             :   //-----------------------------------------------------------------
     264        1744 :   Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance());
     265             : 
     266      139520 :   for (Int_t i=kMaxRow; i--;) fIndex[i]=t.fIndex[i];
     267        4360 :   for (Int_t i=0; i<4;i++) fPoints[i]=t.fPoints[i];
     268       11336 :   for (Int_t i=0; i<12;i++) fKinkPoint[i]=t.fKinkPoint[i];
     269        3488 :   for (Int_t i=0; i<3;i++) fKinkIndexes[i]=t.fKinkIndexes[i];
     270        3488 :   for (Int_t i=0; i<3;i++) fV0Indexes[i]=t.fV0Indexes[i];
     271         436 : }
     272             : 
     273             : AliTPCtrack& AliTPCtrack::operator=(const AliTPCtrack& o){
     274        8472 :   if(this!=&o){
     275        4236 :     AliKalmanTrack::operator=(o);
     276        4236 :     fdEdx = o.fdEdx;
     277        4236 :     memcpy(fIndex,o.fIndex,kMaxRow*sizeof(Int_t));
     278       42360 :     for(Int_t i = 0;i<4;++i)fPoints[i] = o.fPoints[i];
     279        4236 :     fSdEdx = o.fSdEdx;
     280        4236 :     fNFoundable = o.fNFoundable;
     281        4236 :     fBConstrain = o.fBConstrain;
     282        4236 :     fLastPoint  = o.fLastPoint;
     283        4236 :     fFirstPoint = o.fFirstPoint;
     284        4236 :     fTrackType  = o.fTrackType;
     285        4236 :     fLab2       = o.fLab2;
     286        4236 :     fNShared    = o.fNShared;
     287        4236 :     fReference  = o.fReference;
     288      110136 :     for(Int_t i = 0;i<12;++i) fKinkPoint[i] = o.fKinkPoint[i];
     289             : 
     290       33888 :     for(Int_t i = 0;i<3;++i){
     291       12708 :       fKinkIndexes[i] = o.fKinkIndexes[i];
     292       12708 :       fV0Indexes[i] = o.fV0Indexes[i];
     293             :     }
     294        4236 :   }
     295        4236 :   return *this;
     296             : 
     297             : }
     298             : 
     299             : 
     300             : //_____________________________________________________________________________
     301             : Int_t AliTPCtrack::Compare(const TObject *o) const {
     302             :   //-----------------------------------------------------------------
     303             :   // This function compares tracks according to the their curvature
     304             :   //-----------------------------------------------------------------
     305           0 :   AliTPCtrack *t=(AliTPCtrack*)o;
     306             :   //Double_t co=t->OneOverPt();
     307             :   //Double_t c = OneOverPt();
     308           0 :   Double_t co=t->GetSigmaY2()*t->GetSigmaZ2();
     309           0 :   Double_t c =GetSigmaY2()*GetSigmaZ2();
     310           0 :   if (c>co) return 1;
     311           0 :   else if (c<co) return -1;
     312           0 :   return 0;
     313           0 : }
     314             : 
     315             : Double_t AliTPCtrack::GetPredictedChi2(const AliCluster *c) const {
     316             :   //-----------------------------------------------------------------
     317             :   // This function calculates a predicted chi2 increment.
     318             :   //-----------------------------------------------------------------
     319           0 :   Double_t p[2]={c->GetY(), c->GetZ()};
     320           0 :   Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()};
     321           0 :   return AliExternalTrackParam::GetPredictedChi2(p,cov);
     322           0 : }
     323             : 
     324             : //_____________________________________________________________________________
     325             : Bool_t AliTPCtrack::PropagateTo(Double_t xk,Double_t rho,Double_t x0) {
     326             :   //-----------------------------------------------------------------
     327             :   //  This function propagates a track to a reference plane x=xk.
     328             :   //  rho - density of the crossed matrial (g/cm^3)
     329             :   //  x0  - radiation length of the crossed material (g/cm^2) 
     330             :   //-----------------------------------------------------------------
     331             :   //
     332             :   const double kTinyDist = 10e-4; // neglect this distance
     333             :   const double kSmallDist = 0.5;  // use bz only for this distance
     334      235572 :   Double_t oldX=GetX(),dxa = TMath::Abs(oldX-xk);
     335      117796 :   if (dxa<kTinyDist) return kTRUE;
     336             :   //
     337      117776 :   Double_t bz=AliTracker::GetBz(); //RS: avoid extra field calculations for crude checks
     338      117776 :   Double_t zat=0;
     339      117852 :   if (!GetZAt(xk, bz,zat)) return kFALSE;
     340      117700 :   if (TMath::Abs(zat)>250.){
     341             :     // Don't propagate track outside of the fiducial volume - material budget not proper one
     342             :     //
     343             :     //AliWarning("Propagate outside of fiducial volume");
     344         516 :     return kFALSE;
     345             :   }
     346      117184 :   Double_t oldY=GetY(), oldZ=GetZ();
     347             :   //RS: if track is very close to cluster, use bz prolongation only
     348             :   //if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE;
     349      117184 :   if (dxa>kSmallDist) {
     350      116886 :     Double_t b[3]; GetBxByBz(b);
     351      116886 :     if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE;
     352      233772 :   }
     353             :   else {
     354         298 :     if (!AliExternalTrackParam::PropagateTo(xk,GetBz())) return kFALSE; // field at point
     355             :   }
     356      351552 :   Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + 
     357      234368 :                            (GetY()-oldY)*(GetY()-oldY) + 
     358      117184 :                            (GetZ()-oldZ)*(GetZ()-oldZ));
     359      171572 :   if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d);
     360             : 
     361      153698 :   if (oldX < xk) d = -d;
     362      117184 :   if (!AliExternalTrackParam::CorrectForMeanMaterial(d*rho/x0,d*rho,GetMass(),
     363           0 :       kFALSE,AliExternalTrackParam::BetheBlochGas)) return kFALSE;
     364             : 
     365      117184 :   return kTRUE;
     366      235562 : }
     367             : 
     368             : //_____________________________________________________________________________
     369             : Bool_t 
     370             : AliTPCtrack::PropagateToVertex(const AliESDVertex *v,Double_t rho,Double_t x0) 
     371             : {
     372             :   //-----------------------------------------------------------------
     373             :   // This function propagates tracks to the vertex
     374             :   // rho - density of the crossed matrial (g/cm3)
     375             :   // x0  - radiation length of the crossed material (g/cm2) 
     376             :   //-----------------------------------------------------------------
     377           0 :   Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ();
     378             : 
     379             :   //Double_t bz=GetBz();
     380             :   //if (!PropagateToDCA(v,bz,kVeryBig)) return kFALSE;
     381           0 :   Double_t b[3]; GetBxByBz(b);
     382           0 :   if (!PropagateToDCABxByBz(v,b,kVeryBig)) return kFALSE;
     383             : 
     384           0 :   Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + 
     385           0 :                            (GetY()-oldY)*(GetY()-oldY) + 
     386           0 :                            (GetZ()-oldZ)*(GetZ()-oldZ));
     387             : 
     388           0 :   if (oldX < GetX()) d = -d;
     389           0 :   if (!AliExternalTrackParam::CorrectForMeanMaterial(d*rho/x0,d*rho,GetMass(),
     390           0 :       kFALSE,AliExternalTrackParam::BetheBlochGas)) return kFALSE;
     391             : 
     392           0 :   return kTRUE;
     393           0 : }
     394             : 
     395             : //_____________________________________________________________________________
     396             : Bool_t AliTPCtrack::Update(const AliCluster *c, Double_t chisq, Int_t index) {
     397             :   //-----------------------------------------------------------------
     398             :   // This function associates a cluster with this track.
     399             :   //-----------------------------------------------------------------
     400      198496 :   Double_t p[2]={c->GetY(), c->GetZ()};
     401       99248 :   Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()};
     402             : 
     403       99250 :   if (!AliExternalTrackParam::Update(p,cov)) return kFALSE;
     404             : 
     405       99246 :   AliTracker::FillResiduals(this,p,cov,c->GetVolumeId());
     406             : 
     407       99246 :   Int_t n=GetNumberOfClusters();
     408       99246 :   fIndex[n]=index;
     409       99246 :   SetNumberOfClusters(n+1);
     410       99246 :   SetChi2(GetChi2()+chisq);
     411             : 
     412             :   return kTRUE;
     413       99248 : }
     414             : 
     415             : ////////////////////////////////////////////////////////////////////////
     416             : // MI ADDITION
     417             : 
     418             : Float_t AliTPCtrack::Density(Int_t row0, Int_t row1)
     419             : {
     420             :   //
     421             :   // calculate cluster density
     422             :   Int_t good  = 0;
     423             :   Int_t found = 0;
     424             :   //if (row0<fFirstPoint) row0 = fFirstPoint;
     425           0 :   if (row1>fLastPoint) row1 = fLastPoint;
     426             : 
     427             :   
     428           0 :   for (Int_t i=row0;i<=row1;i++){ 
     429             :     //    Int_t index = fClusterIndex[i];
     430           0 :     Int_t index = fIndex[i];
     431           0 :     if (index!=-1)  good++;
     432           0 :     if (index>0)    found++;
     433             :   }
     434             :   Float_t density=0;
     435           0 :   if (good>0) density = Float_t(found)/Float_t(good);
     436           0 :   return density;
     437             : }
     438             : 
     439             : 
     440             : Float_t AliTPCtrack::Density2(Int_t row0, Int_t row1)
     441             : {
     442             :   //
     443             :   // calculate cluster density
     444             :   Int_t good  = 0;
     445             :   Int_t found = 0;
     446             :   //  
     447           0 :   for (Int_t i=row0;i<=row1;i++){     
     448           0 :     Int_t index = fIndex[i];
     449           0 :     if (index!=-1)  good++;
     450           0 :     if (index>0)    found++;
     451             :   }
     452             :   Float_t density=0;
     453           0 :   if (good>0) density = Float_t(found)/Float_t(good);
     454           0 :   return density;
     455             : }
     456             : 
     457             : void  AliTPCtrack::UpdatePoints()
     458             : {
     459             :   //--------------------------------------------------
     460             :   //calculates first ,amx dens and last points
     461             :   //--------------------------------------------------
     462        3592 :   Float_t density[kMaxRow];
     463      574720 :   for (Int_t i=kMaxRow;i--;) density[i]=-1.;
     464        1796 :   fPoints[0]= kMaxRow;
     465        1796 :   fPoints[1] = -1;
     466             :   //
     467             :   Int_t ngood=0;
     468             :   Int_t undeff=0;
     469             :   Int_t nall =0;
     470             :   Int_t range=20;
     471      574720 :   for (Int_t i=0;i<kMaxRow;i++){
     472      285564 :     Int_t last = i-range;
     473      321484 :     if (nall<range) nall++;
     474      285564 :     if (last>=0){
     475      630920 :       if (fIndex[last]>0&& (fIndex[last]&0x8000)==0) ngood--;
     476      261536 :       if (fIndex[last]==-1) undeff--;
     477             :     }
     478      716140 :     if (fIndex[i]>0&& (fIndex[i]&0x8000)==0)   ngood++;
     479      298710 :     if (fIndex[i]==-1) undeff++;
     480      781194 :     if (nall==range &&undeff<range/2) density[i-range/2] = Float_t(ngood)/Float_t(nall-undeff);
     481             :   }
     482             :   Float_t maxdens=0;
     483             :   Int_t indexmax =0;
     484      574720 :   for (Int_t i=0;i<kMaxRow;i++){
     485      285564 :     if (density[i]<0) continue;
     486      244190 :     if (density[i]>maxdens){
     487             :       maxdens=density[i];
     488             :       indexmax=i;
     489        9520 :     }
     490             :   }
     491             :   //
     492             :   //max dens point
     493        1796 :   fPoints[3] = maxdens;
     494        1796 :   fPoints[1] = indexmax;
     495             :   //
     496             :   // last point
     497      308706 :   for (Int_t i=indexmax;i<kMaxRow;i++){
     498      152388 :     if (density[i]<0) continue;
     499      134606 :     if (density[i]<maxdens/2.) {
     500         486 :       break;
     501             :     }
     502      134120 :     fPoints[2]=i;
     503      134120 :   }
     504             :   //
     505             :   // first point
     506      173504 :   for (Int_t i=indexmax;i>0;i--){
     507       84478 :     if (density[i]<0) continue;
     508       70058 :     if (density[i]<maxdens/2.) {
     509         280 :       break;
     510             :     }
     511       69778 :     fPoints[0]=i;
     512       69778 :   }
     513             :   //
     514        1796 : }
     515             : 

Generated by: LCOV version 1.11