From b722cb72c06391e6a6df05ab595e4a3978052a66 Mon Sep 17 00:00:00 2001 From: Simone Michele Mazza <simone.michele.mazza@cern.ch> Date: Fri, 27 Jan 2017 13:24:03 +0100 Subject: [PATCH] fixed minor memory leak (IsolationCorrections-00-01-27) * Fixed minor memory leak (JIRA ATLASG-973) * Tagging IsolationCorrections-00-01-27 Former-commit-id: 70a1c555a152675d7973ed2693c0f924fb850863 --- .../Root/IsolationCorrection.cxx | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx index c279917c1d9..52765bf63ab 100644 --- a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/Root/IsolationCorrection.cxx @@ -667,7 +667,7 @@ namespace CP { ATH_MSG_WARNING("Correction file for 2015 data/mc not found, "<<m_corr_file<<". tool not initialized for 2015 corrections\n"); m_corr_file = ""; }else{ - if(!file_ptleakagecorr->Get("mean_f_topoetcone40_eta_1.15_1.37_converted_ok")){ + if(!file_ptleakagecorr->GetListOfKeys()->Contains("mean_f_topoetcone40_eta_1.15_1.37_converted_ok")){ ATH_MSG_ERROR("Correction file for 2015 data/mc is not right, "<<m_corr_file<<". Tool not initialized for 2015 corrections\n"); m_corr_file = ""; }else{ @@ -969,21 +969,21 @@ namespace CP { // ********************************** // Photon shift corrections - std::vector<TGraphAsymmErrors*> graph_shift; - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_0") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_1") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_2") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_3") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_4") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_5") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_6") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_7") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_8") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_9") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_10") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_11") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_12") ); - graph_shift.push_back( (TGraphAsymmErrors*) file_ddshiftcorr->Get("graph_13") ); + std::vector< std::shared_ptr<TGraphAsymmErrors> > graph_shift; + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_0"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_1"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_2"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_3"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_4"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_5"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_6"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_7"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_8"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_9"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_10"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_11"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_12"))) ); + graph_shift.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddshiftcorr->Get("graph_13"))) ); m_graph_dd_cone40_photon_shift.push_back( graph_shift.at(0)->GetFunction("f") ); m_graph_dd_cone40_photon_shift.push_back( graph_shift.at(1)->GetFunction("f") ); @@ -1001,21 +1001,21 @@ namespace CP { m_graph_dd_cone40_photon_shift.push_back( graph_shift.at(13)->GetFunction("f_2") ); // Photon smearing corrections (to be applied in end caps only) - std::vector<TGraphAsymmErrors*> graph_smearing; - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_0") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_1") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_2") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_3") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_4") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_5") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_6") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_7") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_8") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_9") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_10") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_11") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_12") ); - graph_smearing.push_back( (TGraphAsymmErrors*) file_ddsmearingcorr->Get("graph_13") ); + std::vector< std::shared_ptr<TGraphAsymmErrors> > graph_smearing; + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_0"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_1"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_2"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_3"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_4"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_5"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_6"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_7"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_8"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_9"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_10"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_11"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_12"))) ); + graph_smearing.push_back( std::shared_ptr<TGraphAsymmErrors>(dynamic_cast<TGraphAsymmErrors*>(file_ddsmearingcorr->Get("graph_13"))) ); m_graph_dd_cone40_photon_smearing.push_back( graph_smearing.at(0)->GetFunction("f_3") ); m_graph_dd_cone40_photon_smearing.push_back( graph_smearing.at(1)->GetFunction("f_3") ); -- GitLab