From a023d8d865e9bbfbb80ed812b76718f15421f83a Mon Sep 17 00:00:00 2001 From: belikov Date: Mon, 12 Nov 2007 09:39:28 +0000 Subject: [PATCH] Second round of ESD clean-up at the physics level: possibility to reduce the number of stored V0 candidates by filtering on the DCA between the daughters and the cosine of pointing angle --- STEER/AliESD.cxx | 128 +++++++++++++++++++++++++++++++++--- STEER/AliESD.h | 2 + STEER/AliESDEvent.cxx | 125 +++++++++++++++++++++++++++++++++-- STEER/AliESDEvent.h | 2 + STEER/AliReconstruction.cxx | 4 ++ STEER/AliReconstruction.h | 8 ++- 6 files changed, 253 insertions(+), 16 deletions(-) diff --git a/STEER/AliESD.cxx b/STEER/AliESD.cxx index 127e962e262..fdd03bf596c 100644 --- a/STEER/AliESD.cxx +++ b/STEER/AliESD.cxx @@ -213,6 +213,83 @@ void AliESD::Reset() fErrorLogs.Clear(); } + +Bool_t AliESD::RemoveKink(Int_t rm) { + // --------------------------------------------------------- + // Remove a kink candidate and references to it from ESD, + // if this candidate does not come from a reconstructed decay + // Not yet implemented... + // --------------------------------------------------------- + Int_t last=GetNumberOfKinks()-1; + if ((rm<0)||(rm>last)) return kFALSE; + + return kTRUE; +} + +Bool_t AliESD::RemoveV0(Int_t rm) { + // --------------------------------------------------------- + // Remove a V0 candidate and references to it from ESD, + // if this candidate does not come from a reconstructed decay + // --------------------------------------------------------- + Int_t last=GetNumberOfV0s()-1; + if ((rm<0)||(rm>last)) return kFALSE; + + AliESDv0 *v0=GetV0(rm); + Int_t idxP=v0->GetPindex(), idxN=v0->GetNindex(); + + v0=GetV0(last); + Int_t lastIdxP=v0->GetPindex(), lastIdxN=v0->GetNindex(); + + Int_t used=0; + + // Check if this V0 comes from a reconstructed decay + Int_t ncs=GetNumberOfCascades(); + for (Int_t n=0; nGetPindex(); + Int_t csIdxN=cs->GetNindex(); + + if (idxP==csIdxP) + if (idxN==csIdxN) return kFALSE; + + if (csIdxP==lastIdxP) + if (csIdxN==lastIdxN) used++; + } + + //Replace the removed V0 with the last V0 + TClonesArray &a=fV0s; + delete a.RemoveAt(rm); + + if (rm==last) return kTRUE; + + //v0 is pointing to the last V0 candidate... + new (a[rm]) AliESDv0(*v0); + delete a.RemoveAt(last); + + if (!used) return kTRUE; + + + // Remap the indices of the daughters of reconstructed decays + for (Int_t n=0; nGetPindex(); + Int_t csIdxN=cs->GetNindex(); + + if (csIdxP==lastIdxP) + if (csIdxN==lastIdxN) { + cs->AliESDv0::SetIndex(1,idxP); + cs->AliESDv0::SetIndex(0,idxN); + used--; + if (!used) return kTRUE; + } + } + + return kTRUE; +} + Bool_t AliESD::RemoveTrack(Int_t rm) { // --------------------------------------------------------- // Remove a track and references to it from ESD, @@ -272,8 +349,8 @@ Bool_t AliESD::RemoveTrack(Int_t rm) { delete a.RemoveAt(last); if (!used) return kTRUE; - + // Remap the indices of the daughters of reconstructed decays for (Int_t n=0; n cleanPars[1] + dca/cleanPars[0]*(1.- cleanPars[1]) + // + // an attempt to remove this V0 candidate from ESD is made. + // + // The V0 candidate gets removed if it does not belong to any + // recosntructed cascade decay + // + // 12.11.2007, optimal values: cleanPars[0]=0.5, cleanPars[1]=0.999 + // + // 2) Cleaning the tracks + // ---------------------- + // If track's transverse parameter is larger than cleanPars[2] // OR - // track's longitudinal parameter is larger than zmax - // an attempt to remove this track from ESD is made. + // track's longitudinal parameter is larger than cleanPars[3] + // an attempt to remove this track from ESD is made. // - // The track gets removed if it does not come - // from a reconstructed decay + // The track gets removed if it does not come + // from a reconstructed decay // + Bool_t rc=kFALSE; + + Float_t dcaMax=cleanPars[0]; + Float_t cspMin=cleanPars[1]; + + Int_t nV0s=GetNumberOfV0s(); + for (Int_t i=nV0s-1; i>=0; i--) { + AliESDv0 *v0=GetV0(i); + + Float_t dca=v0->GetDcaV0Daughters(); + Float_t csp=v0->GetV0CosineOfPointingAngle(); + Float_t cspcut=cspMin + dca/dcaMax*(1.-cspMin); + if (csp > cspcut) continue; + + if (RemoveV0(i)) rc=kTRUE; + } + - Float_t dmax=cleanPars[0], zmax=cleanPars[1]; + Float_t dmax=cleanPars[2], zmax=cleanPars[3]; const AliESDVertex *vertex=GetVertex(); - Bool_t vtxOK=vertex->GetStatus(), rc=kFALSE; + Bool_t vtxOK=vertex->GetStatus(); Int_t nTracks=GetNumberOfTracks(); for (Int_t i=nTracks-1; i>=0; i--) { diff --git a/STEER/AliESD.h b/STEER/AliESD.h index e80095f12b9..4748063abd2 100644 --- a/STEER/AliESD.h +++ b/STEER/AliESD.h @@ -76,6 +76,8 @@ public: } Bool_t Clean(Float_t *cleanPars); + Bool_t RemoveKink(Int_t i); + Bool_t RemoveV0(Int_t i); Bool_t RemoveTrack(Int_t i); Int_t AddTrack(const AliESDtrack *t) { diff --git a/STEER/AliESDEvent.cxx b/STEER/AliESDEvent.cxx index 4638c7b3ce6..f88690d1c64 100644 --- a/STEER/AliESDEvent.cxx +++ b/STEER/AliESDEvent.cxx @@ -27,6 +27,7 @@ #include "TRefArray.h" #include +#include "AliLog.h" #include "AliESDEvent.h" #include "AliESDfriend.h" #include "AliESDVZERO.h" @@ -381,6 +382,82 @@ void AliESDEvent::SetESDfriend(const AliESDfriend *ev) { } } +Bool_t AliESDEvent::RemoveKink(Int_t rm) { + // --------------------------------------------------------- + // Remove a kink candidate and references to it from ESD, + // if this candidate does not come from a reconstructed decay + // Not yet implemented... + // --------------------------------------------------------- + Int_t last=GetNumberOfKinks()-1; + if ((rm<0)||(rm>last)) return kFALSE; + + return kTRUE; +} + +Bool_t AliESDEvent::RemoveV0(Int_t rm) { + // --------------------------------------------------------- + // Remove a V0 candidate and references to it from ESD, + // if this candidate does not come from a reconstructed decay + // --------------------------------------------------------- + Int_t last=GetNumberOfV0s()-1; + if ((rm<0)||(rm>last)) return kFALSE; + + AliESDv0 *v0=GetV0(rm); + Int_t idxP=v0->GetPindex(), idxN=v0->GetNindex(); + + v0=GetV0(last); + Int_t lastIdxP=v0->GetPindex(), lastIdxN=v0->GetNindex(); + + Int_t used=0; + + // Check if this V0 comes from a reconstructed decay + Int_t ncs=GetNumberOfCascades(); + for (Int_t n=0; nGetPindex(); + Int_t csIdxN=cs->GetNindex(); + + if (idxP==csIdxP) + if (idxN==csIdxN) return kFALSE; + + if (csIdxP==lastIdxP) + if (csIdxN==lastIdxN) used++; + } + + //Replace the removed V0 with the last V0 + TClonesArray &a=*fV0s; + delete a.RemoveAt(rm); + + if (rm==last) return kTRUE; + + //v0 is pointing to the last V0 candidate... + new (a[rm]) AliESDv0(*v0); + delete a.RemoveAt(last); + + if (!used) return kTRUE; + + + // Remap the indices of the daughters of reconstructed decays + for (Int_t n=0; nGetPindex(); + Int_t csIdxN=cs->GetNindex(); + + if (csIdxP==lastIdxP) + if (csIdxN==lastIdxN) { + cs->AliESDv0::SetIndex(1,idxP); + cs->AliESDv0::SetIndex(0,idxN); + used--; + if (!used) return kTRUE; + } + } + + return kTRUE; +} + Bool_t AliESDEvent::RemoveTrack(Int_t rm) { // --------------------------------------------------------- // Remove a track and references to it from ESD, @@ -488,19 +565,53 @@ 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 + // 1) Cleaning the V0 candidates + // --------------------------- + // If the cosine of the V0 pointing angle "csp" and + // the DCA between the daughter tracks "dca" does not satisfy + // the conditions + // + // csp > cleanPars[1] + dca/cleanPars[0]*(1.- cleanPars[1]) + // + // an attempt to remove this V0 candidate from ESD is made. + // + // The V0 candidate gets removed if it does not belong to any + // recosntructed cascade decay + // + // 12.11.2007, optimal values: cleanPars[0]=0.5, cleanPars[1]=0.999 + // + // 2) Cleaning the tracks + // ---------------------- + // If track's transverse parameter is larger than cleanPars[2] // OR - // track's longitudinal parameter is larger than fZmax - // an attempt to remove this track from ESD is made. + // track's longitudinal parameter is larger than cleanPars[3] + // an attempt to remove this track from ESD is made. // - // The track gets removed if it does not come - // from a reconstructed decay + // The track gets removed if it does not come + // from a reconstructed decay // + Bool_t rc=kFALSE; + + Float_t dcaMax=cleanPars[0]; + Float_t cspMin=cleanPars[1]; + + Int_t nV0s=GetNumberOfV0s(); + for (Int_t i=nV0s-1; i>=0; i--) { + AliESDv0 *v0=GetV0(i); + + Float_t dca=v0->GetDcaV0Daughters(); + Float_t csp=v0->GetV0CosineOfPointingAngle(); + Float_t cspcut=cspMin + dca/dcaMax*(1.-cspMin); + if (csp > cspcut) continue; + + if (RemoveV0(i)) rc=kTRUE; + } + - Float_t dmax=cleanPars[0], zmax=cleanPars[1]; + Float_t dmax=cleanPars[2], zmax=cleanPars[3]; const AliESDVertex *vertex=GetVertex(); - Bool_t vtxOK=vertex->GetStatus(), rc=kFALSE; + Bool_t vtxOK=vertex->GetStatus(); Int_t nTracks=GetNumberOfTracks(); for (Int_t i=nTracks-1; i>=0; i--) { diff --git a/STEER/AliESDEvent.h b/STEER/AliESDEvent.h index f3ab26b4c7e..52b83e498b0 100644 --- a/STEER/AliESDEvent.h +++ b/STEER/AliESDEvent.h @@ -178,6 +178,8 @@ public: Bool_t Clean(Float_t *cleanPars); + Bool_t RemoveKink(Int_t i); + Bool_t RemoveV0(Int_t i); Bool_t RemoveTrack(Int_t i); AliESDtrack *GetTrack(Int_t i) const { diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index 073d67c7f9f..ae6226b8189 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -211,6 +211,8 @@ AliReconstruction::AliReconstruction(const char* gAliceFilename, const char* cdb fFillTriggerESD(kTRUE), fCleanESD(kTRUE), + fV0DCAmax(3.), + fV0CsPmin(0.), fDmax(50.), fZmax(50.), @@ -274,6 +276,8 @@ AliReconstruction::AliReconstruction(const AliReconstruction& rec) : fFillTriggerESD(rec.fFillTriggerESD), fCleanESD(rec.fCleanESD), + fV0DCAmax(rec.fV0DCAmax), + fV0CsPmin(fV0CsPmin), fDmax(rec.fDmax), fZmax(rec.fZmax), diff --git a/STEER/AliReconstruction.h b/STEER/AliReconstruction.h index 83c0f350cb4..2ba727b6ff9 100644 --- a/STEER/AliReconstruction.h +++ b/STEER/AliReconstruction.h @@ -85,8 +85,12 @@ public: void SetDiamondProfile(AliESDVertex *dp) {fDiamondProfile=dp;} void SetCleanESD(Bool_t flag=kTRUE){fCleanESD=flag;} + void SetV0DCAmax(Float_t d) {fV0DCAmax=d;} + void SetV0CsPmin(Float_t d) {fV0CsPmin=d;} void SetDmax(Float_t d) {fDmax=d;} void SetZmax(Float_t z) {fZmax=z;} + Float_t GetV0DCAmax() const {return fV0DCAmax;} + Float_t GetV0CsPmin() const {return fV0CsPmin;} Float_t GetDmax() const {return fDmax;} Float_t GetZmax() const {return fZmax;} @@ -164,6 +168,8 @@ private: //*** Clean ESD flag and parameters ******************* Bool_t fCleanESD; // clean ESD flag + Float_t fV0DCAmax; // max. allowed DCA between V0 daugthers + Float_t fV0CsPmin; // min. allowed cosine of V0 pointing angle Float_t fDmax; // max. allowed transverse impact parameter Float_t fZmax; // max. allowed longitudinal impact parameter @@ -208,7 +214,7 @@ private: // Int_t fQACycles[fgkNDetectors] ; // cycle length (# events) over which QA data are accumulated Bool_t fRunQA ; // Runs the QA at the end of simulation - ClassDef(AliReconstruction, 16) // class for running the reconstruction + ClassDef(AliReconstruction, 17) // class for running the reconstruction }; #endif -- 2.43.0