diff --git a/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondData.h b/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondData.h index c9fc9f3b572690a18e7752f656c9229a6ef63d93..1cd99be70dbcdb4c02b9038325ab12a861f5a863 100644 --- a/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondData.h +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/JetTagCalibration/JetTagCalibCondData.h @@ -37,7 +37,7 @@ public: // Constructor JetTagCalibCondData(); // Destructor - virtual ~JetTagCalibCondData() = default; + ~JetTagCalibCondData(); /** Resize the data members */ void resize(const std::vector<std::string> sizeHisto); @@ -46,6 +46,7 @@ public: void printHistosStatus() const; std::string getChannelAlias(const std::string& originalChannel) const; void addHisto(const unsigned int indexTagger, const std::string& name, TObject *); + void deleteHistos(); void addDL1NN(const std::string& tagger, const std::string& channel, const lwt::JSONConfig& ); void addChannelAlias(const std::string& channel, const std::string& alias); TH1* retrieveHistogram(const std::string& folder, const std::string& channel, const std::string& hname) const; @@ -55,7 +56,6 @@ public: std::string channelName(const std::string& fullHistoName) const; std::string histoName(const std::string& fullHistoName) const ; std::string fullHistoName(const std::string& channel, const std::string& histoName) const; - std::vector<std::string> tokenize(std::string str, std::string delim); private: std::vector< std::map<std::string, TObject*> > m_histos; diff --git a/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondData.cxx b/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondData.cxx index 1b98f19cd84fd9604fcb1837e50d08f06c1e89b3..ac5ad67f92e280dfd153a1d87976dd5440dbaa55 100644 --- a/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondData.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/src/JetTagCalibCondData.cxx @@ -26,6 +26,21 @@ JetTagCalibCondData::JetTagCalibCondData() m_channelAliasesMap.clear(); } +JetTagCalibCondData::~JetTagCalibCondData() { + this->deleteHistos(); +} + +void JetTagCalibCondData::deleteHistos() { + MsgStream log(Athena::getMessageSvc(), "JetTagCalibCondData"); + std::map<std::string, TObject*>::const_iterator iter_hist; + for(unsigned int i=0;i<m_histos.size();i++) { + iter_hist = m_histos[i].begin(); + for(;iter_hist!=m_histos[i].end();++iter_hist) { + log << MSG::DEBUG << "#BTAG# delete histo of " << iter_hist->first << endmsg; + delete iter_hist->second; + } + } +} void JetTagCalibCondData::resize(const std::vector<std::string> taggers) { m_histos.reserve(taggers.size()); @@ -119,23 +134,6 @@ lwt::JSONConfig JetTagCalibCondData::retrieveDL1NN(std::string& tagger, const st return config; } -std::vector<std::string> JetTagCalibCondData::tokenize(std::string str, std::string delim){ - std::vector<std::string> tokens; - std::string::size_type sPos, sEnd, sLen; - // if str starts with a character in delim, do you want an empty string in tokens? - // sPos = 0; // if answer is yes - sPos = str.find_first_not_of(delim); // if answer is no - while(sPos != std::string::npos){ - sEnd = str.find_first_of(delim, sPos); - if(sEnd == std::string::npos) sEnd = str.length(); - sLen = sEnd - sPos; - std::string token = str.substr(sPos, sLen); - tokens.push_back(token); - sPos = str.find_first_not_of(delim, sEnd); - } - return tokens; -} - std::string JetTagCalibCondData::channelName(const std::string& fname) const { const std::string delim("#"); std::string::size_type sPos;