//_______________________________________________________________
AliTRDtrackV1::AliTRDtrackV1() : AliKalmanTrack()
- ,fPIDquality(0)
+ ,fStatus(0)
,fDE(0.)
,fReconstructor(0x0)
,fBackupTrack(0x0)
+ ,fTrackLow(0x0)
+ ,fTrackHigh(0x0)
{
//
// Default constructor
//_______________________________________________________________
AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &ref) : AliKalmanTrack(ref)
- ,fPIDquality(ref.fPIDquality)
+ ,fStatus(ref.fStatus)
,fDE(ref.fDE)
,fReconstructor(ref.fReconstructor)
,fBackupTrack(0x0)
+ ,fTrackLow(0x0)
+ ,fTrackHigh(0x0)
{
//
// Copy constructor
fTrackletIndex[ip] = ref.fTrackletIndex[ip];
fTracklet[ip] = ref.fTracklet[ip];
}
-
+ if(ref.fTrackLow) fTrackLow = new AliExternalTrackParam(*ref.fTrackLow);
+ if(ref.fTrackHigh) fTrackHigh = new AliExternalTrackParam(*ref.fTrackHigh);
+
for (Int_t i = 0; i < 3;i++) fBudget[i] = ref.fBudget[i];
for(Int_t is = 0; is<AliPID::kSPECIES; is++) fPID[is] = ref.fPID[is];
//_______________________________________________________________
AliTRDtrackV1::AliTRDtrackV1(const AliESDtrack &t) : AliKalmanTrack()
- ,fPIDquality(0)
+ ,fStatus(0)
,fDE(0.)
,fReconstructor(0x0)
,fBackupTrack(0x0)
+ ,fTrackLow(0x0)
+ ,fTrackHigh(0x0)
{
//
// Constructor from AliESDtrack
//_______________________________________________________________
AliTRDtrackV1::AliTRDtrackV1(AliTRDseedV1 *trklts, const Double_t p[5], const Double_t cov[15]
, Double_t x, Double_t alpha) : AliKalmanTrack()
- ,fPIDquality(0)
+ ,fStatus(0)
,fDE(0.)
,fReconstructor(0x0)
,fBackupTrack(0x0)
+ ,fTrackLow(0x0)
+ ,fTrackHigh(0x0)
{
//
// The stand alone tracking constructor
//AliInfo("");
//printf("I-AliTRDtrackV1::~AliTRDtrackV1() : Owner[%s]\n", TestBit(kOwner)?"YES":"NO");
- if(fBackupTrack) delete fBackupTrack;
- fBackupTrack = 0x0;
+ if(fBackupTrack) delete fBackupTrack; fBackupTrack = 0x0;
+
+ if(fTrackLow) delete fTrackLow; fTrackLow = 0x0;
+ if(fTrackHigh) delete fTrackHigh; fTrackHigh = 0x0;
for(Int_t ip=0; ip<kNplane; ip++){
if(TestBit(kOwner) && fTracklet[ip]) delete fTracklet[ip];
Bool_t AliTRDtrackV1::CookLabel(Float_t wrong)
{
// set MC label for this track
-
+ if(!GetNumberOfClusters()) return kFALSE;
+
Int_t s[kMAXCLUSTERSPERTRACK][2];
for (Int_t i = 0; i < kMAXCLUSTERSPERTRACK; i++) {
s[i][0] = -1;
AliTRDcluster *c = 0x0;
for (Int_t ip = 0; ip < kNplane; ip++) {
if(fTrackletIndex[ip] == 0xffff) continue;
- for (Int_t ic = 0; ic < AliTRDseed::knTimebins; ic++) {
+ for (Int_t ic = 0; ic < AliTRDseedV1::kNclusters; ic++) {
if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
for (Int_t k = 0; k < 3; k++) {
label = c->GetLabel(k);
max = s[i][1];
label = s[i][0];
}
-
if ((1. - Float_t(max)/GetNumberOfClusters()) > wrong) label = -label;
SetLabel(label);
// Reset the a priori probabilities
Double_t pid = 1. / AliPID::kSPECIES;
- for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) {
- fPID[ispec] = pid;
- }
- fPIDquality = 0;
-
- // steer PID calculation @ tracklet level
- Double_t *prob = 0x0;
- for(int ip=0; ip<kNplane; ip++){
- if(fTrackletIndex[ip] == 0xffff) continue;
- if(!fTracklet[ip]->IsOK()) continue;
- if(!(prob = fTracklet[ip]->GetProbability())) return kFALSE;
-
- Int_t nspec = 0; // quality check of tracklet dEdx
- for(int ispec=0; ispec<AliPID::kSPECIES; ispec++){
- if(prob[ispec] < 0.) continue;
- fPID[ispec] *= prob[ispec];
- nspec++;
- }
- if(!nspec) continue;
-
- fPIDquality++;
- }
-
+ for(int ispec=0; ispec<AliPID::kSPECIES; ispec++) fPID[ispec] = pid;
+
+ UChar_t fPIDquality = SetNumberOfTrackletsPID(kTRUE);
// no tracklet found for PID calculations
- if(!fPIDquality) return kTRUE;
+ if(!fPIDquality) return kFALSE;
// slot for PID calculation @ track level
-
// normalize probabilities
Double_t probTotal = 0.0;
for (Int_t is = 0; is < AliPID::kSPECIES; is++) probTotal += fPID[is];
return kTRUE;
}
-//_____________________________________________________________________________
-Double_t AliTRDtrackV1::GetBz() const
+//___________________________________________________________
+UChar_t AliTRDtrackV1::GetNumberOfTrackletsPID() const
{
- //
- // Returns Bz component of the magnetic field (kG)
- //
+// Retrieve number of tracklets used for PID calculation.
+
+ UChar_t fPIDquality = 0;
+ Float_t *prob = 0x0;
+ for(int ip=0; ip<kNplane; ip++){
+ if(fTrackletIndex[ip] == 0xffff) continue;
+ if(!fTracklet[ip]->IsOK()) continue;
+ if(!(prob = fTracklet[ip]->GetProbability(kFALSE))) return 0;
+
+ Int_t nspec = 0; // quality check of tracklet dEdx
+ for(int ispec=0; ispec<AliPID::kSPECIES; ispec++){
+ if(prob[ispec] < 0.) continue;
+ nspec++;
+ }
+ if(!nspec) continue;
+
+ fPIDquality++;
+ }
+ return fPIDquality;
+}
- if (AliTracker::UniformField()) return AliTracker::GetBz();
+//___________________________________________________________
+UChar_t AliTRDtrackV1::SetNumberOfTrackletsPID(Bool_t recalc)
+{
+// Retrieve number of tracklets used for PID calculation. // Recalculated PID at tracklet level by quering the PID DB.
- Double_t r[3];
- GetXYZ(r);
- return AliTracker::GetBz(r);
+ UChar_t fPIDquality = 0;
+
+ // steer PID calculation @ tracklet level
+ Float_t *prob = 0x0;
+ for(int ip=0; ip<kNplane; ip++){
+ if(fTrackletIndex[ip] == 0xffff) continue;
+ if(!fTracklet[ip]->IsOK()) continue;
+ if(!(prob = fTracklet[ip]->GetProbability(recalc))) return 0;
+
+ Int_t nspec = 0; // quality check of tracklet dEdx
+ for(int ispec=0; ispec<AliPID::kSPECIES; ispec++){
+ if(prob[ispec] < 0.) continue;
+ fPID[ispec] *= prob[ispec];
+ nspec++;
+ }
+ if(!nspec) continue;
+
+ fPIDquality++;
+ }
+ return fPIDquality;
}
//_______________________________________________________________
continue;
}
AliTRDcluster *c = 0x0;
- for(Int_t ic=AliTRDseed::knTimebins-1; ic>=0; ic--){
+ for(Int_t ic=AliTRDseedV1::kNclusters; ic--;){
if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
if(n<id){n++; continue;}
continue;
}
AliTRDcluster *c = 0x0;
- for(Int_t ic=AliTRDseed::knTimebins-1; ic>=0; ic--){
+ for(Int_t ic=AliTRDseedV1::kNclusters; ic--;){
if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
if(n<id){n++; continue;}
//_______________________________________________________________
Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt) const
{
- //
- // Get the predicted chi2
- //
-
- Double_t x = trklt->GetX0();
- Double_t p[2] = { trklt->GetYat(x)
- , trklt->GetZat(x) };
- Double_t cov[3];
- trklt->GetCovAt(x, cov);
-
+// Compute chi2 between tracklet and track. The value is calculated at the radial position of the track
+// equal to the reference radial position of the tracklet (see AliTRDseedV1)
+//
+// The chi2 estimator is computed according to the following formula
+// BEGIN_LATEX
+// #chi^{2}=(X_{trklt}-X_{track})(C_{trklt}+C_{track})^{-1}(X_{trklt}-X_{track})^{T}
+// END_LATEX
+// where X=(y z), the position of the track/tracklet in the yz plane
+//
+
+ Double_t x = GetX();
+ Double_t p[2] = { trklt->GetYat(x), trklt->GetZat(x)};
+ Double_t cov[3]; trklt->GetCovAt(x, cov);
return AliExternalTrackParam::GetPredictedChi2(p, cov);
}
+//_______________________________________________________________
+Int_t AliTRDtrackV1::GetSector() const
+{
+ return Int_t(GetAlpha()/AliTRDgeometry::GetAlpha() + (GetAlpha()>0. ? 0 : AliTRDgeometry::kNsector));
+}
+
//_______________________________________________________________
Bool_t AliTRDtrackV1::IsEqual(const TObject *o) const
{
const AliTRDtrackV1 *inTrack = dynamic_cast<const AliTRDtrackV1*>(o);
if (!inTrack) return kFALSE;
- if ( fPIDquality != inTrack->GetPIDquality() ) return kFALSE;
+ //if ( fPIDquality != inTrack->GetPIDquality() ) return kFALSE;
for(Int_t i = 0; i < AliPID::kSPECIES; i++){
if ( fPID[i] != inTrack->GetPID(i) ) return kFALSE;
}
}
- if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0,xrho,GetMass())) {
- return kFALSE;
- }
+ if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0, xrho, GetMass())) return kFALSE;
+
{
//_____________________________________________________________________________
void AliTRDtrackV1::Print(Option_t *o) const
{
- AliInfo(Form("PID q[%d] [%4.1f %4.1f %4.1f %4.1f %4.1f]", fPIDquality, 1.E2*fPID[0], 1.E2*fPID[1], 1.E2*fPID[2], 1.E2*fPID[3], 1.E2*fPID[4]));
+ AliInfo(Form("PID [%4.1f %4.1f %4.1f %4.1f %4.1f]", 1.E2*fPID[0], 1.E2*fPID[1], 1.E2*fPID[2], 1.E2*fPID[3], 1.E2*fPID[4]));
AliInfo(Form("Material[%5.2f %5.2f %5.2f]", fBudget[0], fBudget[1], fBudget[2]));
AliInfo(Form("x[%7.2f] t[%7.4f] alpha[%f] mass[%f]", GetX(), GetIntegratedLength(), GetAlpha(), fMass));
- AliInfo(Form("Ntr[%1d] Ncl[%3d] lab[%3d]", GetNumberOfTracklets(), fN, fLab));
+ AliInfo(Form("Ntr[%1d] NtrPID[%1d] Ncl[%3d] lab[%3d]", GetNumberOfTracklets(), GetNumberOfTrackletsPID(), fN, fLab));
if(strcmp(o, "a")!=0) return;
printf("|X| = (");
fTrackletIndex[plane] = index;
}
+//_______________________________________________________________
+void AliTRDtrackV1::SetTrackLow()
+{
+ const AliExternalTrackParam *op = dynamic_cast<const AliExternalTrackParam*>(this);
+ fTrackLow = fTrackLow ? new(fTrackLow) AliExternalTrackParam(*op) : new AliExternalTrackParam(*op);
+}
+
+//_______________________________________________________________
+void AliTRDtrackV1::SetTrackHigh(const AliExternalTrackParam *op)
+{
+ if(!op) op = dynamic_cast<const AliExternalTrackParam*>(this);
+ fTrackHigh = fTrackHigh ? new(fTrackHigh) AliExternalTrackParam(*op) : new AliExternalTrackParam(*op);
+}
+
//_______________________________________________________________
void AliTRDtrackV1::UnsetTracklet(Int_t plane)
{
Double_t x = GetX();
Double_t p[2] = { trklt->GetYat(x)
, trklt->GetZat(x) };
- Double_t cov[3], covR[3], cov0[3];
+ Double_t cov[3]/*, covR[3], cov0[3]*/;
// printf("\tD[%3d] Ly[%d] Trk: x[%f] y[%f] z[%f]\n", trklt->GetDetector(), trklt->GetPlane(), GetX(), GetY(), GetZ());
// //
// Update the TRD PID information in the ESD track
//
- Int_t nslices = fReconstructor->IsEightSlices() ? (Int_t)AliTRDReconstructor::kNNslices : (Int_t)AliTRDReconstructor::kLQslices;
+ Int_t nslices = fReconstructor->IsEightSlices() ? (Int_t)AliTRDpidUtil::kNNslices : (Int_t)AliTRDpidUtil::kLQslices;
track->SetNumberOfTRDslices(nslices);
+ Int_t n = 0;
for (Int_t ip = 0; ip < kNplane; ip++) {
if(fTrackletIndex[ip] == 0xffff) continue;
+ n++;
if(!fTracklet[ip]->IsOK()) continue;
fTracklet[ip]->CookdEdx(nslices);
Float_t *dedx = fTracklet[ip]->GetdEdx();
for (Int_t js = 0; js < nslices; js++, dedx++) track->SetTRDslice(*dedx, ip, js);
}
- // copy PID to ESD
- if(!fPIDquality) return;
- track->SetTRDpid(fPID);
- track->SetTRDpidQuality(fPIDquality);
+ UChar_t nPID = GetNumberOfTrackletsPID();
+ if(!nPID) track->SetTRDntracklets(n);
+ else {
+ track->SetTRDpid(fPID);
+ n |= (nPID<<3);
+ track->SetTRDntracklets(n);
+ }
}