Skip to content

Commit

Permalink
Merge pull request #35043 from Sam-Harper/PATTriggerFullModeZeroFilte…
Browse files Browse the repository at this point in the history
…rFix_1130pre6

Adding protections to PATTriggerProducer when the path has zero filters: 12_1
  • Loading branch information
cmsbuild authored Aug 28, 2021
2 parents 030f61e + 43d0871 commit 5c28861
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions PhysicsTools/PatAlgos/plugins/PATTriggerProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,16 +601,22 @@ void PATTriggerProducer::produce(Event& iEvent, const EventSetup& iSetup) {
for (size_t indexPath = 0; indexPath < sizePaths; ++indexPath) {
const std::string& namePath = pathNames.at(indexPath);
unsigned indexLastFilterPathModules(handleTriggerResults->index(indexPath) + 1);
while (indexLastFilterPathModules > 0) {
--indexLastFilterPathModules;
const std::string& labelLastFilterPathModules(hltConfig.moduleLabel(indexPath, indexLastFilterPathModules));
unsigned indexLastFilterFilters =
handleTriggerEvent->filterIndex(InputTag(labelLastFilterPathModules, "", nameProcess_));
if (indexLastFilterFilters < sizeFilters) {
if (hltConfig.moduleType(labelLastFilterPathModules) == "HLTBool")
continue;
break;
const unsigned sizeModulesPath(hltConfig.size(indexPath));
//protection for paths with zero filters (needed for reco, digi, etc paths)
if (sizeModulesPath != 0) {
while (indexLastFilterPathModules > 0) {
--indexLastFilterPathModules;
const std::string& labelLastFilterPathModules(hltConfig.moduleLabel(indexPath, indexLastFilterPathModules));
unsigned indexLastFilterFilters =
handleTriggerEvent->filterIndex(InputTag(labelLastFilterPathModules, "", nameProcess_));
if (indexLastFilterFilters < sizeFilters) {
if (hltConfig.moduleType(labelLastFilterPathModules) == "HLTBool")
continue;
break;
}
}
} else {
indexLastFilterPathModules = 0;
}
TriggerPath triggerPath(namePath,
indexPath,
Expand All @@ -621,8 +627,8 @@ void PATTriggerProducer::produce(Event& iEvent, const EventSetup& iSetup) {
indexLastFilterPathModules,
hltConfig.saveTagsModules(namePath).size());
// add module names to path and states' map
const unsigned sizeModulesPath(hltConfig.size(indexPath));
assert(indexLastFilterPathModules < sizeModulesPath);

assert(indexLastFilterPathModules < sizeModulesPath || sizeModulesPath == 0);
std::map<unsigned, std::string> indicesModules;
for (size_t iM = 0; iM < sizeModulesPath; ++iM) {
const std::string& nameModule(hltConfig.moduleLabel(indexPath, iM));
Expand Down

0 comments on commit 5c28861

Please sign in to comment.