X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliESDtrack.cxx;h=23e442bfe14ce4d1f01a8e8d4dcef7c8c7731ce7;hb=30bda8ef7270a200dfe2dcf55badbedb6d36a9ac;hp=44755fb2f59bc259f8bd170f0f49746a6e361ecc;hpb=1d303a24f9049d0ce998e03b8d0e3320affdcf6f;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliESDtrack.cxx b/STEER/AliESDtrack.cxx index 44755fb2f59..23e442bfe14 100644 --- a/STEER/AliESDtrack.cxx +++ b/STEER/AliESDtrack.cxx @@ -20,13 +20,14 @@ // e-mail: Jouri.Belikov@cern.ch //----------------------------------------------------------------- -#include "TMath.h" +#include +#include #include "AliESDVertex.h" #include "AliESDtrack.h" #include "AliKalmanTrack.h" -#include "AliTrackPointArray.h" #include "AliLog.h" +#include "AliTrackPointArray.h" ClassImp(AliESDtrack) @@ -73,10 +74,9 @@ AliESDtrack::AliESDtrack() : fOp(0), fITSchi2(0), fITSncls(0), + fITSClusterMap(0), fITSsignal(0), fITSLabel(0), - fITSFakeRatio(0), - fITStrack(0), fTPCchi2(0), fTPCncls(0), fTPCnclsF(0), @@ -92,59 +92,49 @@ AliESDtrack::AliESDtrack() : fTRDLabel(0), fTRDQuality(0), fTRDBudget(0), - fTRDtrack(0), fTOFchi2(0), fTOFindex(0), fTOFCalChannel(-1), fTOFsignal(-1), fTOFsignalToT(0), - // fPHOSsignal(-1), - fRICHchi2(1e10), - fRICHncls(0), - fRICHindex(0), - fRICHsignal(-1), - fRICHtheta(0), - fRICHphi(0), - fRICHdx(0), - fRICHdy(0), - fPoints(0) + fHMPIDchi2(1e10), + fHMPIDqn(-1), + fHMPIDcluIdx(-1), + fHMPIDsignal(-1), + fHMPIDtrkTheta(-1), + fHMPIDtrkPhi(-1), + fHMPIDtrkX(-1), + fHMPIDtrkY(-1), + fHMPIDmipX(-1), + fHMPIDmipY(-1), + fEMCALindex(kEMCALNoMatch), + fFriendTrack(new AliESDfriendTrack()) { // // The default ESD constructor // - for (Int_t i=0; iPhi()*180./TMath::Pi(); + if (alpha<0) alpha+= 360.; + if (alpha>360) alpha -= 360.; + + Int_t sector = (Int_t)(alpha/20.); + alpha = 10. + 20.*sector; + alpha /= 180; + alpha *= TMath::Pi(); + + // Covariance matrix: no errors, the parameters are exact + for (Int_t i=0; i<15; i++) covar[i]=0.; + + // Get the vertex of origin and the momentum + TVector3 ver(part->Vx(),part->Vy(),part->Vz()); + TVector3 mom(part->Px(),part->Py(),part->Pz()); + + // Rotate to the local coordinate system (TPC sector) + ver.RotateZ(-alpha); + mom.RotateZ(-alpha); + + // X of the referense plane + xref = ver.X(); + + Int_t pdgCode = part->GetPdgCode(); + + Double_t charge = + TDatabasePDG::Instance()->GetParticle(pdgCode)->Charge(); + + param[0] = ver.Y(); + param[1] = ver.Z(); + param[2] = TMath::Sin(mom.Phi()); + param[3] = mom.Pz()/mom.Pt(); + param[4] = TMath::Sign(1/mom.Pt(),charge); + + // Set AliExternalTrackParam + Set(xref, alpha, param, covar); + + // Set the PID + Int_t indexPID = 99; + + switch (TMath::Abs(pdgCode)) { + + case 11: // electron + indexPID = 0; + break; + + case 13: // muon + indexPID = 1; + break; + + case 211: // pion + indexPID = 2; + break; + + case 321: // kaon + indexPID = 3; + break; + + case 2212: // proton + indexPID = 4; + break; + + default: + break; } + + // If the particle is not e,mu,pi,K or p the PID probabilities are set to 0 + if (indexPID < AliPID::kSPECIES) { + fR[indexPID]=1.; + fITSr[indexPID]=1.; + fTPCr[indexPID]=1.; + fTRDr[indexPID]=1.; + fTOFr[indexPID]=1.; + fHMPIDr[indexPID]=1.; + + } + // AliESD track label + SetLabel(part->GetUniqueID()); + } + //_______________________________________________________________________ AliESDtrack::~AliESDtrack(){ // @@ -247,11 +399,26 @@ AliESDtrack::~AliESDtrack(){ delete fIp; delete fOp; delete fCp; - delete fITStrack; - delete fTRDtrack; - delete fPoints; + delete fFriendTrack; } +void AliESDtrack::AddCalibObject(TObject * object){ + // + // add calib object to the list + // + if (!fFriendTrack) fFriendTrack = new AliESDfriendTrack; + fFriendTrack->AddCalibObject(object); +} + +TObject * AliESDtrack::GetCalibObject(Int_t index){ + // + // return calib objct at given position + // + if (!fFriendTrack) return 0; + return fFriendTrack->GetCalibObject(index); +} + + //_______________________________________________________________________ void AliESDtrack::MakeMiniESDtrack(){ // Resets everything except @@ -261,11 +428,7 @@ void AliESDtrack::MakeMiniESDtrack(){ // fD: Impact parameter in XY-plane // fZ: Impact parameter in Z // fR[AliPID::kSPECIES]: combined "detector response probability" - // Running track parameters - // fRalpha: track rotation angle - // fRx: X-coordinate of the track reference plane - // fRp[5]: external track parameters - // fRc[15]: external cov. matrix of the track parameters + // Running track parameters in the base class (AliExternalTrackParam) fTrackLength = 0; for (Int_t i=0;iGetIntegratedLength()); } - Set(*t); + Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); switch (flags) { case kITSin: case kITSout: case kITSrefit: fITSncls=t->GetNumberOfClusters(); + index=fFriendTrack->GetITSindices(); + for (Int_t i=0;iGetClusterIndex(i); + if (i> 28; + SETBIT(fITSClusterMap,l); + } + } fITSchi2=t->GetChi2(); - for (Int_t i=0;iGetClusterIndex(i); fITSsignal=t->GetPIDsignal(); fITSLabel = t->GetLabel(); - fITSFakeRatio = t->GetFakeRatio(); break; case kTPCin: case kTPCrefit: fTPCLabel = t->GetLabel(); if (!fIp) fIp=new AliExternalTrackParam(*t); - else fIp->Set(*t); + else + fIp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); case kTPCout: + index=fFriendTrack->GetTPCindices(); if (flags & kTPCout){ if (!fOp) fOp=new AliExternalTrackParam(*t); - else fOp->Set(*t); + else + fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); } fTPCncls=t->GetNumberOfClusters(); fTPCchi2=t->GetChi2(); @@ -420,14 +587,16 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ //"jump to case label crosses initialization of `Int_t prevrow'" Int_t prevrow = -1; // for (Int_t i=0;iGetClusterIndex(i); + index[i]=t->GetClusterIndex(i); + Int_t idx = index[i]; + + if (idx<0) continue; // Piotr's Cluster Map for HBT // ### please change accordingly if cluster array is changing // to "New TPC Tracking" style (with gaps in array) - Int_t idx = fTPCindex[i]; Int_t sect = (idx&0xff000000)>>24; Int_t row = (idx&0x00ff0000)>>16; if (sect > 18) row +=63; //if it is outer sector, add number of inner sectors @@ -469,15 +638,17 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ break; case kTRDout: case kTRDin: case kTRDrefit: + index=fFriendTrack->GetTRDindices(); fTRDLabel = t->GetLabel(); fTRDncls=t->GetNumberOfClusters(); fTRDchi2=t->GetChi2(); - for (Int_t i=0;iGetClusterIndex(i); + for (Int_t i=0;iGetClusterIndex(i); fTRDsignal=t->GetPIDsignal(); break; case kTRDbackup: if (!fOp) fOp=new AliExternalTrackParam(*t); - else fOp->Set(*t); + else + fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); fTRDncls0 = t->GetNumberOfClusters(); break; case kTOFin: @@ -610,7 +781,7 @@ Int_t AliESDtrack::GetNcls(Int_t idet) const return ncls; } -Int_t AliESDtrack::GetClusters(Int_t idet, UInt_t *idx) const +Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const { // Get cluster index array by subdetector index // @@ -620,7 +791,7 @@ Int_t AliESDtrack::GetClusters(Int_t idet, UInt_t *idx) const ncls = GetITSclusters(idx); break; case 1: - ncls = GetTPCclusters((Int_t *)idx); + ncls = GetTPCclusters(idx); break; case 2: ncls = GetTRDclusters(idx); @@ -656,9 +827,6 @@ void AliESDtrack::SetITSpid(const Double_t *p) { SetStatus(AliESDtrack::kITSpid); } -void AliESDtrack::SetITSChi2MIP(const Float_t *chi2mip){ - for (Int_t i=0; i<12; i++) fITSchi2MIP[i]=chi2mip[i]; -} //_______________________________________________________________________ void AliESDtrack::GetITSpid(Double_t *p) const { // Gets the probability of each particle type (in ITS) @@ -666,11 +834,14 @@ void AliESDtrack::GetITSpid(Double_t *p) const { } //_______________________________________________________________________ -Int_t AliESDtrack::GetITSclusters(UInt_t *idx) const { +Int_t AliESDtrack::GetITSclusters(Int_t *idx) const { //--------------------------------------------------------------------- // This function returns indices of the assgined ITS clusters //--------------------------------------------------------------------- - for (Int_t i=0; iGetITSindices(); + for (Int_t i=0; iGetTPCindices(); + for (Int_t i=0; iGetTPCindices(); for (Int_t i=row0;i<=row1;i++){ - Int_t index = fTPCindex[i]; - if (index!=-1) good++; // track outside of dead zone - if (index>0) found++; + Int_t idx = index[i]; + if (idx!=-1) good++; // track outside of dead zone + if (idx>0) found++; } Float_t density=0.5; if (good>(row1-row0)*0.5) density = Float_t(found)/Float_t(good); @@ -716,12 +890,14 @@ void AliESDtrack::GetTPCpid(Double_t *p) const { } //_______________________________________________________________________ -Int_t AliESDtrack::GetTRDclusters(UInt_t *idx) const { +Int_t AliESDtrack::GetTRDclusters(Int_t *idx) const { //--------------------------------------------------------------------- // This function returns indices of the assgined TRD clusters //--------------------------------------------------------------------- - if (idx!=0) - for (Int_t i=0; i<180; i++) idx[i]=fTRDindex[i]; // MI I prefer some constant + if (idx!=0) { + Int_t *index=fFriendTrack->GetTRDindices(); + for (Int_t i=0; i maxd) return kFALSE; //Propagate to the DCA - Double_t crv=0.299792458e-3*b*GetParameter()[4]; + Double_t crv=kB2C*b*GetParameter()[4]; + if (TMath::Abs(b) < kAlmost0Field) crv=0.; + Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp)); - sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); cs=TMath::Sqrt(1.- sn*sn); + sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); + if (TMath::Abs(tgfv)>0.) cs = sn/tgfv; + else cs=1.; x = xv*cs + yv*sn; yv=-xv*sn + yv*cs; xv=x; @@ -858,9 +1041,14 @@ Bool_t AliESDtrack::RelateToVertex fZ = GetParameter()[1] - zv; Double_t cov[6]; vtx->GetCovMatrix(cov); - fCdd = GetCovariance()[0] + cov[2]; // neglecting non-diagonals - fCdz = GetCovariance()[1]; // in the vertex's - fCzz = GetCovariance()[2] + cov[5]; // covariance matrix + + //***** Improvements by A.Dainese + alpha=GetAlpha(); sn=TMath::Sin(alpha); cs=TMath::Cos(alpha); + Double_t s2ylocvtx = cov[0]*sn*sn + cov[2]*cs*cs - 2.*cov[1]*cs*sn; + fCdd = GetCovariance()[0] + s2ylocvtx; // neglecting correlations + fCdz = GetCovariance()[1]; // between (x,y) and z + fCzz = GetCovariance()[2] + cov[5]; // in vertex's covariance matrix + //***** {//Try to constrain Double_t p[2]={yv,zv}, c[3]={cov[2],0.,cov[5]}; @@ -914,20 +1102,60 @@ void AliESDtrack::Print(Option_t *) const { printf("%f, ", p[index]) ; printf("\n signal = %f\n", GetTOFsignal()) ; } - if( IsOn(kRICHpid) ){ - printf("From RICH: ") ; - GetRICHpid(p) ; + if( IsOn(kHMPIDpid) ){ + printf("From HMPID: ") ; + GetHMPIDpid(p) ; for(index = 0 ; index < AliPID::kSPECIES; index++) printf("%f, ", p[index]) ; - printf("\n signal = %f\n", GetRICHsignal()) ; + printf("\n signal = %f\n", GetHMPIDsignal()) ; } - // Since 9 March 2006 PHOS left ESDtrack for ESDCaloCluster - // and cannot participate in the global PID for the moment -// if( IsOn(kPHOSpid) ){ -// printf("From PHOS: ") ; -// GetPHOSpid(p) ; -// for(index = 0 ; index < AliPID::kSPECIESN; index++) -// printf("%f, ", p[index]) ; -// printf("\n signal = %f\n", GetPHOSsignal()) ; -// } } + +Bool_t AliESDtrack::PropagateTo(Double_t xToGo, Double_t b, Double_t mass, +Double_t maxStep, Bool_t rotateTo, Double_t maxSnp){ + //---------------------------------------------------------------- + // + // MI's function + // + // Propagates this track to the plane X=xk (cm) + // in the magnetic field "b" (kG), + // the correction for the material is included + // + // mass - mass used in propagation - used for energy loss correction + // maxStep - maximal step for propagation + //---------------------------------------------------------------- + const Double_t kEpsilon = 0.00001; + Double_t xpos = GetX(); + Double_t dir = (xpos kEpsilon){ + Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep); + Double_t x = xpos+step; + Double_t xyz0[3],xyz1[3],param[7]; + GetXYZ(xyz0); //starting global position + if (!GetXYZAt(x,b,xyz1)) return kFALSE; // no prolongation + xyz1[2]+=kEpsilon; // waiting for bug correction in geo + AliKalmanTrack::MeanMaterialBudget(xyz0,xyz1,param); + if (TMath::Abs(GetSnpAt(x,b)) >= maxSnp) return kFALSE; + if (!AliExternalTrackParam::PropagateTo(x,b)) return kFALSE; + + Double_t rho=param[0],x0=param[1],distance=param[4]; + Double_t d=distance*rho/x0; + + if (!CorrectForMaterial(d,x0,mass)) return kFALSE; + if (rotateTo){ + if (TMath::Abs(GetSnp()) >= maxSnp) return kFALSE; + GetXYZ(xyz0); // global position + Double_t alphan = TMath::ATan2(xyz0[1], xyz0[0]); + // + Double_t ca=TMath::Cos(alphan-GetAlpha()), + sa=TMath::Sin(alphan-GetAlpha()); + Double_t sf=GetSnp(), cf=TMath::Sqrt(1.- sf*sf); + Double_t sinNew = sf*ca - cf*sa; + if (TMath::Abs(sinNew) >= maxSnp) return kFALSE; + if (!Rotate(alphan)) return kFALSE; + } + xpos = GetX(); + } + return kTRUE; +}