diff --git a/CombineHarvester/CombineTools/src/CombineHarvester.cc b/CombineHarvester/CombineTools/src/CombineHarvester.cc index 09a1aae9..576b6862 100644 --- a/CombineHarvester/CombineTools/src/CombineHarvester.cc +++ b/CombineHarvester/CombineTools/src/CombineHarvester.cc @@ -604,8 +604,12 @@ std::shared_ptr CombineHarvester::SetupWorkspace( // 2) No: Ok will clone it in. Is the ws name already in use? if (!name_in_use) { // - No: clone with same name and return - wspaces_[std::string(ws.GetName())] = std::shared_ptr( - reinterpret_cast(ws.Clone())); + // IMPORTANT: Don't used RooWorkspace::Clone(), it seems to introduce + // bugs + // wspaces_[std::string(ws.GetName())] = std::shared_ptr( + // reinterpret_cast(ws.Clone())); + wspaces_[std::string(ws.GetName())] = + std::make_shared(RooWorkspace(ws)); return wspaces_.at(ws.GetName()); } @@ -637,8 +641,12 @@ std::shared_ptr CombineHarvester::SetupWorkspace( << " already defined, renaming to " << new_name << "\n"; - wspaces_[new_name] = std::shared_ptr( - reinterpret_cast(ws.Clone(new_name.c_str()))); + // wspaces_[new_name] = std::shared_ptr( + // reinterpret_cast(ws.Clone(new_name.c_str()))); + std::shared_ptr new_wsp = + std::make_shared(RooWorkspace(ws)); + new_wsp->SetName(new_name.c_str()); + wspaces_[new_name] = new_wsp; return wspaces_.at(new_name); }