152 std::map<std::string, std::vector<PathAndFlags> >::const_iterator
it =
map_.find(
filter);
161 std::map<std::string, std::vector<PathAndFlags> >
map_;
162 const std::vector<PathAndFlags>
empty_ = {};
177 : nameProcess_(iConfig.getParameter<
std::
string>(
"processName")),
178 autoProcessName_(nameProcess_ ==
"*"),
179 onlyStandAlone_(iConfig.getParameter<
bool>(
"onlyStandAlone")),
183 tagL1GlobalTriggerObjectMaps_(
"l1L1GtObjectMap"),
185 tagL1ExtraNoIsoEG_(),
192 autoProcessNameL1ExtraMu_(
false),
193 autoProcessNameL1ExtraNoIsoEG_(
false),
194 autoProcessNameL1ExtraIsoEG_(
false),
195 autoProcessNameL1ExtraCenJet_(
false),
196 autoProcessNameL1ExtraForJet_(
false),
197 autoProcessNameL1ExtraTauJet_(
false),
198 autoProcessNameL1ExtraETM_(
false),
199 autoProcessNameL1ExtraHTM_(
false),
202 hltPrescaleProvider_(iConfig, consumesCollector(), *this),
203 hltConfigInit_(
false),
205 tagTriggerResults_(
"TriggerResults"),
206 tagTriggerEvent_(
"hltTriggerSummaryAOD"),
208 labelHltPrescaleTable_(),
209 hltPrescaleTableRun_(),
210 hltPrescaleTableLumi_(),
211 addPathModuleLabels_(
false),
212 packPathNames_(iConfig.existsAs<
bool>(
"packTriggerPathNames") ? iConfig.getParameter<
bool>(
"packTriggerPathNames")
214 packLabels_(iConfig.existsAs<
bool>(
"packTriggerLabels") ? iConfig.getParameter<
bool>(
"packTriggerLabels") :
true),
215 packPrescales_(iConfig.existsAs<
bool>(
"packTriggerPrescales") ? iConfig.getParameter<
bool>(
"packTriggerPrescales")
219 if (iConfig.exists(
"addL1Algos"))
220 addL1Algos_ = iConfig.getParameter<
bool>(
"addL1Algos");
221 if (iConfig.exists(
"l1GlobalTriggerObjectMaps"))
222 tagL1GlobalTriggerObjectMaps_ = iConfig.getParameter<
InputTag>(
"l1GlobalTriggerObjectMaps");
223 l1GlobalTriggerObjectMapsToken_ = mayConsume<L1GlobalTriggerObjectMaps>(tagL1GlobalTriggerObjectMaps_);
224 if (iConfig.exists(
"l1ExtraMu")) {
225 tagL1ExtraMu_ = iConfig.getParameter<
InputTag>(
"l1ExtraMu");
226 if (tagL1ExtraMu_.process() ==
"*") {
227 if (autoProcessName_)
228 autoProcessNameL1ExtraMu_ =
true;
230 tagL1ExtraMu_ =
InputTag(tagL1ExtraMu_.label(), tagL1ExtraMu_.instance(), nameProcess_);
235 if (iConfig.exists(
"l1ExtraNoIsoEG")) {
236 tagL1ExtraNoIsoEG_ = iConfig.getParameter<
InputTag>(
"l1ExtraNoIsoEG");
237 if (tagL1ExtraNoIsoEG_.process() ==
"*") {
238 if (autoProcessName_)
239 autoProcessNameL1ExtraNoIsoEG_ =
true;
241 tagL1ExtraNoIsoEG_ =
InputTag(tagL1ExtraNoIsoEG_.label(), tagL1ExtraNoIsoEG_.instance(), nameProcess_);
246 if (iConfig.exists(
"l1ExtraIsoEG")) {
247 tagL1ExtraIsoEG_ = iConfig.getParameter<
InputTag>(
"l1ExtraIsoEG");
248 if (tagL1ExtraIsoEG_.process() ==
"*") {
249 if (autoProcessName_)
250 autoProcessNameL1ExtraIsoEG_ =
true;
252 tagL1ExtraIsoEG_ =
InputTag(tagL1ExtraIsoEG_.label(), tagL1ExtraIsoEG_.instance(), nameProcess_);
257 if (iConfig.exists(
"l1ExtraCenJet")) {
258 tagL1ExtraCenJet_ = iConfig.getParameter<
InputTag>(
"l1ExtraCenJet");
259 if (tagL1ExtraCenJet_.process() ==
"*") {
260 if (autoProcessName_)
261 autoProcessNameL1ExtraCenJet_ =
true;
263 tagL1ExtraCenJet_ =
InputTag(tagL1ExtraCenJet_.label(), tagL1ExtraCenJet_.instance(), nameProcess_);
268 if (iConfig.exists(
"l1ExtraForJet")) {
269 tagL1ExtraForJet_ = iConfig.getParameter<
InputTag>(
"l1ExtraForJet");
270 if (tagL1ExtraForJet_.process() ==
"*") {
271 if (autoProcessName_)
272 autoProcessNameL1ExtraForJet_ =
true;
274 tagL1ExtraForJet_ =
InputTag(tagL1ExtraForJet_.label(), tagL1ExtraForJet_.instance(), nameProcess_);
279 if (iConfig.exists(
"l1ExtraTauJet")) {
280 tagL1ExtraTauJet_ = iConfig.getParameter<
InputTag>(
"l1ExtraTauJet");
281 if (tagL1ExtraTauJet_.process() ==
"*") {
282 if (autoProcessName_)
283 autoProcessNameL1ExtraTauJet_ =
true;
285 tagL1ExtraTauJet_ =
InputTag(tagL1ExtraTauJet_.label(), tagL1ExtraTauJet_.instance(), nameProcess_);
290 if (iConfig.exists(
"l1ExtraETM")) {
291 tagL1ExtraETM_ = iConfig.getParameter<
InputTag>(
"l1ExtraETM");
292 if (tagL1ExtraETM_.process() ==
"*") {
293 if (autoProcessName_)
294 autoProcessNameL1ExtraETM_ =
true;
296 tagL1ExtraETM_ =
InputTag(tagL1ExtraETM_.label(), tagL1ExtraETM_.instance(), nameProcess_);
301 if (iConfig.exists(
"l1ExtraHTM")) {
302 tagL1ExtraHTM_ = iConfig.getParameter<
InputTag>(
"l1ExtraHTM");
303 if (tagL1ExtraHTM_.process() ==
"*") {
304 if (autoProcessName_)
305 autoProcessNameL1ExtraHTM_ =
true;
307 tagL1ExtraHTM_ =
InputTag(tagL1ExtraHTM_.label(), tagL1ExtraHTM_.instance(), nameProcess_);
312 if (iConfig.exists(
"mainBxOnly"))
313 mainBxOnly_ = iConfig.getParameter<
bool>(
"mainBxOnly");
314 if (iConfig.exists(
"saveL1Refs"))
315 saveL1Refs_ = iConfig.getParameter<
bool>(
"saveL1Refs");
318 if (iConfig.exists(
"triggerResults"))
319 tagTriggerResults_ = iConfig.getParameter<
InputTag>(
"triggerResults");
320 triggerResultsGetter_ =
322 tagTriggerResults_.instance(),
323 autoProcessName_ ?
std::string(
"") : nameProcess_)),
325 if (iConfig.exists(
"triggerEvent"))
326 tagTriggerEvent_ = iConfig.getParameter<
InputTag>(
"triggerEvent");
329 if (iConfig.exists(
"hltPrescaleLabel"))
330 hltPrescaleLabel_ = iConfig.getParameter<
std::string>(
"hltPrescaleLabel");
331 if (iConfig.exists(
"hltPrescaleTable")) {
332 labelHltPrescaleTable_ = iConfig.getParameter<
std::string>(
"hltPrescaleTable");
337 hltPrescaleTableEventGetter_ =
340 if (iConfig.exists(
"addPathModuleLabels"))
341 addPathModuleLabels_ = iConfig.getParameter<
bool>(
"addPathModuleLabels");
342 exludeCollections_.clear();
343 if (iConfig.exists(
"exludeCollections"))
344 exludeCollections_ = iConfig.getParameter<std::vector<std::string> >(
"exludeCollections");
347 if (iConfig.exists(
"l1ExtraMu"))
348 l1ExtraMuGetter_(bd);
349 if (iConfig.exists(
"l1ExtraNoIsoEG"))
350 l1ExtraNoIsoEGGetter_(bd);
351 if (iConfig.exists(
"l1ExtraIsoEG"))
352 l1ExtraIsoEGGetter_(bd);
353 if (iConfig.exists(
"l1ExtraCenJet"))
354 l1ExtraCenJetGetter_(bd);
355 if (iConfig.exists(
"l1ExtraForJet"))
356 l1ExtraForJetGetter_(bd);
357 if (iConfig.exists(
"l1ExtraTauJet"))
358 l1ExtraTauJetGetter_(bd);
359 if (iConfig.exists(
"l1ExtraETM"))
360 l1ExtraETMGetter_(bd);
361 if (iConfig.exists(
"l1ExtraHTM"))
362 l1ExtraHTMGetter_(bd);
363 if (not(this->autoProcessName_ and bd.
processName() == this->moduleDescription().processName())) {
364 triggerResultsGetter_(bd);
366 triggerEventGetter_(bd);
367 if (iConfig.exists(
"hltPrescaleTable")) {
368 hltPrescaleTableRunGetter_(bd);
369 hltPrescaleTableLumiGetter_(bd);
370 hltPrescaleTableEventGetter_(bd);
374 if (!onlyStandAlone_) {
375 produces<TriggerAlgorithmCollection>();
376 produces<TriggerConditionCollection>();
377 produces<TriggerPathCollection>();
378 produces<TriggerFilterCollection>();
379 produces<TriggerObjectCollection>();
381 if (packPrescales_) {
382 produces<PackedTriggerPrescales>();
383 produces<PackedTriggerPrescales>(
"l1max");
384 produces<PackedTriggerPrescales>(
"l1min");
386 produces<TriggerObjectStandAloneCollection>();
405 if (processHistory.getConfigurationForProcess(iHist->processName(), processConfiguration) &&
415 <<
"' not produced according to process history of input data\n" 416 <<
"No trigger information produced";
419 LogInfo(
"autoProcessName") <<
"HLT process name' " <<
nameProcess_ <<
"' used for PAT trigger information";
426 <<
"' differs from HLT process name '" <<
nameProcess_ <<
"'";
432 <<
"' differs from HLT process name '" <<
nameProcess_ <<
"'";
455 LogError(
"hltConfig") <<
"HLT config extraction error with process name '" <<
nameProcess_ <<
"'";
457 LogError(
"hltConfig") <<
"HLT config size error";
473 if (handleHltPrescaleTable.
isValid()) {
475 handleHltPrescaleTable->
set(), handleHltPrescaleTable->
labels(), handleHltPrescaleTable->
table());
495 if (handleHltPrescaleTable.
isValid()) {
497 handleHltPrescaleTable->
set(), handleHltPrescaleTable->
labels(), handleHltPrescaleTable->
table());
508 auto triggerObjects = std::make_unique<TriggerObjectCollection>();
509 auto triggerObjectsStandAlone = std::make_unique<TriggerObjectStandAloneCollection>();
510 std::unique_ptr<PackedTriggerPrescales> packedPrescales, packedPrescalesL1min, packedPrescalesL1max;
522 if (!handleTriggerResults.
isValid()) {
524 <<
"' not in event\n" 525 <<
"No HLT information produced";
527 }
else if (!handleTriggerEvent.
isValid()) {
529 <<
"' not in event\n" 530 <<
"No HLT information produced";
546 if (handleHltPrescaleTable.
isValid()) {
548 handleHltPrescaleTable->
set(), handleHltPrescaleTable->
labels(), handleHltPrescaleTable->
table());
552 if (hltPrescaleTable.size() == 0) {
556 <<
"Using default from event setup";
562 LogDebug(
"hltPrescaleTable") <<
"HLT prescale table found in event setup";
564 LogWarning(
"hltPrescaleSet") <<
"HLTPrescaleTable from event setup has error";
568 unsigned set(hltPrescaleTable.set());
569 if (hltPrescaleTable.size() > 0) {
571 bool foundPrescaleLabel(
false);
572 for (
unsigned iLabel = 0; iLabel < hltPrescaleTable.labels().size(); ++iLabel) {
575 foundPrescaleLabel =
true;
579 if (!foundPrescaleLabel) {
584 }
else if (
iEvent.isRealData()) {
586 LogError(
"hltPrescaleTable") <<
"No HLT prescale table found\n" 587 <<
"Using default empty table with all prescales 1";
591 const unsigned sizePaths(
hltConfig.size());
592 const unsigned sizeFilters(handleTriggerEvent->
sizeFilters());
593 const unsigned sizeObjects(handleTriggerEvent->
sizeObjects());
595 std::map<std::string, int> moduleStates;
598 auto triggerPaths = std::make_unique<TriggerPathCollection>();
600 const std::vector<std::string>& pathNames =
hltConfig.triggerNames();
601 for (
size_t indexPath = 0; indexPath < sizePaths; ++indexPath) {
602 const std::string& namePath = pathNames.at(indexPath);
603 unsigned indexLastFilterPathModules(handleTriggerResults->
index(indexPath) + 1);
604 const unsigned sizeModulesPath(
hltConfig.size(indexPath));
606 if (sizeModulesPath != 0) {
607 while (indexLastFilterPathModules > 0) {
608 --indexLastFilterPathModules;
609 const std::string& labelLastFilterPathModules(
hltConfig.moduleLabel(indexPath, indexLastFilterPathModules));
610 unsigned indexLastFilterFilters =
612 if (indexLastFilterFilters < sizeFilters) {
613 if (
hltConfig.moduleType(labelLastFilterPathModules) ==
"HLTBool")
619 indexLastFilterPathModules = 0;
623 hltConfig.prescaleValue<
double>(
set, namePath),
624 handleTriggerResults->
wasrun(indexPath),
625 handleTriggerResults->
accept(indexPath),
626 handleTriggerResults->
error(indexPath),
627 indexLastFilterPathModules,
628 hltConfig.saveTagsModules(namePath).size());
631 assert(indexLastFilterPathModules < sizeModulesPath || sizeModulesPath == 0);
632 std::map<unsigned, std::string> indicesModules;
633 for (
size_t iM = 0; iM < sizeModulesPath; ++iM) {
639 if (indexFilter < sizeFilters) {
642 const unsigned slotModule(
hltConfig.moduleIndex(indexPath, nameModule));
643 indicesModules.insert(std::pair<unsigned, std::string>(slotModule, nameModule));
647 for (L1SeedCollection::const_iterator iSeed = l1Seeds.begin(); iSeed != l1Seeds.end(); ++iSeed) {
653 for (std::map<unsigned, std::string>::const_iterator iM = indicesModules.begin(); iM != indicesModules.end();
655 if (iM->first < indexLastFilterPathModules) {
656 moduleStates[iM->second] = 1;
657 }
else if (iM->first == indexLastFilterPathModules) {
658 moduleStates[iM->second] = handleTriggerResults->
accept(indexPath);
659 }
else if (moduleStates.find(iM->second) == moduleStates.end()) {
660 moduleStates[iM->second] = -1;
671 std::multimap<trigger::size_type, int>
objectTypes;
672 std::multimap<trigger::size_type, std::string> filterLabels;
674 for (
size_t iF = 0; iF < sizeFilters; ++iF) {
679 for (
size_t iK = 0; iK <
keys.size(); ++iK) {
680 filterLabels.insert(std::pair<trigger::size_type, std::string>(
keys[iK], nameFilter));
688 triggerObjectsStandAlone->reserve(sizeObjects);
691 std::map<trigger::size_type, trigger::size_type> newObjectKeys;
692 for (
size_t iO = 0, iC = 0, nC = handleTriggerEvent->
sizeCollections(); iO < sizeObjects && iC < nC; ++iO) {
697 while (iO >= collectionKeys[iC])
701 typedef std::multimap<trigger::size_type, int>::const_iterator it_type;
702 for (std::pair<it_type, it_type> trange =
objectTypes.equal_range(iO); trange.first != trange.second;
704 triggerObject.addTriggerObjectType(trange.first->second);
710 bool excluded(
false);
721 typedef std::multimap<trigger::size_type, std::string>::const_iterator it_fl;
722 for (std::pair<it_fl, it_fl> frange = filterLabels.equal_range(iO); frange.first != frange.second;
725 const std::vector<ModuleLabelToPathAndFlags::PathAndFlags>&
paths =
727 for (std::vector<ModuleLabelToPathAndFlags::PathAndFlags>::const_iterator iP =
paths.begin(); iP !=
paths.end();
729 bool pathFired = handleTriggerResults->
wasrun(iP->pathIndex) && handleTriggerResults->
accept(iP->pathIndex);
730 triggerObjectStandAlone.
addPathName(iP->pathName, pathFired && iP->lastFilter, pathFired && iP->l3Filter);
734 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
743 auto triggerFilters = std::make_unique<TriggerFilterCollection>();
744 triggerFilters->reserve(sizeFilters);
745 for (
size_t iF = 0; iF < sizeFilters; ++iF) {
755 for (
size_t iK = 0; iK <
keys.size(); ++iK) {
757 if (newObjectKeys.find(
keys.at(iK)) != newObjectKeys.end()) {
758 if (newObjectKeys[
keys.at(iK)] == sizeObjects)
763 LogWarning(
"triggerObjectKey") <<
"TriggerFilter '" << nameFilter
764 <<
"' requests non-existing TriggerObject key " <<
keys.at(iK) <<
"\n" 765 <<
"Skipping object assignment";
769 std::map<std::string, int>::iterator iS(moduleStates.find(nameFilter));
770 if (iS != moduleStates.end()) {
785 packedPrescales = std::make_unique<PackedTriggerPrescales>(handleTriggerResults);
786 packedPrescalesL1min = std::make_unique<PackedTriggerPrescales>(handleTriggerResults);
787 packedPrescalesL1max = std::make_unique<PackedTriggerPrescales>(handleTriggerResults);
789 for (
unsigned int i = 0,
n =
names.size();
i <
n; ++
i) {
791 if (pvdet.first.empty()) {
792 packedPrescalesL1max->addPrescaledTrigger(
i, 1);
793 packedPrescalesL1min->addPrescaledTrigger(
i, 1);
795 double pmin = -1, pmax = -1;
796 for (
const auto&
p : pvdet.first) {
798 if (
p.second > 0 && (
pmin == -1 ||
pmin >
p.second))
801 packedPrescalesL1max->addPrescaledTrigger(
i, pmax);
802 packedPrescalesL1min->addPrescaledTrigger(
i,
pmin);
804 packedPrescales->addPrescaledTrigger(
i, pvdet.second);
817 std::map<L1GtObject, std::vector<unsigned> > l1ObjectTypeMap;
821 if (handleL1ExtraMu.
isValid()) {
822 std::vector<unsigned> muKeys;
823 for (
size_t l1Mu = 0; l1Mu < handleL1ExtraMu->size(); ++l1Mu) {
824 if (
mainBxOnly_ && handleL1ExtraMu->at(l1Mu).bx() != 0)
831 const reco::LeafCandidate leafCandidate(*(handleL1ExtraMu->at(l1Mu).reco::LeafCandidate::clone()));
839 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
840 if (handleL1ExtraMu->at(l1Mu).bx() == 0)
841 muKeys.push_back(triggerObjectsStandAlone->size() - 1);
843 l1ObjectTypeMap.insert(std::make_pair(
Mu, muKeys));
851 if (handleL1ExtraNoIsoEG.
isValid()) {
852 std::vector<unsigned> noIsoEGKeys;
853 for (
size_t l1NoIsoEG = 0; l1NoIsoEG < handleL1ExtraNoIsoEG->size(); ++l1NoIsoEG) {
854 if (
mainBxOnly_ && handleL1ExtraNoIsoEG->at(l1NoIsoEG).bx() != 0)
861 const reco::LeafCandidate leafCandidate(*(handleL1ExtraNoIsoEG->at(l1NoIsoEG).reco::LeafCandidate::clone()));
869 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
870 if (handleL1ExtraNoIsoEG->at(l1NoIsoEG).bx() == 0)
871 noIsoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
873 l1ObjectTypeMap.insert(std::make_pair(
NoIsoEG, noIsoEGKeys));
875 LogError(
"l1ExtraValid") <<
"l1extra::L1EmParticleCollection product with InputTag '" 881 if (handleL1ExtraIsoEG.
isValid()) {
882 std::vector<unsigned> isoEGKeys;
883 for (
size_t l1IsoEG = 0; l1IsoEG < handleL1ExtraIsoEG->size(); ++l1IsoEG) {
884 if (
mainBxOnly_ && handleL1ExtraIsoEG->at(l1IsoEG).bx() != 0)
891 const reco::LeafCandidate leafCandidate(*(handleL1ExtraIsoEG->at(l1IsoEG).reco::LeafCandidate::clone()));
899 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
900 if (handleL1ExtraIsoEG->at(l1IsoEG).bx() == 0)
901 isoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
903 l1ObjectTypeMap.insert(std::make_pair(
IsoEG, isoEGKeys));
911 if (handleL1ExtraCenJet.
isValid()) {
912 std::vector<unsigned> cenJetKeys;
913 for (
size_t l1CenJet = 0; l1CenJet < handleL1ExtraCenJet->size(); ++l1CenJet) {
914 if (
mainBxOnly_ && handleL1ExtraCenJet->at(l1CenJet).bx() != 0)
921 const reco::LeafCandidate leafCandidate(*(handleL1ExtraCenJet->at(l1CenJet).reco::LeafCandidate::clone()));
929 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
930 if (handleL1ExtraCenJet->at(l1CenJet).bx() == 0)
931 cenJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
933 l1ObjectTypeMap.insert(std::make_pair(
CenJet, cenJetKeys));
935 LogError(
"l1ExtraValid") <<
"l1extra::L1JetParticleCollection product with InputTag '" 941 if (handleL1ExtraForJet.
isValid()) {
942 std::vector<unsigned> forJetKeys;
943 for (
size_t l1ForJet = 0; l1ForJet < handleL1ExtraForJet->size(); ++l1ForJet) {
944 if (
mainBxOnly_ && handleL1ExtraForJet->at(l1ForJet).bx() != 0)
951 const reco::LeafCandidate leafCandidate(*(handleL1ExtraForJet->at(l1ForJet).reco::LeafCandidate::clone()));
959 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
960 if (handleL1ExtraForJet->at(l1ForJet).bx() == 0)
961 forJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
963 l1ObjectTypeMap.insert(std::make_pair(
ForJet, forJetKeys));
965 LogError(
"l1ExtraValid") <<
"l1extra::L1JetParticleCollection product with InputTag '" 971 if (handleL1ExtraTauJet.
isValid()) {
972 std::vector<unsigned> tauJetKeys;
973 for (
size_t l1TauJet = 0; l1TauJet < handleL1ExtraTauJet->size(); ++l1TauJet) {
974 if (
mainBxOnly_ && handleL1ExtraTauJet->at(l1TauJet).bx() != 0)
981 const reco::LeafCandidate leafCandidate(*(handleL1ExtraTauJet->at(l1TauJet).reco::LeafCandidate::clone()));
989 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
990 if (handleL1ExtraTauJet->at(l1TauJet).bx() == 0)
991 tauJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
993 l1ObjectTypeMap.insert(std::make_pair(
TauJet, tauJetKeys));
995 LogError(
"l1ExtraValid") <<
"l1extra::L1JetParticleCollection product with InputTag '" 1001 if (handleL1ExtraETM.
isValid()) {
1002 std::vector<unsigned> etmKeys;
1003 for (
size_t l1ETM = 0; l1ETM < handleL1ExtraETM->size(); ++l1ETM) {
1004 if (
mainBxOnly_ && handleL1ExtraETM->at(l1ETM).bx() != 0)
1011 const reco::LeafCandidate leafCandidate(*(handleL1ExtraETM->at(l1ETM).reco::LeafCandidate::clone()));
1019 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
1020 if (handleL1ExtraETM->at(l1ETM).bx() == 0)
1021 etmKeys.push_back(triggerObjectsStandAlone->size() - 1);
1023 l1ObjectTypeMap.insert(std::make_pair(
ETM, etmKeys));
1025 LogError(
"l1ExtraValid") <<
"l1extra::L1EtMissParticleCollection product with InputTag '" 1031 if (handleL1ExtraHTM.
isValid()) {
1032 std::vector<unsigned> htmKeys;
1033 for (
size_t l1HTM = 0; l1HTM < handleL1ExtraHTM->size(); ++l1HTM) {
1034 if (
mainBxOnly_ && handleL1ExtraHTM->at(l1HTM).bx() != 0)
1041 const reco::LeafCandidate leafCandidate(*(handleL1ExtraHTM->at(l1HTM).reco::LeafCandidate::clone()));
1049 triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
1050 if (handleL1ExtraHTM->at(l1HTM).bx() == 0)
1051 htmKeys.push_back(triggerObjectsStandAlone->size() - 1);
1053 l1ObjectTypeMap.insert(std::make_pair(
HTM, htmKeys));
1055 LogError(
"l1ExtraValid") <<
"l1extra::L1EtMissParticleCollection product with InputTag '" 1065 auto triggerAlgos = std::make_unique<TriggerAlgorithmCollection>();
1069 std::map<L1GtObject, trigger::TriggerObjectType> mapObjectTypes;
1081 auto const& l1GtAlgorithms = handleL1GtTriggerMenu->gtAlgorithmMap();
1082 auto const& l1GtTechTriggers = handleL1GtTriggerMenu->gtTechnicalTriggerMap();
1083 auto const& l1GtConditionsVector = handleL1GtTriggerMenu->gtConditionMap();
1086 for (
size_t iCv = 0; iCv < l1GtConditionsVector.size(); ++iCv) {
1087 l1GtConditions.insert(l1GtConditionsVector.at(iCv).begin(), l1GtConditionsVector.at(iCv).end());
1089 triggerAlgos->reserve(l1GtAlgorithms.size() + l1GtTechTriggers.size());
1092 if (!handleL1GlobalTriggerObjectMaps.
isValid()) {
1093 LogError(
"l1ObjectMap") <<
"L1GlobalTriggerObjectMaps product with InputTag '" 1095 <<
"No L1 objects and GTL results available for physics algorithms";
1102 LogError(
"l1ObjectMap") <<
"ParameterSet registry not available\n" 1103 <<
"Skipping conditions for all L1 physics algorithm names in this run";
1107 LogInfo(
"l1ObjectMap") <<
"ParameterSet registry not available\n" 1108 <<
"Skipping conditions for all L1 physics algorithm names in this event";
1112 for (
CItAlgo iAlgo = l1GtAlgorithms.begin(); iAlgo != l1GtAlgorithms.end(); ++iAlgo) {
1115 LogError(
"l1Algo") <<
"L1 physics algorithm '" <<
algoName <<
"' has bit number " 1116 << iAlgo->second.algoBitNumber()
1124 LogError(
"l1Algo") <<
"L1 physics algorithm '" <<
algoName <<
"' not found in the L1 menu\n" 1130 <<
"' does not have category 'AlgorithmTrigger' from 'L1GtUtils'\n" 1134 bool decisionBeforeMask;
1135 bool decisionAfterMask;
1141 <<
" from 'L1GtUtils'\n" 1146 iAlgo->second.algoAlias(),
1155 if (!handleL1GlobalTriggerObjectMaps.
isValid()) {
1156 triggerAlgos->push_back(triggerAlgo);
1161 <<
"' is missing in L1GlobalTriggerObjectMaps\n" 1162 <<
"Skipping conditions and GTL result";
1163 triggerAlgos->push_back(triggerAlgo);
1168 if ((algorithmResult != decisionBeforeMask) &&
1169 (decisionBeforeMask ==
true)) {
1170 LogInfo(
"l1ObjectMap") <<
"L1 physics algorithm '" <<
algoName <<
"' with different decisions in\n" 1171 <<
"L1GlobalTriggerObjectMaps (GTL result) : " << algorithmResult <<
"\n" 1172 <<
"L1GlobalTriggerReadoutRecord (decision before mask): " << decisionBeforeMask;
1179 triggerAlgos->push_back(triggerAlgo);
1185 <<
"' not available in ParameterSet registry\n" 1186 <<
"Skipping conditions for this algorithm in this run";
1189 <<
"' not available in ParameterSet registry\n" 1190 <<
"Skipping conditions for this algorithm in this event";
1192 triggerAlgos->push_back(triggerAlgo);
1197 for (
unsigned iT = 0; iT < conditionNames.size(); ++iT) {
1207 LogError(
"l1CondMap") <<
"More condition names from ParameterSet registry than the " 1208 <<
conditions.nConditions() <<
" conditions in L1GlobalTriggerObjectMaps\n" 1209 <<
"Skipping condition " << conditionNames.at(iT) <<
" in algorithm " <<
algoName;
1213 if (l1GtConditions.find(triggerCond.name()) != l1GtConditions.end()) {
1214 triggerCond.
setCategory(l1GtConditions[triggerCond.name()]->condCategory());
1215 triggerCond.setType(l1GtConditions[triggerCond.name()]->condType());
1216 const std::vector<L1GtObject> l1ObjectTypes(l1GtConditions[triggerCond.name()]->objectType());
1217 for (
size_t iType = 0; iType < l1ObjectTypes.size(); ++iType) {
1218 triggerCond.addTriggerObjectType(mapObjectTypes[l1ObjectTypes.at(iType)]);
1223 for (
size_t iVV = 0; iVV < combinations.
nCombinations(); ++iVV) {
1226 if (iV >= l1ObjectTypes.size()) {
1227 LogError(
"l1CondMap") <<
"Index " << iV <<
" in combinations vector overshoots size " 1228 << l1ObjectTypes.size() <<
" of types vector in conditions map\n" 1229 <<
"Skipping object key in condition " << triggerCond.name();
1230 }
else if (l1ObjectTypeMap.find(l1ObjectTypes.at(iV)) != l1ObjectTypeMap.end()) {
1231 if (objectIndex >= l1ObjectTypeMap[l1ObjectTypes.at(iV)].size()) {
1233 <<
"Index " << objectIndex <<
" in combination overshoots number " 1234 << l1ObjectTypeMap[l1ObjectTypes.at(iV)].size() <<
"of according trigger objects\n" 1235 <<
"Skipping object key in condition " << triggerCond.name();
1237 const unsigned objectKey(l1ObjectTypeMap[l1ObjectTypes.at(iV)].at(objectIndex));
1238 triggerCond.addObjectKey(objectKey);
1240 triggerObjectsStandAlone->at(objectKey).addAlgorithmName(
1241 triggerAlgo.
name(), (triggerAlgo.
decision() && triggerCond.wasAccept()));
1242 triggerObjectsStandAlone->at(objectKey).addConditionName(triggerCond.name());
1247 LogWarning(
"l1CondMap") <<
"L1 conditions '" << triggerCond.name() <<
"' not found in the L1 menu\n" 1248 <<
"Remains incomplete";
1254 triggerAlgos->push_back(triggerAlgo);
1257 for (
CItAlgo iAlgo = l1GtTechTriggers.begin(); iAlgo != l1GtTechTriggers.end(); ++iAlgo) {
1260 LogError(
"l1Algo") <<
"L1 technical trigger '" <<
algoName <<
"' has bit number " 1261 << iAlgo->second.algoBitNumber()
1269 LogError(
"l1Algo") <<
"L1 technical trigger '" <<
algoName <<
"' not found in the L1 menu\n" 1275 <<
"' does not have category 'TechnicalTrigger' from 'L1GtUtils'\n" 1279 bool decisionBeforeMask;
1280 bool decisionAfterMask;
1286 <<
" from 'L1GtUtils'\n" 1291 iAlgo->second.algoAlias(),
1299 triggerAlgos->push_back(triggerAlgo);
1317 obj.packFilterLabels(
iEvent, *handleTriggerResults);
1328 const std::vector<std::string>& pathNames =
hltConfig.triggerNames();
1329 unsigned int sizePaths = pathNames.size();
1330 for (
unsigned int indexPath = 0; indexPath < sizePaths; ++indexPath) {
1331 const std::string& namePath = pathNames[indexPath];
1333 const std::vector<std::string>& nameModules =
hltConfig.moduleLabels(indexPath);
1334 unsigned int sizeModulesPath = nameModules.size();
1335 bool lastFilter =
true;
1336 unsigned int iM = sizeModulesPath;
1338 const std::string& nameFilter = nameModules[--iM];
1339 if (
hltConfig.moduleEDMType(nameFilter) !=
"EDFilter")
1341 if (
hltConfig.moduleType(nameFilter) ==
"HLTBool")
collection_type::const_iterator const_iterator
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
bool accept() const
Has at least one path accepted the event?
const std::vector< PathAndFlags > empty_
const Keys & filterKeys(trigger::size_type index) const
std::vector< L1Seed > L1SeedCollection
Collection of L1Seed.
const std::vector< std::string > & labels() const
T getParameter(std::string const &) const
Analysis-level L1 trigger algorithm class.
void beginLuminosityBlock(const edm::LuminosityBlock &iLuminosityBlock, const edm::EventSetup &iSetup) override
edm::InputTag tagL1ExtraForJet_
bool autoProcessNameL1ExtraHTM_
bool error() const
Has any path encountered an error (exception)
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
bool autoProcessNameL1ExtraIsoEG_
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > l1GlobalTriggerObjectMapsToken_
edm::InputTag tagTriggerEvent_
PATTriggerProducer(const edm::ParameterSet &iConfig)
static PFTauRenderPlugin instance
enum start value shifted to 81 so as to avoid clashes with PDG codes
bool autoProcessNameL1ExtraTauJet_
edm::InputTag tagTriggerResults_
static const unsigned int NumberTechnicalTriggers
bool exists(std::string const ¶meterName) const
checks if a parameter exists
trigger::size_type sizeFilters() const
The single EDProduct containing the HLT Prescale Table.
void setGtlResult(bool gtlResult)
Set L1 algorithm GTL result.
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
void insert(const std::string &filter, const std::string &path, unsigned int pathIndex, bool lastFilter, bool l3Filter)
std::pair< std::vector< std::pair< std::string, TL1 > >, THLT > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
void consistencyCheck() const
void beginRun(const edm::Run &iRun, const edm::EventSetup &iSetup) override
std::string const & processName() const
PathAndFlags(const std::string &name, unsigned int index, bool last, bool l3)
edm::InputTag tagL1ExtraETM_
const std::string & collectionTagEncoded(trigger::size_type index) const
HLTConfigProvider const & hltConfigProvider() const
std::string hltPrescaleLabel_
Log< level::Error, false > LogError
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableLumiGetter_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraForJetGetter_
const std::string names[nVars_]
bool autoProcessNameL1ExtraMu_
void addFilterLabel(const std::string &filterLabel)
Adds a new HLT filter label.
bool autoProcessNameL1ExtraCenJet_
bool wasrun() const
Was at least one path run?
Single trigger physics object (e.g., an isolated muon)
const int l1Results(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
const std::vector< PathAndFlags > & operator[](const std::string &filter) const
void addPathName(const std::string &pathName, bool pathLastFilterAccepted=true, bool pathL3FilterAccepted=true)
Adds a new HLT path name.
bool addPathModuleLabels_
Analysis-level HLTrigger filter class.
std::vector< std::string > exludeCollections_
edm::GetterOfProducts< l1extra::L1EmParticleCollection > l1ExtraNoIsoEGGetter_
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableEventGetter_
Produces the full or stand-alone PAT trigger information collections.
std::map< std::string, std::vector< PathAndFlags > > map_
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
unsigned int set() const
low-level const accessors for data members
edm::InputTag tagL1ExtraIsoEG_
void setCollection(const std::string &collName)
Methods.
Analysis-level L1 trigger condition class.
static const unsigned int NumberPhysTriggersExtended
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > l1ExtraHTMGetter_
const std::map< std::string, std::vector< unsigned int > > & table() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
trigger::size_type sizeCollections() const
other
bool hasCollection(const std::string &collName) const override
Checks, if a certain label of original collection is assigned (method overrides)
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraTauJetGetter_
unsigned char getObjectIndex(unsigned combination, unsigned object) const
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraCenJetGetter_
const TriggerObjectCollection & getObjects() const
bool getByLabel(std::string const &label, Handle< PROD > &result) const
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > l1ExtraETMGetter_
key
prepare the HTCondor submission files and eventually submit them
trigger::size_type sizeObjects() const
static const unsigned int NumberPhysTriggers
#define DEFINE_FWK_MODULE(type)
ProcessHistory const & processHistory() const
edm::GetterOfProducts< l1extra::L1EmParticleCollection > l1ExtraIsoEGGetter_
void setLogicalExpression(const std::string &expression)
Set L1 algorithm logical expression.
edm::GetterOfProducts< trigger::TriggerEvent > triggerEventGetter_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::GetterOfProducts< l1extra::L1MuonParticleCollection > l1ExtraMuGetter_
edm::InputTag tagL1GlobalTriggerObjectMaps_
Log< level::Info, false > LogInfo
edm::InputTag tagL1ExtraMu_
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
const Vids & filterIds(trigger::size_type index) const
bool getByLabel(std::string const &label, Handle< PROD > &result) const
void setCategory(L1GtConditionCategory category)
Set the condition category.
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
void init(const HLTConfigProvider &)
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > handleL1GtTriggerMenuToken_
~PATTriggerProducer() override
unsigned short nObjectsPerCombination() const
std::vector< size_type > Keys
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
const std::string & name() const
Get L1 algorithm name.
bool autoProcessNameL1ExtraForJet_
void addConditionKey(unsigned conditionKey)
Add a new trigger condition collection index.
edm::ParameterSetID const & namesParameterSetID() const
edm::InputTag tagL1ExtraTauJet_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
bool algorithmExists(int algorithmBitNumber) const
Returns true if there is an entry for this algorithm bit number.
dictionary config
Read in AllInOne config in JSON format.
trigger::HLTPrescaleTable hltPrescaleTableRun_
std::string_view filterLabel(trigger::size_type index) const
L1GtUtils const & l1GtUtils() const
bool autoProcessNameL1ExtraETM_
bool autoProcessNameL1ExtraNoIsoEG_
Log< level::Warning, false > LogWarning
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
static std::string const triggerPaths
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
const Keys & collectionKeys() const
edm::InputTag tagL1ExtraNoIsoEG_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
edm::InputTag tagL1ExtraCenJet_
edm::GetterOfProducts< edm::TriggerResults > triggerResultsGetter_
HLTPrescaleProvider hltPrescaleProvider_
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableRunGetter_
Analysis-level trigger object class (stand-alone)
edm::InputTag tagL1ExtraHTM_
unsigned nCombinations() const
edm::ParameterSet * l1PSet_
std::string labelHltPrescaleTable_