Skip to content

Commit 55ff541

Browse files
fgrosaalcaliva
authored andcommitted
Fix protection of MC signal filtering to work with any embedPatt
1 parent c309e5b commit 55ff541

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,16 +2048,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
20482048
const auto& mcRecords = mcReader->getDigitizationContext()->getEventRecords();
20492049
const auto& mcParts = mcReader->getDigitizationContext()->getEventParts();
20502050

2051-
// count all parts
2052-
int totalNParts = 0;
2053-
for (int iCol = 0; iCol < nMCCollisions; iCol++) {
2054-
totalNParts += mcParts[iCol].size();
2055-
2056-
// if signal filtering enabled, let's check if there are more than one source; otherwise fatalise
2057-
if (mUseSigFiltMC) {
2058-
std::vector<int> sourceIDs{};
2059-
auto& colParts = mcParts[iCol];
2060-
for (auto colPart : colParts) {
2051+
// if signal filtering enabled, let's check if there are more than one source; otherwise fatalise
2052+
if (mUseSigFiltMC) {
2053+
std::vector<int> sourceIDs{};
2054+
for (int iCol = 0; iCol < nMCCollisions; iCol++) {
2055+
for (auto const& colPart : mcParts[iCol]) {
20612056
int sourceID = colPart.sourceID;
20622057
if (std::find(sourceIDs.begin(), sourceIDs.end(), sourceID) == sourceIDs.end()) {
20632058
sourceIDs.push_back(sourceID);
@@ -2066,10 +2061,19 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
20662061
break;
20672062
}
20682063
}
2069-
if (sourceIDs.size() <= 1) {
2070-
LOGP(fatal, "Signal filtering cannot be enabled without embedding. Please fix the configuration either enabling the embedding, or turning off the signal filtering.");
2064+
if (sourceIDs.size() > 1) { // we found more than one, exit
2065+
break;
20712066
}
20722067
}
2068+
if (sourceIDs.size() <= 1) {
2069+
LOGP(fatal, "Signal filtering cannot be enabled without embedding. Please fix the configuration either enabling the embedding, or turning off the signal filtering.");
2070+
}
2071+
}
2072+
2073+
// count all parts
2074+
int totalNParts = 0;
2075+
for (int iCol = 0; iCol < nMCCollisions; iCol++) {
2076+
totalNParts += mcParts[iCol].size();
20732077
}
20742078
mcCollisionsCursor.reserve(totalNParts);
20752079

0 commit comments

Comments
 (0)