Skip to content

Commit 5b5abc2

Browse files
f3schsawenzel
authored andcommitted
SIM: Fix detectorList parsing
set_difference only accepts sorted lists, when testing I think I only ever tested with ITS/IT3 which is the first detector and thus it worked always fine... Signed-off-by: Felix Schlepper <[email protected]>
1 parent 68e0e4f commit 5b5abc2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: Common/SimConfig/src/SimConfig.cxx

+10-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <cmath>
2121
#include <chrono>
2222
#include <regex>
23-
#include <algorithm>
2423

2524
using namespace o2::conf;
2625
namespace bpo = boost::program_options;
@@ -197,7 +196,11 @@ bool SimConfig::determineActiveModulesList(const std::string& version, std::vect
197196
// check if specified modules are in list
198197
if (inputargs.size() != 1 || inputargs[0] != "all") {
199198
std::vector<std::string> diff;
200-
std::set_difference(inputargs.begin(), inputargs.end(), modules.begin(), modules.end(), std::back_inserter(diff));
199+
for (const auto& in : inputargs) {
200+
if (std::find(modules.begin(), modules.end(), in) == std::end(modules)) {
201+
diff.emplace_back(in);
202+
}
203+
}
201204
if (!diff.empty()) {
202205
LOGP(error, "Modules specified that are not present in detector list {}", version);
203206
for (int j{0}; const auto& m : diff) {
@@ -423,7 +426,11 @@ bool SimConfig::filterSkippedElements(std::vector<std::string>& elements, std::v
423426
LOGP(error, " + {: <2}. {}", j++, m);
424427
}
425428
std::vector<std::string> diff;
426-
std::set_difference(skipped.begin(), skipped.end(), elements.begin(), elements.end(), std::back_inserter(diff));
429+
for (const auto& skip : skipped) {
430+
if (std::find(elements.begin(), elements.end(), skip) == std::end(elements)) {
431+
diff.emplace_back(skip);
432+
}
433+
}
427434
LOGP(error, "Specified skipped modules not present in built modules:");
428435
for (int j{0}; const auto& m : diff) {
429436
LOGP(error, " - {: <2}. {}", j++, m);

0 commit comments

Comments
 (0)