Skip to content

Commit e2c5128

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. (cherry picked from commit 08dc832)
1 parent 38374d6 commit e2c5128

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
@@ -67,6 +67,7 @@
6767
#include <fstream>
6868
#include <iomanip>
6969
#include <memory>
70+
#include <set>
7071
#include <utility>
7172

7273
constexpr double alphaLow = -5.0;
@@ -1474,6 +1475,11 @@ RooArgList HistoToWorkspaceFactoryFast::createObservables(const TH1 *hist, RooWo
14741475
Error("MakeCombinedModel","Input vector of workspace has an invalid size - return a nullptr");
14751476
return nullptr;
14761477
}
1478+
std::set<std::string> ch_names_set{ch_names.begin(), ch_names.end()};
1479+
if (ch_names.size() != ch_names_set.size()) {
1480+
Error("MakeCombinedModel", "Input vector of channel names has duplicate names - return a nullptr");
1481+
return nullptr;
1482+
}
14771483

14781484
//
14791485
/// These things were used for debugging. Maybe useful in the future

0 commit comments

Comments
 (0)