#include <TMath.h>
#include <TParticle.h>
+#include <TDatabasePDG.h>
#include "AliESDVertex.h"
#include "AliESDtrack.h"
#include "AliKalmanTrack.h"
+#include "AliVTrack.h"
#include "AliLog.h"
#include "AliTrackPointArray.h"
#include "TPolyMarker3D.h"
fTOFCalChannel(0),
fTOFindex(-1),
fHMPIDqn(0),
- fHMPIDcluIdx(0),
+ fHMPIDcluIdx(-1),
fEMCALindex(kEMCALNoMatch),
fHMPIDtrkTheta(0),
fHMPIDtrkPhi(0),
fTRDchi2(0),
fTOFchi2(0),
fHMPIDchi2(0),
+ fGlobalChi2(0),
fITSsignal(0),
fTPCsignal(0),
fTPCsignalS(0),
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
for (i=0;i<kTRDnPlanes;i++) {
fTRDTimBin[i]=0;
}
+ for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
for (i=0;i<4;i++) {fTPCPoints[i]=0;}
for (i=0;i<3;i++) {fTOFLabel[i]=0;}
for (i=0;i<10;i++) {fTOFInfo[i]=0;}
fTRDchi2(track.fTRDchi2),
fTOFchi2(track.fTOFchi2),
fHMPIDchi2(track.fHMPIDchi2),
+ fGlobalChi2(track.fGlobalChi2),
fITSsignal(track.fITSsignal),
fTPCsignal(track.fTPCsignal),
fTPCsignalS(track.fTPCsignalS),
fITSClusterMap(track.fITSClusterMap),
fTRDncls(track.fTRDncls),
fTRDncls0(track.fTRDncls0),
- fTRDpidQuality(track.fTRDpidQuality),
+ fTRDntracklets(track.fTRDntracklets),
fTRDnSlices(track.fTRDnSlices),
- fTRDslices(0x0)
+ fTRDslices(0x0),
+ fVertexID(track.fVertexID)
{
//
//copy constructor
for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=track.fITSr[i];
//
for (Int_t i=0;i<AliPID::kSPECIES;i++) fTPCr[i]=track.fTPCr[i];
+ for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=track.fITSdEdxSamples[i];}
for (Int_t i=0;i<4;i++) {fTPCPoints[i]=track.fTPCPoints[i];}
for (Int_t i=0; i<3;i++) { fKinkIndexes[i]=track.fKinkIndexes[i];}
for (Int_t i=0; i<3;i++) { fV0Indexes[i]=track.fV0Indexes[i];}
if (track.fFriendTrack) fFriendTrack=new AliESDfriendTrack(*(track.fFriendTrack));
}
+//_______________________________________________________________________
+AliESDtrack::AliESDtrack(const AliVTrack *track) :
+ AliExternalTrackParam(track),
+ fCp(0),
+ fIp(0),
+ fTPCInner(0),
+ fOp(0),
+ fFriendTrack(0),
+ fTPCClusterMap(159),//number of padrows
+ fTPCSharedMap(159),//number of padrows
+ fFlags(0),
+ fID(),
+ fLabel(0),
+ fITSLabel(0),
+ fTPCLabel(0),
+ fTRDLabel(0),
+ fTOFCalChannel(0),
+ fTOFindex(-1),
+ fHMPIDqn(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),
+ fITSchi2(0),
+ fTPCchi2(0),
+ fTRDchi2(0),
+ fTOFchi2(0),
+ fHMPIDchi2(0),
+ fGlobalChi2(0),
+ fITSsignal(0),
+ fTPCsignal(0),
+ fTPCsignalS(0),
+ fTRDsignal(0),
+ fTRDQuality(0),
+ fTRDBudget(0),
+ fTOFsignal(0),
+ fTOFsignalToT(0),
+ fTOFsignalRaw(0),
+ fTOFsignalDz(0),
+ fHMPIDtrkX(0),
+ fHMPIDtrkY(0),
+ fHMPIDmipX(0),
+ fHMPIDmipY(0),
+ fTPCncls(0),
+ fTPCnclsF(0),
+ fTPCsignalN(0),
+ fITSncls(0),
+ fITSClusterMap(0),
+ fTRDncls(0),
+ fTRDncls0(0),
+ fTRDntracklets(0),
+ fTRDnSlices(0),
+ fTRDslices(0x0),
+ fVertexID(-2) // -2 means an orphan track
+{
+ //
+ // ESD track from AliVTrack.
+ // This is not a copy constructor !
+ //
+
+ if (track->InheritsFrom("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; i<AliPID::kSPECIES; i++) {
+ fTrackTime[i]=0.;
+ fR[i]=0.;
+ fITSr[i]=0.;
+ fTPCr[i]=0.;
+ fTRDr[i]=0.;
+ fTOFr[i]=0.;
+ fHMPIDr[i]=0.;
+ }
+
+ for (i=0; i<3; i++) { fKinkIndexes[i]=0;}
+ for (i=0; i<3; i++) { fV0Indexes[i]=-1;}
+ for (i=0;i<kTRDnPlanes;i++) {
+ fTRDTimBin[i]=0;
+ }
+ for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
+ for (i=0;i<4;i++) {fTPCPoints[i]=0;}
+ for (i=0;i<3;i++) {fTOFLabel[i]=0;}
+ for (i=0;i<10;i++) {fTOFInfo[i]=0;}
+ for (i=0;i<12;i++) {fITSModule[i]=-1;}
+
+ // Set the ID
+ SetID(track->GetID());
+
+ // 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; i<AliPID::kSPECIES; i++) fR[i]=pid[i];
+ }
+ // AliESD track label
+ SetLabel(track->GetLabel());
+ // Set the status
+ SetStatus(track->GetStatus());
+}
+
//_______________________________________________________________________
AliESDtrack::AliESDtrack(TParticle * part) :
AliExternalTrackParam(),
fTOFCalChannel(0),
fTOFindex(-1),
fHMPIDqn(0),
- fHMPIDcluIdx(0),
+ fHMPIDcluIdx(-1),
fEMCALindex(kEMCALNoMatch),
fHMPIDtrkTheta(0),
fHMPIDtrkPhi(0),
fTRDchi2(0),
fTOFchi2(0),
fHMPIDchi2(0),
+ fGlobalChi2(0),
fITSsignal(0),
fTPCsignal(0),
fTPCsignalS(0),
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
for (i=0;i<kTRDnPlanes;i++) {
fTRDTimBin[i]=0;
}
+ for (i=0;i<4;i++) {fITSdEdxSamples[i]=0.;}
for (i=0;i<4;i++) {fTPCPoints[i]=0;}
for (i=0;i<3;i++) {fTOFLabel[i]=0;}
for (i=0;i<10;i++) {fTOFInfo[i]=0;}
fTOFchi2 = source.fTOFchi2;
fHMPIDchi2 = source.fHMPIDchi2;
+ fGlobalChi2 = source.fGlobalChi2;
fITSsignal = source.fITSsignal;
+ for (Int_t i=0;i<4;i++) {fITSdEdxSamples[i]=source.fITSdEdxSamples[i];}
fTPCsignal = source.fTPCsignal;
fTPCsignalS = source.fTPCsignalS;
for(int i = 0; i< 4;++i){
fITSClusterMap = source.fITSClusterMap;
fTRDncls = source.fTRDncls;
fTRDncls0 = source.fTRDncls0;
- fTRDpidQuality = source.fTRDpidQuality;
+ fTRDntracklets = source.fTRDntracklets;
+ fVertexID = source.fVertexID;
return *this;
}
}
-const Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
+Bool_t AliESDtrack::FillTPCOnlyTrack(AliESDtrack &track){
// Fills the information of the TPC-only first reconstruction pass
// into the passed ESDtrack object. For consistency fTPCInner is also filled
track.fFlags = kTPCin;
track.fID = fID;
+ track.fFlags |= fFlags & kTPCpid; //copy the TPCpid status flag
for (Int_t i=0;i<3;i++) track.fKinkIndexes[i] = fKinkIndexes[i];
fITSncls = 0;
fITSClusterMap=0;
fITSsignal = 0;
+ for (Int_t i=0;i<4;i++) fITSdEdxSamples[i] = 0.;
for (Int_t i=0;i<AliPID::kSPECIES;i++) fITSr[i]=0;
fITSLabel = 0;
for (Int_t i=0;i<AliPID::kSPECIES;i++) fTRDr[i] = 0;
fTRDLabel = 0;
fTRDQuality = 0;
- fTRDpidQuality = 0;
+ fTRDntracklets = 0;
if(fTRDnSlices)
delete[] fTRDslices;
fTRDslices=0x0;
// Reset HMPID related track information
fHMPIDchi2 = 0;
fHMPIDqn = 0;
- fHMPIDcluIdx = 0;
+ fHMPIDcluIdx = -1;
fHMPIDsignal = 0;
for (Int_t i=0;i<AliPID::kSPECIES;i++) fHMPIDr[i] = 0;
fHMPIDtrkTheta = 0;
fHMPIDmipY = 0;
fEMCALindex = kEMCALNoMatch;
+ // reset global track chi2
+ fGlobalChi2 = 0;
+
+ fVertexID = -2; // an orphan track
+
delete fFriendTrack; fFriendTrack = 0;
}
//_______________________________________________________________________
}
Set(t->GetX(),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) {
if (!fOp) fOp=new AliExternalTrackParam(*t);
else
fOp->Set(t->GetX(),t->GetAlpha(),t->GetParameter(),t->GetCovariance());
- }
+ }
break;
case kTPCin: case kTPCrefit:
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();
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;
}
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
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; i<ns; i++, s++) if((*s)>0.) 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<fTRDnSlices; i++) fTRDslices[i]=-1.;
+
+ // set-up correctly the allocated memory
+ memset(fTRDslices, 0, n*sizeof(Double32_t));
+ for (Int_t i=GetNumberOfTRDslices(); i--;) fTRDslices[i]=-1.;
}
+//____________________________________________________
void AliESDtrack::SetTRDslice(Double_t q, Int_t plane, Int_t slice) {
//Sets the charge q in the slice of the plane
- Int_t ns=GetNumberOfTRDslices();
- if (ns==0) {
+ if(!fTRDslices) {
AliError("No TRD slices allocated for this track !");
return;
}
-
if ((plane<0) || (plane>=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;
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; i<ns; i++) q+=fTRDslices[plane*ns + i];
- return q/ns;
- }
+ Int_t idx = fTRDnSlices-(kTRDnPlanes<<1)+plane;
+ // Protection for backward compatibility
+ if(idx<GetNumberOfTRDslices()*kTRDnPlanes) return;
- return fTRDslices[plane*ns + slice];
+ if(sp) fTRDslices[idx+kTRDnPlanes] = (*sp);
+ fTRDslices[idx] = p;
}
if (!fCp->Update(p,c)) {delete fCp; fCp=0; return kFALSE;}
//----------------------------------------
+ fVertexID = vtx->GetID();
if (!cParam) return kTRUE;
}
}
}
+
+//_______________________________________________________________________
+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];
+}