CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
pat::PATTriggerProducer Class Reference

Produces the full or stand-alone PAT trigger information collections. More...

Inheritance diagram for pat::PATTriggerProducer:
edm::stream::EDProducer<>

Classes

class  ModuleLabelToPathAndFlags
 

Public Member Functions

 PATTriggerProducer (const edm::ParameterSet &iConfig)
 
 ~PATTriggerProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &iLuminosityBlock, const edm::EventSetup &iSetup) override
 
void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 

Private Attributes

bool addL1Algos_
 
bool addPathModuleLabels_
 
bool autoProcessName_
 
bool autoProcessNameL1ExtraCenJet_
 
bool autoProcessNameL1ExtraETM_
 
bool autoProcessNameL1ExtraForJet_
 
bool autoProcessNameL1ExtraHTM_
 
bool autoProcessNameL1ExtraIsoEG_
 
bool autoProcessNameL1ExtraMu_
 
bool autoProcessNameL1ExtraNoIsoEG_
 
bool autoProcessNameL1ExtraTauJet_
 
std::vector< std::string > exludeCollections_
 
bool firstInRun_
 
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcdhandleL1GtTriggerMenuToken_
 
bool hltConfigInit_
 
std::string hltPrescaleLabel_
 
HLTPrescaleProvider hltPrescaleProvider_
 
edm::GetterOfProducts< trigger::HLTPrescaleTablehltPrescaleTableEventGetter_
 
trigger::HLTPrescaleTable hltPrescaleTableLumi_
 
edm::GetterOfProducts< trigger::HLTPrescaleTablehltPrescaleTableLumiGetter_
 
trigger::HLTPrescaleTable hltPrescaleTableRun_
 
edm::GetterOfProducts< trigger::HLTPrescaleTablehltPrescaleTableRunGetter_
 
edm::GetterOfProducts< l1extra::L1JetParticleCollectionl1ExtraCenJetGetter_
 
edm::GetterOfProducts< l1extra::L1EtMissParticleCollectionl1ExtraETMGetter_
 
edm::GetterOfProducts< l1extra::L1JetParticleCollectionl1ExtraForJetGetter_
 
edm::GetterOfProducts< l1extra::L1EtMissParticleCollectionl1ExtraHTMGetter_
 
edm::GetterOfProducts< l1extra::L1EmParticleCollectionl1ExtraIsoEGGetter_
 
edm::GetterOfProducts< l1extra::L1MuonParticleCollectionl1ExtraMuGetter_
 
edm::GetterOfProducts< l1extra::L1EmParticleCollectionl1ExtraNoIsoEGGetter_
 
edm::GetterOfProducts< l1extra::L1JetParticleCollectionl1ExtraTauJetGetter_
 
edm::EDGetTokenT< L1GlobalTriggerObjectMapsl1GlobalTriggerObjectMapsToken_
 
edm::ParameterSetl1PSet_
 
std::string labelHltPrescaleTable_
 
bool mainBxOnly_
 
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
 
std::string nameProcess_
 
bool onlyStandAlone_
 
bool packLabels_
 
bool packPathNames_
 
bool packPrescales_
 
bool saveL1Refs_
 
edm::InputTag tagL1ExtraCenJet_
 
edm::InputTag tagL1ExtraETM_
 
edm::InputTag tagL1ExtraForJet_
 
edm::InputTag tagL1ExtraHTM_
 
edm::InputTag tagL1ExtraIsoEG_
 
edm::InputTag tagL1ExtraMu_
 
edm::InputTag tagL1ExtraNoIsoEG_
 
edm::InputTag tagL1ExtraTauJet_
 
edm::InputTag tagL1GlobalTriggerObjectMaps_
 
edm::InputTag tagTriggerEvent_
 
edm::InputTag tagTriggerResults_
 
edm::GetterOfProducts< trigger::TriggerEventtriggerEventGetter_
 
edm::GetterOfProducts< edm::TriggerResultstriggerResultsGetter_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Produces the full or stand-alone PAT trigger information collections.

This producer extracts the trigger information from

For me information, s. https://twiki.cern.ch/twiki/bin/view/CMS/SWGuidePATTrigger

Author
Volker Adler
Version
Id
PATTriggerProducer.h,v 1.20 2012/09/11 22:45:29 vadler Exp

Definition at line 72 of file PATTriggerProducer.cc.

Constructor & Destructor Documentation

◆ PATTriggerProducer()

PATTriggerProducer::PATTriggerProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 176 of file PATTriggerProducer.cc.

References deDxTools::esConsumes().

177  : nameProcess_(iConfig.getParameter<std::string>("processName")),
179  onlyStandAlone_(iConfig.getParameter<bool>("onlyStandAlone")),
180  firstInRun_(true),
181  // L1 configuration parameters
182  addL1Algos_(false),
183  tagL1GlobalTriggerObjectMaps_("l1L1GtObjectMap"),
184  tagL1ExtraMu_(),
190  tagL1ExtraETM_(),
191  tagL1ExtraHTM_(),
200  mainBxOnly_(true),
201  saveL1Refs_(false),
202  hltPrescaleProvider_(iConfig, consumesCollector(), *this),
203  hltConfigInit_(false),
204  // HLT configuration parameters
205  tagTriggerResults_("TriggerResults"),
206  tagTriggerEvent_("hltTriggerSummaryAOD"),
211  addPathModuleLabels_(false),
212  packPathNames_(iConfig.existsAs<bool>("packTriggerPathNames") ? iConfig.getParameter<bool>("packTriggerPathNames")
213  : false),
214  packLabels_(iConfig.existsAs<bool>("packTriggerLabels") ? iConfig.getParameter<bool>("packTriggerLabels") : true),
215  packPrescales_(iConfig.existsAs<bool>("packTriggerPrescales") ? iConfig.getParameter<bool>("packTriggerPrescales")
216  : true),
218  // L1 configuration parameters
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_)
229  else
231  }
234  }
235  if (iConfig.exists("l1ExtraNoIsoEG")) {
236  tagL1ExtraNoIsoEG_ = iConfig.getParameter<InputTag>("l1ExtraNoIsoEG");
237  if (tagL1ExtraNoIsoEG_.process() == "*") {
238  if (autoProcessName_)
240  else
242  }
245  }
246  if (iConfig.exists("l1ExtraIsoEG")) {
247  tagL1ExtraIsoEG_ = iConfig.getParameter<InputTag>("l1ExtraIsoEG");
248  if (tagL1ExtraIsoEG_.process() == "*") {
249  if (autoProcessName_)
251  else
253  }
256  }
257  if (iConfig.exists("l1ExtraCenJet")) {
258  tagL1ExtraCenJet_ = iConfig.getParameter<InputTag>("l1ExtraCenJet");
259  if (tagL1ExtraCenJet_.process() == "*") {
260  if (autoProcessName_)
262  else
264  }
267  }
268  if (iConfig.exists("l1ExtraForJet")) {
269  tagL1ExtraForJet_ = iConfig.getParameter<InputTag>("l1ExtraForJet");
270  if (tagL1ExtraForJet_.process() == "*") {
271  if (autoProcessName_)
273  else
275  }
278  }
279  if (iConfig.exists("l1ExtraTauJet")) {
280  tagL1ExtraTauJet_ = iConfig.getParameter<InputTag>("l1ExtraTauJet");
281  if (tagL1ExtraTauJet_.process() == "*") {
282  if (autoProcessName_)
284  else
286  }
289  }
290  if (iConfig.exists("l1ExtraETM")) {
291  tagL1ExtraETM_ = iConfig.getParameter<InputTag>("l1ExtraETM");
292  if (tagL1ExtraETM_.process() == "*") {
293  if (autoProcessName_)
295  else
297  }
300  }
301  if (iConfig.exists("l1ExtraHTM")) {
302  tagL1ExtraHTM_ = iConfig.getParameter<InputTag>("l1ExtraHTM");
303  if (tagL1ExtraHTM_.process() == "*") {
304  if (autoProcessName_)
306  else
308  }
311  }
312  if (iConfig.exists("mainBxOnly"))
313  mainBxOnly_ = iConfig.getParameter<bool>("mainBxOnly");
314  if (iConfig.exists("saveL1Refs"))
315  saveL1Refs_ = iConfig.getParameter<bool>("saveL1Refs");
316 
317  // HLT configuration parameters
318  if (iConfig.exists("triggerResults"))
319  tagTriggerResults_ = iConfig.getParameter<InputTag>("triggerResults");
324  this);
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");
339  }
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");
345 
346  callWhenNewProductsRegistered([this, &iConfig](BranchDescription const& bd) {
347  if (iConfig.exists("l1ExtraMu"))
349  if (iConfig.exists("l1ExtraNoIsoEG"))
351  if (iConfig.exists("l1ExtraIsoEG"))
353  if (iConfig.exists("l1ExtraCenJet"))
355  if (iConfig.exists("l1ExtraForJet"))
357  if (iConfig.exists("l1ExtraTauJet"))
359  if (iConfig.exists("l1ExtraETM"))
361  if (iConfig.exists("l1ExtraHTM"))
363  if (not(this->autoProcessName_ and bd.processName() == this->moduleDescription().processName())) {
365  }
367  if (iConfig.exists("hltPrescaleTable")) {
371  }
372  });
373 
374  if (!onlyStandAlone_) {
375  produces<TriggerAlgorithmCollection>();
376  produces<TriggerConditionCollection>();
377  produces<TriggerPathCollection>();
378  produces<TriggerFilterCollection>();
379  produces<TriggerObjectCollection>();
380  }
381  if (packPrescales_) {
382  produces<PackedTriggerPrescales>();
383  produces<PackedTriggerPrescales>("l1max");
384  produces<PackedTriggerPrescales>("l1min");
385  }
386  produces<TriggerObjectStandAloneCollection>();
387 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > l1GlobalTriggerObjectMapsToken_
std::string const & instance() const
Definition: InputTag.h:37
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string const & label() const
Definition: InputTag.h:36
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:171
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableLumiGetter_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraForJetGetter_
std::vector< std::string > exludeCollections_
edm::GetterOfProducts< l1extra::L1EmParticleCollection > l1ExtraNoIsoEGGetter_
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableEventGetter_
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > l1ExtraHTMGetter_
trigger::HLTPrescaleTable hltPrescaleTableLumi_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraTauJetGetter_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraCenJetGetter_
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > l1ExtraETMGetter_
edm::GetterOfProducts< l1extra::L1EmParticleCollection > l1ExtraIsoEGGetter_
edm::GetterOfProducts< trigger::TriggerEvent > triggerEventGetter_
edm::GetterOfProducts< l1extra::L1MuonParticleCollection > l1ExtraMuGetter_
edm::InputTag tagL1GlobalTriggerObjectMaps_
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > handleL1GtTriggerMenuToken_
trigger::HLTPrescaleTable hltPrescaleTableRun_
std::string const & process() const
Definition: InputTag.h:40
edm::GetterOfProducts< edm::TriggerResults > triggerResultsGetter_
HLTPrescaleProvider hltPrescaleProvider_
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableRunGetter_

