Skip to content

Commit f473164

Browse files
committed
[RF][HF] Error out in HistFactory in case of duplicate channel names
Duplicate channel names are not allowed, because it would result in name collisions for the channel pdfs.
1 parent 26b25d7 commit f473164

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

roofit/histfactory/src/HistoToWorkspaceFactoryFast.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#include <fstream>
7272
#include <iomanip>
7373
#include <memory>
74+
#include <set>
7475
#include <utility>
7576

7677
constexpr double alphaLow = -5.0;
@@ -1478,6 +1479,11 @@ RooArgList HistoToWorkspaceFactoryFast::createObservables(const TH1 *hist, RooWo
14781479
Error("MakeCombinedModel","Input vector of workspace has an invalid size - return a nullptr");
14791480
return nullptr;
14801481
}
1482+
std::set<std::string> ch_names_set{ch_names.begin(), ch_names.end()};
1483+
if (ch_names.size() != ch_names_set.size()) {
1484+
Error("MakeCombinedModel", "Input vector of channel names has duplicate names - return a nullptr");
1485+
return nullptr;
1486+
}
14811487

14821488
//
14831489
/// These things were used for debugging. Maybe useful in the future

0 commit comments

Comments
 (0)