diff --git a/source/framework/core/inc/TRestCut.h b/source/framework/core/inc/TRestCut.h index c0a3cc7fb..26a40a5ca 100644 --- a/source/framework/core/inc/TRestCut.h +++ b/source/framework/core/inc/TRestCut.h @@ -56,6 +56,7 @@ class TRestCut : public TRestMetadata { TRestCut& operator=(TRestCut& cut); void PrintMetadata() override; + void Print(); Int_t Write(const char* name, Int_t option, Int_t bufsize) override; diff --git a/source/framework/core/src/TRestCut.cxx b/source/framework/core/src/TRestCut.cxx index 565f72ec0..18b16dd71 100644 --- a/source/framework/core/src/TRestCut.cxx +++ b/source/framework/core/src/TRestCut.cxx @@ -66,7 +66,11 @@ ClassImp(TRestCut); TRestCut::TRestCut() { Initialize(); } -void TRestCut::Initialize() { fCuts.clear(); } +void TRestCut::Initialize() { + fCuts.clear(); + fCutStrings.clear(); + fParamCut.clear(); +} void TRestCut::InitFromConfigFile() { auto ele = GetElement("cut"); @@ -158,12 +162,14 @@ void TRestCut::PrintMetadata() { TRestMetadata::PrintMetadata(); RESTMetadata << " " << RESTendl; RESTMetadata << "Cuts added: " << RESTendl; - for (const auto& cut : fCuts) { - RESTMetadata << cut.GetName() << " " << cut.GetTitle() << RESTendl; - } + Print(); RESTMetadata << "+++" << RESTendl; } +void TRestCut::Print() { + for (const auto& cut : fCuts) RESTMetadata << cut.GetName() << " " << cut.GetTitle() << RESTendl; +} + Int_t TRestCut::Write(const char* name, Int_t option, Int_t bufsize) { // write cuts to file. diff --git a/source/framework/core/src/TRestMetadata.cxx b/source/framework/core/src/TRestMetadata.cxx index 8a416e438..d0c4a7df9 100644 --- a/source/framework/core/src/TRestMetadata.cxx +++ b/source/framework/core/src/TRestMetadata.cxx @@ -747,8 +747,8 @@ TRestMetadata* TRestMetadata::InstantiateChildMetadata(int index, std::string pa md->SetConfigFile(fConfigFileName); TiXmlElement* rootEle = GetElementFromFile(fConfigFileName); TiXmlElement* Global = GetElement("globals", rootEle); - md->LoadConfigFromElement(paraele, Global, {}); md->Initialize(); + md->LoadConfigFromElement(paraele, Global, {}); return md; } } @@ -798,8 +798,8 @@ TRestMetadata* TRestMetadata::InstantiateChildMetadata(std::string pattern, std: TRestMetadata* md = (TRestMetadata*)c->New(); TiXmlElement* rootEle = GetElementFromFile(fConfigFileName); TiXmlElement* Global = GetElement("globals", rootEle); - md->LoadConfigFromElement(paraele, Global, {}); md->Initialize(); + md->LoadConfigFromElement(paraele, Global, {}); return md; } }