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"))
348  l1ExtraMuGetter_(bd);
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"))
360  l1ExtraETMGetter_(bd);
361  if (iConfig.exists("l1ExtraHTM"))
362  l1ExtraHTMGetter_(bd);
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:307
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 & processName() const
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:172
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_, ProducerED_cfi::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(), ProducerED_cfi::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:278
ProcessHistory const & processHistory() const
Definition: Run.cc:115
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(), triggerObjects_cff::bit, nano_mu_local_reco_cff::bool, validateAlignments::category, CenJet, trigger::TriggerEvent::collectionKeys(), trigger::TriggerEvent::collectionTagEncoded(), PixelBaryCentreAnalyzer_cfg::conditions, DiMuonV_cfg::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(), 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(), ProducerED_cfi::InputTag, instance, createfilelist::int, IsoEG, edm::HandleBase::isValid(), submitPVResolutionJobs::key, relativeConstraints::keys, L1GtUtils::l1AlgoTechTrigBitNumber(), l1GlobalTriggerObjectMapsToken_, HLTPrescaleProvider::l1GtUtils(), l1PSet_, L1GtUtils::l1Results(), edm::InputTag::label(), labelHltPrescaleTable_, trigger::HLTPrescaleTable::labels(), LogDebug, mainBxOnly_, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, trigger::TriggerObject::mass(), WZElectronSkims53X_cff::max, moduleLabelToPathAndFlags_, eostools::move(), Mu, create_idmaps::n, pat::TriggerAlgorithm::name(), nameProcess_, names, L1GlobalTriggerObjectMaps::namesParameterSetID(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nCombinations(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nObjectsPerCombination(), NoIsoEG, L1GlobalTriggerReadoutSetup::NumberPhysTriggers, L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers, getGTfromDQMFile::obj, L1TriggerKeyDummy_cfi::objectKey, L1MuTriggerScaleKeysOnlineProd_cfi::objectTypes, onlyStandAlone_, AlCaHLTBitMon_ParallelJobs::p, packLabels_, packPathNames_, packPrescales_, Skims_PA_cff::paths, trigger::TriggerObject::phi(), TrackingDataMCValidation_Standalone_cff::pmin, setupCalibrationTree_cff::prescale, 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, JetHT_cfg::triggerConditions, JetHT_cfg::triggerFilter, trigger::TriggerL1CenJet, trigger::TriggerL1ETM, trigger::TriggerL1ForJet, trigger::TriggerL1HTM, trigger::TriggerL1IsoEG, trigger::TriggerL1Mu, trigger::TriggerL1NoIsoEG, trigger::TriggerL1TauJet, triggerMatchMonitor_cfi::triggerObjects, JetHT_cfg::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(), {});
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<double>(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->filterLabel(iF));
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  for (unsigned int i = 0, n = names.size(); i < n; ++i) {
790  auto pvdet = hltPrescaleProvider_.prescaleValuesInDetail<double, double>(iEvent, iSetup, names.triggerName(i));
791  if (pvdet.first.empty()) {
792  packedPrescalesL1max->addPrescaledTrigger(i, 1);
793  packedPrescalesL1min->addPrescaledTrigger(i, 1);
794  } else {
795  double pmin = -1, pmax = -1;
796  for (const auto& p : pvdet.first) {
797  pmax = std::max(pmax, p.second);
798  if (p.second > 0 && (pmin == -1 || pmin > p.second))
799  pmin = p.second;
800  }
801  packedPrescalesL1max->addPrescaledTrigger(i, pmax);
802  packedPrescalesL1min->addPrescaledTrigger(i, pmin);
803  }
804  packedPrescales->addPrescaledTrigger(i, pvdet.second);
805  }
806  iEvent.put(std::move(packedPrescales));
807  iEvent.put(std::move(packedPrescalesL1max), "l1max");
808  iEvent.put(std::move(packedPrescalesL1min), "l1min");
809  }
810 
811  } // if ( goodHlt )
812 
813  // L1 objects
814  // (needs to be done after HLT objects, since their x-links with filters rely on their collection keys)
815 
816  // map for assignments of objects to conditions
817  std::map<L1GtObject, std::vector<unsigned> > l1ObjectTypeMap;
818  if (!tagL1ExtraMu_.label().empty()) {
820  iEvent.getByLabel(tagL1ExtraMu_, handleL1ExtraMu);
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)
825  continue;
826  TriggerObject triggerObject;
827  if (saveL1Refs_) {
828  const reco::CandidateBaseRef leafCandRef(l1extra::L1MuonParticleRef(handleL1ExtraMu, l1Mu));
829  triggerObject = TriggerObject(leafCandRef);
830  } else {
831  const reco::LeafCandidate leafCandidate(*(handleL1ExtraMu->at(l1Mu).reco::LeafCandidate::clone()));
832  triggerObject = TriggerObject(leafCandidate);
833  }
834  triggerObject.setCollection(tagL1ExtraMu_);
836  if (!onlyStandAlone_)
837  triggerObjects->push_back(triggerObject);
838  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
839  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
840  if (handleL1ExtraMu->at(l1Mu).bx() == 0)
841  muKeys.push_back(triggerObjectsStandAlone->size() - 1);
842  }
843  l1ObjectTypeMap.insert(std::make_pair(Mu, muKeys));
844  } else
845  LogError("l1ExtraValid") << "l1extra::L1MuonParticleCollection product with InputTag '" << tagL1ExtraMu_.encode()
846  << "' not in event";
847  }
848  if (!tagL1ExtraNoIsoEG_.label().empty()) {
849  Handle<l1extra::L1EmParticleCollection> handleL1ExtraNoIsoEG;
850  iEvent.getByLabel(tagL1ExtraNoIsoEG_, handleL1ExtraNoIsoEG);
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)
855  continue;
856  TriggerObject triggerObject;
857  if (saveL1Refs_) {
858  const reco::CandidateBaseRef leafCandRef(l1extra::L1EmParticleRef(handleL1ExtraNoIsoEG, l1NoIsoEG));
859  triggerObject = TriggerObject(leafCandRef);
860  } else {
861  const reco::LeafCandidate leafCandidate(*(handleL1ExtraNoIsoEG->at(l1NoIsoEG).reco::LeafCandidate::clone()));
862  triggerObject = TriggerObject(leafCandidate);
863  }
864  triggerObject.setCollection(tagL1ExtraNoIsoEG_);
866  if (!onlyStandAlone_)
867  triggerObjects->push_back(triggerObject);
868  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
869  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
870  if (handleL1ExtraNoIsoEG->at(l1NoIsoEG).bx() == 0)
871  noIsoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
872  }
873  l1ObjectTypeMap.insert(std::make_pair(NoIsoEG, noIsoEGKeys));
874  } else
875  LogError("l1ExtraValid") << "l1extra::L1EmParticleCollection product with InputTag '"
876  << tagL1ExtraNoIsoEG_.encode() << "' not in event";
877  }
878  if (!tagL1ExtraIsoEG_.label().empty()) {
879  Handle<l1extra::L1EmParticleCollection> handleL1ExtraIsoEG;
880  iEvent.getByLabel(tagL1ExtraIsoEG_, handleL1ExtraIsoEG);
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)
885  continue;
886  TriggerObject triggerObject;
887  if (saveL1Refs_) {
888  const reco::CandidateBaseRef leafCandRef(l1extra::L1EmParticleRef(handleL1ExtraIsoEG, l1IsoEG));
889  triggerObject = TriggerObject(leafCandRef);
890  } else {
891  const reco::LeafCandidate leafCandidate(*(handleL1ExtraIsoEG->at(l1IsoEG).reco::LeafCandidate::clone()));
892  triggerObject = TriggerObject(leafCandidate);
893  }
894  triggerObject.setCollection(tagL1ExtraIsoEG_);
896  if (!onlyStandAlone_)
897  triggerObjects->push_back(triggerObject);
898  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
899  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
900  if (handleL1ExtraIsoEG->at(l1IsoEG).bx() == 0)
901  isoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
902  }
903  l1ObjectTypeMap.insert(std::make_pair(IsoEG, isoEGKeys));
904  } else
905  LogError("l1ExtraValid") << "l1extra::L1EmParticleCollection product with InputTag '" << tagL1ExtraIsoEG_.encode()
906  << "' not in event";
907  }
908  if (!tagL1ExtraCenJet_.label().empty()) {
909  Handle<l1extra::L1JetParticleCollection> handleL1ExtraCenJet;
910  iEvent.getByLabel(tagL1ExtraCenJet_, handleL1ExtraCenJet);
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)
915  continue;
916  TriggerObject triggerObject;
917  if (saveL1Refs_) {
918  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraCenJet, l1CenJet));
919  triggerObject = TriggerObject(leafCandRef);
920  } else {
921  const reco::LeafCandidate leafCandidate(*(handleL1ExtraCenJet->at(l1CenJet).reco::LeafCandidate::clone()));
922  triggerObject = TriggerObject(leafCandidate);
923  }
924  triggerObject.setCollection(tagL1ExtraCenJet_);
926  if (!onlyStandAlone_)
927  triggerObjects->push_back(triggerObject);
928  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
929  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
930  if (handleL1ExtraCenJet->at(l1CenJet).bx() == 0)
931  cenJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
932  }
933  l1ObjectTypeMap.insert(std::make_pair(CenJet, cenJetKeys));
934  } else
935  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
936  << tagL1ExtraCenJet_.encode() << "' not in event";
937  }
938  if (!tagL1ExtraForJet_.label().empty()) {
939  Handle<l1extra::L1JetParticleCollection> handleL1ExtraForJet;
940  iEvent.getByLabel(tagL1ExtraForJet_, handleL1ExtraForJet);
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)
945  continue;
946  TriggerObject triggerObject;
947  if (saveL1Refs_) {
948  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraForJet, l1ForJet));
949  triggerObject = TriggerObject(leafCandRef);
950  } else {
951  const reco::LeafCandidate leafCandidate(*(handleL1ExtraForJet->at(l1ForJet).reco::LeafCandidate::clone()));
952  triggerObject = TriggerObject(leafCandidate);
953  }
954  triggerObject.setCollection(tagL1ExtraForJet_);
956  if (!onlyStandAlone_)
957  triggerObjects->push_back(triggerObject);
958  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
959  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
960  if (handleL1ExtraForJet->at(l1ForJet).bx() == 0)
961  forJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
962  }
963  l1ObjectTypeMap.insert(std::make_pair(ForJet, forJetKeys));
964  } else
965  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
966  << tagL1ExtraForJet_.encode() << "' not in event";
967  }
968  if (!tagL1ExtraTauJet_.label().empty()) {
969  Handle<l1extra::L1JetParticleCollection> handleL1ExtraTauJet;
970  iEvent.getByLabel(tagL1ExtraTauJet_, handleL1ExtraTauJet);
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)
975  continue;
976  TriggerObject triggerObject;
977  if (saveL1Refs_) {
978  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraTauJet, l1TauJet));
979  triggerObject = TriggerObject(leafCandRef);
980  } else {
981  const reco::LeafCandidate leafCandidate(*(handleL1ExtraTauJet->at(l1TauJet).reco::LeafCandidate::clone()));
982  triggerObject = TriggerObject(leafCandidate);
983  }
984  triggerObject.setCollection(tagL1ExtraTauJet_);
986  if (!onlyStandAlone_)
987  triggerObjects->push_back(triggerObject);
988  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
989  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
990  if (handleL1ExtraTauJet->at(l1TauJet).bx() == 0)
991  tauJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
992  }
993  l1ObjectTypeMap.insert(std::make_pair(TauJet, tauJetKeys));
994  } else
995  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
996  << tagL1ExtraTauJet_.encode() << "' not in event";
997  }
998  if (!tagL1ExtraETM_.label().empty()) {
1000  iEvent.getByLabel(tagL1ExtraETM_, handleL1ExtraETM);
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)
1005  continue;
1006  TriggerObject triggerObject;
1007  if (saveL1Refs_) {
1008  const reco::CandidateBaseRef leafCandRef(l1extra::L1EtMissParticleRef(handleL1ExtraETM, l1ETM));
1009  triggerObject = TriggerObject(leafCandRef);
1010  } else {
1011  const reco::LeafCandidate leafCandidate(*(handleL1ExtraETM->at(l1ETM).reco::LeafCandidate::clone()));
1012  triggerObject = TriggerObject(leafCandidate);
1013  }
1014  triggerObject.setCollection(tagL1ExtraETM_);
1016  if (!onlyStandAlone_)
1017  triggerObjects->push_back(triggerObject);
1018  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
1019  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
1020  if (handleL1ExtraETM->at(l1ETM).bx() == 0)
1021  etmKeys.push_back(triggerObjectsStandAlone->size() - 1);
1022  }
1023  l1ObjectTypeMap.insert(std::make_pair(ETM, etmKeys));
1024  } else
1025  LogError("l1ExtraValid") << "l1extra::L1EtMissParticleCollection product with InputTag '"
1026  << tagL1ExtraETM_.encode() << "' not in event";
1027  }
1028  if (!tagL1ExtraHTM_.label().empty()) {
1030  iEvent.getByLabel(tagL1ExtraHTM_, handleL1ExtraHTM);
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)
1035  continue;
1036  TriggerObject triggerObject;
1037  if (saveL1Refs_) {
1038  const reco::CandidateBaseRef leafCandRef(l1extra::L1EtMissParticleRef(handleL1ExtraHTM, l1HTM));
1039  triggerObject = TriggerObject(leafCandRef);
1040  } else {
1041  const reco::LeafCandidate leafCandidate(*(handleL1ExtraHTM->at(l1HTM).reco::LeafCandidate::clone()));
1042  triggerObject = TriggerObject(leafCandidate);
1043  }
1044  triggerObject.setCollection(tagL1ExtraHTM_);
1046  if (!onlyStandAlone_)
1047  triggerObjects->push_back(triggerObject);
1048  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
1049  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
1050  if (handleL1ExtraHTM->at(l1HTM).bx() == 0)
1051  htmKeys.push_back(triggerObjectsStandAlone->size() - 1);
1052  }
1053  l1ObjectTypeMap.insert(std::make_pair(HTM, htmKeys));
1054  } else
1055  LogError("l1ExtraValid") << "l1extra::L1EtMissParticleCollection product with InputTag '"
1056  << tagL1ExtraHTM_.encode() << "' not in event";
1057  }
1058 
1059  // Put trigger objects to event
1060  if (!onlyStandAlone_)
1062 
1063  // L1 algorithms
1064  if (!onlyStandAlone_) {
1065  auto triggerAlgos = std::make_unique<TriggerAlgorithmCollection>();
1066  auto triggerConditions = std::make_unique<TriggerConditionCollection>();
1067  if (addL1Algos_) {
1068  // create trigger object types transalation map (yes, it's ugly!)
1069  std::map<L1GtObject, trigger::TriggerObjectType> mapObjectTypes;
1070  mapObjectTypes.insert(std::make_pair(Mu, trigger::TriggerL1Mu));
1071  mapObjectTypes.insert(std::make_pair(NoIsoEG, trigger::TriggerL1NoIsoEG));
1072  mapObjectTypes.insert(std::make_pair(IsoEG, trigger::TriggerL1IsoEG));
1073  mapObjectTypes.insert(std::make_pair(CenJet, trigger::TriggerL1CenJet));
1074  mapObjectTypes.insert(std::make_pair(ForJet, trigger::TriggerL1ForJet));
1075  mapObjectTypes.insert(std::make_pair(TauJet, trigger::TriggerL1TauJet));
1076  mapObjectTypes.insert(std::make_pair(ETM, trigger::TriggerL1ETM));
1077  mapObjectTypes.insert(std::make_pair(HTM, trigger::TriggerL1HTM));
1078  // get and cache L1 menu
1079  L1GtUtils const& l1GtUtils = hltPrescaleProvider_.l1GtUtils();
1080  auto handleL1GtTriggerMenu = iSetup.getHandle(handleL1GtTriggerMenuToken_);
1081  auto const& l1GtAlgorithms = handleL1GtTriggerMenu->gtAlgorithmMap();
1082  auto const& l1GtTechTriggers = handleL1GtTriggerMenu->gtTechnicalTriggerMap();
1083  auto const& l1GtConditionsVector = handleL1GtTriggerMenu->gtConditionMap();
1084  // cache conditions in one single condition map
1085  ConditionMap l1GtConditions;
1086  for (size_t iCv = 0; iCv < l1GtConditionsVector.size(); ++iCv) {
1087  l1GtConditions.insert(l1GtConditionsVector.at(iCv).begin(), l1GtConditionsVector.at(iCv).end());
1088  }
1089  triggerAlgos->reserve(l1GtAlgorithms.size() + l1GtTechTriggers.size());
1090  Handle<L1GlobalTriggerObjectMaps> handleL1GlobalTriggerObjectMaps;
1091  iEvent.getByToken(l1GlobalTriggerObjectMapsToken_, handleL1GlobalTriggerObjectMaps);
1092  if (!handleL1GlobalTriggerObjectMaps.isValid()) {
1093  LogError("l1ObjectMap") << "L1GlobalTriggerObjectMaps product with InputTag '"
1094  << tagL1GlobalTriggerObjectMaps_.encode() << "' not in event\n"
1095  << "No L1 objects and GTL results available for physics algorithms";
1096  }
1097  handleL1GlobalTriggerObjectMaps->consistencyCheck();
1098  if (firstInRun_) {
1099  l1PSet_ = (ParameterSet*)(pset::Registry::instance()->getMapped(
1100  handleL1GlobalTriggerObjectMaps->namesParameterSetID()));
1101  if (l1PSet_ == nullptr) {
1102  LogError("l1ObjectMap") << "ParameterSet registry not available\n"
1103  << "Skipping conditions for all L1 physics algorithm names in this run";
1104  }
1105  } else {
1106  if (l1PSet_ == nullptr) {
1107  LogInfo("l1ObjectMap") << "ParameterSet registry not available\n"
1108  << "Skipping conditions for all L1 physics algorithm names in this event";
1109  }
1110  }
1111  // physics algorithms
1112  for (CItAlgo iAlgo = l1GtAlgorithms.begin(); iAlgo != l1GtAlgorithms.end(); ++iAlgo) {
1113  const std::string& algoName(iAlgo->second.algoName());
1114  if (!(iAlgo->second.algoBitNumber() < int(L1GlobalTriggerReadoutSetup::NumberPhysTriggers))) {
1115  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' has bit number "
1116  << iAlgo->second.algoBitNumber()
1118  << "Skipping";
1119  continue;
1120  }
1122  int bit;
1123  if (!l1GtUtils.l1AlgoTechTrigBitNumber(algoName, category, bit)) {
1124  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' not found in the L1 menu\n"
1125  << "Skipping";
1126  continue;
1127  }
1129  LogError("l1Algo") << "L1 physics algorithm '" << algoName
1130  << "' does not have category 'AlgorithmTrigger' from 'L1GtUtils'\n"
1131  << "Skipping";
1132  continue;
1133  }
1134  bool decisionBeforeMask;
1135  bool decisionAfterMask;
1136  int prescale;
1137  int mask;
1138  int error(l1GtUtils.l1Results(iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask));
1139  if (error) {
1140  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' decision has error code " << error
1141  << " from 'L1GtUtils'\n"
1142  << "Skipping";
1143  continue;
1144  }
1145  TriggerAlgorithm triggerAlgo(algoName,
1146  iAlgo->second.algoAlias(),
1148  (unsigned)bit,
1149  (unsigned)prescale,
1150  (bool)mask,
1151  decisionBeforeMask,
1152  decisionAfterMask);
1153  triggerAlgo.setLogicalExpression(iAlgo->second.algoLogicalExpression());
1154  // GTL result and used conditions in physics algorithm
1155  if (!handleL1GlobalTriggerObjectMaps.isValid()) {
1156  triggerAlgos->push_back(triggerAlgo);
1157  continue; // LogWarning already earlier (before loop)
1158  }
1159  if (!handleL1GlobalTriggerObjectMaps->algorithmExists(bit)) {
1160  LogError("l1ObjectMap") << "L1 physics algorithm '" << algoName
1161  << "' is missing in L1GlobalTriggerObjectMaps\n"
1162  << "Skipping conditions and GTL result";
1163  triggerAlgos->push_back(triggerAlgo);
1164  continue;
1165  }
1166  bool algorithmResult = handleL1GlobalTriggerObjectMaps->algorithmResult(bit);
1167  // if ( ( algorithmResult != decisionBeforeMask ) && ( decisionBeforeMask == true || prescale == 1 ) ) {
1168  if ((algorithmResult != decisionBeforeMask) &&
1169  (decisionBeforeMask == true)) { // FIXME: understand the difference for un-prescaled algos 118, 119, 123
1170  LogInfo("l1ObjectMap") << "L1 physics algorithm '" << algoName << "' with different decisions in\n"
1171  << "L1GlobalTriggerObjectMaps (GTL result) : " << algorithmResult << "\n"
1172  << "L1GlobalTriggerReadoutRecord (decision before mask): " << decisionBeforeMask;
1173  }
1174  triggerAlgo.setGtlResult(algorithmResult);
1175  // conditions in algorithm
1177  handleL1GlobalTriggerObjectMaps->getConditionsInAlgorithm(bit);
1178  if (l1PSet_ == nullptr) {
1179  triggerAlgos->push_back(triggerAlgo);
1180  continue;
1181  }
1182  if (!l1PSet_->exists(algoName)) {
1183  if (firstInRun_) {
1184  LogError("l1ObjectMap") << "L1 physics algorithm name '" << algoName
1185  << "' not available in ParameterSet registry\n"
1186  << "Skipping conditions for this algorithm in this run";
1187  } else {
1188  LogInfo("l1ObjectMap") << "L1 physics algorithm name '" << algoName
1189  << "' not available in ParameterSet registry\n"
1190  << "Skipping conditions for this algorithm in this event";
1191  }
1192  triggerAlgos->push_back(triggerAlgo);
1193  continue;
1194  }
1195  std::vector<std::string> conditionNames(l1PSet_->getParameter<std::vector<std::string> >(algoName));
1196 
1197  for (unsigned iT = 0; iT < conditionNames.size(); ++iT) {
1198  size_t key(triggerConditions->size());
1199  for (size_t iC = 0; iC < triggerConditions->size(); ++iC) {
1200  if (conditionNames.at(iT) == triggerConditions->at(iC).name()) {
1201  key = iC;
1202  break;
1203  }
1204  }
1205  if (key == triggerConditions->size()) {
1206  if (iT >= conditions.nConditions()) {
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;
1210  break;
1211  }
1212  TriggerCondition triggerCond(conditionNames[iT], conditions.getConditionResult(iT));
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)]);
1219  }
1220  // objects in condition
1222  handleL1GlobalTriggerObjectMaps->getCombinationsInCondition(bit, iT);
1223  for (size_t iVV = 0; iVV < combinations.nCombinations(); ++iVV) {
1224  for (size_t iV = 0; iV < combinations.nObjectsPerCombination(); ++iV) {
1225  unsigned objectIndex = combinations.getObjectIndex(iVV, iV);
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()) {
1232  LogError("l1CondMap")
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();
1236  }
1237  const unsigned objectKey(l1ObjectTypeMap[l1ObjectTypes.at(iV)].at(objectIndex));
1238  triggerCond.addObjectKey(objectKey);
1239  // add current condition and algorithm also to the according stand-alone trigger object
1240  triggerObjectsStandAlone->at(objectKey).addAlgorithmName(
1241  triggerAlgo.name(), (triggerAlgo.decision() && triggerCond.wasAccept()));
1242  triggerObjectsStandAlone->at(objectKey).addConditionName(triggerCond.name());
1243  }
1244  }
1245  }
1246  } else {
1247  LogWarning("l1CondMap") << "L1 conditions '" << triggerCond.name() << "' not found in the L1 menu\n"
1248  << "Remains incomplete";
1249  }
1250  triggerConditions->push_back(triggerCond);
1251  }
1252  triggerAlgo.addConditionKey(key);
1253  }
1254  triggerAlgos->push_back(triggerAlgo);
1255  }
1256  // technical triggers
1257  for (CItAlgo iAlgo = l1GtTechTriggers.begin(); iAlgo != l1GtTechTriggers.end(); ++iAlgo) {
1258  const std::string& algoName(iAlgo->second.algoName());
1259  if (!(iAlgo->second.algoBitNumber() < int(L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers))) {
1260  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' has bit number "
1261  << iAlgo->second.algoBitNumber()
1263  << "Skipping";
1264  continue;
1265  }
1267  int bit;
1268  if (!l1GtUtils.l1AlgoTechTrigBitNumber(algoName, category, bit)) {
1269  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' not found in the L1 menu\n"
1270  << "Skipping";
1271  continue;
1272  }
1274  LogError("l1Algo") << "L1 technical trigger '" << algoName
1275  << "' does not have category 'TechnicalTrigger' from 'L1GtUtils'\n"
1276  << "Skipping";
1277  continue;
1278  }
1279  bool decisionBeforeMask;
1280  bool decisionAfterMask;
1281  int prescale;
1282  int mask;
1283  int error(l1GtUtils.l1Results(iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask));
1284  if (error) {
1285  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' decision has error code " << error
1286  << " from 'L1GtUtils'\n"
1287  << "Skipping";
1288  continue;
1289  }
1290  TriggerAlgorithm triggerAlgo(algoName,
1291  iAlgo->second.algoAlias(),
1293  (unsigned)bit,
1294  (unsigned)prescale,
1295  (bool)mask,
1296  decisionBeforeMask,
1297  decisionAfterMask);
1298  triggerAlgo.setLogicalExpression(iAlgo->second.algoLogicalExpression());
1299  triggerAlgos->push_back(triggerAlgo);
1300  }
1301  }
1302 
1303  // Put L1 algorithms and conditions to event
1304  iEvent.put(std::move(triggerAlgos));
1306  }
1307 
1309  iEvent.processHistory().getConfigurationForProcess(nameProcess_, config);
1310 
1311  const edm::TriggerNames& names = iEvent.triggerNames(*handleTriggerResults);
1312  for (pat::TriggerObjectStandAlone& obj : *triggerObjectsStandAlone) {
1313  obj.setPSetID(config.parameterSetID());
1314  if (packPathNames_)
1315  obj.packPathNames(names);
1316  if (packLabels_)
1317  obj.packFilterLabels(iEvent, *handleTriggerResults);
1318  }
1319 
1320  // Put (finally) stand-alone trigger objects to event
1321  iEvent.put(std::move(triggerObjectsStandAlone));
1322 
1323  firstInRun_ = false;
1324 }
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?
Definition: L1GtObject.h:38
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:119
std::vector< L1Seed > L1SeedCollection
Collection of L1Seed.
Definition: TriggerPath.h:35
const std::vector< std::string > & labels() const
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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.
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
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:147
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:107
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 std::string names[nVars_]
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
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:79
Analysis-level L1 trigger condition class.
Definition: L1GtObject.h:35
const std::map< std::string, std::vector< unsigned int > > & table() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
trigger::size_type sizeCollections() const
other
Definition: TriggerEvent.h:145
unsigned char getObjectIndex(unsigned combination, unsigned object) const
const TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:102
int id() const
getters
Definition: TriggerObject.h:51
key
prepare the HTCondor submission files and eventually submit them
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:146
static const unsigned int NumberPhysTriggers
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:118
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:133
const edm::ESGetToken< L1GtTriggerMenu, L1GtTriggerMenuRcd > handleL1GtTriggerMenuToken_
std::vector< size_type > Keys
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.
dictionary config
Read in AllInOne config in JSON format.
Definition: DiMuonV_cfg.py:30
std::string_view filterLabel(trigger::size_type index) const
Definition: TriggerEvent.h:113
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:48
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
const Keys & collectionKeys() const
Definition: TriggerEvent.h:101
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)
triggerConditions
Definition: JetHT_cfg.py:258

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.