Skip to content

Commit bd0f983

Browse files
fgrosaalcaliva
authored andcommitted
Fix protection of MC signal filtering to work with any embedPatt
1 parent 51da6c0 commit bd0f983

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

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

1946-
// count all parts
1947-
int totalNParts = 0;
1948-
for (int iCol = 0; iCol < nMCCollisions; iCol++) {
1949-
totalNParts += mcParts[iCol].size();
1950-
1951-
// if signal filtering enabled, let's check if there are more than one source; otherwise fatalise
1952-
if (mUseSigFiltMC) {
1953-
std::vector<int> sourceIDs{};
1954-
auto& colParts = mcParts[iCol];
1955-
for (auto colPart : colParts) {
1946+
// if signal filtering enabled, let's check if there are more than one source; otherwise fatalise
1947+
if (mUseSigFiltMC) {
1948+
std::vector<int> sourceIDs{};
1949+
for (int iCol = 0; iCol < nMCCollisions; iCol++) {
1950+
for (auto const& colPart : mcParts[iCol]) {
19561951
int sourceID = colPart.sourceID;
19571952
if (std::find(sourceIDs.begin(), sourceIDs.end(), sourceID) == sourceIDs.end()) {
19581953
sourceIDs.push_back(sourceID);
@@ -1961,10 +1956,19 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
19611956
break;
19621957
}
19631958
}
1964-
if (sourceIDs.size() <= 1) {
1965-
LOGP(fatal, "Signal filtering cannot be enabled without embedding. Please fix the configuration either enabling the embedding, or turning off the signal filtering.");
1959+
if (sourceIDs.size() > 1) { // we found more than one, exit
1960+
break;
19661961
}
19671962
}
1963+
if (sourceIDs.size() <= 1) {
1964+
LOGP(fatal, "Signal filtering cannot be enabled without embedding. Please fix the configuration either enabling the embedding, or turning off the signal filtering.");
1965+
}
1966+
}
1967+
1968+
// count all parts
1969+
int totalNParts = 0;
1970+
for (int iCol = 0; iCol < nMCCollisions; iCol++) {
1971+
totalNParts += mcParts[iCol].size();
19681972
}
19691973
mcCollisionsCursor.reserve(totalNParts);
19701974

0 commit comments

Comments
 (0)