◆ ~PATTriggerProducer()

pat::PATTriggerProducer::~PATTriggerProducer ( )
inlineoverride

Definition at line 75 of file PATTriggerProducer.cc.

75 {};

Member Function Documentation

◆ beginLuminosityBlock()

void PATTriggerProducer::beginLuminosityBlock ( const edm::LuminosityBlock iLuminosityBlock,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 481 of file PATTriggerProducer.cc.

References edm::LuminosityBlock::getByLabel(), hltConfigInit_, hltPrescaleTableLumi_, hltPrescaleTableRun_, HLT_2022v12_cff::InputTag, edm::HandleBase::isValid(), labelHltPrescaleTable_, trigger::HLTPrescaleTable::labels(), nameProcess_, trigger::HLTPrescaleTable::set(), and trigger::HLTPrescaleTable::table().

481  {
482  // Terminate, if auto process name determination failed
483  if (nameProcess_ == "*")
484  return;
485 
486  // Extract pre-scales
487  if (hltConfigInit_) {
488  // Start from run
491  // Try lumi product, if configured and available
492  if (!labelHltPrescaleTable_.empty()) {
493  Handle<trigger::HLTPrescaleTable> handleHltPrescaleTable;
494  iLuminosityBlock.getByLabel(InputTag(labelHltPrescaleTable_, "Lumi", nameProcess_), handleHltPrescaleTable);
495  if (handleHltPrescaleTable.isValid()) {
497  handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table());
498  }
499  }
500  }
501 }
const std::vector< std::string > & labels() const
The single EDProduct containing the HLT Prescale Table.
unsigned int set() const
low-level const accessors for data members
const std::map< std::string, std::vector< unsigned int > > & table() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
bool getByLabel(std::string const &label, Handle< PROD > &result) const
bool isValid() const
Definition: HandleBase.h:70
trigger::HLTPrescaleTable hltPrescaleTableRun_

◆ beginRun()

void PATTriggerProducer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 389 of file PATTriggerProducer.cc.

References autoProcessName_, autoProcessNameL1ExtraCenJet_, autoProcessNameL1ExtraETM_, autoProcessNameL1ExtraForJet_, autoProcessNameL1ExtraHTM_, autoProcessNameL1ExtraIsoEG_, autoProcessNameL1ExtraMu_, autoProcessNameL1ExtraNoIsoEG_, autoProcessNameL1ExtraTauJet_, edm::ParameterSet::exists(), firstInRun_, edm::Run::getByLabel(), HltComparatorCreateWorkflow::hltConfig, hltConfigInit_, HLTPrescaleProvider::hltConfigProvider(), hltPrescaleProvider_, hltPrescaleTableRun_, HLTPrescaleProvider::init(), pat::PATTriggerProducer::ModuleLabelToPathAndFlags::init(), HLT_2022v12_cff::InputTag, edm::InputTag::instance(), instance, edm::HandleBase::isValid(), l1PSet_, edm::InputTag::label(), labelHltPrescaleTable_, trigger::HLTPrescaleTable::labels(), LogDebug, moduleLabelToPathAndFlags_, nameProcess_, edm::InputTag::process(), edm::Run::processHistory(), trigger::HLTPrescaleTable::set(), trigger::HLTPrescaleTable::table(), tagL1ExtraCenJet_, tagL1ExtraETM_, tagL1ExtraForJet_, tagL1ExtraHTM_, tagL1ExtraIsoEG_, tagL1ExtraMu_, tagL1ExtraNoIsoEG_, tagL1ExtraTauJet_, tagTriggerEvent_, and tagTriggerResults_.

389  {
390  // Initialize
391  firstInRun_ = true;
392  l1PSet_ = nullptr;
393  hltConfigInit_ = false;
394 
395  // Initialize process name
396  if (autoProcessName_) {
397  // reset
398  nameProcess_ = "*";
399  // determine process name from last run TriggerSummaryProducerAOD module in process history of input
400  const ProcessHistory& processHistory(iRun.processHistory());
401  ProcessConfiguration processConfiguration;
402  ParameterSet processPSet;
403  // unbroken loop, which relies on time ordering (accepts the last found entry)
404  for (ProcessHistory::const_iterator iHist = processHistory.begin(); iHist != processHistory.end(); ++iHist) {
405  if (processHistory.getConfigurationForProcess(iHist->processName(), processConfiguration) &&
406  pset::Registry::instance()->getMapped(processConfiguration.parameterSetID(), processPSet) &&
407  processPSet.exists(tagTriggerEvent_.label())) {
408  nameProcess_ = iHist->processName();
409  LogDebug("autoProcessName") << "HLT process name '" << nameProcess_ << "' discovered";
410  }
411  }
412  // terminate, if nothing is found
413  if (nameProcess_ == "*") {
414  LogError("autoProcessName") << "trigger::TriggerEvent product with label '" << tagTriggerEvent_.label()
415  << "' not produced according to process history of input data\n"
416  << "No trigger information produced";
417  return;
418  }
419  LogInfo("autoProcessName") << "HLT process name' " << nameProcess_ << "' used for PAT trigger information";
420  }
421  // adapt configuration of used input tags
422  if (tagTriggerResults_.process().empty() || tagTriggerResults_.process() == "*") {
424  } else if (tagTriggerEvent_.process() != nameProcess_) {
425  LogWarning("inputTags") << "TriggerResults process name '" << tagTriggerResults_.process()
426  << "' differs from HLT process name '" << nameProcess_ << "'";
427  }
428  if (tagTriggerEvent_.process().empty() || tagTriggerEvent_.process() == "*") {
430  } else if (tagTriggerEvent_.process() != nameProcess_) {
431  LogWarning("inputTags") << "TriggerEvent process name '" << tagTriggerEvent_.process()
432  << "' differs from HLT process name '" << nameProcess_ << "'";
433  }
450 
451  // Initialize HLTConfigProvider
453  bool changed(true);
454  if (!hltPrescaleProvider_.init(iRun, iSetup, nameProcess_, changed)) {
455  LogError("hltConfig") << "HLT config extraction error with process name '" << nameProcess_ << "'";
456  } else if (hltConfig.size() <= 0) {
457  LogError("hltConfig") << "HLT config size error";
458  } else
459  hltConfigInit_ = true;
460 
461  // Update mapping from filter names to path names
462  if (hltConfigInit_ && changed)
464 
465  // Extract pre-scales
466  if (hltConfigInit_) {
467  // Start empty
469  // Try run product, if configured
470  if (!labelHltPrescaleTable_.empty()) {
471  Handle<trigger::HLTPrescaleTable> handleHltPrescaleTable;
472  iRun.getByLabel(InputTag(labelHltPrescaleTable_, "Run", nameProcess_), handleHltPrescaleTable);
473  if (handleHltPrescaleTable.isValid()) {
475  handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table());
476  }
477  }
478  }
479 }
collection_type::const_iterator const_iterator
const std::vector< std::string > & labels() const
static PFTauRenderPlugin instance
std::string const & instance() const
Definition: InputTag.h:37
bool exists(std::string const &parameterName) const
checks if a parameter exists
The single EDProduct containing the HLT Prescale Table.
HLTConfigProvider const & hltConfigProvider() const
std::string const & label() const
Definition: InputTag.h:36
Log< level::Error, false > LogError
unsigned int set() const
low-level const accessors for data members
const std::map< std::string, std::vector< unsigned int > > & table() const
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:283
ProcessHistory const & processHistory() const
Definition: Run.cc:113
Log< level::Info, false > LogInfo
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
bool isValid() const
Definition: HandleBase.h:70
trigger::HLTPrescaleTable hltPrescaleTableRun_
Log< level::Warning, false > LogWarning
std::string const & process() const
Definition: InputTag.h:40
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
HLTPrescaleProvider hltPrescaleProvider_
edm::ParameterSet * l1PSet_
#define LogDebug(id)

◆ produce()

void PATTriggerProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 503 of file PATTriggerProducer.cc.

