Skip to content

Commit

Permalink
Port cookdedx fixes to production branch
Browse files Browse the repository at this point in the history
From now on all tags from the production branch will have the `cookdedx` suffix
and will contain the two commits that made the fix:

* Fix for CookdEdx in TPC Cluster2Tracks
  The clusters pointers were not attached to TPC seed during Clusters2Traks
  phase, as a result the TPCsignal stored was always 0 and all tracks were
  tracked in ITS as pions dirung ITS Clusters2Tracks stage

* Store PIDForTracking set at TPCin to monitor PID
  • Loading branch information
shahor02 authored and dberzano committed Jan 17, 2017
1 parent 27b4184 commit 34c6baa
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 60 deletions.
5 changes: 3 additions & 2 deletions ITS/ITSbase/AliITStrackerMI.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
for (fCurrentEsdTrack=0; fCurrentEsdTrack<nentr; fCurrentEsdTrack++) {
AliITStrackMI *t=(AliITStrackMI*)itsTracks.UncheckedAt(fCurrentEsdTrack);
if (t==0) continue; //this track has been already tracked
Int_t tpcLabel=t->GetESDtrack()->GetLabel(); //save the TPC track label
AliDebug(2,Form("LABEL %d pass %d",tpcLabel,fPass));

//cout<<"========== "<<fPass<<" "<<fCurrentEsdTrack<<" =========\n";
if (t->GetReconstructed()&&(t->GetNUsed()<1.5)) continue; //this track was already "succesfully" reconstructed
Float_t dz[2]={0}; t->GetDZ(GetX(),GetY(),GetZ(),dz); //I.B.
Expand All @@ -637,8 +640,6 @@ Int_t AliITStrackerMI::Clusters2Tracks(AliESDEvent *event) {
TMath::Abs(dz[1])>AliITSReconstructor::GetRecoParam()->GetMaxDZToUseConstraint()) continue;
}

Int_t tpcLabel=t->GetLabel(); //save the TPC track label
AliDebug(2,Form("LABEL %d pass %d",tpcLabel,fPass));
fI = 6;
ResetTrackToFollow(*t);
ResetBestTrack();
Expand Down
10 changes: 8 additions & 2 deletions STEER/ESD/AliESDtrack.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ AliESDtrack::AliESDtrack() :
fTRDslices(0x0),
fVertexID(-2),// -2 means an orphan track
fPIDForTracking(AliPID::kPion),
fPIDForTrackingIn(AliPID::kPion),
fESDEvent(0),
fCacheNCrossedRows(-10),
fCacheChi2TPCConstrainedVsGlobal(-10),
Expand Down Expand Up @@ -395,6 +396,7 @@ AliESDtrack::AliESDtrack(const AliESDtrack& track):
fTRDslices(0x0),
fVertexID(track.fVertexID),
fPIDForTracking(AliPID::kPion),
fPIDForTrackingIn(AliPID::kPion),
fESDEvent(track.fESDEvent),
fCacheNCrossedRows(track.fCacheNCrossedRows),
fCacheChi2TPCConstrainedVsGlobal(track.fCacheChi2TPCConstrainedVsGlobal),
Expand Down Expand Up @@ -574,6 +576,7 @@ AliESDtrack::AliESDtrack(const AliVTrack *track) :
fTRDslices(0x0),
fVertexID(-2), // -2 means an orphan track
fPIDForTracking(track->GetPIDForTracking()),
fPIDForTrackingIn(track->GetPIDForTracking()),
fESDEvent(0),
fCacheNCrossedRows(-10),
fCacheChi2TPCConstrainedVsGlobal(-10),
Expand Down Expand Up @@ -774,6 +777,7 @@ AliESDtrack::AliESDtrack(TParticle * part) :
fTRDslices(0x0),
fVertexID(-2), // -2 means an orphan track
fPIDForTracking(AliPID::kPion),
fPIDForTrackingIn(AliPID::kPion),
fESDEvent(0),
fCacheNCrossedRows(-10),
fCacheChi2TPCConstrainedVsGlobal(-10),
Expand Down Expand Up @@ -853,7 +857,7 @@ AliESDtrack::AliESDtrack(TParticle * part) :
if (pdgCode<0) pdgCode = -pdgCode;
for (i=0;i<AliPID::kSPECIESC;i++) if (pdgCode==AliPID::ParticleCode(i)) {indexPID = i; break;}

