diff --git a/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx b/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx index 56291bce0387ee1d2f6b58132b9eba40f9c13a10..1a5de34f61f303ef514028d4046f182442bcc8f3 100644 --- a/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx +++ b/Reconstruction/Jet/JetCalibTools/Root/GlobalSequentialCorrection.cxx @@ -53,7 +53,14 @@ GlobalSequentialCorrection::GlobalSequentialCorrection(const std::string& name, { } GlobalSequentialCorrection::~GlobalSequentialCorrection() { - + for(TH2F* hist : m_respFactorsEM3 ){if(hist) delete hist;} + for(TH2F* hist : m_respFactorsnTrk ){if(hist) delete hist;} + for(TH2F* hist : m_respFactorstrackWIDTH ){if(hist) delete hist;} + for(TH2F* hist : m_respFactorsTile0 ){if(hist) delete hist;} + for(TH2F* hist : m_respFactorsPunchThrough ){if(hist) delete hist;} + for(TH2F* hist : m_respFactorsChargedFraction){if(hist) delete hist;} + for(TH2F* hist : m_respFactorsN90Constituents){if(hist) delete hist;} + for(TH2F* hist : m_respFactorscaloWIDTH ){if(hist) delete hist;} } StatusCode GlobalSequentialCorrection::initializeTool(const std::string&) { diff --git a/Reconstruction/Jet/JetCalibTools/Root/InsituDataCorrection.cxx b/Reconstruction/Jet/JetCalibTools/Root/InsituDataCorrection.cxx index 254edd4b424a15919e85fdf277871d6888ca95e7..67cb11ddf3f7b7fb4aca666752fb8ef1935c4ee3 100644 --- a/Reconstruction/Jet/JetCalibTools/Root/InsituDataCorrection.cxx +++ b/Reconstruction/Jet/JetCalibTools/Root/InsituDataCorrection.cxx @@ -71,23 +71,21 @@ StatusCode InsituDataCorrection::initializeTool(const std::string&) { rel_histoname.ReplaceAll("JETALGO",m_jetAlgo); abs_histoname.ReplaceAll("JETALGO",m_jetAlgo); if(m_applyRelativeandAbsoluteInsitu){ - TH2D * rel_histo = (TH2D*)JetCalibUtils::GetHisto2(insitu_file,rel_histoname); - TH1D * abs_histo = (TH1D*)JetCalibUtils::GetHisto(insitu_file,abs_histoname); + std::unique_ptr<TH2D> rel_histo(dynamic_cast<TH2D*>(JetCalibUtils::GetHisto2(insitu_file,rel_histoname))); + std::unique_ptr<TH1D> abs_histo(dynamic_cast<TH1D*>(JetCalibUtils::GetHisto(insitu_file,abs_histoname))); if ( !rel_histo || !abs_histo ) { ATH_MSG_FATAL( "\n Tool configured for data, but no residual in-situ histograms could be retrieved. Aborting..." ); return StatusCode::FAILURE; } - else { - gROOT->cd(); - // save pTmax of the relative and absolute in situ calibrations - m_relhistoPtMax = rel_histo->GetXaxis()->GetBinLowEdge(rel_histo->GetNbinsX()+1); - m_abshistoPtMax = abs_histo->GetBinLowEdge(abs_histo->GetNbinsX()+1); - // combine in situ calibrations - m_insituCorr = combineCalibration(rel_histo,abs_histo); - m_insituEtaMax = m_insituCorr->GetYaxis()->GetBinLowEdge(m_insituCorr->GetNbinsY()+1); - m_insituPtMin = m_insituCorr->GetXaxis()->GetBinLowEdge(1); - m_insituPtMax = m_insituCorr->GetXaxis()->GetBinLowEdge(m_insituCorr->GetNbinsX()+1); - } + gROOT->cd(); + // save pTmax of the relative and absolute in situ calibrations + m_relhistoPtMax = rel_histo->GetXaxis()->GetBinLowEdge(rel_histo->GetNbinsX()+1); + m_abshistoPtMax = abs_histo->GetBinLowEdge(abs_histo->GetNbinsX()+1); + // combine in situ calibrations + m_insituCorr = combineCalibration(rel_histo.get(),abs_histo.get()); + m_insituEtaMax = m_insituCorr->GetYaxis()->GetBinLowEdge(m_insituCorr->GetNbinsY()+1); + m_insituPtMin = m_insituCorr->GetXaxis()->GetBinLowEdge(1); + m_insituPtMax = m_insituCorr->GetXaxis()->GetBinLowEdge(m_insituCorr->GetNbinsX()+1); if(m_applyEtaRestrictionRelativeandAbsolute) m_insituEtaMax = insitu_etarestriction_relativeandabsolute; } if(m_applyResidualMCbasedInsitu){ diff --git a/Reconstruction/Jet/JetCalibTools/Root/JMSCorrection.cxx b/Reconstruction/Jet/JetCalibTools/Root/JMSCorrection.cxx index 5ec72f9664b5e8ce4d95c5983cdb1cb75f313737..98144e15cbaac030b44f929efcff33d01279517e 100644 --- a/Reconstruction/Jet/JetCalibTools/Root/JMSCorrection.cxx +++ b/Reconstruction/Jet/JetCalibTools/Root/JMSCorrection.cxx @@ -45,58 +45,19 @@ JMSCorrection::JMSCorrection(const std::string& name, TEnv * config, TString jet JMSCorrection::~JMSCorrection() { - if (m_use3Dhisto) - { - // Free 3D histograms - if (m_respFactorMass3D) - { - delete m_respFactorMass3D; - m_respFactorMass3D = NULL; - } - if (m_respFactorTrackAssistedMass3D) - { - delete m_respFactorTrackAssistedMass3D; - m_respFactorTrackAssistedMass3D = NULL; - } - if (m_caloResolutionMassCombination3D) - { - delete m_caloResolutionMassCombination3D; - m_caloResolutionMassCombination3D = NULL; - } - if (m_taResolutionMassCombination3D) - { - delete m_taResolutionMassCombination3D; - m_taResolutionMassCombination3D = NULL; - } - if (m_correlationMapMassCombination3D) - { - delete m_correlationMapMassCombination3D; - m_correlationMapMassCombination3D = NULL; - } - } - { - // Free 2D histograms - for (TH2F* histo : m_respFactorsMass) - delete histo; - m_respFactorsMass.clear(); - - for (TH2F* histo : m_respFactorsTrackAssistedMass) - delete histo; - m_respFactorsTrackAssistedMass.clear(); - - for (TH2D* histo : m_caloResolutionMassCombination) - delete histo; - m_caloResolutionMassCombination.clear(); - - for (TH2D* histo : m_taResolutionMassCombination) - delete histo; - m_taResolutionMassCombination.clear(); - - for (TH2D* histo : m_correlationMapMassCombination) - delete histo; - m_correlationMapMassCombination.clear(); - } - + // Free 3D histograms + if (m_respFactorMass3D ) delete m_respFactorMass3D; + if (m_respFactorTrackAssistedMass3D ) delete m_respFactorTrackAssistedMass3D; + if (m_caloResolutionMassCombination3D) delete m_caloResolutionMassCombination3D; + if (m_taResolutionMassCombination3D ) delete m_taResolutionMassCombination3D; + if (m_correlationMapMassCombination3D) delete m_correlationMapMassCombination3D; + + // Free 2D histograms + for (TH2F* histo : m_respFactorsMass ){if(histo) delete histo;} + for (TH2F* histo : m_respFactorsTrackAssistedMass ){if(histo) delete histo;} + for (TH2D* histo : m_caloResolutionMassCombination){if(histo) delete histo;} + for (TH2D* histo : m_taResolutionMassCombination ){if(histo) delete histo;} + for (TH2D* histo : m_correlationMapMassCombination){if(histo) delete histo;} } StatusCode JMSCorrection::initializeTool(const std::string&) { diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVertexTaggerTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVertexTaggerTool.h index 30cfdd8c3435e24f337f6da37848be9050b97c58..aa52d5990dc300d3fd2ccf95f5b2b74374d7ccb4 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVertexTaggerTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVertexTaggerTool.h @@ -84,6 +84,9 @@ public: // Constructor from tool name JetVertexTaggerTool(const std::string& name); + // Destructor + virtual ~JetVertexTaggerTool(); + // Initialization. StatusCode initialize() override; diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetVertexTaggerTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetVertexTaggerTool.cxx index 41b61bd304831f0492b55ac0270dbc28a7f35747..953753a8c6e03784fbd2a5d6836bcdc5d1a01a16 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetVertexTaggerTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetVertexTaggerTool.cxx @@ -20,12 +20,19 @@ using xAOD::JetFourMom_t; //********************************************************************** JetVertexTaggerTool::JetVertexTaggerTool(const std::string& name) -: asg::AsgTool(name) +: asg::AsgTool(name), + m_jvthisto(nullptr) { } //********************************************************************** +JetVertexTaggerTool::~JetVertexTaggerTool(){ + if(m_jvthisto) delete m_jvthisto; +} + +//********************************************************************** + StatusCode JetVertexTaggerTool::initialize() { ATH_MSG_INFO("Initializing JetVertexTaggerTool " << name()); diff --git a/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h b/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h index 0e66b2dec42640a79506c11f97c0db3b6e229d73..94eacde5975589ab50bb2cf4d540ff5f21c78642 100644 --- a/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h +++ b/Reconstruction/Jet/JetRec/JetRec/PseudoJetContainer.h @@ -130,12 +130,7 @@ private: } ExtractorRange bump(int step) const { - ExtractorRange result = *this; - result.m_lo += step; - result.m_hi += step; - IConstituentExtractor* ce = m_e->clone(); - result.m_e = ce; - return result; + return ExtractorRange(m_lo + step, m_hi + step, m_e->clone()); } int m_lo;