/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id$ */ //----------------------------------------------------------------- // Implementation of the TPC track class // This class is used by the AliTPCtracker class // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch //----------------------------------------------------------------- #include #include "AliTPCtrack.h" #include "AliCluster.h" #include "AliTracker.h" #include "AliESDtrack.h" #include "AliESDVertex.h" #include "TTreeStream.h" #include "AliTPCRecoParam.h" #include "AliTPCReconstructor.h" ClassImp(AliTPCtrack) //_________________________________________________________________________ AliTPCtrack::AliTPCtrack(): AliKalmanTrack(), fdEdx(0), fSdEdx(1e10), fNFoundable(0), fBConstrain(kFALSE), fLastPoint(-1), fFirstPoint(-1), fRemoval(0), fTrackType(0), fLab2(-1), fNShared(0), fReference() { //------------------------------------------------- // default constructor //------------------------------------------------- for (Int_t i=0; i AliTPCtrack. //----------------------------------------------------------------- const Double_t kmaxC[4]={10,10,0.1,0.1}; // cuts on the rms /fP0,fP1,fP2,fP3 SetNumberOfClusters(t.GetTPCclusters(fIndex)); SetLabel(t.GetLabel()); SetMass(t.GetMass()); for (Int_t i=0; i<4;i++) fPoints[i]=0.; for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.; for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0; for (Int_t i=0; i<3;i++) fV0Indexes[i]=0; // // choose parameters to start // const AliTPCRecoParam * recoParam = AliTPCReconstructor::GetRecoParam(); Int_t reject=0; AliExternalTrackParam param(t); const AliExternalTrackParam *tpcout=(t.GetFriendTrack())? ((AliESDfriendTrack*)(t.GetFriendTrack()))->GetTPCOut():0; const AliExternalTrackParam *tpcin = t.GetInnerParam(); const AliExternalTrackParam *tpc=(tpcout)?tpcout:tpcin; if (!tpc) tpc=¶m; Bool_t isOK=recoParam->GetUseOuterDetectors(); if (param.GetCovariance()[0]>kmaxC[0]*kmaxC[0]) isOK=kFALSE; if (param.GetCovariance()[2]>kmaxC[1]*kmaxC[1]) isOK=kFALSE; if (param.GetCovariance()[5]>kmaxC[2]*kmaxC[2]) isOK=kFALSE; if (param.GetCovariance()[9]>kmaxC[3]*kmaxC[3]) isOK=kFALSE; param.Rotate(tpc->GetAlpha()); Double_t oldX=param.GetX(), oldY=param.GetY(), oldZ=param.GetZ(); if (!isOK ){ param=*tpc; isOK=kTRUE; reject=1; } isOK=AliTracker::PropagateTrackToBxByBz(¶m,tpc->GetX(),t.GetMass(),2.,kFALSE); if (param.GetCovariance()[0]>kmaxC[0]*kmaxC[0]) isOK=kFALSE; if (param.GetCovariance()[2]>kmaxC[1]*kmaxC[1]) isOK=kFALSE; if (param.GetCovariance()[5]>kmaxC[2]*kmaxC[2]) isOK=kFALSE; if (param.GetCovariance()[9]>kmaxC[3]*kmaxC[3]) isOK=kFALSE; if (!isOK){ param=*tpc; isOK=kTRUE; reject=2; } if (reject>0){ param.ResetCovariance(4.); // reset covariance if start from backup param } // // if (pcstream){ AliExternalTrackParam dummy; AliExternalTrackParam *ptpc=(AliExternalTrackParam *)tpc; if (!ptpc) ptpc=&dummy; AliESDtrack *esd= (AliESDtrack *)&t; (*pcstream)<<"trackP"<< "reject="<oldX) { Double_t dX=GetX()-oldX, dY=GetY()-oldY, dZ=GetZ()-oldZ; Double_t d=TMath::Sqrt(dX*dX + dY*dY + dZ*dZ); AddTimeStep(d); } } //_____________________________________________________________________________ AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : AliKalmanTrack(t), fdEdx(t.fdEdx), fSdEdx(t.fSdEdx), fNFoundable(t.fNFoundable), fBConstrain(t.fBConstrain), fLastPoint(t.fLastPoint), fFirstPoint(t.fFirstPoint), fRemoval(t.fRemoval), fTrackType(t.fTrackType), fLab2(t.fLab2), fNShared(t.fNShared), fReference(t.fReference) { //----------------------------------------------------------------- // This is a track copy constructor. //----------------------------------------------------------------- Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance()); for (Int_t i=0; iOneOverPt(); //Double_t c = OneOverPt(); Double_t co=t->GetSigmaY2()*t->GetSigmaZ2(); Double_t c =GetSigmaY2()*GetSigmaZ2(); if (c>co) return 1; else if (cGetY(), c->GetZ()}; Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; return AliExternalTrackParam::GetPredictedChi2(p,cov); } //_____________________________________________________________________________ Bool_t AliTPCtrack::PropagateTo(Double_t xk,Double_t rho,Double_t x0) { //----------------------------------------------------------------- // This function propagates a track to a reference plane x=xk. // rho - density of the crossed matrial (g/cm^3) // x0 - radiation length of the crossed material (g/cm^2) //----------------------------------------------------------------- // Double_t bz=GetBz(); Double_t zat=0; if (!GetZAt(xk, bz,zat)) return kFALSE; if (TMath::Abs(zat)>250.){ // Don't propagate track outside of the fiducial volume - material budget not proper one // //AliWarning("Propagate outside of fiducial volume"); return kFALSE; } Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ(); //if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE; Double_t b[3]; GetBxByBz(b); if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE; Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + (GetY()-oldY)*(GetY()-oldY) + (GetZ()-oldZ)*(GetZ()-oldZ)); if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d); if (oldX < xk) d = -d; if (!AliExternalTrackParam::CorrectForMeanMaterial(d*rho/x0,d*rho,GetMass(), kFALSE,AliExternalTrackParam::BetheBlochGas)) return kFALSE; return kTRUE; } //_____________________________________________________________________________ Bool_t AliTPCtrack::PropagateToVertex(const AliESDVertex *v,Double_t rho,Double_t x0) { //----------------------------------------------------------------- // This function propagates tracks to the vertex // rho - density of the crossed matrial (g/cm3) // x0 - radiation length of the crossed material (g/cm2) //----------------------------------------------------------------- Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ(); //Double_t bz=GetBz(); //if (!PropagateToDCA(v,bz,kVeryBig)) return kFALSE; Double_t b[3]; GetBxByBz(b); if (!PropagateToDCABxByBz(v,b,kVeryBig)) return kFALSE; Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + (GetY()-oldY)*(GetY()-oldY) + (GetZ()-oldZ)*(GetZ()-oldZ)); if (oldX < GetX()) d = -d; if (!AliExternalTrackParam::CorrectForMeanMaterial(d*rho/x0,d*rho,GetMass(), kFALSE,AliExternalTrackParam::BetheBlochGas)) return kFALSE; return kTRUE; } //_____________________________________________________________________________ Bool_t AliTPCtrack::Update(const AliCluster *c, Double_t chisq, Int_t index) { //----------------------------------------------------------------- // This function associates a cluster with this track. //----------------------------------------------------------------- Double_t p[2]={c->GetY(), c->GetZ()}; Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; AliTracker::FillResiduals(this,p,cov,c->GetVolumeId()); Int_t n=GetNumberOfClusters(); fIndex[n]=index; SetNumberOfClusters(n+1); SetChi2(GetChi2()+chisq); return kTRUE; } //////////////////////////////////////////////////////////////////////// // MI ADDITION Float_t AliTPCtrack::Density(Int_t row0, Int_t row1) { // // calculate cluster density Int_t good = 0; Int_t found = 0; //if (row0fLastPoint) row1 = fLastPoint; for (Int_t i=row0;i<=row1;i++){ // Int_t index = fClusterIndex[i]; Int_t index = fIndex[i]; if (index!=-1) good++; if (index>0) found++; } Float_t density=0; if (good>0) density = Float_t(found)/Float_t(good); return density; } Float_t AliTPCtrack::Density2(Int_t row0, Int_t row1) { // // calculate cluster density Int_t good = 0; Int_t found = 0; // for (Int_t i=row0;i<=row1;i++){ Int_t index = fIndex[i]; if (index!=-1) good++; if (index>0) found++; } Float_t density=0; if (good>0) density = Float_t(found)/Float_t(good); return density; } void AliTPCtrack::UpdatePoints() { //-------------------------------------------------- //calculates first ,amx dens and last points //-------------------------------------------------- Float_t density[160]; for (Int_t i=0;i<160;i++) density[i]=-1.; fPoints[0]= 160; fPoints[1] = -1; // Int_t ngood=0; Int_t undeff=0; Int_t nall =0; Int_t range=20; for (Int_t i=0;i<160;i++){ Int_t last = i-range; if (nall=0){ if (fIndex[last]>0&& (fIndex[last]&0x8000)==0) ngood--; if (fIndex[last]==-1) undeff--; } if (fIndex[i]>0&& (fIndex[i]&0x8000)==0) ngood++; if (fIndex[i]==-1) undeff++; if (nall==range &&undeffmaxdens){ maxdens=density[i]; indexmax=i; } } // //max dens point fPoints[3] = maxdens; fPoints[1] = indexmax; // // last point for (Int_t i=indexmax;i<160;i++){ if (density[i]<0) continue; if (density[i]0;i--){ if (density[i]<0) continue; if (density[i]