if (indexPID < AliPID::kSPECIESC) fPIDForTracking = indexPID;
if (indexPID < AliPID::kSPECIESC) fPIDForTrackingIn = fPIDForTracking = indexPID;

// AliESD track label
SetLabel(part->GetUniqueID());
Expand Down Expand Up @@ -1049,6 +1053,7 @@ AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source)
else {delete[] fHMPIDr; fHMPIDr = 0;}

fPIDForTracking = source.fPIDForTracking;
fPIDForTrackingIn = source.fPIDForTrackingIn;

fHMPIDtrkTheta = source.fHMPIDtrkTheta;
fHMPIDtrkPhi = source.fHMPIDtrkPhi;
Expand Down Expand Up @@ -1148,6 +1153,7 @@ AliESDtrack &AliESDtrack::operator=(const AliESDtrack &source)
fTRDntracklets = source.fTRDntracklets;
fVertexID = source.fVertexID;
fPIDForTracking = source.fPIDForTracking;
fPIDForTrackingIn = source.fPIDForTrackingIn;

fCacheNCrossedRows = source.fCacheNCrossedRows;
fCacheChi2TPCConstrainedVsGlobal = source.fCacheChi2TPCConstrainedVsGlobal;
Expand Down Expand Up @@ -1407,7 +1413,7 @@ void AliESDtrack::MakeMiniESDtrack(){
fGlobalChi2 = 0;

fVertexID = -2; // an orphan track
fPIDForTracking = AliPID::kPion;
fPIDForTrackingIn = fPIDForTracking = AliPID::kPion;
//
delete fFriendTrack; fFriendTrack = 0;
}
Expand Down
6 changes: 4 additions & 2 deletions STEER/ESD/AliESDtrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,9 @@ class AliESDtrack : public AliExternalTrackParam {
//
Double_t GetMass(Bool_t tpcOnly=kFALSE) const {return AliPID::ParticleMass(GetPID(tpcOnly));}
Double_t GetMassForTracking() const;
void SetPIDForTracking(Int_t pid) {fPIDForTracking = pid;}
void SetPIDForTracking(Int_t pid) {fPIDForTracking = pid; if (!IsOn(kTPCout)) fPIDForTrackingIn=pid;}
Int_t GetPIDForTracking() const {return fPIDForTracking;}
Int_t GetPIDForTracking0() const {return fPIDForTrackingIn;}
Double_t M() const;
Double_t E() const;
Double_t Y() const;
Expand Down Expand Up @@ -657,6 +658,7 @@ class AliESDtrack : public AliExternalTrackParam {
Char_t fTRDTimBin[kTRDnPlanes]; // Time bin of Max cluster from all six planes
Char_t fVertexID; // ID of the primary vertex this track belongs to
Char_t fPIDForTracking; // mass used for tracking
Char_t fPIDForTrackingIn; // mass used for tracking set during TPCin

mutable const AliESDEvent* fESDEvent; //!Pointer back to event to which the track belongs

Expand All @@ -681,7 +683,7 @@ class AliESDtrack : public AliExternalTrackParam {
static bool fgkOnlineMode; //! indicate the online mode to skip some of the functionality

AliESDtrack & operator=(const AliESDtrack & );
ClassDef(AliESDtrack,72) //ESDtrack
ClassDef(AliESDtrack,73) //ESDtrack
};


Expand Down
86 changes: 32 additions & 54 deletions TPC/TPCrec/AliTPCtracker.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7441,11 +7441,24 @@ void AliTPCtracker::FindKinks(TObjArray * array, AliESDEvent *esd)
//
RemoveUsed2(array,0.5,0.4,30);
UnsignClusters();
// RS: the cluster pointers are not permanently attached to the seed during the tracking, need to attach temporarily
AliTPCclusterMI* seedClusters[kMaxRow] = {0};
//
for (Int_t i=0;i<nentries;i++){
AliTPCseed * track0 = (AliTPCseed*)array->At(i);
if (!track0) continue;
//RS: if needed, attach temporary cluster array
const AliTPCclusterMI** seedClustersSave = track0->GetClusters();
if (!seedClustersSave) { //RS: temporary attach clusters
for (int ir=kMaxRow;ir--;) {
int idx = track0->GetClusterIndex2(ir);
seedClusters[ir] = idx<0 ? 0 : GetClusterMI(idx);
}
track0->SetClustersArrayTMP(seedClusters);
}
track0->CookdEdx(0.02,0.6);
track0->CookPID();
if (!seedClustersSave) track0->SetClustersArrayTMP(0);
}
//
// RS use stack allocation instead of the heap
Expand Down Expand Up @@ -8104,78 +8117,43 @@ Int_t AliTPCtracker::Clusters2Tracks() {
//
nseed=fSeeds->GetEntriesFast();
found = 0;
// RS: the cluster pointers are not permanently attached to the seed during the tracking, need to attach temporarily
AliTPCclusterMI* seedClusters[kMaxRow];
//
for (Int_t i=0; i<nseed; i++) {
AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt;
AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t = *pt;
if (!pt) continue;
Int_t nc=t.GetNumberOfClusters();
if (nc<15) {
MarkSeedFree( fSeeds->RemoveAt(i) );
continue;
}
t.SetUniqueID(i);
t.CookdEdx(0.02,0.6);

// CheckKinkPoint(&t,0.05);
//if ((pt->IsActive() || (pt->fRemoval==10) )&& nc>50 &&pt->GetNumberOfClusters()>0.4*pt->fNFoundable){
if ((pt->IsActive() || (pt->GetRemoval()==10) )){
found++;
if (fDebug>0){
cerr<<found<<'\r';
}
if (fDebug>0) cerr<<found<<'\r';
pt->SetLab2(i);
}
else
MarkSeedFree( fSeeds->RemoveAt(i) );
//AliTPCseed * seed1 = ReSeed(pt,0.05,0.5,1);
//if (seed1){
// FollowProlongation(*seed1,0);
// Int_t n = seed1->GetNumberOfClusters();
// printf("fP4\t%f\t%f\n",seed1->GetC(),pt->GetC());
// printf("fN\t%d\t%d\n", seed1->GetNumberOfClusters(),pt->GetNumberOfClusters());
else {MarkSeedFree( fSeeds->RemoveAt(i) );}
//
// temporarilly attach clusters and cook dedx
const AliTPCclusterMI** seedClustersSave = t.GetClusters();
if (!seedClustersSave) { //RS: temporary attach clusters
for (int ir=kMaxRow;ir--;) {
int idx = t.GetClusterIndex2(ir);
seedClusters[ir] = idx<0 ? 0 : GetClusterMI(idx);
}
t.SetClustersArrayTMP(seedClusters);
}
t.CookdEdx(0.02,0.6);
if (!seedClustersSave) t.SetClustersArrayTMP(0);
//
//}
//AliTPCseed * seed2 = ReSeed(pt,0.95,0.5,0.05);

}

SortTracks(fSeeds, 1);

/*
fIteration = 1;
PrepareForBackProlongation(fSeeds,5.);
PropagateBack(fSeeds);
printf("Time for back propagation: \t");timer.Print();timer.Start();
fIteration = 2;
PrepareForProlongation(fSeeds,5.);
PropagateForard2(fSeeds);
printf("Time for FORWARD propagation: \t");timer.Print();timer.Start();
// RemoveUsed(fSeeds,0.7,0.7,6);
//RemoveOverlap(fSeeds,0.9,7,kTRUE);

nseed=fSeeds->GetEntriesFast();
found = 0;
for (Int_t i=0; i<nseed; i++) {
AliTPCseed *pt=(AliTPCseed*)fSeeds->UncheckedAt(i), &t=*pt;
if (!pt) continue;
Int_t nc=t.GetNumberOfClusters();
if (nc<15) {
MarkSeedFree( fSeeds->RemoveAt(i) );
continue;
}
t.CookdEdx(0.02,0.6);
// CookLabel(pt,0.1); //For comparison only
//if ((pt->IsActive() || (pt->fRemoval==10) )&& nc>50 &&pt->GetNumberOfClusters()>0.4*pt->fNFoundable){
if ((pt->IsActive() || (pt->fRemoval==10) )){
cerr<<found++<<'\r';
}
else
MarkSeedFree( fSeeds->RemoveAt(i) );
pt->fLab2 = i;
}
*/

// fNTracks = found;
if (fDebug>0){
Info("Clusters2Tracks","Time for overlap removal, track writing and dedx cooking: \t"); timer.Print();timer.Start();
Expand Down

0 comments on commit 34c6baa

Please sign in to comment.