Commit aee0c0fd authored by Oliver Majersky's avatar Oliver Majersky Committed by Nils Erik Krumnack
Browse files

FFJetmearingTool memory leak bugfix

parent b9dccb95
......@@ -289,7 +289,7 @@ StatusCode FFJetSmearingTool::readFFJetSmearingToolSimplifiedData(TEnv& settings
return StatusCode::FAILURE;
}
m_CALO_ResponseMap = std::make_unique<TH2D>(*dynamic_cast<TH2D*>(data_file->Get( CaloResponseMap_path )));
m_CALO_ResponseMap = std::unique_ptr<TH2D>(dynamic_cast<TH2D*>(data_file->Get( CaloResponseMap_path )));
m_CALO_ResponseMap->SetDirectory(0);
}
......@@ -302,7 +302,7 @@ StatusCode FFJetSmearingTool::readFFJetSmearingToolSimplifiedData(TEnv& settings
return StatusCode::FAILURE;
}
m_TA_ResponseMap = std::make_unique<TH2D>(*dynamic_cast<TH2D*>(data_file->Get( TAResponseMap_path )));
m_TA_ResponseMap = std::unique_ptr<TH2D>(dynamic_cast<TH2D*>(data_file->Get( TAResponseMap_path )));
m_TA_ResponseMap->SetDirectory(0);//To keep it open when we close the .root file
}
......@@ -322,12 +322,12 @@ StatusCode FFJetSmearingTool::readFFJetSmearingToolSimplifiedData(TEnv& settings
m_Syst_TopologyAffected_map[Syst_Name] = settings.GetValue(prefix+"Topology","");
m_Syst_Affects_JMSorJMR[Syst_Name] = "JMS";
m_Syst_HistPath_map[Syst_Name] = settings.GetValue(prefix+"Hist","");
m_Syst_Hist_map[Syst_Name] = std::make_unique<TH2D>(*dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistPath_map[Syst_Name].c_str())));
m_Syst_Hist_map[Syst_Name] = std::unique_ptr<TH2D>(dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistPath_map[Syst_Name].c_str())));
m_Syst_Hist_map[Syst_Name]->SetDirectory(0);
if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::Comb){//for comb mass we need to read two histograms
m_Syst_HistTAPath_map[Syst_Name] = settings.GetValue(prefix+"HistTA","");
if(m_Syst_HistTAPath_map[Syst_Name]!=""){
m_Syst_HistTA_map[Syst_Name] = std::make_unique<TH2D>(*dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistTAPath_map[Syst_Name].c_str())));
m_Syst_HistTA_map[Syst_Name] = std::unique_ptr<TH2D>(dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistTAPath_map[Syst_Name].c_str())));
m_Syst_HistTA_map[Syst_Name]->SetDirectory(0);
}
}
......@@ -347,12 +347,12 @@ StatusCode FFJetSmearingTool::readFFJetSmearingToolSimplifiedData(TEnv& settings
m_Syst_TopologyAffected_map[Syst_Name] = settings.GetValue(prefix+"Topology","");
m_Syst_Affects_JMSorJMR[Syst_Name] = "JMR";
m_Syst_HistPath_map[Syst_Name] = settings.GetValue(prefix+"Hist","");
m_Syst_Hist_map[Syst_Name] = std::make_unique<TH2D>(*dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistPath_map[Syst_Name].c_str())));
m_Syst_Hist_map[Syst_Name] = std::unique_ptr<TH2D>(dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistPath_map[Syst_Name].c_str())));
m_Syst_Hist_map[Syst_Name]->SetDirectory(0);
if(m_MassDef==JetTools::FFJetAllowedMassDefEnum::Comb){//for comb mass we need to read two histograms
m_Syst_HistTAPath_map[Syst_Name] = settings.GetValue(prefix+"HistTA","");
if(m_Syst_HistTAPath_map[Syst_Name]!=""){
m_Syst_HistTA_map[Syst_Name] = std::make_unique<TH2D>(*dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistTAPath_map[Syst_Name].c_str())));
m_Syst_HistTA_map[Syst_Name] = std::unique_ptr<TH2D>(dynamic_cast<TH2D*>(data_file->Get(m_Syst_HistTAPath_map[Syst_Name].c_str())));
m_Syst_HistTA_map[Syst_Name]->SetDirectory(0);
}
}
......@@ -399,8 +399,8 @@ StatusCode FFJetSmearingTool::readFFJetSmearingToolSimplifiedData(TEnv& settings
return StatusCode::FAILURE;
}
m_caloMassWeight = std::make_unique<TH3F>(*dynamic_cast<TH3F*>(Calo_TA_weight_file->Get(Calo_weight_hist_name)));
m_TAMassWeight = std::make_unique<TH3F>(*dynamic_cast<TH3F*>(Calo_TA_weight_file->Get(TA_weight_hist_name)));
m_caloMassWeight = std::unique_ptr<TH3F>(dynamic_cast<TH3F*>(Calo_TA_weight_file->Get(Calo_weight_hist_name)));
m_TAMassWeight = std::unique_ptr<TH3F>(dynamic_cast<TH3F*>(Calo_TA_weight_file->Get(TA_weight_hist_name)));
m_caloMassWeight->SetDirectory(0);
m_TAMassWeight->SetDirectory(0);//To keep it open when we close the .root file
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment