//_______________________________________________________________
AliTRDtrackV1::AliTRDtrackV1() : AliKalmanTrack()
- ,fPIDquality(0)
+ ,fStatus(0)
+ ,fESDid(0)
,fDE(0.)
- ,fReconstructor(0x0)
- ,fBackupTrack(0x0)
+ ,fkReconstructor(NULL)
+ ,fBackupTrack(NULL)
+ ,fTrackLow(NULL)
+ ,fTrackHigh(NULL)
{
//
// Default constructor
for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
for(int ip=0; ip<kNplane; ip++){
- fTrackletIndex[ip] = 0xffff;
- fTracklet[ip] = 0x0;
+ fTrackletIndex[ip] = -1;
+ fTracklet[ip] = NULL;
}
}
//_______________________________________________________________
AliTRDtrackV1::AliTRDtrackV1(const AliTRDtrackV1 &ref) : AliKalmanTrack(ref)
- ,fPIDquality(ref.fPIDquality)
+ ,fStatus(ref.fStatus)
+ ,fESDid(ref.fESDid)
,fDE(ref.fDE)
- ,fReconstructor(ref.fReconstructor)
- ,fBackupTrack(0x0)
+ ,fkReconstructor(ref.fkReconstructor)
+ ,fBackupTrack(NULL)
+ ,fTrackLow(NULL)
+ ,fTrackHigh(NULL)
{
//
// 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)
+ ,fESDid(0)
,fDE(0.)
- ,fReconstructor(0x0)
- ,fBackupTrack(0x0)
+ ,fkReconstructor(NULL)
+ ,fBackupTrack(NULL)
+ ,fTrackLow(NULL)
+ ,fTrackHigh(NULL)
{
//
// Constructor from AliESDtrack
//
+ SetESDid(t.GetID());
SetLabel(t.GetLabel());
SetChi2(0.0);
- SetMass(t.GetMass());
+
+ SetMass(t.GetMass()/*0.000510*/);
AliKalmanTrack::SetNumberOfClusters(t.GetTRDncls());
- Int_t ti[kNplane]; t.GetTRDtracklets(&ti[0]);
+ Int_t ti[]={-1, -1, -1, -1, -1, -1}; t.GetTRDtracklets(&ti[0]);
for(int ip=0; ip<kNplane; ip++){
- fTrackletIndex[ip] = ti[ip] < 0 ? 0xffff : ti[ip];
- fTracklet[ip] = 0x0;
+ fTrackletIndex[ip] = ti[ip];
+ fTracklet[ip] = NULL;
}
for(int i =0; i<3; i++) fBudget[i] = 0.;
}
//_______________________________________________________________
-AliTRDtrackV1::AliTRDtrackV1(AliTRDseedV1 *trklts, const Double_t p[5], const Double_t cov[15]
+AliTRDtrackV1::AliTRDtrackV1(AliTRDseedV1 * const trklts, const Double_t p[5], const Double_t cov[15]
, Double_t x, Double_t alpha) : AliKalmanTrack()
- ,fPIDquality(0)
+ ,fStatus(0)
+ ,fESDid(0)
,fDE(0.)
- ,fReconstructor(0x0)
- ,fBackupTrack(0x0)
+ ,fkReconstructor(NULL)
+ ,fBackupTrack(NULL)
+ ,fTrackLow(NULL)
+ ,fTrackHigh(NULL)
{
//
// The stand alone tracking constructor
// 2. dQdl calculation
//
- Double_t cnv = GetBz() < 1.e-5 ? 1.e5 : 1.0 / (GetBz() * kB2C);
- // Double_t cnv = 1.0 / (GetBz() * kB2C);
-
+ Double_t b(GetBz());
+ Double_t cnv = (TMath::Abs(b) < 1.e-5) ? 1.e5 : 1./GetBz()/kB2C;
+
Double_t pp[5] = { p[0]
- , p[1]
- , p[2]
- , p[3]
- , p[4]*cnv };
-
+ , p[1]
+ , p[2]
+ , p[3]
+ , p[4]*cnv };
+
Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[ 5];
Double_t c32 = x*cov[13] - cov[ 8];
Double_t c20 = x*cov[10] - cov[ 3];
Double_t c21 = x*cov[11] - cov[ 4];
Double_t c42 = x*cov[14] - cov[12];
-
+
Double_t cc[15] = { cov[ 0]
, cov[ 1], cov[ 2]
, c20, c21, c22
, cov[ 6], cov[ 7], c32, cov[ 9]
, cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv };
-
+
Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt();
Double_t p0=TMath::Sign(1/mostProbablePt,pp[4]);
Double_t w0=cc[14]/(cc[14] + p0*p0), w1=p0*p0/(cc[14] + p0*p0);
+ AliDebug(3, Form("Pt mixing : w0[%4.2f] pt0[%5.3f] w1[%4.2f] pt[%5.3f]", w0, 1./p0, w1, 1./pp[4]));
+
pp[4] = w0*p0 + w1*pp[4];
cc[10]*=w1; cc[11]*=w1; cc[12]*=w1; cc[13]*=w1; cc[14]*=w1;
-
- Set(x,alpha,pp,cc);
+ Set(x,alpha,pp,cc);
+ AliDebug(2, Form("Init @ x[%6.2f] pt[%5.3f]", x, 1./pp[4]));
Int_t ncls = 0;
- for(int iplane=0; iplane<kNplane; iplane++){
- fTrackletIndex[iplane] = 0xffff;
- if(!trklts[iplane].IsOK()) fTracklet[iplane] = 0x0;
+ for(int iplane=0; iplane<kNplane; iplane++){
+ fTrackletIndex[iplane] = -1;
+ if(!trklts[iplane].IsOK()) fTracklet[iplane] = NULL;
else{
fTracklet[iplane] = &trklts[iplane];
ncls += fTracklet[iplane]->GetN();
}
- }
+ }
AliKalmanTrack::SetNumberOfClusters(ncls);
for(int i =0; i<3; i++) fBudget[i] = 0.;
Float_t pid = 1./AliPID::kSPECIES;
for(int is =0; is<AliPID::kSPECIES; is++) fPID[is] = pid;
-
}
//_______________________________________________________________
//AliInfo("");
//printf("I-AliTRDtrackV1::~AliTRDtrackV1() : Owner[%s]\n", TestBit(kOwner)?"YES":"NO");
- if(fBackupTrack) delete fBackupTrack;
- fBackupTrack = 0x0;
+ if(fBackupTrack) delete fBackupTrack; fBackupTrack = NULL;
+
+ if(fTrackLow) delete fTrackLow; fTrackLow = NULL;
+ if(fTrackHigh) delete fTrackHigh; fTrackHigh = NULL;
for(Int_t ip=0; ip<kNplane; ip++){
if(TestBit(kOwner) && fTracklet[ip]) delete fTracklet[ip];
- fTracklet[ip] = 0x0;
- fTrackletIndex[ip] = 0xffff;
+ fTracklet[ip] = NULL;
+ fTrackletIndex[ip] = -1;
}
}
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;
Bool_t labelAdded;
Int_t label;
- AliTRDcluster *c = 0x0;
+ AliTRDcluster *c = NULL;
for (Int_t ip = 0; ip < kNplane; ip++) {
- if(fTrackletIndex[ip] == 0xffff) continue;
- for (Int_t ic = 0; ic < AliTRDseed::knTimebins; ic++) {
+ if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue;
+ 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);
//_______________________________________________________________
Bool_t AliTRDtrackV1::CookPID()
{
- //
- // Cook the PID information
- //
+//
+// Cook the PID information for the track by delegating the omonim function of the tracklets.
+// Computes the number of tracklets used. The tracklet information are considered independent.
+// For the moment no global track measurement of PID is performed as for example to estimate
+// bremsstrahlung probability based on global chi2 of the track.
+//
+// The status bit AliESDtrack::kTRDpid is set during the call of AliTRDtrackV1::UpdateESDtrack().The PID performance of the
+//TRD for tracks with 6 tacklets is displayed below.
+//Begin_Html
+//<img src="TRD/trackPID.gif">
+//End_Html
+//
- // Reset the a priori probabilities
+ /*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;
-
- // slot for PID calculation @ track level
+ if(!fPIDquality) return kFALSE;
+ // slot for PID calculation @ track level for bremsstrahlung TODO
// normalize probabilities
Double_t probTotal = 0.0;
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.
- if (AliTracker::UniformField()) return AliTracker::GetBz();
+ UChar_t nPID = 0;
+ Float_t *prob = NULL;
+ for(int ip=0; ip<kNplane; ip++){
+ if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue;
+ if(!fTracklet[ip]->IsOK()) continue;
+ if(!(prob = fTracklet[ip]->GetProbability(kFALSE))) continue;
- Double_t r[3];
- GetXYZ(r);
- return AliTracker::GetBz(r);
+ 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;
+
+ fTracklet[ip]->SetPID();
+ nPID++;
+ }
+ return nPID;
+}
+
+//___________________________________________________________
+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.
+
+ UChar_t fPIDquality(0);
+
+ // steer PID calculation @ tracklet level
+ Float_t *prob(NULL);
+ for(int ip=0; ip<kNplane; ip++){
+ if(fTrackletIndex[ip]<0 || !fTracklet[ip]) 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;
}
//_______________________________________________________________
AliTRDcluster* AliTRDtrackV1::GetCluster(Int_t id)
{
+ // Get the cluster at a certain position in the track
Int_t n = 0;
for(Int_t ip=0; ip<kNplane; ip++){
if(!fTracklet[ip]) continue;
n+=fTracklet[ip]->GetN();
continue;
}
- AliTRDcluster *c = 0x0;
- for(Int_t ic=AliTRDseed::knTimebins-1; ic>=0; ic--){
+ AliTRDcluster *c = NULL;
+ for(Int_t ic=AliTRDseedV1::kNclusters; ic--;){
if(!(c = fTracklet[ip]->GetClusters(ic))) continue;
if(n<id){n++; continue;}
return c;
}
}
- return 0x0;
+ return NULL;
}
//_______________________________________________________________
Int_t AliTRDtrackV1::GetClusterIndex(Int_t id) const
{
+ // Get the cluster index at a certain position in the track
Int_t n = 0;
for(Int_t ip=0; ip<kNplane; ip++){
if(!fTracklet[ip]) continue;
n+=fTracklet[ip]->GetN();
continue;
}
- AliTRDcluster *c = 0x0;
- for(Int_t ic=AliTRDseed::knTimebins-1; ic>=0; ic--){
+ AliTRDcluster *c = NULL;
+ 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
+Double_t AliTRDtrackV1::GetPredictedChi2(const AliTRDseedV1 *trklt, Double_t *cov) 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 p[2] = { trklt->GetY(), trklt->GetZ()};
+ trklt->GetCovAt(trklt->GetX(), 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
{
+ // Checks whether two tracks are equal
if (!o) return kFALSE;
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;
//_______________________________________________________________
Bool_t AliTRDtrackV1::IsElectron() const
{
- if(GetPID(0) > fReconstructor->GetRecoParam()->GetPIDThreshold(GetP())) return kTRUE;
+ if(GetPID(0) > fkReconstructor->GetRecoParam()->GetPIDThreshold(GetP())) return kTRUE;
return kFALSE;
}
//_____________________________________________________________________________
-void AliTRDtrackV1::MakeBackupTrack()
+Int_t AliTRDtrackV1::MakeBackupTrack()
{
- //
- // Creates a backup track
- //
+//
+// Creates a backup track
+// TO DO update quality check of the track.
+//
+
+ Float_t occupancy(0.); Int_t n(0), ncls(0);
+ for(Int_t il(AliTRDgeometry::kNlayer); il--;){
+ if(!fTracklet[il]) continue;
+ n++;
+ occupancy+=fTracklet[il]->GetOccupancyTB();
+ ncls += fTracklet[il]->GetN();
+ }
+ if(!n) return -1;
+ occupancy/=n;
+
+ //Float_t ratio1 = Float_t(t.GetNumberOfClusters()+1) / Float_t(t.GetNExpected()+1);
+
+ Int_t failedCutId(0);
+ if(GetChi2()/n > 5.0) failedCutId=1;
+ if(occupancy < 0.7) failedCutId=2;
+ //if(ratio1 > 0.6) &&
+ //if(ratio0+ratio1 > 1.5) &&
+ if(GetNCross() != 0) failedCutId=3;
+ if(TMath::Abs(GetSnp()) > 0.85) failedCutId=4;
+ if(ncls < 20) failedCutId=5;
+
+ if(failedCutId){
+ AliDebug(2, Form("\n"
+ "chi2/tracklet < 5.0 [%c] %5.2f\n"
+ "occupancy > 0.7 [%c] %4.2f\n"
+ "NCross == 0 [%c] %d\n"
+ "Abs(snp) < 0.85 [%c] %4.2f\n"
+ "NClusters > 20 [%c] %d"
+ ,(GetChi2()/n<5.0)?'y':'n', GetChi2()/n
+ ,(occupancy>0.7)?'y':'n', occupancy
+ ,(GetNCross()==0)?'y':'n', GetNCross()
+ ,(TMath::Abs(GetSnp())<0.85)?'y':'n', TMath::Abs(GetSnp())
+ ,(ncls>20)?'y':'n', ncls
+ ));
+ return failedCutId;
+ }
if(fBackupTrack) {
fBackupTrack->~AliTRDtrackV1();
new(fBackupTrack) AliTRDtrackV1((AliTRDtrackV1&)(*this));
- return;
+ return 0;
}
fBackupTrack = new AliTRDtrackV1((AliTRDtrackV1&)(*this));
+ return 0;
}
//_____________________________________________________________________________
{
//
// Find a prolongation at given x
- // Return 0 if it does not exist
+ // Return -1 if it does not exist
//
Double_t bz = GetBz();
- if (!AliExternalTrackParam::GetYAt(xk,bz,y)) return 0;
- if (!AliExternalTrackParam::GetZAt(xk,bz,z)) return 0;
+ if (!AliExternalTrackParam::GetYAt(xk,bz,y)) return -1;
+ if (!AliExternalTrackParam::GetZAt(xk,bz,z)) return -1;
return 1;
// "xrho" - thickness*density [g/cm^2]
//
- if (xk == GetX()) {
- return kTRUE;
- }
+ if (xk == GetX()) return kTRUE;
- Double_t oldX = GetX();
- Double_t oldY = GetY();
- Double_t oldZ = GetZ();
-
- Double_t bz = GetBz();
-
- if (!AliExternalTrackParam::PropagateTo(xk,bz)) {
- return kFALSE;
- }
-
- Double_t x = GetX();
- Double_t y = GetY();
- Double_t z = GetZ();
-
- if (oldX < xk) {
+ Double_t xyz0[3] = {GetX(), GetY(), GetZ()}, // track position BEFORE propagation
+ b[3]; // magnetic field
+ GetBxByBz(b);
+ if(!AliExternalTrackParam::PropagateToBxByBz(xk,b)) return kFALSE;
+
+ // local track position AFTER propagation
+ Double_t xyz1[3] = {GetX(), GetY(), GetZ()};
+ if(xyz0[0] < xk) {
xrho = -xrho;
if (IsStartedTimeIntegral()) {
- Double_t l2 = TMath::Sqrt((x-oldX)*(x-oldX)
- + (y-oldY)*(y-oldY)
- + (z-oldZ)*(z-oldZ));
- Double_t crv = AliExternalTrackParam::GetC(bz);
+ Double_t l2 = TMath::Sqrt((xyz1[0]-xyz0[0])*(xyz1[0]-xyz0[0])
+ + (xyz1[1]-xyz0[1])*(xyz1[1]-xyz0[1])
+ + (xyz1[2]-xyz0[2])*(xyz1[2]-xyz0[2]));
+ Double_t crv = AliExternalTrackParam::GetC(b[2]);
if (TMath::Abs(l2*crv) > 0.0001) {
// Make correction for curvature if neccesary
- l2 = 0.5 * TMath::Sqrt((x-oldX)*(x-oldX)
- + (y-oldY)*(y-oldY));
+ l2 = 0.5 * TMath::Sqrt((xyz1[0]-xyz0[0])*(xyz1[0]-xyz0[0])
+ + (xyz1[1]-xyz0[1])*(xyz1[1]-xyz0[1]));
l2 = 2.0 * TMath::ASin(l2 * crv) / crv;
- l2 = TMath::Sqrt(l2*l2 + (z-oldZ)*(z-oldZ));
+ l2 = TMath::Sqrt(l2*l2 + (xyz1[2]-xyz0[2])*(xyz1[2]-xyz0[2]));
}
AddTimeStep(l2);
}
Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
Rotate(alpha,kTRUE);
GetXYZ(xyz0);
- GetProlongation(x,y,z);
+ if(GetProlongation(x,y,z)<0) return -1;
xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha);
xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha);
xyz1[2] = z;
Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]);
Rotate(alpha,kTRUE);
GetXYZ(xyz0);
- GetProlongation(r,y,z);
+ if(GetProlongation(r,y,z)<0) return -1;
xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha);
xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha);
xyz1[2] = z;
//_____________________________________________________________________________
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]));
+ // Print track status
+ 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| = (");
const Double_t *curP = GetParameter();
for (Int_t i = 0; i < 5; i++) printf("%7.2f ", curP[i]);
k=-1; j--;
}
}
+ if(strcmp(o, "a")!=0) return;
for(Int_t ip=0; ip<kNplane; ip++){
if(!fTracklet[ip]) continue;
Int_t ncls = 0;
for(int ip=0; ip<kNplane; ip++){
- if(fTracklet[ip] && fTrackletIndex[ip] != 0xffff) ncls += fTracklet[ip]->GetN();
+ if(fTracklet[ip] && fTrackletIndex[ip] >= 0) ncls += fTracklet[ip]->GetN();
}
AliKalmanTrack::SetNumberOfClusters(ncls);
}
if(TestBit(kOwner)) return;
for (Int_t ip = 0; ip < kNplane; ip++) {
- if(fTrackletIndex[ip] == 0xffff) continue;
+ if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue;
fTracklet[ip] = new AliTRDseedV1(*fTracklet[ip]);
fTracklet[ip]->SetOwner();
}
}
//_______________________________________________________________
-void AliTRDtrackV1::SetTracklet(AliTRDseedV1 *trklt, Int_t index)
+void AliTRDtrackV1::SetTracklet(AliTRDseedV1 *const trklt, Int_t index)
{
//
// Set the tracklets
}
//_______________________________________________________________
-void AliTRDtrackV1::UnsetTracklet(Int_t plane)
+void AliTRDtrackV1::SetTrackIn()
{
- if(plane<0 && plane >= kNplane) return;
- fTrackletIndex[plane] = 0xffff;
- fTracklet[plane] = 0x0;
+ const AliExternalTrackParam *op = dynamic_cast<const AliExternalTrackParam*>(this);
+ fTrackLow = fTrackLow ? new(fTrackLow) AliExternalTrackParam(*op) : new AliExternalTrackParam(*op);
}
+//_______________________________________________________________
+void AliTRDtrackV1::SetTrackOut(const AliExternalTrackParam *op)
+{
+ if(!op) op = dynamic_cast<const AliExternalTrackParam*>(this);
+ fTrackHigh = fTrackHigh ? new(fTrackHigh) AliExternalTrackParam(*op) : new AliExternalTrackParam(*op);
+}
//_______________________________________________________________
-Bool_t AliTRDtrackV1::Update(AliTRDseedV1 *trklt, Double_t chisq)
+void AliTRDtrackV1::UnsetTracklet(Int_t plane)
{
- //
- // Update track and tracklet parameters
- //
-
- Double_t x = GetX();
- Double_t p[2] = { trklt->GetYat(x)
- , trklt->GetZat(x) };
- 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());
-// //
-// Double_t xref = trklt->GetXref();
-// trklt->GetCovAt(xref, covR);
-// printf("xr=%5.3f y=%f+-%f z=%f+-%f (covYZ=%f)\n", xref, trklt->GetYat(xref), TMath::Sqrt(covR[0]), trklt->GetZat(xref), TMath::Sqrt(covR[2]), covR[1]);
-//
-// Double_t x0 = trklt->GetX0();
-// trklt->GetCovAt(x0, cov0);
-// printf("x0=%5.3f y=%f+-%f z=%f+-%f (covYZ=%f)\n", x0, trklt->GetYat(x0), TMath::Sqrt(cov0[0]), trklt->GetZat(x0), TMath::Sqrt(cov0[2]), cov0[1]);
-//
-// trklt->GetCovAt(x, cov);
-// printf("x =%5.3f y=%f+-%f z=%f+-%f (covYZ=%f)\n", x, p[0], TMath::Sqrt(cov[0]), p[1], TMath::Sqrt(cov[2]), cov[1]);
-//
-// const Double_t *cc = GetCovariance();
-// printf("yklm[0] = %f +- %f\n", GetY(), TMath::Sqrt(cc[0]));
+ if(plane<0 && plane >= kNplane) return;
+ fTrackletIndex[plane] = -1;
+ fTracklet[plane] = NULL;
+}
- trklt->GetCovAt(x, cov);
- if(!AliExternalTrackParam::Update(p, cov)) return kFALSE;
-// cc = GetCovariance();
-// printf("yklm[1] = %f +- %f\n", GetY(), TMath::Sqrt(cc[0]));
- AliTRDcluster *c = 0x0;
- Int_t ic = 0; while(!(c = trklt->GetClusters(ic))) ic++;
- AliTracker::FillResiduals(this, p, cov, c->GetVolumeId());
-
- // Register info to track
- SetNumberOfClusters();
- SetChi2(GetChi2() + chisq);
- return kTRUE;
+//_______________________________________________________________
+void AliTRDtrackV1::UpdateChi2(Float_t chi2)
+{
+// Update chi2/track with one tracklet contribution
+ SetChi2(GetChi2() + chi2);
}
//_______________________________________________________________
// Update the TRD PID information in the ESD track
//
- Int_t nslices = fReconstructor->IsEightSlices() ? (Int_t)AliTRDpidUtil::kNNslices : (Int_t)AliTRDpidUtil::kLQslices;
- track->SetNumberOfTRDslices(nslices);
-
+ Int_t nslices = fkReconstructor->GetRecoParam()->IsEightSlices() ? (Int_t)AliTRDpidUtil::kNNslices : (Int_t)AliTRDpidUtil::kLQslices;
+ // number of tracklets used for PID calculation
+ UChar_t nPID = GetNumberOfTrackletsPID();
+ // number of tracklets attached to the track
+ UChar_t nTrk = GetNumberOfTracklets();
+ // pack the two numbers together and store them in the ESD
+ track->SetTRDntracklets(nPID | (nTrk<<3));
+ // allocate space to store raw PID signals dEdx & momentum
+ track->SetNumberOfTRDslices((nslices+2)*AliTRDgeometry::kNlayer);
+ // store raw signals
+ Float_t p, sp; Double_t spd;
for (Int_t ip = 0; ip < kNplane; ip++) {
- if(fTrackletIndex[ip] == 0xffff) continue;
- if(!fTracklet[ip]->IsOK()) continue;
- fTracklet[ip]->CookdEdx(nslices);
- Float_t *dedx = fTracklet[ip]->GetdEdx();
+ if(fTrackletIndex[ip]<0 || !fTracklet[ip]) continue;
+ if(!fTracklet[ip]->HasPID()) continue;
+ const Float_t *dedx = fTracklet[ip]->GetdEdx();
for (Int_t js = 0; js < nslices; js++, dedx++) track->SetTRDslice(*dedx, ip, js);
+ p = fTracklet[ip]->GetMomentum(&sp); spd = sp;
+ track->SetTRDmomentum(p, ip, &spd);
}
-
- // copy PID to ESD
- if(!fPIDquality) return;
+ // store PID probabilities
track->SetTRDpid(fPID);
- track->SetTRDpidQuality(fPIDquality);
}