fErrorLogs.Clear();
}
-Bool_t AliESD::RemoveTrack(Int_t /*i*/) {
+Bool_t AliESD::RemoveTrack(Int_t rm) {
// ---------------------------------------------------------
- // Remove track
+ // Remove a track and references to it from ESD,
+ // if this track does not come from a reconstructed decay
// ---------------------------------------------------------
+ Int_t last=GetNumberOfTracks()-1;
+ if ((rm<0)||(rm>last)) return kFALSE;
+
+ Int_t used=0;
// Check if this track comes from a reconstructed decay
- // if (yes) return kFALSE
+ Int_t nv0=GetNumberOfV0s();
+ for (Int_t n=0; n<nv0; n++) {
+ AliESDv0 *v0=GetV0(n);
+
+ Int_t idx=v0->GetNindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+
+ idx=v0->GetPindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
- // Remap the indices of the daughters of recosntructed decays
+ Int_t ncs=GetNumberOfCascades();
+ for (Int_t n=0; n<ncs; n++) {
+ AliESDcascade *cs=GetCascade(n);
- // Remove the track
- // delete fTracks->RemoveAt(i);
+ Int_t idx=cs->GetIndex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
+
+ Int_t nkn=GetNumberOfKinks();
+ for (Int_t n=0; n<nkn; n++) {
+ AliESDkink *kn=GetKink(n);
- // Compress the array with tracks
- // fTracks->Compress();
+ Int_t idx=kn->GetIndex(0);
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+
+ idx=kn->GetIndex(1);
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
+
+
+ //Replace the removed track with the last track
+ TClonesArray &a=fTracks;
+ delete a.RemoveAt(rm);
+
+ if (rm==last) return kTRUE;
+
+ AliESDtrack *t=GetTrack(last);
+ t->SetID(rm);
+ new (a[rm]) AliESDtrack(*t);
+ delete a.RemoveAt(last);
+
+ if (!used) return kTRUE;
+
+
+ // Remap the indices of the daughters of reconstructed decays
+ for (Int_t n=0; n<nv0; n++) {
+ AliESDv0 *v0=GetV0(n);
+ if (v0->GetIndex(0)==last) {
+ v0->SetIndex(0,rm);
+ used--;
+ if (!used) return kTRUE;
+ }
+ if (v0->GetIndex(1)==last) {
+ v0->SetIndex(1,rm);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
+
+ for (Int_t n=0; n<ncs; n++) {
+ AliESDcascade *cs=GetCascade(n);
+ if (cs->GetIndex()==last) {
+ cs->SetIndex(rm);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
+
+ for (Int_t n=0; n<nkn; n++) {
+ AliESDkink *kn=GetKink(n);
+ if (kn->GetIndex(0)==last) {
+ kn->SetIndex(rm,0);
+ used--;
+ if (!used) return kTRUE;
+ }
+ if (kn->GetIndex(1)==last) {
+ kn->SetIndex(rm,1);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
return kTRUE;
}
+Bool_t AliESD::Clean(Float_t *cleanPars) {
+ //
+ // Remove the data which are not needed for the physics analysis.
+ //
+ // If track's transverse parameter is larger than dmax
+ // OR
+ // track's longitudinal parameter is larger than zmax
+ // an attempt to remove this track from ESD is made.
+ //
+ // The track gets removed if it does not come
+ // from a reconstructed decay
+ //
+
+ Float_t dmax=cleanPars[0], zmax=cleanPars[1];
+
+ const AliESDVertex *vertex=GetVertex();
+ Bool_t vtxOK=vertex->GetStatus(), rc=kFALSE;
+
+ Int_t nTracks=GetNumberOfTracks();
+ for (Int_t i=nTracks-1; i>=0; i--) {
+ AliESDtrack *track=GetTrack(i);
+ Float_t xy,z; track->GetImpactParameters(xy,z);
+ if ((TMath::Abs(xy) > dmax) || (vtxOK && (TMath::Abs(z) > zmax))) {
+ if (RemoveTrack(i)) rc=kTRUE;
+ }
+ }
+
+ return rc;
+}
+
Int_t AliESD::AddV0(const AliESDv0 *v) {
//
// Add V0
return (AliESDTrdTrack *)fTrdTracks.UncheckedAt(i);
}
- Bool_t RemoveTrack(Int_t i);
+ Bool_t Clean(Float_t *cleanPars);
+ Bool_t RemoveTrack(Int_t i);
Int_t AddTrack(const AliESDtrack *t) {
AliESDtrack * track = new(fTracks[fTracks.GetEntriesFast()]) AliESDtrack(*t);
}
}
-Bool_t AliESDEvent::RemoveTrack(Int_t /*i*/) {
+Bool_t AliESDEvent::RemoveTrack(Int_t rm) {
// ---------------------------------------------------------
- // Remove track
+ // Remove a track and references to it from ESD,
+ // if this track does not come from a reconstructed decay
// ---------------------------------------------------------
+ Int_t last=GetNumberOfTracks()-1;
+ if ((rm<0)||(rm>last)) return kFALSE;
+
+ Int_t used=0;
// Check if this track comes from a reconstructed decay
- // if (yes) return kFALSE
+ Int_t nv0=GetNumberOfV0s();
+ for (Int_t n=0; n<nv0; n++) {
+ AliESDv0 *v0=GetV0(n);
+
+ Int_t idx=v0->GetNindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+
+ idx=v0->GetPindex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
+
+ Int_t ncs=GetNumberOfCascades();
+ for (Int_t n=0; n<ncs; n++) {
+ AliESDcascade *cs=GetCascade(n);
- // Remap the indices of the daughters of recosntructed decays
+ Int_t idx=cs->GetIndex();
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
+
+ Int_t nkn=GetNumberOfKinks();
+ for (Int_t n=0; n<nkn; n++) {
+ AliESDkink *kn=GetKink(n);
+
+ Int_t idx=kn->GetIndex(0);
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+
+ idx=kn->GetIndex(1);
+ if (rm==idx) return kFALSE;
+ if (idx==last) used++;
+ }
- // Remove the track
- // delete fTracks->RemoveAt(i);
- // Compress the array with tracks
- // fTracks->Compress();
+ //Replace the removed track with the last track
+ TClonesArray &a=*fTracks;
+ delete a.RemoveAt(rm);
+
+ if (rm==last) return kTRUE;
+
+ AliESDtrack *t=GetTrack(last);
+ t->SetID(rm);
+ new (a[rm]) AliESDtrack(*t);
+ delete a.RemoveAt(last);
+
+ if (!used) return kTRUE;
+
+
+ // Remap the indices of the daughters of reconstructed decays
+ for (Int_t n=0; n<nv0; n++) {
+ AliESDv0 *v0=GetV0(n);
+ if (v0->GetIndex(0)==last) {
+ v0->SetIndex(0,rm);
+ used--;
+ if (!used) return kTRUE;
+ }
+ if (v0->GetIndex(1)==last) {
+ v0->SetIndex(1,rm);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
+
+ for (Int_t n=0; n<ncs; n++) {
+ AliESDcascade *cs=GetCascade(n);
+ if (cs->GetIndex()==last) {
+ cs->SetIndex(rm);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
+
+ for (Int_t n=0; n<nkn; n++) {
+ AliESDkink *kn=GetKink(n);
+ if (kn->GetIndex(0)==last) {
+ kn->SetIndex(rm,0);
+ used--;
+ if (!used) return kTRUE;
+ }
+ if (kn->GetIndex(1)==last) {
+ kn->SetIndex(rm,1);
+ used--;
+ if (!used) return kTRUE;
+ }
+ }
return kTRUE;
}
+Bool_t AliESDEvent::Clean(Float_t *cleanPars) {
+ //
+ // Remove the data which are not needed for the physics analysis.
+ //
+ // If track's transverse parameter is larger than fDmax
+ // OR
+ // track's longitudinal parameter is larger than fZmax
+ // an attempt to remove this track from ESD is made.
+ //
+ // The track gets removed if it does not come
+ // from a reconstructed decay
+ //
+
+ Float_t dmax=cleanPars[0], zmax=cleanPars[1];
+
+ const AliESDVertex *vertex=GetVertex();
+ Bool_t vtxOK=vertex->GetStatus(), rc=kFALSE;
+
+ Int_t nTracks=GetNumberOfTracks();
+ for (Int_t i=nTracks-1; i>=0; i--) {
+ AliESDtrack *track=GetTrack(i);
+ Float_t xy,z; track->GetImpactParameters(xy,z);
+ if ((TMath::Abs(xy) > dmax) || (vtxOK && (TMath::Abs(z) > zmax))) {
+ if (RemoveTrack(i)) rc=kTRUE;
+ }
+ }
+
+ return rc;
+}
+
Int_t AliESDEvent::AddTrack(const AliESDtrack *t) {
// Add track
TClonesArray &ftr = *fTracks;
const AliMultiplicity *GetMultiplicity() const {return fSPDMult;}
- Bool_t RemoveTrack(Int_t i);
+ Bool_t Clean(Float_t *cleanPars);
+ Bool_t RemoveTrack(Int_t i);
AliESDtrack *GetTrack(Int_t i) const {
return (AliESDtrack *)fTracks->UncheckedAt(i);
}
Int_t GetBindex() const {return fBachIdx;}
+ void SetIndex(Int_t i) {fBachIdx=i;} //for the consistensy with V0
+ Int_t GetIndex() const {return GetBindex();} //for the consistensy with V0
void SetDcaXiDaughters(Double_t rDcaXiDaughters=0.);
Double_t GetDcaXiDaughters() const {return fDcaXiDaughters;}
Double_t GetCascadeCosineOfPointingAngle(Double_t&, Double_t&, Double_t&) const;
fRunCascadeFinder(kTRUE),
fStopOnError(kFALSE),
fWriteAlignmentData(kFALSE),
- fCleanESD(kTRUE),
fWriteESDfriend(kFALSE),
fWriteAOD(kFALSE),
fFillTriggerESD(kTRUE),
+ fCleanESD(kTRUE),
+ fDmax(50.),
+ fZmax(50.),
+
fRunLocalReconstruction("ALL"),
fRunTracking("ALL"),
fFillESD("ALL"),
fRunCascadeFinder(rec.fRunCascadeFinder),
fStopOnError(rec.fStopOnError),
fWriteAlignmentData(rec.fWriteAlignmentData),
- fCleanESD(rec.fCleanESD),
fWriteESDfriend(rec.fWriteESDfriend),
fWriteAOD(rec.fWriteAOD),
fFillTriggerESD(rec.fFillTriggerESD),
+ fCleanESD(rec.fCleanESD),
+ fDmax(rec.fDmax),
+ fZmax(rec.fZmax),
+
fRunLocalReconstruction(rec.fRunLocalReconstruction),
fRunTracking(rec.fRunTracking),
fFillESD(rec.fFillESD),
//
AliInfo("Cleaning the ESD...");
-
- const AliESDVertex *vertex=esd->GetVertex();
- Double_t vz=vertex->GetZv();
-
Int_t nTracks=esd->GetNumberOfTracks();
- for (Int_t i=0; i<nTracks; i++) {
- AliESDtrack *track=esd->GetTrack(i);
+ AliInfo(Form("Number of ESD tracks before cleaning %d",nTracks));
- Float_t xy,z; track->GetImpactParameters(xy,z);
- if (TMath::Abs(xy) < 50.) continue;
- if (vertex->GetStatus())
- if (TMath::Abs(vz-z) < 5.) continue;
+ Float_t cleanPars[]={fDmax,fZmax};
+ Bool_t rc=esd->Clean(cleanPars);
- esd->RemoveTrack(i);
- }
+ nTracks=esd->GetNumberOfTracks();
+ AliInfo(Form("Number of ESD tracks after cleaning %d",nTracks));
- return kTRUE;
+ return rc;
}
//_____________________________________________________________________________
void SetRunCascadeFinder(Bool_t flag=kTRUE) {fRunCascadeFinder=flag;};
void SetStopOnError(Bool_t flag=kTRUE) {fStopOnError=flag;}
void SetWriteAlignmentData(Bool_t flag=kTRUE){fWriteAlignmentData=flag;}
- void SetCleanESD(Bool_t flag=kTRUE){fCleanESD=flag;}
void SetWriteESDfriend(Bool_t flag=kTRUE){fWriteESDfriend=flag;}
void SetWriteAOD(Bool_t flag=kTRUE){fWriteAOD=flag;}
void SetFillTriggerESD(Bool_t flag=kTRUE){fFillTriggerESD=flag;}
void SetDiamondProfile(AliESDVertex *dp) {fDiamondProfile=dp;}
+ void SetCleanESD(Bool_t flag=kTRUE){fCleanESD=flag;}
+ void SetDmax(Float_t d) {fDmax=d;}
+ void SetZmax(Float_t z) {fZmax=z;}
+ Float_t GetDmax() const {return fDmax;}
+ Float_t GetZmax() const {return fZmax;}
+
void SetCheckPointLevel(Int_t checkPointLevel)
{fCheckPointLevel = checkPointLevel;}
// CDB storage activation
Bool_t fRunCascadeFinder; // run the ESD cascade finder
Bool_t fStopOnError; // stop or continue on errors
Bool_t fWriteAlignmentData; // write track space-points flag
- Bool_t fCleanESD; // clean ESD flag
Bool_t fWriteESDfriend; // write ESD friend flag
Bool_t fWriteAOD; // write AOD flag
Bool_t fFillTriggerESD; // fill trigger info into ESD
+ //*** Clean ESD flag and parameters *******************
+ Bool_t fCleanESD; // clean ESD flag
+ Float_t fDmax; // max. allowed transverse impact parameter
+ Float_t fZmax; // max. allowed longitudinal impact parameter
+
TString fRunLocalReconstruction; // run the local reconstruction for these detectors
TString fRunTracking; // run the tracking for these detectors
TString fFillESD; // fill ESD for these detectors
AliQualAssDataMaker * fQualAssDataMaker[fgkNDetectors]; //! array of QA data maker objects
Int_t fQACycles[fgkNDetectors] ; // cycle length (# events) over which QA data are accumulated
- ClassDef(AliReconstruction, 14) // class for running the reconstruction
+ ClassDef(AliReconstruction, 15) // class for running the reconstruction
};
#endif