From 8dd6eba08aaa270dd1d41d5abef6e60bab943659 Mon Sep 17 00:00:00 2001 From: schutz Date: Thu, 25 Nov 2010 10:51:23 +0000 Subject: [PATCH] Add Clear method to Calorimeter objects --- STEER/AliAODCaloCells.cxx | 6 ++++++ STEER/AliAODCaloCells.h | 3 ++- STEER/AliAODCaloCluster.cxx | 10 +++++++++- STEER/AliAODCaloCluster.h | 2 +- STEER/AliAODCluster.cxx | 8 ++++++++ STEER/AliAODCluster.h | 3 ++- STEER/AliESDCaloCells.cxx | 9 +++++++++ STEER/AliESDCaloCells.h | 2 +- STEER/AliESDCaloCluster.cxx | 12 ++++++++++++ STEER/AliESDCaloCluster.h | 3 ++- STEER/AliMCEventHandler.h | 1 + STEER/AliVCaloCells.h | 1 + STEER/AliVCluster.h | 1 + 13 files changed, 55 insertions(+), 6 deletions(-) diff --git a/STEER/AliAODCaloCells.cxx b/STEER/AliAODCaloCells.cxx index a481491a055..7a6ce924f54 100644 --- a/STEER/AliAODCaloCells.cxx +++ b/STEER/AliAODCaloCells.cxx @@ -74,6 +74,12 @@ AliAODCaloCells::~AliAODCaloCells() DeleteContainer(); } +void AliAODCaloCells::Clear(const Option_t*) +{ + // clear + + DeleteContainer(); +} void AliAODCaloCells::Copy(TObject &obj) const { diff --git a/STEER/AliAODCaloCells.h b/STEER/AliAODCaloCells.h index 6440375f6bf..53c05e451e4 100644 --- a/STEER/AliAODCaloCells.h +++ b/STEER/AliAODCaloCells.h @@ -25,7 +25,8 @@ class AliAODCaloCells : public AliVCaloCells virtual AliVCaloCells* CopyCaloCells(Bool_t all) const; virtual ~AliAODCaloCells(); - + void Clear(const Option_t*); + void CreateContainer(Short_t nCells); void DeleteContainer(); void Sort(); diff --git a/STEER/AliAODCaloCluster.cxx b/STEER/AliAODCaloCluster.cxx index 20d59249194..e04ab505e92 100644 --- a/STEER/AliAODCaloCluster.cxx +++ b/STEER/AliAODCaloCluster.cxx @@ -101,9 +101,17 @@ AliAODCaloCluster::~AliAODCaloCluster() { // destructor if(fCellsAmpFraction) delete[] fCellsAmpFraction; fCellsAmpFraction=0; - if(fCellsAbsId) delete[] fCellsAbsId; fCellsAbsId = 0; + if(fCellsAbsId) delete[] fCellsAbsId; fCellsAbsId = 0; } +//______________________________________________________________________________ +void AliAODCaloCluster::Clear(const Option_t*) +{ + // clear + RemoveLabel(); + if(fCellsAmpFraction) delete[] fCellsAmpFraction; fCellsAmpFraction=0; + if(fCellsAbsId) delete[] fCellsAbsId; fCellsAbsId = 0; +} //______________________________________________________________________________ AliAODCaloCluster::AliAODCaloCluster(const AliAODCaloCluster& clus) : diff --git a/STEER/AliAODCaloCluster.h b/STEER/AliAODCaloCluster.h index b3cc53b89cc..e8ff13ba219 100644 --- a/STEER/AliAODCaloCluster.h +++ b/STEER/AliAODCaloCluster.h @@ -44,7 +44,7 @@ class AliAODCaloCluster : public AliAODCluster { virtual ~AliAODCaloCluster(); AliAODCaloCluster(const AliAODCaloCluster& clus); AliAODCaloCluster& operator=(const AliAODCaloCluster& clus); - + void Clear(const Option_t*); // getters Double_t GetDistanceToBadChannel() const { return fDistToBadChannel; } diff --git a/STEER/AliAODCluster.cxx b/STEER/AliAODCluster.cxx index 8c49de0a482..1628556e174 100644 --- a/STEER/AliAODCluster.cxx +++ b/STEER/AliAODCluster.cxx @@ -99,6 +99,14 @@ AliAODCluster::~AliAODCluster() RemoveLabel(); } +//______________________________________________________________________________ +void AliAODCluster::Clear(const Option_t*) +{ + // Clear + + RemoveLabel(); +} + //______________________________________________________________________________ AliAODCluster::AliAODCluster(const AliAODCluster& clus) : diff --git a/STEER/AliAODCluster.h b/STEER/AliAODCluster.h index fc8354c3154..706ddf36883 100644 --- a/STEER/AliAODCluster.h +++ b/STEER/AliAODCluster.h @@ -38,7 +38,8 @@ class AliAODCluster : public AliVCluster { virtual ~AliAODCluster(); AliAODCluster(const AliAODCluster& clus); AliAODCluster& operator=(const AliAODCluster& clus); - + void Clear(const Option_t*); + Double_t Chi2() const { return fChi2; } Double_t E() const { return fEnergy; } diff --git a/STEER/AliESDCaloCells.cxx b/STEER/AliESDCaloCells.cxx index bb8864a50a9..a7d5eaac445 100644 --- a/STEER/AliESDCaloCells.cxx +++ b/STEER/AliESDCaloCells.cxx @@ -128,6 +128,15 @@ AliESDCaloCells::~AliESDCaloCells() DeleteContainer(); } +//_______________________________________________________________________ +void AliESDCaloCells::Clear(const Option_t*) +{ + // clear + + DeleteContainer(); +} + + //_______________________________________________________________________ void AliESDCaloCells::CreateContainer(Short_t nCells) { diff --git a/STEER/AliESDCaloCells.h b/STEER/AliESDCaloCells.h index 9e265e656b9..d3cec6199bb 100644 --- a/STEER/AliESDCaloCells.h +++ b/STEER/AliESDCaloCells.h @@ -27,7 +27,7 @@ class AliESDCaloCells : public AliVCaloCells virtual ~AliESDCaloCells(); virtual void Copy(TObject &obj) const; virtual AliVCaloCells * CopyCaloCells(Bool_t all) const; - + void Clear(const Option_t*); Bool_t IsEMCAL() const { return (fType == kEMCALCell);} Bool_t IsPHOS() const { return (fType == kPHOSCell) ;} diff --git a/STEER/AliESDCaloCluster.cxx b/STEER/AliESDCaloCluster.cxx index 7dd2a0934ed..4aaa0bc03c2 100644 --- a/STEER/AliESDCaloCluster.cxx +++ b/STEER/AliESDCaloCluster.cxx @@ -210,6 +210,18 @@ AliESDCaloCluster::~AliESDCaloCluster(){ if(fCellsAbsId){ delete[] fCellsAbsId; fCellsAbsId = 0;} } +//_______________________________________________________________________ +void AliESDCaloCluster::Clear(const Option_t*){ + // + // This is destructor according Coding Conventions + // + if(fTracksMatched)delete fTracksMatched;fTracksMatched = 0; + if(fLabels) delete fLabels; fLabels = 0; + if(fCellsAmpFraction){ delete[] fCellsAmpFraction; fCellsAmpFraction=0;} + if(fCellsAbsId){ delete[] fCellsAbsId; fCellsAbsId = 0;} +} + + //_______________________________________________________________________ void AliESDCaloCluster::SetPID(const Float_t *p) { // Sets the probability of each particle type diff --git a/STEER/AliESDCaloCluster.h b/STEER/AliESDCaloCluster.h index d8356fcc0b2..f7d21b110b1 100644 --- a/STEER/AliESDCaloCluster.h +++ b/STEER/AliESDCaloCluster.h @@ -33,7 +33,8 @@ class AliESDCaloCluster : public AliVCluster AliESDCaloCluster & operator=(const AliESDCaloCluster& source); virtual ~AliESDCaloCluster(); virtual void Copy(TObject &) const; - + void Clear(const Option_t*); + void SetID(Int_t id) {fID = id;} Int_t GetID() const {return fID;} diff --git a/STEER/AliMCEventHandler.h b/STEER/AliMCEventHandler.h index 0fd10ba859c..3dce300a901 100644 --- a/STEER/AliMCEventHandler.h +++ b/STEER/AliMCEventHandler.h @@ -66,6 +66,7 @@ public: AliMCEvent* MCEvent() const {return fMCEvent;} TTree* TreeTR() const {return fTreeTR;} TTree* TreeK() const {return fTreeK;} + virtual TTree* GetTree() const {return fTreeE;} Int_t GetParticleAndTR(Int_t i, TParticle*& particle, TClonesArray*& trefs); void DrawCheck(Int_t i, Int_t search=0); Bool_t InitOk() {return fInitOk;} diff --git a/STEER/AliVCaloCells.h b/STEER/AliVCaloCells.h index 40f843800ae..8308a1ec173 100644 --- a/STEER/AliVCaloCells.h +++ b/STEER/AliVCaloCells.h @@ -26,6 +26,7 @@ class AliVCaloCells : public TNamed AliVCaloCells(const char* name, const char* title) : TNamed(name, title) {;} AliVCaloCells(const AliVCaloCells& cells) : TNamed(cells.GetName(), cells.GetTitle()) {;} virtual ~AliVCaloCells(){;} + void Clear(const Option_t*) {;} virtual Bool_t IsEMCAL() const = 0; virtual Bool_t IsPHOS() const = 0; diff --git a/STEER/AliVCluster.h b/STEER/AliVCluster.h index f282dbc1b81..5b5eb79286c 100644 --- a/STEER/AliVCluster.h +++ b/STEER/AliVCluster.h @@ -24,6 +24,7 @@ class AliVCluster : public TObject virtual ~AliVCluster() { ; } AliVCluster(const AliVCluster& clus); AliVCluster & operator=(const AliVCluster& source); + void Clear(const Option_t*) {;} enum VClu_t {kUndef = -2, kPHOSNeutral, -- 2.43.0