References edm::HLTGlobalStatus::accept(), pat::TriggerAlgorithm::addConditionKey(), pat::TriggerObjectStandAlone::addFilterLabel(), addL1Algos_, addPathModuleLabels_, pat::TriggerObjectStandAlone::addPathName(), pat::TriggerObject::addTriggerObjectType(), MillePedeAlignmentAlgorithm_cfi::algoName, L1GlobalTriggerObjectMaps::algorithmExists(), L1GlobalTriggerObjectMaps::algorithmResult(), L1GtUtils::AlgorithmTrigger, cms::cuda::assert(), electrons_cff::bool, taus_updatedMVAIds_cff::category, CenJet, trigger::TriggerEvent::collectionKeys(), trigger::TriggerEvent::collectionTagEncoded(), submitPVValidationJobs::conditions, submitPVResolutionJobs::config, L1GlobalTriggerObjectMaps::consistencyCheck(), pat::TriggerAlgorithm::decision(), edm::InputTag::encode(), edm::HLTGlobalStatus::error(), relativeConstraints::error, trigger::TriggerObject::eta(), ETM, edm::ParameterSet::exists(), exludeCollections_, trigger::TriggerEvent::filterIds(), trigger::TriggerEvent::filterIndex(), trigger::TriggerEvent::filterKeys(), trigger::TriggerEvent::filterLabel(), trigger::TriggerEvent::filterTag(), firstInRun_, ForJet, L1GlobalTriggerObjectMaps::getCombinationsInCondition(), L1GlobalTriggerObjectMaps::getConditionsInAlgorithm(), edm::EventSetup::getHandle(), L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex(), trigger::TriggerEvent::getObjects(), edm::ParameterSet::getParameter(), handleL1GtTriggerMenuToken_, pat::TriggerObjectStandAlone::hasCollection(), HltComparatorCreateWorkflow::hltConfig, hltConfigInit_, HLTPrescaleProvider::hltConfigProvider(), hltPrescaleLabel_, hltPrescaleProvider_, hltPrescaleTableLumi_, HTM, mps_fire::i, trigger::TriggerObject::id(), iEvent, edm::HLTGlobalStatus::index(), HLT_2022v12_cff::InputTag, instance, createfilelist::int, IsoEG, edm::HandleBase::isValid(), crabWrapper::key, relativeConstraints::keys, L1GtUtils::l1AlgoTechTrigBitNumber(), l1GlobalTriggerObjectMapsToken_, HLTPrescaleProvider::l1GtUtils(), l1PSet_, L1GtUtils::l1Results(), edm::InputTag::label(), labelHltPrescaleTable_, trigger::HLTPrescaleTable::labels(), LogDebug, mainBxOnly_, gpuClustering::pixelStatus::mask, trigger::TriggerObject::mass(), SiStripPI::max, moduleLabelToPathAndFlags_, eostools::move(), Mu, dqmiodumpmetadata::n, pat::TriggerAlgorithm::name(), nameProcess_, names, L1GlobalTriggerObjectMaps::namesParameterSetID(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nCombinations(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nObjectsPerCombination(), NoIsoEG, L1GlobalTriggerReadoutSetup::NumberPhysTriggers, L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers, getGTfromDQMFile::obj, L1MuTriggerScaleKeysOnlineProd_cfi::objectTypes, onlyStandAlone_, AlCaHLTBitMon_ParallelJobs::p, packLabels_, packPathNames_, packPrescales_, Skims_PA_cff::paths, trigger::TriggerObject::phi(), trackingParticleMuon_cfi::pmin, HLTPrescaleProvider::prescaleSet(), HLTPrescaleProvider::prescaleValuesInDetail(), trigger::TriggerObject::pt(), saveL1Refs_, trigger::HLTPrescaleTable::set(), pat::TriggerCondition::setCategory(), pat::TriggerObject::setCollection(), pat::TriggerAlgorithm::setGtlResult(), pat::TriggerAlgorithm::setLogicalExpression(), trigger::TriggerEvent::sizeCollections(), trigger::TriggerEvent::sizeFilters(), trigger::TriggerEvent::sizeObjects(), AlCaHLTBitMon_QueryRunRegistry::string, trigger::HLTPrescaleTable::table(), tagL1ExtraCenJet_, tagL1ExtraETM_, tagL1ExtraForJet_, tagL1ExtraHTM_, tagL1ExtraIsoEG_, tagL1ExtraMu_, tagL1ExtraNoIsoEG_, tagL1ExtraTauJet_, tagL1GlobalTriggerObjectMaps_, tagTriggerEvent_, tagTriggerResults_, TauJet, L1GtUtils::TechnicalTrigger, PDWG_DiJetAODSkim_cff::triggerConditions, hotlineDQM_cfi::triggerFilter, trigger::TriggerL1CenJet, trigger::TriggerL1ETM, trigger::TriggerL1ForJet, trigger::TriggerL1HTM, trigger::TriggerL1IsoEG, trigger::TriggerL1Mu, trigger::TriggerL1NoIsoEG, trigger::TriggerL1TauJet, triggerMatchMonitor_cfi::triggerObjects, eventshapeDQM_cfi::triggerPath, triggerPaths, and edm::HLTGlobalStatus::wasrun().

503  {
504  // Terminate, if auto process name determination failed
505  if (nameProcess_ == "*")
506  return;
507 
508  auto triggerObjects = std::make_unique<TriggerObjectCollection>();
509  auto triggerObjectsStandAlone = std::make_unique<TriggerObjectStandAloneCollection>();
510  std::unique_ptr<PackedTriggerPrescales> packedPrescales, packedPrescalesL1min, packedPrescalesL1max;
511 
512  // HLT
514 
515  // Get and check HLT event data
516  Handle<trigger::TriggerEvent> handleTriggerEvent;
517  iEvent.getByLabel(tagTriggerEvent_, handleTriggerEvent);
518  Handle<TriggerResults> handleTriggerResults;
519  iEvent.getByLabel(tagTriggerResults_, handleTriggerResults);
520  bool goodHlt(hltConfigInit_);
521  if (goodHlt) {
522  if (!handleTriggerResults.isValid()) {
523  LogError("triggerResultsValid") << "TriggerResults product with InputTag '" << tagTriggerResults_.encode()
524  << "' not in event\n"
525  << "No HLT information produced";
526  goodHlt = false;
527  } else if (!handleTriggerEvent.isValid()) {
528  LogError("triggerEventValid") << "trigger::TriggerEvent product with InputTag '" << tagTriggerEvent_.encode()
529  << "' not in event\n"
530  << "No HLT information produced";
531  goodHlt = false;
532  }
533  }
534 
535  // Produce HLT paths and determine status of modules
536 
537  if (goodHlt) {
538  // Extract pre-scales
539  // Start from lumi
540  trigger::HLTPrescaleTable hltPrescaleTable(
542  // Try event product, if configured and available
543  if (!labelHltPrescaleTable_.empty()) {
544  Handle<trigger::HLTPrescaleTable> handleHltPrescaleTable;
545  iEvent.getByLabel(InputTag(labelHltPrescaleTable_, "Event", nameProcess_), handleHltPrescaleTable);
546  if (handleHltPrescaleTable.isValid()) {
547  hltPrescaleTable = trigger::HLTPrescaleTable(
548  handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table());
549  }
550  }
551  // Try event setup, if no product
552  if (hltPrescaleTable.size() == 0) {
553  if (!labelHltPrescaleTable_.empty()) {
554  LogWarning("hltPrescaleInputTag") << "HLTPrescaleTable product with label '" << labelHltPrescaleTable_
555  << "' not found in process" << nameProcess_ << "\n"
556  << "Using default from event setup";
557  }
558  if (hltConfig.prescaleSize() > 0) {
559  if (hltPrescaleProvider_.prescaleSet(iEvent, iSetup) != -1) {
560  hltPrescaleTable = trigger::HLTPrescaleTable(
561  hltPrescaleProvider_.prescaleSet(iEvent, iSetup), hltConfig.prescaleLabels(), hltConfig.prescaleTable());
562  LogDebug("hltPrescaleTable") << "HLT prescale table found in event setup";
563  } else {
564  LogWarning("hltPrescaleSet") << "HLTPrescaleTable from event setup has error";
565  }
566  }
567  }
568  unsigned set(hltPrescaleTable.set());
569  if (hltPrescaleTable.size() > 0) {
570  if (!hltPrescaleLabel_.empty()) {
571  bool foundPrescaleLabel(false);
572  for (unsigned iLabel = 0; iLabel < hltPrescaleTable.labels().size(); ++iLabel) {
573  if (hltPrescaleTable.labels().at(iLabel) == hltPrescaleLabel_) {
574  set = iLabel;
575  foundPrescaleLabel = true;
576  break;
577  }
578  }
579  if (!foundPrescaleLabel) {
580  LogWarning("hltPrescaleLabel") << "HLT prescale label '" << hltPrescaleLabel_ << "' not in prescale table\n"
581  << "Using default";
582  }
583  }
584  } else if (iEvent.isRealData()) {
585  if ((labelHltPrescaleTable_.empty() && firstInRun_) || !labelHltPrescaleTable_.empty()) {
586  LogError("hltPrescaleTable") << "No HLT prescale table found\n"
587  << "Using default empty table with all prescales 1";
588  }
589  }
590 
591  const unsigned sizePaths(hltConfig.size());
592  const unsigned sizeFilters(handleTriggerEvent->sizeFilters());
593  const unsigned sizeObjects(handleTriggerEvent->sizeObjects());
594 
595  std::map<std::string, int> moduleStates;
596 
597  if (!onlyStandAlone_) {
598  auto triggerPaths = std::make_unique<TriggerPathCollection>();
599  triggerPaths->reserve(sizePaths);
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));
605  //protection for paths with zero filters (needed for reco, digi, etc paths)
606  if (sizeModulesPath != 0) {
607  while (indexLastFilterPathModules > 0) {
608  --indexLastFilterPathModules;
609  const std::string& labelLastFilterPathModules(hltConfig.moduleLabel(indexPath, indexLastFilterPathModules));
610  unsigned indexLastFilterFilters =
611  handleTriggerEvent->filterIndex(InputTag(labelLastFilterPathModules, "", nameProcess_));
612  if (indexLastFilterFilters < sizeFilters) {
613  if (hltConfig.moduleType(labelLastFilterPathModules) == "HLTBool")
614  continue;
615  break;
616  }
617  }
618  } else {
619  indexLastFilterPathModules = 0;
620  }
621  TriggerPath triggerPath(namePath,
622  indexPath,
623  hltConfig.prescaleValue(set, namePath),
624  handleTriggerResults->wasrun(indexPath),
625  handleTriggerResults->accept(indexPath),
626  handleTriggerResults->error(indexPath),
627  indexLastFilterPathModules,
628  hltConfig.saveTagsModules(namePath).size());
629  // add module names to path and states' map
630 
631  assert(indexLastFilterPathModules < sizeModulesPath || sizeModulesPath == 0);
632  std::map<unsigned, std::string> indicesModules;
633  for (size_t iM = 0; iM < sizeModulesPath; ++iM) {
634  const std::string& nameModule(hltConfig.moduleLabel(indexPath, iM));
635  if (addPathModuleLabels_) {
636  triggerPath.addModule(nameModule);
637  }
638  const unsigned indexFilter(handleTriggerEvent->filterIndex(InputTag(nameModule, "", nameProcess_)));
639  if (indexFilter < sizeFilters) {
640  triggerPath.addFilterIndex(indexFilter);
641  }
642  const unsigned slotModule(hltConfig.moduleIndex(indexPath, nameModule));
643  indicesModules.insert(std::pair<unsigned, std::string>(slotModule, nameModule));
644  }
645  // add L1 seeds
646  const L1SeedCollection& l1Seeds(hltConfig.hltL1GTSeeds(namePath));
647  for (L1SeedCollection::const_iterator iSeed = l1Seeds.begin(); iSeed != l1Seeds.end(); ++iSeed) {
648  triggerPath.addL1Seed(*iSeed);
649  }
650  // store path
651  triggerPaths->push_back(triggerPath);
652  // cache module states to be used for the filters
653  for (std::map<unsigned, std::string>::const_iterator iM = indicesModules.begin(); iM != indicesModules.end();
654  ++iM) {
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;
661  }
662  }
663  }
664  // Put HLT paths to event
666  }
667 
668  // Store used trigger objects and their types for HLT filters
669  // (only active filter(s) available from trigger::TriggerEvent)
670 
671  std::multimap<trigger::size_type, int> objectTypes;
672  std::multimap<trigger::size_type, std::string> filterLabels;
673 
674  for (size_t iF = 0; iF < sizeFilters; ++iF) {
675  const std::string nameFilter(handleTriggerEvent->filterLabel(iF));
676  const trigger::Keys& keys = handleTriggerEvent->filterKeys(iF);
677  const trigger::Vids& types = handleTriggerEvent->filterIds(iF);
678  assert(types.size() == keys.size());
679  for (size_t iK = 0; iK < keys.size(); ++iK) {
680  filterLabels.insert(std::pair<trigger::size_type, std::string>(keys[iK], nameFilter));
681  objectTypes.insert(std::pair<trigger::size_type, int>(keys[iK], types[iK]));
682  }
683  }
684 
685  // HLT objects
686 
687  triggerObjects->reserve(onlyStandAlone_ ? 0 : sizeObjects);
688  triggerObjectsStandAlone->reserve(sizeObjects);
689 
690  const trigger::Keys& collectionKeys(handleTriggerEvent->collectionKeys());
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) {
693  const trigger::TriggerObject tobj = handleTriggerEvent->getObjects().at(iO);
694  TriggerObject triggerObject(reco::Particle::PolarLorentzVector(tobj.pt(), tobj.eta(), tobj.phi(), tobj.mass()),
695  tobj.id());
696  // set collection
697  while (iO >= collectionKeys[iC])
698  ++iC; // relies on well ordering of trigger objects with respect to the collections
699  triggerObject.setCollection(handleTriggerEvent->collectionTagEncoded(iC));
700  // set filter ID
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;
703  ++trange.first) {
704  triggerObject.addTriggerObjectType(trange.first->second);
705  }
706 
707  // stand-alone trigger object
708  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
709  // check for excluded collections
710  bool excluded(false);
711  for (size_t iE = 0; iE < exludeCollections_.size(); ++iE) {
712  if (triggerObjectStandAlone.hasCollection(exludeCollections_.at(iE))) {
713  if (!onlyStandAlone_)
714  newObjectKeys[iO] = trigger::size_type(sizeObjects);
715  excluded = true;
716  break;
717  }
718  }
719  if (excluded)
720  continue;
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;
723  ++frange.first) {
724  triggerObjectStandAlone.addFilterLabel(frange.first->second);
725  const std::vector<ModuleLabelToPathAndFlags::PathAndFlags>& paths =
726  moduleLabelToPathAndFlags_[frange.first->second];
727  for (std::vector<ModuleLabelToPathAndFlags::PathAndFlags>::const_iterator iP = paths.begin(); iP != paths.end();
728  ++iP) {
729  bool pathFired = handleTriggerResults->wasrun(iP->pathIndex) && handleTriggerResults->accept(iP->pathIndex);
730  triggerObjectStandAlone.addPathName(iP->pathName, pathFired && iP->lastFilter, pathFired && iP->l3Filter);
731  }
732  }
733 
734  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
735  if (!onlyStandAlone_) {
736  triggerObjects->push_back(triggerObject);
737  newObjectKeys[iO] = trigger::size_type(triggerObjects->size() - 1);
738  }
739  }
740 
741  // Re-iterate HLT filters and finally produce them in order to account for optionally skipped objects
742  if (!onlyStandAlone_) {
743  auto triggerFilters = std::make_unique<TriggerFilterCollection>();
744  triggerFilters->reserve(sizeFilters);
745  for (size_t iF = 0; iF < sizeFilters; ++iF) {
746  const std::string nameFilter(handleTriggerEvent->filterTag(iF).label());
747  const trigger::Keys& keys = handleTriggerEvent->filterKeys(iF); // not cached
748  const trigger::Vids& types = handleTriggerEvent->filterIds(iF); // not cached
749  TriggerFilter triggerFilter(nameFilter);
750  // set filter type
751  const std::string typeFilter(hltConfig.moduleType(nameFilter));
752  triggerFilter.setType(typeFilter);
753  triggerFilter.setSaveTags(hltConfig.saveTags(nameFilter));
754  // set keys and trigger object types of used objects
755  for (size_t iK = 0; iK < keys.size(); ++iK) { // identical to types.size()
756  // check, if current object is excluded
757  if (newObjectKeys.find(keys.at(iK)) != newObjectKeys.end()) {
758  if (newObjectKeys[keys.at(iK)] == sizeObjects)
759  continue;
760  triggerFilter.addObjectKey(newObjectKeys[keys.at(iK)]);
761  triggerFilter.addTriggerObjectType(types.at(iK));
762  } else {
763  LogWarning("triggerObjectKey") << "TriggerFilter '" << nameFilter
764  << "' requests non-existing TriggerObject key " << keys.at(iK) << "\n"
765  << "Skipping object assignment";
766  }
767  }
768  // set status from path info
769  std::map<std::string, int>::iterator iS(moduleStates.find(nameFilter));
770  if (iS != moduleStates.end()) {
771  if (!triggerFilter.setStatus(iS->second)) {
772  triggerFilter.setStatus(-1); // FIXME different code for "unvalid status determined" needed?
773  }
774  } else {
775  triggerFilter.setStatus(-1); // FIXME different code for "unknown" needed?
776  }
777  // store filter
778  triggerFilters->push_back(triggerFilter);
779  }
780  // put HLT filters to event
781  iEvent.put(std::move(triggerFilters));
782  }
783 
784  if (packPrescales_) {
785  packedPrescales = std::make_unique<PackedTriggerPrescales>(handleTriggerResults);
786  packedPrescalesL1min = std::make_unique<PackedTriggerPrescales>(handleTriggerResults);
787  packedPrescalesL1max = std::make_unique<PackedTriggerPrescales>(handleTriggerResults);
788  const edm::TriggerNames& names = iEvent.triggerNames(*handleTriggerResults);
789  //std::cout << "Run " << iEvent.id().run() << ", LS " << iEvent.id().luminosityBlock() << ": pset " << set << std::endl;
790  for (unsigned int i = 0, n = names.size(); i < n; ++i) {
791  auto pvdet = hltPrescaleProvider_.prescaleValuesInDetail(iEvent, iSetup, names.triggerName(i));
792  //int hltprescale = hltConfig_.prescaleValue(set, names.triggerName(i));
793  if (pvdet.first.empty()) {
794  packedPrescalesL1max->addPrescaledTrigger(i, 1);
795  packedPrescalesL1min->addPrescaledTrigger(i, 1);
796  } else {
797  int pmin = -1, pmax = -1;
798  for (const auto& p : pvdet.first) {
799  pmax = std::max(pmax, p.second);
800  if (p.second > 0 && (pmin == -1 || pmin > p.second))
801  pmin = p.second;
802  }
803  packedPrescalesL1max->addPrescaledTrigger(i, pmax);
804  packedPrescalesL1min->addPrescaledTrigger(i, pmin);
805  //std::cout << "\tTrigger " << names.triggerName(i) << ", L1 ps " << pmin << "-" << pmax << ", HLT ps " << hltprescale << std::endl;
806  }
807  packedPrescales->addPrescaledTrigger(i, pvdet.second);
808  //assert( hltprescale == pvdet.second );
809  }
810  iEvent.put(std::move(packedPrescales));
811  iEvent.put(std::move(packedPrescalesL1max), "l1max");
812  iEvent.put(std::move(packedPrescalesL1min), "l1min");
813  }
814 
815  } // if ( goodHlt )
816 
817  // L1 objects
818  // (needs to be done after HLT objects, since their x-links with filters rely on their collection keys)
819 
820  // map for assignments of objects to conditions
821  std::map<L1GtObject, std::vector<unsigned> > l1ObjectTypeMap;
822  if (!tagL1ExtraMu_.label().empty()) {
824  iEvent.getByLabel(tagL1ExtraMu_, handleL1ExtraMu);
825  if (handleL1ExtraMu.isValid()) {
826  std::vector<unsigned> muKeys;
827  for (size_t l1Mu = 0; l1Mu < handleL1ExtraMu->size(); ++l1Mu) {
828  if (mainBxOnly_ && handleL1ExtraMu->at(l1Mu).bx() != 0)
829  continue;
830  TriggerObject triggerObject;
831  if (saveL1Refs_) {
832  const reco::CandidateBaseRef leafCandRef(l1extra::L1MuonParticleRef(handleL1ExtraMu, l1Mu));
833  triggerObject = TriggerObject(leafCandRef);
834  } else {
835  const reco::LeafCandidate leafCandidate(*(handleL1ExtraMu->at(l1Mu).reco::LeafCandidate::clone()));
836  triggerObject = TriggerObject(leafCandidate);
837  }
838  triggerObject.setCollection(tagL1ExtraMu_);
840  if (!onlyStandAlone_)
841  triggerObjects->push_back(triggerObject);
842  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
843  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
844  if (handleL1ExtraMu->at(l1Mu).bx() == 0)
845  muKeys.push_back(triggerObjectsStandAlone->size() - 1);
846  }
847  l1ObjectTypeMap.insert(std::make_pair(Mu, muKeys));
848  } else
849  LogError("l1ExtraValid") << "l1extra::L1MuonParticleCollection product with InputTag '" << tagL1ExtraMu_.encode()
850  << "' not in event";
851  }
852  if (!tagL1ExtraNoIsoEG_.label().empty()) {
853  Handle<l1extra::L1EmParticleCollection> handleL1ExtraNoIsoEG;
854  iEvent.getByLabel(tagL1ExtraNoIsoEG_, handleL1ExtraNoIsoEG);
855  if (handleL1ExtraNoIsoEG.isValid()) {
856  std::vector<unsigned> noIsoEGKeys;
857  for (size_t l1NoIsoEG = 0; l1NoIsoEG < handleL1ExtraNoIsoEG->size(); ++l1NoIsoEG) {
858  if (mainBxOnly_ && handleL1ExtraNoIsoEG->at(l1NoIsoEG).bx() != 0)
859  continue;
860  TriggerObject triggerObject;
861  if (saveL1Refs_) {
862  const reco::CandidateBaseRef leafCandRef(l1extra::L1EmParticleRef(handleL1ExtraNoIsoEG, l1NoIsoEG));
863  triggerObject = TriggerObject(leafCandRef);
864  } else {
865  const reco::LeafCandidate leafCandidate(*(handleL1ExtraNoIsoEG->at(l1NoIsoEG).reco::LeafCandidate::clone()));
866  triggerObject = TriggerObject(leafCandidate);
867  }
868  triggerObject.setCollection(tagL1ExtraNoIsoEG_);
870  if (!onlyStandAlone_)
871  triggerObjects->push_back(triggerObject);
872  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
873  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
874  if (handleL1ExtraNoIsoEG->at(l1NoIsoEG).bx() == 0)
875  noIsoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
876  }
877  l1ObjectTypeMap.insert(std::make_pair(NoIsoEG, noIsoEGKeys));
878  } else
879  LogError("l1ExtraValid") << "l1extra::L1EmParticleCollection product with InputTag '"
880  << tagL1ExtraNoIsoEG_.encode() << "' not in event";
881  }
882  if (!tagL1ExtraIsoEG_.label().empty()) {
883  Handle<l1extra::L1EmParticleCollection> handleL1ExtraIsoEG;
884  iEvent.getByLabel(tagL1ExtraIsoEG_, handleL1ExtraIsoEG);
885  if (handleL1ExtraIsoEG.isValid()) {
886  std::vector<unsigned> isoEGKeys;
887  for (size_t l1IsoEG = 0; l1IsoEG < handleL1ExtraIsoEG->size(); ++l1IsoEG) {
888  if (mainBxOnly_ && handleL1ExtraIsoEG->at(l1IsoEG).bx() != 0)
889  continue;
890  TriggerObject triggerObject;
891  if (saveL1Refs_) {
892  const reco::CandidateBaseRef leafCandRef(l1extra::L1EmParticleRef(handleL1ExtraIsoEG, l1IsoEG));
893  triggerObject = TriggerObject(leafCandRef);
894  } else {
895  const reco::LeafCandidate leafCandidate(*(handleL1ExtraIsoEG->at(l1IsoEG).reco::LeafCandidate::clone()));
896  triggerObject = TriggerObject(leafCandidate);
897  }
898  triggerObject.setCollection(tagL1ExtraIsoEG_);
900  if (!onlyStandAlone_)
901  triggerObjects->push_back(triggerObject);
902  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
903  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
904  if (handleL1ExtraIsoEG->at(l1IsoEG).bx() == 0)
905  isoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
906  }
907  l1ObjectTypeMap.insert(std::make_pair(IsoEG, isoEGKeys));
908  } else
909  LogError("l1ExtraValid") << "l1extra::L1EmParticleCollection product with InputTag '" << tagL1ExtraIsoEG_.encode()
910  << "' not in event";
911  }
912  if (!tagL1ExtraCenJet_.label().empty()) {
913  Handle<l1extra::L1JetParticleCollection> handleL1ExtraCenJet;
914  iEvent.getByLabel(tagL1ExtraCenJet_, handleL1ExtraCenJet);
915  if (handleL1ExtraCenJet.isValid()) {
916  std::vector<unsigned> cenJetKeys;
917  for (size_t l1CenJet = 0; l1CenJet < handleL1ExtraCenJet->size(); ++l1CenJet) {
918  if (mainBxOnly_ && handleL1ExtraCenJet->at(l1CenJet).bx() != 0)
919  continue;
920  TriggerObject triggerObject;
921  if (saveL1Refs_) {
922  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraCenJet, l1CenJet));
923  triggerObject = TriggerObject(leafCandRef);
924  } else {
925  const reco::LeafCandidate leafCandidate(*(handleL1ExtraCenJet->at(l1CenJet).reco::LeafCandidate::clone()));
926  triggerObject = TriggerObject(leafCandidate);
927  }
928  triggerObject.setCollection(tagL1ExtraCenJet_);
930  if (!onlyStandAlone_)
931  triggerObjects->push_back(triggerObject);
932  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
933  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
934  if (handleL1ExtraCenJet->at(l1CenJet).bx() == 0)
935  cenJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
936  }
937  l1ObjectTypeMap.insert(std::make_pair(CenJet, cenJetKeys));
938  } else
939  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
940  << tagL1ExtraCenJet_.encode() << "' not in event";
941  }
942  if (!tagL1ExtraForJet_.label().empty()) {
943  Handle<l1extra::L1JetParticleCollection> handleL1ExtraForJet;
944  iEvent.getByLabel(tagL1ExtraForJet_, handleL1ExtraForJet);
945  if (handleL1ExtraForJet.isValid()) {
946  std::vector<unsigned> forJetKeys;
947  for (size_t l1ForJet = 0; l1ForJet < handleL1ExtraForJet->size(); ++l1ForJet) {
948  if (mainBxOnly_ && handleL1ExtraForJet->at(l1ForJet).bx() != 0)
949  continue;
950  TriggerObject triggerObject;
951  if (saveL1Refs_) {
952  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraForJet, l1ForJet));
953  triggerObject = TriggerObject(leafCandRef);
954  } else {
955  const reco::LeafCandidate leafCandidate(*(handleL1ExtraForJet->at(l1ForJet).reco::LeafCandidate::clone()));
956  triggerObject = TriggerObject(leafCandidate);
957  }
958  triggerObject.setCollection(tagL1ExtraForJet_);
960  if (!onlyStandAlone_)
961  triggerObjects->push_back(triggerObject);
962  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
963  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
964  if (handleL1ExtraForJet->at(l1ForJet).bx() == 0)
965  forJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
966  }
967  l1ObjectTypeMap.insert(std::make_pair(ForJet, forJetKeys));
968  } else
969  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
970  << tagL1ExtraForJet_.encode() << "' not in event";
971  }
972  if (!tagL1ExtraTauJet_.label().empty()) {
973  Handle<l1extra::L1JetParticleCollection> handleL1ExtraTauJet;
974  iEvent.getByLabel(tagL1ExtraTauJet_, handleL1ExtraTauJet);
975  if (handleL1ExtraTauJet.isValid()) {
976  std::vector<unsigned> tauJetKeys;
977  for (size_t l1TauJet = 0; l1TauJet < handleL1ExtraTauJet->size(); ++l1TauJet) {
978  if (mainBxOnly_ && handleL1ExtraTauJet->at(l1TauJet).bx() != 0)
979  continue;
980  TriggerObject triggerObject;
981  if (saveL1Refs_) {
982  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraTauJet, l1TauJet));
983  triggerObject = TriggerObject(leafCandRef);
984  } else {
985  const reco::LeafCandidate leafCandidate(*(handleL1ExtraTauJet->at(l1TauJet).reco::LeafCandidate::clone()));
986  triggerObject = TriggerObject(leafCandidate);
987  }
988  triggerObject.setCollection(tagL1ExtraTauJet_);
990  if (!onlyStandAlone_)
991  triggerObjects->push_back(triggerObject);
992  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
993  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
994  if (handleL1ExtraTauJet->at(l1TauJet).bx() == 0)
995  tauJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
996  }
997  l1ObjectTypeMap.insert(std::make_pair(TauJet, tauJetKeys));
998  } else
999  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
1000  << tagL1ExtraTauJet_.encode() << "' not in event";
1001  }
1002  if (!tagL1ExtraETM_.label().empty()) {
1004  iEvent.getByLabel(tagL1ExtraETM_, handleL1ExtraETM);
1005  if (handleL1ExtraETM.isValid()) {
1006  std::vector<unsigned> etmKeys;
1007  for (size_t l1ETM = 0; l1ETM < handleL1ExtraETM->size(); ++l1ETM) {
1008  if (mainBxOnly_ && handleL1ExtraETM->at(l1ETM).bx() != 0)
1009  continue;
1010  TriggerObject triggerObject;
1011  if (saveL1Refs_) {
1012  const reco::CandidateBaseRef leafCandRef(l1extra::L1EtMissParticleRef(handleL1ExtraETM, l1ETM));
1013  triggerObject = TriggerObject(leafCandRef);
1014  } else {
1015  const reco::LeafCandidate leafCandidate(*(handleL1ExtraETM->at(l1ETM).reco::LeafCandidate::clone()));
1016  triggerObject = TriggerObject(leafCandidate);
1017  }
1018  triggerObject.setCollection(tagL1ExtraETM_);
1020  if (!onlyStandAlone_)
1021  triggerObjects->push_back(triggerObject);
1022  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
1023  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
1024  if (handleL1ExtraETM->at(l1ETM).bx() == 0)
1025  etmKeys.push_back(triggerObjectsStandAlone->size() - 1);
1026  }
1027  l1ObjectTypeMap.insert(std::make_pair(ETM, etmKeys));
1028  } else
1029  LogError("l1ExtraValid") << "l1extra::L1EtMissParticleCollection product with InputTag '"
1030  << tagL1ExtraETM_.encode() << "' not in event";
1031  }
1032  if (!tagL1ExtraHTM_.label().empty()) {
1034  iEvent.getByLabel(tagL1ExtraHTM_, handleL1ExtraHTM);
1035  if (handleL1ExtraHTM.isValid()) {
1036  std::vector<unsigned> htmKeys;
1037  for (size_t l1HTM = 0; l1HTM < handleL1ExtraHTM->size(); ++l1HTM) {
1038  if (mainBxOnly_ && handleL1ExtraHTM->at(l1HTM).bx() != 0)
1039  continue;
1040  TriggerObject triggerObject;
1041  if (saveL1Refs_) {
1042  const reco::CandidateBaseRef leafCandRef(l1extra::L1EtMissParticleRef(handleL1ExtraHTM, l1HTM));
1043  triggerObject = TriggerObject(leafCandRef);
1044  } else {
1045  const reco::LeafCandidate leafCandidate(*(handleL1ExtraHTM->at(l1HTM).reco::LeafCandidate::clone()));
1046  triggerObject = TriggerObject(leafCandidate);
1047  }
1048  triggerObject.setCollection(tagL1ExtraHTM_);
1050  if (!onlyStandAlone_)
1051  triggerObjects->push_back(triggerObject);
1052  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
1053  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
1054  if (handleL1ExtraHTM->at(l1HTM).bx() == 0)
1055  htmKeys.push_back(triggerObjectsStandAlone->size() - 1);
1056  }
1057  l1ObjectTypeMap.insert(std::make_pair(HTM, htmKeys));
1058  } else
1059  LogError("l1ExtraValid") << "l1extra::L1EtMissParticleCollection product with InputTag '"
1060  << tagL1ExtraHTM_.encode() << "' not in event";
1061  }
1062 
1063  // Put trigger objects to event
1064  if (!onlyStandAlone_)
1066 
1067  // L1 algorithms
1068  if (!onlyStandAlone_) {
1069  auto triggerAlgos = std::make_unique<TriggerAlgorithmCollection>();
1070  auto triggerConditions = std::make_unique<TriggerConditionCollection>();
1071  if (addL1Algos_) {
1072  // create trigger object types transalation map (yes, it's ugly!)
1073  std::map<L1GtObject, trigger::TriggerObjectType> mapObjectTypes;
1074  mapObjectTypes.insert(std::make_pair(Mu, trigger::TriggerL1Mu));
1075  mapObjectTypes.insert(std::make_pair(NoIsoEG, trigger::TriggerL1NoIsoEG));
1076  mapObjectTypes.insert(std::make_pair(IsoEG, trigger::TriggerL1IsoEG));
1077  mapObjectTypes.insert(std::make_pair(CenJet, trigger::TriggerL1CenJet));
1078  mapObjectTypes.insert(std::make_pair(ForJet, trigger::TriggerL1ForJet));
1079  mapObjectTypes.insert(std::make_pair(TauJet, trigger::TriggerL1TauJet));
1080  mapObjectTypes.insert(std::make_pair(ETM, trigger::TriggerL1ETM));
1081  mapObjectTypes.insert(std::make_pair(HTM, trigger::TriggerL1HTM));
1082  // get and cache L1 menu
1083  L1GtUtils const& l1GtUtils = hltPrescaleProvider_.l1GtUtils();
1084  auto handleL1GtTriggerMenu = iSetup.getHandle(handleL1GtTriggerMenuToken_);
1085  auto const& l1GtAlgorithms = handleL1GtTriggerMenu->gtAlgorithmMap();
1086  auto const& l1GtTechTriggers = handleL1GtTriggerMenu->gtTechnicalTriggerMap();
1087  auto const& l1GtConditionsVector = handleL1GtTriggerMenu->gtConditionMap();
1088  // cache conditions in one single condition map
1089  ConditionMap l1GtConditions;
1090  for (size_t iCv = 0; iCv < l1GtConditionsVector.size(); ++iCv) {
1091  l1GtConditions.insert(l1GtConditionsVector.at(iCv).begin(), l1GtConditionsVector.at(iCv).end());
1092  }
1093  triggerAlgos->reserve(l1GtAlgorithms.size() + l1GtTechTriggers.size());
1094  Handle<L1GlobalTriggerObjectMaps> handleL1GlobalTriggerObjectMaps;
1095  iEvent.getByToken(l1GlobalTriggerObjectMapsToken_, handleL1GlobalTriggerObjectMaps);
1096  if (!handleL1GlobalTriggerObjectMaps.isValid()) {
1097  LogError("l1ObjectMap") << "L1GlobalTriggerObjectMaps product with InputTag '"
1098  << tagL1GlobalTriggerObjectMaps_.encode() << "' not in event\n"
1099  << "No L1 objects and GTL results available for physics algorithms";
1100  }
1101  handleL1GlobalTriggerObjectMaps->consistencyCheck();
1102  if (firstInRun_) {
1103  l1PSet_ = (ParameterSet*)(pset::Registry::instance()->getMapped(
1104  handleL1GlobalTriggerObjectMaps->namesParameterSetID()));
1105  if (l1PSet_ == nullptr) {
1106  LogError("l1ObjectMap") << "ParameterSet registry not available\n"
1107  << "Skipping conditions for all L1 physics algorithm names in this run";
1108  }
1109  } else {
1110  if (l1PSet_ == nullptr) {
1111  LogInfo("l1ObjectMap") << "ParameterSet registry not available\n"
1112  << "Skipping conditions for all L1 physics algorithm names in this event";
1113  }
1114  }
1115  // physics algorithms
1116  for (CItAlgo iAlgo = l1GtAlgorithms.begin(); iAlgo != l1GtAlgorithms.end(); ++iAlgo) {
1117  const std::string& algoName(iAlgo->second.algoName());
1118  if (!(iAlgo->second.algoBitNumber() < int(L1GlobalTriggerReadoutSetup::NumberPhysTriggers))) {
1119  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' has bit number "
1120  << iAlgo->second.algoBitNumber()
1122  << "Skipping";
1123  continue;
1124  }
1126  int bit;
1127  if (!l1GtUtils.l1AlgoTechTrigBitNumber(algoName, category, bit)) {
1128  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' not found in the L1 menu\n"
1129  << "Skipping";
1130  continue;
1131  }
1133  LogError("l1Algo") << "L1 physics algorithm '" << algoName
1134  << "' does not have category 'AlgorithmTrigger' from 'L1GtUtils'\n"
1135  << "Skipping";
1136  continue;
1137  }
1138  bool decisionBeforeMask;
1139  bool decisionAfterMask;
1140  int prescale;
1141  int mask;
1142  int error(l1GtUtils.l1Results(iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask));
1143  if (error) {
1144  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' decision has error code " << error
1145  << " from 'L1GtUtils'\n"
1146  << "Skipping";
1147  continue;
1148  }
1149  TriggerAlgorithm triggerAlgo(algoName,
1150  iAlgo->second.algoAlias(),
1152  (unsigned)bit,
1153  (unsigned)prescale,
1154  (bool)mask,
1155  decisionBeforeMask,
1156  decisionAfterMask);
1157  triggerAlgo.setLogicalExpression(iAlgo->second.algoLogicalExpression());
1158  // GTL result and used conditions in physics algorithm
1159  if (!handleL1GlobalTriggerObjectMaps.isValid()) {
1160  triggerAlgos->push_back(triggerAlgo);
1161  continue; // LogWarning already earlier (before loop)
1162  }
1163  if (!handleL1GlobalTriggerObjectMaps->algorithmExists(bit)) {
1164  LogError("l1ObjectMap") << "L1 physics algorithm '" << algoName
1165  << "' is missing in L1GlobalTriggerObjectMaps\n"
1166  << "Skipping conditions and GTL result";
1167  triggerAlgos->push_back(triggerAlgo);
1168  continue;
1169  }
1170  bool algorithmResult = handleL1GlobalTriggerObjectMaps->algorithmResult(bit);
1171  // if ( ( algorithmResult != decisionBeforeMask ) && ( decisionBeforeMask == true || prescale == 1 ) ) {
1172  if ((algorithmResult != decisionBeforeMask) &&
1173  (decisionBeforeMask == true)) { // FIXME: understand the difference for un-prescaled algos 118, 119, 123
1174  LogInfo("l1ObjectMap") << "L1 physics algorithm '" << algoName << "' with different decisions in\n"
1175  << "L1GlobalTriggerObjectMaps (GTL result) : " << algorithmResult << "\n"
1176  << "L1GlobalTriggerReadoutRecord (decision before mask): " << decisionBeforeMask;
1177  }
1178  triggerAlgo.setGtlResult(algorithmResult);
1179  // conditions in algorithm
1181  handleL1GlobalTriggerObjectMaps->getConditionsInAlgorithm(bit);
1182  if (l1PSet_ == nullptr) {
1183  triggerAlgos->push_back(triggerAlgo);
1184  continue;
1185  }
1186  if (!l1PSet_->exists(algoName)) {
1187  if (firstInRun_) {
1188  LogError("l1ObjectMap") << "L1 physics algorithm name '" << algoName
1189  << "' not available in ParameterSet registry\n"
1190  << "Skipping conditions for this algorithm in this run";
1191  } else {
1192  LogInfo("l1ObjectMap") << "L1 physics algorithm name '" << algoName
1193  << "' not available in ParameterSet registry\n"
1194  << "Skipping conditions for this algorithm in this event";
1195  }
1196  triggerAlgos->push_back(triggerAlgo);
1197  continue;
1198  }
1199  std::vector<std::string> conditionNames(l1PSet_->getParameter<std::vector<std::string> >(algoName));
1200 
1201  for (unsigned iT = 0; iT < conditionNames.size(); ++iT) {
1202  size_t key(triggerConditions->size());
1203  for (size_t iC = 0; iC < triggerConditions->size(); ++iC) {
1204  if (conditionNames.at(iT) == triggerConditions->at(iC).name()) {
1205  key = iC;
1206  break;
1207  }
1208  }
1209  if (key == triggerConditions->size()) {
1210  if (iT >= conditions.nConditions()) {
1211  LogError("l1CondMap") << "More condition names from ParameterSet registry than the "
1212  << conditions.nConditions() << " conditions in L1GlobalTriggerObjectMaps\n"
1213  << "Skipping condition " << conditionNames.at(iT) << " in algorithm " << algoName;
1214  break;
1215  }
1216  TriggerCondition triggerCond(conditionNames[iT], conditions.getConditionResult(iT));
1217  if (l1GtConditions.find(triggerCond.name()) != l1GtConditions.end()) {
1218  triggerCond.setCategory(l1GtConditions[triggerCond.name()]->condCategory());
1219  triggerCond.setType(l1GtConditions[triggerCond.name()]->condType());
1220  const std::vector<L1GtObject> l1ObjectTypes(l1GtConditions[triggerCond.name()]->objectType());
1221  for (size_t iType = 0; iType < l1ObjectTypes.size(); ++iType) {
1222  triggerCond.addTriggerObjectType(mapObjectTypes[l1ObjectTypes.at(iType)]);
1223  }
1224  // objects in condition
1226  handleL1GlobalTriggerObjectMaps->getCombinationsInCondition(bit, iT);
1227  for (size_t iVV = 0; iVV < combinations.nCombinations(); ++iVV) {
1228  for (size_t iV = 0; iV < combinations.nObjectsPerCombination(); ++iV) {
1229  unsigned objectIndex = combinations.getObjectIndex(iVV, iV);
1230  if (iV >= l1ObjectTypes.size()) {
1231  LogError("l1CondMap") << "Index " << iV << " in combinations vector overshoots size "
1232  << l1ObjectTypes.size() << " of types vector in conditions map\n"
1233  << "Skipping object key in condition " << triggerCond.name();
1234  } else if (l1ObjectTypeMap.find(l1ObjectTypes.at(iV)) != l1ObjectTypeMap.end()) {
1235  if (objectIndex >= l1ObjectTypeMap[l1ObjectTypes.at(iV)].size()) {
1236  LogError("l1CondMap")
1237  << "Index " << objectIndex << " in combination overshoots number "
1238  << l1ObjectTypeMap[l1ObjectTypes.at(iV)].size() << "of according trigger objects\n"
1239  << "Skipping object key in condition " << triggerCond.name();
1240  }
1241  const unsigned objectKey(l1ObjectTypeMap[l1ObjectTypes.at(iV)].at(objectIndex));
1242  triggerCond.addObjectKey(objectKey);
1243  // add current condition and algorithm also to the according stand-alone trigger object
1244  triggerObjectsStandAlone->at(objectKey).addAlgorithmName(
1245  triggerAlgo.name(), (triggerAlgo.decision() && triggerCond.wasAccept()));
1246  triggerObjectsStandAlone->at(objectKey).addConditionName(triggerCond.name());
1247  }
1248  }
1249  }
1250  } else {
1251  LogWarning("l1CondMap") << "L1 conditions '" << triggerCond.name() << "' not found in the L1 menu\n"
1252  << "Remains incomplete";
1253  }
1254  triggerConditions->push_back(triggerCond);
1255  }
1256  triggerAlgo.addConditionKey(key);
1257  }
1258  triggerAlgos->push_back(triggerAlgo);
1259  }
1260  // technical triggers
1261  for (CItAlgo iAlgo = l1GtTechTriggers.begin(); iAlgo != l1GtTechTriggers.end(); ++iAlgo) {
1262  const std::string& algoName(iAlgo->second.algoName());
1263  if (!(iAlgo->second.algoBitNumber() < int(L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers))) {
1264  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' has bit number "
1265  << iAlgo->second.algoBitNumber()
1267  << "Skipping";
1268  continue;
1269  }
1271  int bit;
1272  if (!l1GtUtils.l1AlgoTechTrigBitNumber(algoName, category, bit)) {
1273  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' not found in the L1 menu\n"
1274  << "Skipping";
1275  continue;
1276  }
1278  LogError("l1Algo") << "L1 technical trigger '" << algoName
1279  << "' does not have category 'TechnicalTrigger' from 'L1GtUtils'\n"
1280  << "Skipping";
1281  continue;
1282  }
1283  bool decisionBeforeMask;
1284  bool decisionAfterMask;
1285  int prescale;
1286  int mask;
1287  int error(l1GtUtils.l1Results(iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask));
1288  if (error) {
1289  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' decision has error code " << error
1290  << " from 'L1GtUtils'\n"
1291  << "Skipping";
1292  continue;
1293  }
1294  TriggerAlgorithm triggerAlgo(algoName,
1295  iAlgo->second.algoAlias(),
1297  (unsigned)bit,
1298  (unsigned)prescale,
1299  (bool)mask,
1300  decisionBeforeMask,
1301  decisionAfterMask);
1302  triggerAlgo.setLogicalExpression(iAlgo->second.algoLogicalExpression());
1303  triggerAlgos->push_back(triggerAlgo);
1304  }
1305  }
1306 
1307  // Put L1 algorithms and conditions to event
1308  iEvent.put(std::move(triggerAlgos));
1310  }
1311 
1313  iEvent.processHistory().getConfigurationForProcess(nameProcess_, config);
1314 
1315  const edm::TriggerNames& names = iEvent.triggerNames(*handleTriggerResults);
1316  for (pat::TriggerObjectStandAlone& obj : *triggerObjectsStandAlone) {
1317  obj.setPSetID(config.parameterSetID());
1318  if (packPathNames_)
1319  obj.packPathNames(names);
1320  if (packLabels_)
1321  obj.packFilterLabels(iEvent, *handleTriggerResults);
1322  }
1323 
1324  // Put (finally) stand-alone trigger objects to event
1325  iEvent.put(std::move(triggerObjectsStandAlone));
1326 
1327  firstInRun_ = false;
1328 }
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 Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
std::vector< L1Seed > L1SeedCollection
Collection of L1Seed.
Definition: TriggerPath.h:34
const std::vector< std::string > & labels() const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Analysis-level L1 trigger algorithm class.
bool error() const
Has any path encountered an error (exception)
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
Definition: L1GtObject.h:38
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > l1GlobalTriggerObjectMapsToken_
static PFTauRenderPlugin instance
enum start value shifted to 81 so as to avoid clashes with PDG codes
std::string encode() const
Definition: InputTag.cc:159
std::map< std::string, L1GtCondition * > ConditionMap
map containing the conditions
Definition: L1GtObject.h:35
static const unsigned int NumberTechnicalTriggers
bool exists(std::string const &parameterName) const
checks if a parameter exists
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
The single EDProduct containing the HLT Prescale Table.
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
Definition: L1GtUtils.cc:371
std::pair< std::vector< std::pair< std::string, TL1 > >, THLT > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
const std::string & collectionTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:106
HLTConfigProvider const & hltConfigProvider() const
Definition: config.py:1
std::string const & label() const
Definition: InputTag.h:36
Log< level::Error, false > LogError
assert(be >=bs)
uint16_t size_type
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:108
const std::string names[nVars_]
constexpr uint32_t mask
Definition: gpuClustering.h:24
bool wasrun() const
Was at least one path run?
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
const int l1Results(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
Definition: L1GtUtils.cc:666
Analysis-level HLTrigger filter class.
Definition: TriggerFilter.h:33
std::vector< std::string > exludeCollections_
int iEvent
Definition: GenABIO.cc:224
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
unsigned int set() const
low-level const accessors for data members
std::string filterLabel(trigger::size_type index) const
Definition: TriggerEvent.h:112
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:79
Analysis-level L1 trigger condition class.
Analysis-level HLTrigger path class.
Definition: TriggerPath.h:36
const std::map< std::string, std::vector< unsigned int > > & table() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
trigger::size_type sizeCollections() const
other
Definition: TriggerEvent.h:144
unsigned char getObjectIndex(unsigned combination, unsigned object) const
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
int id() const
getters
Definition: TriggerObject.h:51
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:145
static const unsigned int NumberPhysTriggers
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
edm::InputTag tagL1GlobalTriggerObjectMaps_
Log< level::Info, false > LogInfo
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:117
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
Definition: TriggerEvent.h:132
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > handleL1GtTriggerMenuToken_
Definition: L1GtObject.h:29
std::vector< size_type > Keys
config
parse the configuration file
bool isValid() const
Definition: HandleBase.h:70
edm::ParameterSetID const & namesParameterSetID() const
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
bool algorithmExists(int algorithmBitNumber) const
Returns true if there is an entry for this algorithm bit number.
L1GtUtils const & l1GtUtils() const
Log< level::Warning, false > LogWarning
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
Definition: TriggerObject.h:82
static std::string const triggerPaths
Definition: EdmProvDump.cc:45
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
const Keys & collectionKeys() const
Definition: TriggerEvent.h:100
std::vector< int > Vids
def move(src, dest)
Definition: eostools.py:511
HLTPrescaleProvider hltPrescaleProvider_
Analysis-level trigger object class (stand-alone)
edm::ParameterSet * l1PSet_
#define LogDebug(id)

Member Data Documentation

◆ addL1Algos_

bool pat::PATTriggerProducer::addL1Algos_
private

Definition at line 88 of file PATTriggerProducer.cc.

Referenced by produce().

◆ addPathModuleLabels_

bool pat::PATTriggerProducer::addPathModuleLabels_
private

Definition at line 131 of file PATTriggerProducer.cc.

Referenced by produce().

◆ autoProcessName_

bool pat::PATTriggerProducer::autoProcessName_
private

Definition at line 83 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraCenJet_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraCenJet_
private

Definition at line 110 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraETM_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraETM_
private

Definition at line 113 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraForJet_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraForJet_
private

Definition at line 111 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraHTM_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraHTM_
private

Definition at line 114 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraIsoEG_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraIsoEG_
private

Definition at line 109 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraMu_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraMu_
private

Definition at line 107 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraNoIsoEG_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraNoIsoEG_
private

Definition at line 108 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ autoProcessNameL1ExtraTauJet_

bool pat::PATTriggerProducer::autoProcessNameL1ExtraTauJet_
private

Definition at line 112 of file PATTriggerProducer.cc.

Referenced by beginRun().

◆ exludeCollections_

std::vector<std::string> pat::PATTriggerProducer::exludeCollections_
private

Definition at line 132 of file PATTriggerProducer.cc.

Referenced by produce().

◆ firstInRun_

bool pat::PATTriggerProducer::firstInRun_
private

Definition at line 85 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ handleL1GtTriggerMenuToken_

const edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> pat::PATTriggerProducer::handleL1GtTriggerMenuToken_
private

Definition at line 136 of file PATTriggerProducer.cc.

Referenced by produce().

◆ hltConfigInit_

bool pat::PATTriggerProducer::hltConfigInit_
private

Definition at line 119 of file PATTriggerProducer.cc.

Referenced by beginLuminosityBlock(), beginRun(), and produce().

◆ hltPrescaleLabel_

std::string pat::PATTriggerProducer::hltPrescaleLabel_
private

Definition at line 124 of file PATTriggerProducer.cc.

Referenced by produce().

◆ hltPrescaleProvider_

HLTPrescaleProvider pat::PATTriggerProducer::hltPrescaleProvider_
private

Definition at line 118 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ hltPrescaleTableEventGetter_

edm::GetterOfProducts<trigger::HLTPrescaleTable> pat::PATTriggerProducer::hltPrescaleTableEventGetter_
private

Definition at line 128 of file PATTriggerProducer.cc.

◆ hltPrescaleTableLumi_

trigger::HLTPrescaleTable pat::PATTriggerProducer::hltPrescaleTableLumi_
private

Definition at line 130 of file PATTriggerProducer.cc.

Referenced by beginLuminosityBlock(), and produce().

◆ hltPrescaleTableLumiGetter_

edm::GetterOfProducts<trigger::HLTPrescaleTable> pat::PATTriggerProducer::hltPrescaleTableLumiGetter_
private

Definition at line 127 of file PATTriggerProducer.cc.

◆ hltPrescaleTableRun_

trigger::HLTPrescaleTable pat::PATTriggerProducer::hltPrescaleTableRun_
private

Definition at line 129 of file PATTriggerProducer.cc.

Referenced by beginLuminosityBlock(), and beginRun().

◆ hltPrescaleTableRunGetter_

edm::GetterOfProducts<trigger::HLTPrescaleTable> pat::PATTriggerProducer::hltPrescaleTableRunGetter_
private

Definition at line 126 of file PATTriggerProducer.cc.

◆ l1ExtraCenJetGetter_

edm::GetterOfProducts<l1extra::L1JetParticleCollection> pat::PATTriggerProducer::l1ExtraCenJetGetter_
private

Definition at line 98 of file PATTriggerProducer.cc.

◆ l1ExtraETMGetter_

edm::GetterOfProducts<l1extra::L1EtMissParticleCollection> pat::PATTriggerProducer::l1ExtraETMGetter_
private

Definition at line 104 of file PATTriggerProducer.cc.

◆ l1ExtraForJetGetter_

edm::GetterOfProducts<l1extra::L1JetParticleCollection> pat::PATTriggerProducer::l1ExtraForJetGetter_
private

Definition at line 100 of file PATTriggerProducer.cc.

◆ l1ExtraHTMGetter_

edm::GetterOfProducts<l1extra::L1EtMissParticleCollection> pat::PATTriggerProducer::l1ExtraHTMGetter_
private

Definition at line 106 of file PATTriggerProducer.cc.

◆ l1ExtraIsoEGGetter_

edm::GetterOfProducts<l1extra::L1EmParticleCollection> pat::PATTriggerProducer::l1ExtraIsoEGGetter_
private

Definition at line 96 of file PATTriggerProducer.cc.

◆ l1ExtraMuGetter_

edm::GetterOfProducts<l1extra::L1MuonParticleCollection> pat::PATTriggerProducer::l1ExtraMuGetter_
private

Definition at line 92 of file PATTriggerProducer.cc.

◆ l1ExtraNoIsoEGGetter_

edm::GetterOfProducts<l1extra::L1EmParticleCollection> pat::PATTriggerProducer::l1ExtraNoIsoEGGetter_
private

Definition at line 94 of file PATTriggerProducer.cc.

◆ l1ExtraTauJetGetter_

edm::GetterOfProducts<l1extra::L1JetParticleCollection> pat::PATTriggerProducer::l1ExtraTauJetGetter_
private

Definition at line 102 of file PATTriggerProducer.cc.

◆ l1GlobalTriggerObjectMapsToken_

edm::EDGetTokenT<L1GlobalTriggerObjectMaps> pat::PATTriggerProducer::l1GlobalTriggerObjectMapsToken_
private

Definition at line 90 of file PATTriggerProducer.cc.

Referenced by produce().

◆ l1PSet_

edm::ParameterSet* pat::PATTriggerProducer::l1PSet_
private

Definition at line 87 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ labelHltPrescaleTable_

std::string pat::PATTriggerProducer::labelHltPrescaleTable_
private

Definition at line 125 of file PATTriggerProducer.cc.

Referenced by beginLuminosityBlock(), beginRun(), and produce().

◆ mainBxOnly_

bool pat::PATTriggerProducer::mainBxOnly_
private

Definition at line 115 of file PATTriggerProducer.cc.

Referenced by produce().

◆ moduleLabelToPathAndFlags_

ModuleLabelToPathAndFlags pat::PATTriggerProducer::moduleLabelToPathAndFlags_
private

Definition at line 164 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ nameProcess_

std::string pat::PATTriggerProducer::nameProcess_
private

Definition at line 82 of file PATTriggerProducer.cc.

Referenced by beginLuminosityBlock(), beginRun(), and produce().

◆ onlyStandAlone_

bool pat::PATTriggerProducer::onlyStandAlone_
private

Definition at line 84 of file PATTriggerProducer.cc.

Referenced by produce().

◆ packLabels_

bool pat::PATTriggerProducer::packLabels_
private

Definition at line 134 of file PATTriggerProducer.cc.

Referenced by produce().

◆ packPathNames_

bool pat::PATTriggerProducer::packPathNames_
private

Definition at line 133 of file PATTriggerProducer.cc.

Referenced by produce().

◆ packPrescales_

bool pat::PATTriggerProducer::packPrescales_
private

Definition at line 135 of file PATTriggerProducer.cc.

Referenced by produce().

◆ saveL1Refs_

bool pat::PATTriggerProducer::saveL1Refs_
private

Definition at line 116 of file PATTriggerProducer.cc.

Referenced by produce().

◆ tagL1ExtraCenJet_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraCenJet_
private

Definition at line 97 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1ExtraETM_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraETM_
private

Definition at line 103 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1ExtraForJet_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraForJet_
private

Definition at line 99 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1ExtraHTM_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraHTM_
private

Definition at line 105 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1ExtraIsoEG_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraIsoEG_
private

Definition at line 95 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1ExtraMu_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraMu_
private

Definition at line 91 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1ExtraNoIsoEG_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraNoIsoEG_
private

Definition at line 93 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1ExtraTauJet_

edm::InputTag pat::PATTriggerProducer::tagL1ExtraTauJet_
private

Definition at line 101 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagL1GlobalTriggerObjectMaps_

edm::InputTag pat::PATTriggerProducer::tagL1GlobalTriggerObjectMaps_
private

Definition at line 89 of file PATTriggerProducer.cc.

Referenced by produce().

◆ tagTriggerEvent_

edm::InputTag pat::PATTriggerProducer::tagTriggerEvent_
private

Definition at line 122 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ tagTriggerResults_

edm::InputTag pat::PATTriggerProducer::tagTriggerResults_
private

Definition at line 120 of file PATTriggerProducer.cc.

Referenced by beginRun(), and produce().

◆ triggerEventGetter_

edm::GetterOfProducts<trigger::TriggerEvent> pat::PATTriggerProducer::triggerEventGetter_
private

Definition at line 123 of file PATTriggerProducer.cc.

◆ triggerResultsGetter_

edm::GetterOfProducts<edm::TriggerResults> pat::PATTriggerProducer::triggerResultsGetter_
private

Definition at line 121 of file PATTriggerProducer.cc.