X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=STEER%2FAliESDtrack.cxx;h=60a44b9f850fb47a8f20c15627940bfa8f3d4694;hb=72f5f463e947152de42166d8a1582d662413aa92;hp=786f31474e2305a7e378b711a5d26b6ba2103d9b;hpb=313af949bf629682ac449f0b9b760a57808961d1;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliESDtrack.cxx b/STEER/AliESDtrack.cxx index 786f31474e2..60a44b9f850 100644 --- a/STEER/AliESDtrack.cxx +++ b/STEER/AliESDtrack.cxx @@ -18,14 +18,109 @@ // This is the class to deal with during the phisics analysis of data // Origin: Iouri Belikov, CERN // e-mail: Jouri.Belikov@cern.ch +// +// +// +// What do you need to know before starting analysis +// (by Marian Ivanov: marian.ivanov@cern.ch) +// +// +// AliESDtrack: +// 1. What is the AliESDtrack +// 2. What informations do we store +// 3. How to use the information for analysis +// +// +// 1.AliESDtrack is the container of the information about the track/particle +// reconstructed during Barrel Tracking. +// The track information is propagated from one tracking detector to +// other using the functionality of AliESDtrack - Current parameters. +// +// No global fit model is used. +// Barrel tracking use Kalman filtering technique, it gives optimal local +// track parameters at given point under certian assumptions. +// +// Kalman filter take into account additional effect which are +// difficult to handle using global fit. +// Effects: +// a.) Multiple scattering +// b.) Energy loss +// c.) Non homogenous magnetic field +// +// In general case, following barrel detectors are contributing to +// the Kalman track information: +// a. TPC +// b. ITS +// c. TRD +// +// In general 3 reconstruction itteration are performed: +// 1. Find tracks - sequence TPC->ITS +// 2. PropagateBack - sequence ITS->TPC->TRD -> Outer PID detectors +// 3. Refit invward - sequence TRD->TPC->ITS +// The current tracks are updated after each detector (see bellow). +// In specical cases a track sanpshots are stored. +// +// +// For some type of analysis (+visualization) track local parameters at +// different position are neccesary. A snapshots during the track +// propagation are created. +// (See AliExternalTrackParam class for desctiption of variables and +// functionality) +// Snapshots: +// a. Current parameters - class itself (AliExternalTrackParam) +// Contributors: general case TRD->TPC->ITS +// Preferable usage: Decission - primary or secondary track +// NOTICE - By default the track parameters are stored at the DCA point +// to the primary vertex. optimal for primary tracks, +// far from optimal for secondary tracks. +// b. Constrained parameters - Kalman information updated with +// the Primary vertex information +// Contributors: general case TRD->TPC->ITS +// Preferable usage: Use only for tracks selected as primary +// NOTICE - not real constrain - taken as additional measurement +// with corresponding error +// Function: +// const AliExternalTrackParam *GetConstrainedParam() const {return fCp;} +// c. Inner parameters - Track parameters at inner wall of the TPC +// Contributors: general case TRD->TPC +// function: +// const AliExternalTrackParam *GetInnerParam() const { return fIp;} +// +// d. TPCinnerparam - contributors - TPC only +// Contributors: TPC +// Preferable usage: Requested for HBT study +// (smaller correlations as using also ITS information) +// NOTICE - the track parameters are propagated to the DCA to +// to primary vertex +// Optimal for primary, far from optimal for secondary tracks +// Function: +// const AliExternalTrackParam *GetTPCInnerParam() const {return fTPCInner;} +// +// e. Outer parameters - +// Contributors- general case - ITS-> TPC -> TRD +// The last point - Outer parameters radius is determined +// e.a) Local inclination angle bigger than threshold - +// Low momenta tracks +// e.a) Catastrofic energy losss in material +// e.b) Not further improvement (no space points) +// Usage: +// a.) Tracking: Starting parameter for Refit inward +// b.) Visualization +// c.) QA +// NOTICE: Should be not used for the physic analysis +// Function: +// const AliExternalTrackParam *GetOuterParam() const { return fOp;} +// //----------------------------------------------------------------- #include #include +#include #include "AliESDVertex.h" #include "AliESDtrack.h" #include "AliKalmanTrack.h" +#include "AliVTrack.h" #include "AliLog.h" #include "AliTrackPointArray.h" #include "TPolyMarker3D.h" @@ -66,6 +161,7 @@ AliESDtrack::AliESDtrack() : fIp(0), fTPCInner(0), fOp(0), + fHMPIDp(0), fFriendTrack(new AliESDfriendTrack()), fTPCClusterMap(159),//number of padrows fTPCSharedMap(159),//number of padrows @@ -76,14 +172,17 @@ AliESDtrack::AliESDtrack() : fTPCLabel(0), fTRDLabel(0), fTOFCalChannel(0), - fTOFindex(0), + fTOFindex(-1), fHMPIDqn(0), - fHMPIDcluIdx(0), + fHMPIDcluIdx(-1), fEMCALindex(kEMCALNoMatch), fHMPIDtrkTheta(0), fHMPIDtrkPhi(0), fHMPIDsignal(0), fTrackLength(0), + fdTPC(0),fzTPC(0), + fCddTPC(0),fCdzTPC(0),fCzzTPC(0), + fCchi2TPC(0), fD(0),fZ(0), fCdd(0),fCdz(0),fCzz(0), fCchi2(0), @@ -92,6 +191,7 @@ AliESDtrack::AliESDtrack() : fTRDchi2(0), fTOFchi2(0), fHMPIDchi2(0), + fGlobalChi2(0), fITSsignal(0), fTPCsignal(0), fTPCsignalS(0), @@ -113,10 +213,10 @@ AliESDtrack::AliESDtrack() : fITSClusterMap(0), fTRDncls(0), fTRDncls0(0), - fTRDpidQuality(0), + fTRDntracklets(0), fTRDnSlices(0), - fTRDslices(0x0) - + fTRDslices(0x0), + fVertexID(-2) // -2 means an orphan track { // // The default ESD constructor @@ -137,6 +237,7 @@ AliESDtrack::AliESDtrack() : for (i=0;iInheritsFrom("AliExternalTrackParam")) { + AliError("This is not a copy constructor. Use AliESDtrack(const AliESDtrack &) !"); + AliWarning("Calling the default constructor..."); + AliESDtrack(); + return; + } + + // Reset all the arrays + Int_t i; + for (i=0; iGetID()); + + // Set ITS cluster map + fITSClusterMap=track->GetITSClusterMap(); + + fITSncls=0; + for(i=0; i<6; i++) { + if(HasPointOnITSLayer(i)) fITSncls++; + } + + // Set the combined PID + const Double_t *pid = track->PID(); + if(pid){ + for (i=0; iGetLabel()); + // Set the status + SetStatus(track->GetStatus()); +} + //_______________________________________________________________________ AliESDtrack::AliESDtrack(TParticle * part) : AliExternalTrackParam(), @@ -245,6 +475,7 @@ AliESDtrack::AliESDtrack(TParticle * part) : fIp(0), fTPCInner(0), fOp(0), + fHMPIDp(0), fFriendTrack(0), fTPCClusterMap(159),//number of padrows fTPCSharedMap(159),//number of padrows @@ -255,14 +486,17 @@ AliESDtrack::AliESDtrack(TParticle * part) : fTPCLabel(0), fTRDLabel(0), fTOFCalChannel(0), - fTOFindex(0), + fTOFindex(-1), fHMPIDqn(0), - fHMPIDcluIdx(0), + fHMPIDcluIdx(-1), fEMCALindex(kEMCALNoMatch), fHMPIDtrkTheta(0), fHMPIDtrkPhi(0), fHMPIDsignal(0), fTrackLength(0), + fdTPC(0),fzTPC(0), + fCddTPC(0),fCdzTPC(0),fCzzTPC(0), + fCchi2TPC(0), fD(0),fZ(0), fCdd(0),fCdz(0),fCzz(0), fCchi2(0), @@ -271,6 +505,7 @@ AliESDtrack::AliESDtrack(TParticle * part) : fTRDchi2(0), fTOFchi2(0), fHMPIDchi2(0), + fGlobalChi2(0), fITSsignal(0), fTPCsignal(0), fTPCsignalS(0), @@ -292,9 +527,10 @@ AliESDtrack::AliESDtrack(TParticle * part) : fITSClusterMap(0), fTRDncls(0), fTRDncls0(0), - fTRDpidQuality(0), + fTRDntracklets(0), fTRDnSlices(0), - fTRDslices(0x0) + fTRDslices(0x0), + fVertexID(-2) // -2 means an orphan track { // // ESD track from TParticle @@ -317,6 +553,7 @@ AliESDtrack::AliESDtrack(TParticle * part) : for (i=0;iGetImpactParametersTPC(p,cov); + // if(p[0]==0&&p[1]==0) // <- Default values + // track->RelateToVertexTPC(esd->GetPrimaryVertexTPC(),esd->GetMagneticField(),kVeryBig); + + + if(!fTPCInner)return kFALSE; + + // fill the TPC track params to the global track parameters + track.Set(fTPCInner->GetX(),fTPCInner->GetAlpha(),fTPCInner->GetParameter(),fTPCInner->GetCovariance()); + track.fD = fdTPC; + track.fZ = fzTPC; + track.fCdd = fCddTPC; + track.fCdz = fCdzTPC; + track.fCzz = fCzzTPC; + + // copy the TPCinner parameters + if(track.fTPCInner) *track.fTPCInner = *fTPCInner; + else track.fTPCInner = new AliExternalTrackParam(*fTPCInner); + track.fdTPC = fdTPC; + track.fzTPC = fzTPC; + track.fCddTPC = fCddTPC; + track.fCdzTPC = fCdzTPC; + track.fCzzTPC = fCzzTPC; + track.fCchi2TPC = fCchi2TPC; + + + // copy all other TPC specific parameters + + // replace label by TPC label + track.fLabel = fTPCLabel; + track.fTPCLabel = fTPCLabel; + + track.fTPCchi2 = fTPCchi2; + track.fTPCsignal = fTPCsignal; + track.fTPCsignalS = fTPCsignalS; + for(int i = 0;i<4;++i)track.fTPCPoints[i] = fTPCPoints[i]; + + track.fTPCncls = fTPCncls; + track.fTPCnclsF = fTPCnclsF; + track.fTPCsignalN = fTPCsignalN; + + // PID + for(int i=0;iGetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + if (flags==kITSout) fFriendTrack->SetITSOut(*t); + if (flags==kTPCout) fFriendTrack->SetTPCOut(*t); + if (flags==kTRDrefit) fFriendTrack->SetTRDIn(*t); switch (flags) { @@ -809,6 +1154,12 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ fITSchi2=t->GetChi2(); fITSsignal=t->GetPIDsignal(); fITSLabel = t->GetLabel(); + // keep in fOp the parameters outside ITS for ITS stand-alone tracks + if (flags==kITSout) { + if (!fOp) fOp=new AliExternalTrackParam(*t); + else + fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + } break; case kTPCin: case kTPCrefit: @@ -881,7 +1232,9 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ fTPCsignal=t->GetPIDsignal(); break; - case kTRDout: case kTRDin: case kTRDrefit: + case kTRDin: case kTRDrefit: + break; + case kTRDout: index = fFriendTrack->GetTRDindices(); fTRDLabel = t->GetLabel(); fTRDchi2 = t->GetChi2(); @@ -902,6 +1255,11 @@ Bool_t AliESDtrack::UpdateTrackParams(const AliKalmanTrack *t, ULong_t flags){ break; case kTRDStop: break; + case kHMPIDout: + if (!fHMPIDp) fHMPIDp=new AliExternalTrackParam(*t); + else + fHMPIDp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance()); + break; default: AliError("Wrong flag !"); return kFALSE; @@ -976,6 +1334,26 @@ AliESDtrack::GetInnerExternalCovariance(Double_t cov[15]) const { return kTRUE; } +void +AliESDtrack::SetOuterParam(const AliExternalTrackParam *p, ULong_t flags) { + // + // This is a direct setter for the outer track parameters + // + SetStatus(flags); + if (fOp) delete fOp; + fOp=new AliExternalTrackParam(*p); +} + +void +AliESDtrack::SetOuterHmpParam(const AliExternalTrackParam *p, ULong_t flags) { + // + // This is a direct setter for the outer track parameters + // + SetStatus(flags); + if (fHMPIDp) delete fHMPIDp; + fHMPIDp=new AliExternalTrackParam(*p); +} + Bool_t AliESDtrack::GetOuterExternalParameters (Double_t &alpha, Double_t &x, Double_t p[5]) const { @@ -990,6 +1368,20 @@ AliESDtrack::GetOuterExternalParameters return kTRUE; } +Bool_t +AliESDtrack::GetOuterHmpExternalParameters + (Double_t &alpha, Double_t &x, Double_t p[5]) const { + //--------------------------------------------------------------------- + // This function returns external representation of the track parameters + // at the inner layer of TRD + //--------------------------------------------------------------------- + if (!fHMPIDp) return kFALSE; + alpha=fHMPIDp->GetAlpha(); + x=fHMPIDp->GetX(); + for (Int_t i=0; i<5; i++) p[i]=fHMPIDp->GetParameter()[i]; + return kTRUE; +} + Bool_t AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const { //--------------------------------------------------------------------- @@ -1001,6 +1393,17 @@ AliESDtrack::GetOuterExternalCovariance(Double_t cov[15]) const { return kTRUE; } +Bool_t +AliESDtrack::GetOuterHmpExternalCovariance(Double_t cov[15]) const { + //--------------------------------------------------------------------- + // This function returns external representation of the cov. matrix + // at the inner layer of TRD + //--------------------------------------------------------------------- + if (!fHMPIDp) return kFALSE; + for (Int_t i=0; i<15; i++) cov[i]=fHMPIDp->GetCovariance()[i]; + return kTRUE; +} + Int_t AliESDtrack::GetNcls(Int_t idet) const { // Get number of clusters by subdetector index @@ -1017,9 +1420,18 @@ Int_t AliESDtrack::GetNcls(Int_t idet) const ncls = fTRDncls; break; case 3: - if (fTOFindex != 0) + if (fTOFindex != -1) ncls = 1; break; + case 4: //PHOS + break; + case 5: //HMPID + if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) { + if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) { + ncls = 1; + } + } + break; default: break; } @@ -1042,17 +1454,19 @@ Int_t AliESDtrack::GetClusters(Int_t idet, Int_t *idx) const ncls = GetTRDclusters(idx); break; case 3: - if (fTOFindex != 0) { - idx[0] = GetTOFcluster(); + if (fTOFindex != -1) { + idx[0] = fTOFindex; ncls = 1; } break; case 4: //PHOS break; case 5: - if (fHMPIDcluIdx != 0) { - idx[0] = GetHMPIDcluIdx(); - ncls = 1; + if ((fHMPIDcluIdx >= 0) && (fHMPIDcluIdx < 7000000)) { + if ((fHMPIDcluIdx%1000000 != 9999) && (fHMPIDcluIdx%1000000 != 99999)) { + idx[0] = GetHMPIDcluIdx(); + ncls = 1; + } } break; case 6: //EMCAL @@ -1095,7 +1509,10 @@ Char_t AliESDtrack::GetITSclusters(Int_t *idx) const { //--------------------------------------------------------------------- if (idx!=0) { Int_t *index=fFriendTrack->GetITSindices(); - for (Int_t i=0; i=fITSncls) && (i<6) ) idx[i]=-1; + else idx[i]=index[i]; + } } return fITSncls; } @@ -1119,7 +1536,6 @@ Bool_t AliESDtrack::GetITSModuleIndexInfo(Int_t ilayer,Int_t &idet,Int_t &status //---------------------------------------------------------------------- if(fITSModule[ilayer]==-1) { - AliError("fModule was not set !"); idet = -1; status=0; xloc=-99.; zloc=-99.; @@ -1252,26 +1668,88 @@ Double_t AliESDtrack::GetTRDpid(Int_t iSpecies) const return fTRDr[iSpecies]; } +//____________________________________________________ +Int_t AliESDtrack::GetNumberOfTRDslices() const +{ + // built in backward compatibility + Int_t idx = fTRDnSlices - (kTRDnPlanes<<1); + return idx<18 ? fTRDnSlices/kTRDnPlanes : idx/kTRDnPlanes; +} + +//____________________________________________________ +Double_t AliESDtrack::GetTRDmomentum(Int_t plane, Double_t *sp) const +{ +//Returns momentum estimation and optional its error (sp) +// in TRD layer "plane". + + if (!fTRDnSlices) { + AliError("No TRD info allocated for this track !"); + return -1.; + } + if ((plane<0) || (plane>=kTRDnPlanes)) { + AliError("Info for TRD plane not available!"); + return -1.; + } + + Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane; + // Protection for backward compatibility + if(idx<(GetNumberOfTRDslices()*kTRDnPlanes)) return -1.; + + if(sp) (*sp) = fTRDslices[idx+kTRDnPlanes]; + return fTRDslices[idx]; +} + +//____________________________________________________ +Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const { + //Gets the charge from the slice of the plane + + if(!fTRDslices) { + //AliError("No TRD slices allocated for this track !"); + return -1.; + } + if ((plane<0) || (plane>=kTRDnPlanes)) { + AliError("Info for TRD plane not available !"); + return -1.; + } + Int_t ns=GetNumberOfTRDslices(); + if ((slice<-1) || (slice>=ns)) { + //AliError("Wrong TRD slice !"); + return -1.; + } + + if(slice>=0) return fTRDslices[plane*ns + slice]; + + // return average of the dEdx measurements + Double_t q=0.; Double32_t *s = &fTRDslices[plane*ns]; + for (Int_t i=0; i0.) q+=(*s); + return q/ns; +} + +//____________________________________________________ void AliESDtrack::SetNumberOfTRDslices(Int_t n) { //Sets the number of slices used for PID - if (fTRDnSlices != 0) return; - fTRDnSlices=kTRDnPlanes*n; + if (fTRDnSlices) return; + + fTRDnSlices=n; fTRDslices=new Double32_t[fTRDnSlices]; - for (Int_t i=0; i=kTRDnPlanes)) { - AliError("Wrong TRD plane !"); + AliError("Info for TRD plane not allocated !"); return; } + Int_t ns=GetNumberOfTRDslices(); if ((slice<0) || (slice>=ns)) { AliError("Wrong TRD slice !"); return; @@ -1280,30 +1758,25 @@ void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) { fTRDslices[n]=q; } -Double_t AliESDtrack::GetTRDslice(Int_t plane, Int_t slice) const { - //Gets the charge from the slice of the plane - Int_t ns=GetNumberOfTRDslices(); - if (ns==0) { - //AliError("No TRD slices allocated for this track !"); - return -1.; - } - if ((plane<0) || (plane>=kTRDnPlanes)) { - AliError("Wrong TRD plane !"); - return -1.; +//____________________________________________________ +void AliESDtrack::SetTRDmomentum(Double_t p, Int_t plane, Double_t *sp) +{ + if(!fTRDslices) { + AliError("No TRD slices allocated for this track !"); + return; } - if ((slice<-1) || (slice>=ns)) { - //AliError("Wrong TRD slice !"); - return -1.; + if ((plane<0) || (plane>=kTRDnPlanes)) { + AliError("Info for TRD plane not allocated !"); + return; } - if (slice==-1) { - Double_t q=0.; - for (Int_t i=0; iPropagateToDCA(vtx, b, maxd, dz, cov)) return kFALSE; + + fdTPC = dz[0]; + fzTPC = dz[1]; + fCddTPC = cov[0]; + fCdzTPC = cov[1]; + fCzzTPC = cov[2]; + + Double_t covar[6]; vtx->GetCovMatrix(covar); + Double_t p[2]={GetParameter()[0]-dz[0],GetParameter()[1]-dz[1]}; + Double_t c[3]={covar[2],0.,covar[5]}; + + Double_t chi2=GetPredictedChi2(p,c); + if (chi2>kVeryBig) return kFALSE; + + fCchi2TPC=chi2; + + if (!cParam) return kTRUE; + + *cParam = *fTPCInner; + if (!cParam->Update(p,c)) return kFALSE; + + return kTRUE; +} + +//_______________________________________________________________________ +Bool_t AliESDtrack::RelateToVertex(const AliESDVertex *vtx, +Double_t b, Double_t maxd, AliExternalTrackParam *cParam) { // // Try to relate this track to the vertex "vtx", // if the (rough) transverse impact parameter is not bigger then "maxd". @@ -1385,9 +1904,10 @@ Bool_t AliESDtrack::RelateToVertex // a) The track gets extapolated to the DCA to the vertex. // b) The impact parameters and their covariance matrix are calculated. // c) An attempt to constrain this track to the vertex is done. + // The constrained params are returned via "cParam". // - // In the case of success, the returned value is kTRUE - // (otherwise, it's kFALSE) + // In the case of success, the returned value is kTRUE + // (otherwise, it's kFALSE) // if (!vtx) return kFALSE; @@ -1406,21 +1926,32 @@ Bool_t AliESDtrack::RelateToVertex Double_t c[3]={covar[2],0.,covar[5]}; Double_t chi2=GetPredictedChi2(p,c); - if (chi2>77.) return kFALSE; + if (chi2>kVeryBig) return kFALSE; + fCchi2=chi2; + + + //--- Could now these lines be removed ? --- delete fCp; fCp=new AliExternalTrackParam(*this); if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;} - - fCchi2=chi2; + //---------------------------------------- + + fVertexID = vtx->GetID(); + + if (!cParam) return kTRUE; + + *cParam = *this; + if (!cParam->Update(p,c)) return kFALSE; + return kTRUE; } //_______________________________________________________________________ void AliESDtrack::Print(Option_t *) const { // Prints info on the track - + AliExternalTrackParam::Print(); printf("ESD track info\n") ; Double_t p[AliPID::kSPECIESN] ; Int_t index = 0 ; @@ -1474,6 +2005,7 @@ void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, arrayRef.AddLast(new AliExternalTrackParam(*this)); if (fIp) arrayRef.AddLast(new AliExternalTrackParam(*fIp)); if (fOp) arrayRef.AddLast(new AliExternalTrackParam(*fOp)); + if (fHMPIDp) arrayRef.AddLast(new AliExternalTrackParam(*fHMPIDp)); // Double_t mpos[3]={0,0,0}; Int_t entries=arrayRef.GetEntries(); @@ -1517,3 +2049,21 @@ void AliESDtrack::FillPolymarker(TPolyMarker3D *pol, Float_t magF, Float_t minR, } } } + +//_______________________________________________________________________ +void AliESDtrack::SetITSdEdxSamples(const Double_t s[4]) { + // + // Store the dE/dx samples measured by the two SSD and two SDD layers. + // These samples are corrected for the track segment length. + // + for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i]; +} + +//_______________________________________________________________________ +void AliESDtrack::GetITSdEdxSamples(Double_t *s) const { + // + // Get the dE/dx samples measured by the two SSD and two SDD layers. + // These samples are corrected for the track segment length. + // + for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i]; +}