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...

#include "PhysicsTools/PatAlgos/plugins/PATTriggerProducer.h"

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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_
 
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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 56 of file PATTriggerProducer.h.

Constructor & Destructor Documentation

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

Definition at line 43 of file PATTriggerProducer.cc.

References addL1Algos_, addPathModuleLabels_, autoProcessName_, autoProcessNameL1ExtraCenJet_, autoProcessNameL1ExtraETM_, autoProcessNameL1ExtraForJet_, autoProcessNameL1ExtraHTM_, autoProcessNameL1ExtraIsoEG_, autoProcessNameL1ExtraMu_, autoProcessNameL1ExtraNoIsoEG_, autoProcessNameL1ExtraTauJet_, edm::ParameterSet::exists(), exludeCollections_, edm::ParameterSet::getParameter(), hltPrescaleLabel_, hltPrescaleTableEventGetter_, hltPrescaleTableLumiGetter_, hltPrescaleTableRunGetter_, edm::InLumi, HLT_2018_cff::InputTag, edm::InRun, edm::InputTag::instance(), l1ExtraCenJetGetter_, l1ExtraETMGetter_, l1ExtraForJetGetter_, l1ExtraHTMGetter_, l1ExtraIsoEGGetter_, l1ExtraMuGetter_, l1ExtraNoIsoEGGetter_, l1ExtraTauJetGetter_, l1GlobalTriggerObjectMapsToken_, edm::InputTag::label(), labelHltPrescaleTable_, mainBxOnly_, nameProcess_, onlyStandAlone_, packPrescales_, edm::InputTag::process(), edm::BranchDescription::processName(), saveL1Refs_, AlCaHLTBitMon_QueryRunRegistry::string, tagL1ExtraCenJet_, tagL1ExtraETM_, tagL1ExtraForJet_, tagL1ExtraHTM_, tagL1ExtraIsoEG_, tagL1ExtraMu_, tagL1ExtraNoIsoEG_, tagL1ExtraTauJet_, tagL1GlobalTriggerObjectMaps_, tagTriggerEvent_, tagTriggerResults_, triggerEventGetter_, and triggerResultsGetter_.

44  : nameProcess_(iConfig.getParameter<std::string>("processName")),
46  onlyStandAlone_(iConfig.getParameter<bool>("onlyStandAlone")),
47  firstInRun_(true),
48  // L1 configuration parameters
49  addL1Algos_(false),
50  tagL1GlobalTriggerObjectMaps_("l1L1GtObjectMap"),
51  tagL1ExtraMu_(),
67  mainBxOnly_(true),
68  saveL1Refs_(false),
69  hltPrescaleProvider_(iConfig, consumesCollector(), *this),
70  hltConfigInit_(false),
71  // HLT configuration parameters
72  tagTriggerResults_("TriggerResults"),
73  tagTriggerEvent_("hltTriggerSummaryAOD"),
78  addPathModuleLabels_(false),
79  packPathNames_(iConfig.existsAs<bool>("packTriggerPathNames") ? iConfig.getParameter<bool>("packTriggerPathNames")
80  : false),
81  packLabels_(iConfig.existsAs<bool>("packTriggerLabels") ? iConfig.getParameter<bool>("packTriggerLabels") : true),
82  packPrescales_(iConfig.existsAs<bool>("packTriggerPrescales") ? iConfig.getParameter<bool>("packTriggerPrescales")
83  : true) {
84  // L1 configuration parameters
85  if (iConfig.exists("addL1Algos"))
86  addL1Algos_ = iConfig.getParameter<bool>("addL1Algos");
87  if (iConfig.exists("l1GlobalTriggerObjectMaps"))
88  tagL1GlobalTriggerObjectMaps_ = iConfig.getParameter<InputTag>("l1GlobalTriggerObjectMaps");
89  l1GlobalTriggerObjectMapsToken_ = mayConsume<L1GlobalTriggerObjectMaps>(tagL1GlobalTriggerObjectMaps_);
90  if (iConfig.exists("l1ExtraMu")) {
91  tagL1ExtraMu_ = iConfig.getParameter<InputTag>("l1ExtraMu");
92  if (tagL1ExtraMu_.process() == "*") {
93  if (autoProcessName_)
95  else
97  }
100  }
101  if (iConfig.exists("l1ExtraNoIsoEG")) {
102  tagL1ExtraNoIsoEG_ = iConfig.getParameter<InputTag>("l1ExtraNoIsoEG");
103  if (tagL1ExtraNoIsoEG_.process() == "*") {
104  if (autoProcessName_)
106  else
108  }
111  }
112  if (iConfig.exists("l1ExtraIsoEG")) {
113  tagL1ExtraIsoEG_ = iConfig.getParameter<InputTag>("l1ExtraIsoEG");
114  if (tagL1ExtraIsoEG_.process() == "*") {
115  if (autoProcessName_)
117  else
119  }
122  }
123  if (iConfig.exists("l1ExtraCenJet")) {
124  tagL1ExtraCenJet_ = iConfig.getParameter<InputTag>("l1ExtraCenJet");
125  if (tagL1ExtraCenJet_.process() == "*") {
126  if (autoProcessName_)
128  else
130  }
133  }
134  if (iConfig.exists("l1ExtraForJet")) {
135  tagL1ExtraForJet_ = iConfig.getParameter<InputTag>("l1ExtraForJet");
136  if (tagL1ExtraForJet_.process() == "*") {
137  if (autoProcessName_)
139  else
141  }
144  }
145  if (iConfig.exists("l1ExtraTauJet")) {
146  tagL1ExtraTauJet_ = iConfig.getParameter<InputTag>("l1ExtraTauJet");
147  if (tagL1ExtraTauJet_.process() == "*") {
148  if (autoProcessName_)
150  else
152  }
155  }
156  if (iConfig.exists("l1ExtraETM")) {
157  tagL1ExtraETM_ = iConfig.getParameter<InputTag>("l1ExtraETM");
158  if (tagL1ExtraETM_.process() == "*") {
159  if (autoProcessName_)
161  else
163  }
166  }
167  if (iConfig.exists("l1ExtraHTM")) {
168  tagL1ExtraHTM_ = iConfig.getParameter<InputTag>("l1ExtraHTM");
169  if (tagL1ExtraHTM_.process() == "*") {
170  if (autoProcessName_)
172  else
174  }
177  }
178  if (iConfig.exists("mainBxOnly"))
179  mainBxOnly_ = iConfig.getParameter<bool>("mainBxOnly");
180  if (iConfig.exists("saveL1Refs"))
181  saveL1Refs_ = iConfig.getParameter<bool>("saveL1Refs");
182 
183  // HLT configuration parameters
184  if (iConfig.exists("triggerResults"))
185  tagTriggerResults_ = iConfig.getParameter<InputTag>("triggerResults");
190  this);
191  if (iConfig.exists("triggerEvent"))
192  tagTriggerEvent_ = iConfig.getParameter<InputTag>("triggerEvent");
195  if (iConfig.exists("hltPrescaleLabel"))
196  hltPrescaleLabel_ = iConfig.getParameter<std::string>("hltPrescaleLabel");
197  if (iConfig.exists("hltPrescaleTable")) {
198  labelHltPrescaleTable_ = iConfig.getParameter<std::string>("hltPrescaleTable");
205  }
206  if (iConfig.exists("addPathModuleLabels"))
207  addPathModuleLabels_ = iConfig.getParameter<bool>("addPathModuleLabels");
208  exludeCollections_.clear();
209  if (iConfig.exists("exludeCollections"))
210  exludeCollections_ = iConfig.getParameter<std::vector<std::string> >("exludeCollections");
211 
212  callWhenNewProductsRegistered([this, &iConfig](BranchDescription const& bd) {
213  if (iConfig.exists("l1ExtraMu"))
214  l1ExtraMuGetter_(bd);
215  if (iConfig.exists("l1ExtraNoIsoEG"))
217  if (iConfig.exists("l1ExtraIsoEG"))
219  if (iConfig.exists("l1ExtraCenJet"))
221  if (iConfig.exists("l1ExtraForJet"))
223  if (iConfig.exists("l1ExtraTauJet"))
225  if (iConfig.exists("l1ExtraETM"))
226  l1ExtraETMGetter_(bd);
227  if (iConfig.exists("l1ExtraHTM"))
228  l1ExtraHTMGetter_(bd);
229  if (not(this->autoProcessName_ and bd.processName() == this->moduleDescription().processName())) {
231  }
233  if (iConfig.exists("hltPrescaleTable")) {
237  }
238  });
239 
240  if (!onlyStandAlone_) {
241  produces<TriggerAlgorithmCollection>();
242  produces<TriggerConditionCollection>();
243  produces<TriggerPathCollection>();
244  produces<TriggerFilterCollection>();
245  produces<TriggerObjectCollection>();
246  }
247  if (packPrescales_) {
248  produces<PackedTriggerPrescales>();
249  produces<PackedTriggerPrescales>("l1max");
250  produces<PackedTriggerPrescales>("l1min");
251  }
252  produces<TriggerObjectStandAloneCollection>();
253 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > l1GlobalTriggerObjectMapsToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string const & processName() const
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_
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
trigger::HLTPrescaleTable hltPrescaleTableRun_
std::string const & instance() const
Definition: InputTag.h:37
edm::InputTag tagL1ExtraNoIsoEG_
edm::GetterOfProducts< edm::TriggerResults > triggerResultsGetter_
HLTPrescaleProvider hltPrescaleProvider_
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableRunGetter_
pat::PATTriggerProducer::~PATTriggerProducer ( )
inlineoverride

Definition at line 59 of file PATTriggerProducer.h.

References beginLuminosityBlock(), beginRun(), iEvent, and produce().

59 {};

Member Function Documentation

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

Definition at line 347 of file PATTriggerProducer.cc.

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

Referenced by ~PATTriggerProducer().

347  {
348  // Terminate, if auto process name determination failed
349  if (nameProcess_ == "*")
350  return;
351 
352  // Extract pre-scales
353  if (hltConfigInit_) {
354  // Start from run
357  // Try lumi product, if configured and available
358  if (!labelHltPrescaleTable_.empty()) {
359  Handle<trigger::HLTPrescaleTable> handleHltPrescaleTable;
360  iLuminosityBlock.getByLabel(InputTag(labelHltPrescaleTable_, "Lumi", nameProcess_), handleHltPrescaleTable);
361  if (handleHltPrescaleTable.isValid()) {
363  handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table());
364  }
365  }
366  }
367 }
unsigned int set() const
low-level const accessors for data members
The single EDProduct containing the HLT Prescale Table.
bool getByLabel(std::string const &label, Handle< PROD > &result) const
const std::vector< std::string > & labels() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
bool isValid() const
Definition: HandleBase.h:70
trigger::HLTPrescaleTable hltPrescaleTableRun_
const std::map< std::string, std::vector< unsigned int > > & table() const
void PATTriggerProducer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 255 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_2018_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_.

Referenced by ~PATTriggerProducer().

255  {
256  // Initialize
257  firstInRun_ = true;
258  l1PSet_ = nullptr;
259  hltConfigInit_ = false;
260 
261  // Initialize process name
262  if (autoProcessName_) {
263  // reset
264  nameProcess_ = "*";
265  // determine process name from last run TriggerSummaryProducerAOD module in process history of input
266  const ProcessHistory& processHistory(iRun.processHistory());
267  ProcessConfiguration processConfiguration;
268  ParameterSet processPSet;
269  // unbroken loop, which relies on time ordering (accepts the last found entry)
270  for (ProcessHistory::const_iterator iHist = processHistory.begin(); iHist != processHistory.end(); ++iHist) {
271  if (processHistory.getConfigurationForProcess(iHist->processName(), processConfiguration) &&
272  pset::Registry::instance()->getMapped(processConfiguration.parameterSetID(), processPSet) &&
273  processPSet.exists(tagTriggerEvent_.label())) {
274  nameProcess_ = iHist->processName();
275  LogDebug("autoProcessName") << "HLT process name '" << nameProcess_ << "' discovered";
276  }
277  }
278  // terminate, if nothing is found
279  if (nameProcess_ == "*") {
280  LogError("autoProcessName") << "trigger::TriggerEvent product with label '" << tagTriggerEvent_.label()
281  << "' not produced according to process history of input data\n"
282  << "No trigger information produced";
283  return;
284  }
285  LogInfo("autoProcessName") << "HLT process name' " << nameProcess_ << "' used for PAT trigger information";
286  }
287  // adapt configuration of used input tags
288  if (tagTriggerResults_.process().empty() || tagTriggerResults_.process() == "*") {
290  } else if (tagTriggerEvent_.process() != nameProcess_) {
291  LogWarning("inputTags") << "TriggerResults process name '" << tagTriggerResults_.process()
292  << "' differs from HLT process name '" << nameProcess_ << "'";
293  }
294  if (tagTriggerEvent_.process().empty() || tagTriggerEvent_.process() == "*") {
296  } else if (tagTriggerEvent_.process() != nameProcess_) {
297  LogWarning("inputTags") << "TriggerEvent process name '" << tagTriggerEvent_.process()
298  << "' differs from HLT process name '" << nameProcess_ << "'";
299  }
316 
317  // Initialize HLTConfigProvider
319  bool changed(true);
320  if (!hltPrescaleProvider_.init(iRun, iSetup, nameProcess_, changed)) {
321  LogError("hltConfig") << "HLT config extraction error with process name '" << nameProcess_ << "'";
322  } else if (hltConfig.size() <= 0) {
323  LogError("hltConfig") << "HLT config size error";
324  } else
325  hltConfigInit_ = true;
326 
327  // Update mapping from filter names to path names
328  if (hltConfigInit_ && changed)
329  moduleLabelToPathAndFlags_.init(hltConfig);
330 
331  // Extract pre-scales
332  if (hltConfigInit_) {
333  // Start empty
335  // Try run product, if configured
336  if (!labelHltPrescaleTable_.empty()) {
337  Handle<trigger::HLTPrescaleTable> handleHltPrescaleTable;
338  iRun.getByLabel(InputTag(labelHltPrescaleTable_, "Run", nameProcess_), handleHltPrescaleTable);
339  if (handleHltPrescaleTable.isValid()) {
341  handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table());
342  }
343  }
344  }
345 }
#define LogDebug(id)
unsigned int set() const
low-level const accessors for data members
collection_type::const_iterator const_iterator
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:280
static PFTauRenderPlugin instance
The single EDProduct containing the HLT Prescale Table.
bool exists(std::string const &parameterName) const
checks if a parameter exists
const std::vector< std::string > & labels() const
ProcessHistory const & processHistory() const
Definition: Run.cc:106
bool isValid() const
Definition: HandleBase.h:70
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
HLTConfigProvider const & hltConfigProvider() const
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
trigger::HLTPrescaleTable hltPrescaleTableRun_
const std::map< std::string, std::vector< unsigned int > > & table() const
std::string const & instance() const
Definition: InputTag.h:37
edm::InputTag tagL1ExtraNoIsoEG_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
HLTPrescaleProvider hltPrescaleProvider_
edm::ParameterSet * l1PSet_
void PATTriggerProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 369 of file PATTriggerProducer.cc.

References edm::HLTGlobalStatus::accept(), pat::TriggerAlgorithm::addConditionKey(), pat::TriggerObjectStandAlone::addFilterLabel(), addL1Algos_, pat::TriggerFilter::addObjectKey(), addPathModuleLabels_, pat::TriggerObjectStandAlone::addPathName(), pat::TriggerFilter::addTriggerObjectType(), pat::TriggerObject::addTriggerObjectType(), HIPAlignmentAlgorithm_cfi::algoName, L1GlobalTriggerObjectMaps::algorithmExists(), L1GlobalTriggerObjectMaps::algorithmResult(), L1GtUtils::AlgorithmTrigger, electrons_cff::bool, taus_updatedMVAIds_cff::category, CenJet, trigger::TriggerEvent::collectionKeys(), trigger::TriggerEvent::collectionTagEncoded(), looper::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(), patCandidatesForDimuonsSequences_cff::filterLabels, trigger::TriggerEvent::filterTag(), firstInRun_, ForJet, edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByToken(), L1GlobalTriggerObjectMaps::getCombinationsInCondition(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult(), L1GlobalTriggerObjectMaps::getConditionsInAlgorithm(), edm::ProcessHistory::getConfigurationForProcess(), L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex(), trigger::TriggerEvent::getObjects(), edm::ParameterSet::getParameter(), L1GtTriggerMenu::gtAlgorithmMap(), L1GtTriggerMenu::gtConditionMap(), L1GtTriggerMenu::gtTechnicalTriggerMap(), pat::TriggerObjectStandAlone::hasCollection(), HltComparatorCreateWorkflow::hltConfig, hltConfigInit_, HLTPrescaleProvider::hltConfigProvider(), HLTConfigProvider::hltL1GTSeeds(), hltPrescaleLabel_, hltPrescaleProvider_, hltPrescaleTableLumi_, HTM, mps_fire::i, trigger::TriggerObject::id(), edm::HLTGlobalStatus::index(), HLT_2018_cff::InputTag, instance, createfilelist::int, IsoEG, edm::EventBase::isRealData(), edm::HandleBase::isValid(), crabWrapper::key, relativeConstraints::keys, L1GtUtils::l1AlgoTechTrigBitNumber(), l1GlobalTriggerObjectMapsToken_, HLTPrescaleProvider::l1GtUtils(), l1PSet_, L1GtUtils::l1Results(), edm::InputTag::label(), labelHltPrescaleTable_, trigger::HLTPrescaleTable::labels(), LogDebug, mainBxOnly_, trigger::TriggerObject::mass(), SiStripPI::max, HLTConfigProvider::moduleIndex(), HLTConfigProvider::moduleLabel(), moduleLabelToPathAndFlags_, HLTConfigProvider::moduleType(), eostools::move(), Mu, dqmiodumpmetadata::n, pat::TriggerAlgorithm::name(), nameProcess_, names, L1GlobalTriggerObjectMaps::namesParameterSetID(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nCombinations(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::nConditions(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nObjectsPerCombination(), NoIsoEG, L1GlobalTriggerReadoutSetup::NumberPhysTriggers, L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers, getGTfromDQMFile::obj, L1MuTriggerScaleKeysOnlineProd_cfi::objectTypes, onlyStandAlone_, AlCaHLTBitMon_ParallelJobs::p, packLabels_, packPathNames_, packPrescales_, edm::ProcessConfiguration::parameterSetID(), patCandidatesForDimuonsSequences_cff::pathNames, Skims_PA_cff::paths, trigger::TriggerObject::phi(), HLTConfigProvider::prescaleLabels(), HLTPrescaleProvider::prescaleSet(), HLTConfigProvider::prescaleSize(), HLTConfigProvider::prescaleTable(), HLTConfigProvider::prescaleValue(), HLTPrescaleProvider::prescaleValuesInDetail(), edm::Event::processHistory(), trigger::TriggerObject::pt(), edm::Event::put(), saveL1Refs_, HLTConfigProvider::saveTags(), HLTConfigProvider::saveTagsModules(), trigger::HLTPrescaleTable::set(), pat::TriggerCondition::setCategory(), pat::TriggerObject::setCollection(), pat::TriggerAlgorithm::setGtlResult(), pat::TriggerAlgorithm::setLogicalExpression(), pat::TriggerFilter::setSaveTags(), pat::TriggerFilter::setStatus(), pat::TriggerFilter::setType(), HLTConfigProvider::size(), edm::TriggerNames::size(), 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, edm::TriggerNames::triggerName(), HLTConfigProvider::triggerNames(), edm::Event::triggerNames(), triggerMatchMonitor_cfi::triggerObjects, eventshapeDQM_cfi::triggerPath, triggerPaths, and edm::HLTGlobalStatus::wasrun().

Referenced by ~PATTriggerProducer().

369  {
370  // Terminate, if auto process name determination failed
371  if (nameProcess_ == "*")
372  return;
373 
374  auto triggerObjects = std::make_unique<TriggerObjectCollection>();
375  auto triggerObjectsStandAlone = std::make_unique<TriggerObjectStandAloneCollection>();
376  std::unique_ptr<PackedTriggerPrescales> packedPrescales, packedPrescalesL1min, packedPrescalesL1max;
377 
378  // HLT
380 
381  // Get and check HLT event data
382  Handle<trigger::TriggerEvent> handleTriggerEvent;
383  iEvent.getByLabel(tagTriggerEvent_, handleTriggerEvent);
384  Handle<TriggerResults> handleTriggerResults;
385  iEvent.getByLabel(tagTriggerResults_, handleTriggerResults);
386  bool goodHlt(hltConfigInit_);
387  if (goodHlt) {
388  if (!handleTriggerResults.isValid()) {
389  LogError("triggerResultsValid") << "TriggerResults product with InputTag '" << tagTriggerResults_.encode()
390  << "' not in event\n"
391  << "No HLT information produced";
392  goodHlt = false;
393  } else if (!handleTriggerEvent.isValid()) {
394  LogError("triggerEventValid") << "trigger::TriggerEvent product with InputTag '" << tagTriggerEvent_.encode()
395  << "' not in event\n"
396  << "No HLT information produced";
397  goodHlt = false;
398  }
399  }
400 
401  // Produce HLT paths and determine status of modules
402 
403  if (goodHlt) {
404  // Extract pre-scales
405  // Start from lumi
406  trigger::HLTPrescaleTable hltPrescaleTable(
408  // Try event product, if configured and available
409  if (!labelHltPrescaleTable_.empty()) {
410  Handle<trigger::HLTPrescaleTable> handleHltPrescaleTable;
411  iEvent.getByLabel(InputTag(labelHltPrescaleTable_, "Event", nameProcess_), handleHltPrescaleTable);
412  if (handleHltPrescaleTable.isValid()) {
413  hltPrescaleTable = trigger::HLTPrescaleTable(
414  handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table());
415  }
416  }
417  // Try event setup, if no product
418  if (hltPrescaleTable.size() == 0) {
419  if (!labelHltPrescaleTable_.empty()) {
420  LogWarning("hltPrescaleInputTag") << "HLTPrescaleTable product with label '" << labelHltPrescaleTable_
421  << "' not found in process" << nameProcess_ << "\n"
422  << "Using default from event setup";
423  }
424  if (hltConfig.prescaleSize() > 0) {
425  if (hltPrescaleProvider_.prescaleSet(iEvent, iSetup) != -1) {
426  hltPrescaleTable = trigger::HLTPrescaleTable(
427  hltPrescaleProvider_.prescaleSet(iEvent, iSetup), hltConfig.prescaleLabels(), hltConfig.prescaleTable());
428  LogDebug("hltPrescaleTable") << "HLT prescale table found in event setup";
429  } else {
430  LogWarning("hltPrescaleSet") << "HLTPrescaleTable from event setup has error";
431  }
432  }
433  }
434  unsigned set(hltPrescaleTable.set());
435  if (hltPrescaleTable.size() > 0) {
436  if (!hltPrescaleLabel_.empty()) {
437  bool foundPrescaleLabel(false);
438  for (unsigned iLabel = 0; iLabel < hltPrescaleTable.labels().size(); ++iLabel) {
439  if (hltPrescaleTable.labels().at(iLabel) == hltPrescaleLabel_) {
440  set = iLabel;
441  foundPrescaleLabel = true;
442  break;
443  }
444  }
445  if (!foundPrescaleLabel) {
446  LogWarning("hltPrescaleLabel") << "HLT prescale label '" << hltPrescaleLabel_ << "' not in prescale table\n"
447  << "Using default";
448  }
449  }
450  } else if (iEvent.isRealData()) {
451  if ((labelHltPrescaleTable_.empty() && firstInRun_) || !labelHltPrescaleTable_.empty()) {
452  LogError("hltPrescaleTable") << "No HLT prescale table found\n"
453  << "Using default empty table with all prescales 1";
454  }
455  }
456 
457  const unsigned sizePaths(hltConfig.size());
458  const unsigned sizeFilters(handleTriggerEvent->sizeFilters());
459  const unsigned sizeObjects(handleTriggerEvent->sizeObjects());
460 
461  std::map<std::string, int> moduleStates;
462 
463  if (!onlyStandAlone_) {
464  auto triggerPaths = std::make_unique<TriggerPathCollection>();
465  triggerPaths->reserve(sizePaths);
466  const std::vector<std::string>& pathNames = hltConfig.triggerNames();
467  for (size_t indexPath = 0; indexPath < sizePaths; ++indexPath) {
468  const std::string& namePath = pathNames.at(indexPath);
469  unsigned indexLastFilterPathModules(handleTriggerResults->index(indexPath) + 1);
470  while (indexLastFilterPathModules > 0) {
471  --indexLastFilterPathModules;
472  const std::string& labelLastFilterPathModules(hltConfig.moduleLabel(indexPath, indexLastFilterPathModules));
473  unsigned indexLastFilterFilters =
474  handleTriggerEvent->filterIndex(InputTag(labelLastFilterPathModules, "", nameProcess_));
475  if (indexLastFilterFilters < sizeFilters) {
476  if (hltConfig.moduleType(labelLastFilterPathModules) == "HLTBool")
477  continue;
478  break;
479  }
480  }
481  TriggerPath triggerPath(namePath,
482  indexPath,
483  hltConfig.prescaleValue(set, namePath),
484  handleTriggerResults->wasrun(indexPath),
485  handleTriggerResults->accept(indexPath),
486  handleTriggerResults->error(indexPath),
487  indexLastFilterPathModules,
488  hltConfig.saveTagsModules(namePath).size());
489  // add module names to path and states' map
490  const unsigned sizeModulesPath(hltConfig.size(indexPath));
491  assert(indexLastFilterPathModules < sizeModulesPath);
492  std::map<unsigned, std::string> indicesModules;
493  for (size_t iM = 0; iM < sizeModulesPath; ++iM) {
494  const std::string& nameModule(hltConfig.moduleLabel(indexPath, iM));
495  if (addPathModuleLabels_) {
496  triggerPath.addModule(nameModule);
497  }
498  const unsigned indexFilter(handleTriggerEvent->filterIndex(InputTag(nameModule, "", nameProcess_)));
499  if (indexFilter < sizeFilters) {
500  triggerPath.addFilterIndex(indexFilter);
501  }
502  const unsigned slotModule(hltConfig.moduleIndex(indexPath, nameModule));
503  indicesModules.insert(std::pair<unsigned, std::string>(slotModule, nameModule));
504  }
505  // add L1 seeds
506  const L1SeedCollection& l1Seeds(hltConfig.hltL1GTSeeds(namePath));
507  for (L1SeedCollection::const_iterator iSeed = l1Seeds.begin(); iSeed != l1Seeds.end(); ++iSeed) {
508  triggerPath.addL1Seed(*iSeed);
509  }
510  // store path
511  triggerPaths->push_back(triggerPath);
512  // cache module states to be used for the filters
513  for (std::map<unsigned, std::string>::const_iterator iM = indicesModules.begin(); iM != indicesModules.end();
514  ++iM) {
515  if (iM->first < indexLastFilterPathModules) {
516  moduleStates[iM->second] = 1;
517  } else if (iM->first == indexLastFilterPathModules) {
518  moduleStates[iM->second] = handleTriggerResults->accept(indexPath);
519  } else if (moduleStates.find(iM->second) == moduleStates.end()) {
520  moduleStates[iM->second] = -1;
521  }
522  }
523  }
524  // Put HLT paths to event
525  iEvent.put(std::move(triggerPaths));
526  }
527 
528  // Store used trigger objects and their types for HLT filters
529  // (only active filter(s) available from trigger::TriggerEvent)
530 
531  std::multimap<trigger::size_type, int> objectTypes;
532  std::multimap<trigger::size_type, std::string> filterLabels;
533 
534  for (size_t iF = 0; iF < sizeFilters; ++iF) {
535  const std::string nameFilter(handleTriggerEvent->filterLabel(iF));
536  const trigger::Keys& keys = handleTriggerEvent->filterKeys(iF);
537  const trigger::Vids& types = handleTriggerEvent->filterIds(iF);
538  assert(types.size() == keys.size());
539  for (size_t iK = 0; iK < keys.size(); ++iK) {
540  filterLabels.insert(std::pair<trigger::size_type, std::string>(keys[iK], nameFilter));
541  objectTypes.insert(std::pair<trigger::size_type, int>(keys[iK], types[iK]));
542  }
543  }
544 
545  // HLT objects
546 
547  triggerObjects->reserve(onlyStandAlone_ ? 0 : sizeObjects);
548  triggerObjectsStandAlone->reserve(sizeObjects);
549 
550  const trigger::Keys& collectionKeys(handleTriggerEvent->collectionKeys());
551  std::map<trigger::size_type, trigger::size_type> newObjectKeys;
552  for (size_t iO = 0, iC = 0, nC = handleTriggerEvent->sizeCollections(); iO < sizeObjects && iC < nC; ++iO) {
553  const trigger::TriggerObject tobj = handleTriggerEvent->getObjects().at(iO);
554  TriggerObject triggerObject(reco::Particle::PolarLorentzVector(tobj.pt(), tobj.eta(), tobj.phi(), tobj.mass()),
555  tobj.id());
556  // set collection
557  while (iO >= collectionKeys[iC])
558  ++iC; // relies on well ordering of trigger objects with respect to the collections
559  triggerObject.setCollection(handleTriggerEvent->collectionTagEncoded(iC));
560  // set filter ID
561  typedef std::multimap<trigger::size_type, int>::const_iterator it_type;
562  for (std::pair<it_type, it_type> trange = objectTypes.equal_range(iO); trange.first != trange.second;
563  ++trange.first) {
564  triggerObject.addTriggerObjectType(trange.first->second);
565  }
566 
567  // stand-alone trigger object
568  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
569  // check for excluded collections
570  bool excluded(false);
571  for (size_t iE = 0; iE < exludeCollections_.size(); ++iE) {
572  if (triggerObjectStandAlone.hasCollection(exludeCollections_.at(iE))) {
573  if (!onlyStandAlone_)
574  newObjectKeys[iO] = trigger::size_type(sizeObjects);
575  excluded = true;
576  break;
577  }
578  }
579  if (excluded)
580  continue;
581  typedef std::multimap<trigger::size_type, std::string>::const_iterator it_fl;
582  for (std::pair<it_fl, it_fl> frange = filterLabels.equal_range(iO); frange.first != frange.second;
583  ++frange.first) {
584  triggerObjectStandAlone.addFilterLabel(frange.first->second);
585  const std::vector<ModuleLabelToPathAndFlags::PathAndFlags>& paths =
586  moduleLabelToPathAndFlags_[frange.first->second];
587  for (std::vector<ModuleLabelToPathAndFlags::PathAndFlags>::const_iterator iP = paths.begin(); iP != paths.end();
588  ++iP) {
589  bool pathFired = handleTriggerResults->wasrun(iP->pathIndex) && handleTriggerResults->accept(iP->pathIndex);
590  triggerObjectStandAlone.addPathName(iP->pathName, pathFired && iP->lastFilter, pathFired && iP->l3Filter);
591  }
592  }
593 
594  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
595  if (!onlyStandAlone_) {
596  triggerObjects->push_back(triggerObject);
597  newObjectKeys[iO] = trigger::size_type(triggerObjects->size() - 1);
598  }
599  }
600 
601  // Re-iterate HLT filters and finally produce them in order to account for optionally skipped objects
602  if (!onlyStandAlone_) {
603  auto triggerFilters = std::make_unique<TriggerFilterCollection>();
604  triggerFilters->reserve(sizeFilters);
605  for (size_t iF = 0; iF < sizeFilters; ++iF) {
606  const std::string nameFilter(handleTriggerEvent->filterTag(iF).label());
607  const trigger::Keys& keys = handleTriggerEvent->filterKeys(iF); // not cached
608  const trigger::Vids& types = handleTriggerEvent->filterIds(iF); // not cached
609  TriggerFilter triggerFilter(nameFilter);
610  // set filter type
611  const std::string typeFilter(hltConfig.moduleType(nameFilter));
612  triggerFilter.setType(typeFilter);
613  triggerFilter.setSaveTags(hltConfig.saveTags(nameFilter));
614  // set keys and trigger object types of used objects
615  for (size_t iK = 0; iK < keys.size(); ++iK) { // identical to types.size()
616  // check, if current object is excluded
617  if (newObjectKeys.find(keys.at(iK)) != newObjectKeys.end()) {
618  if (newObjectKeys[keys.at(iK)] == sizeObjects)
619  continue;
620  triggerFilter.addObjectKey(newObjectKeys[keys.at(iK)]);
621  triggerFilter.addTriggerObjectType(types.at(iK));
622  } else {
623  LogWarning("triggerObjectKey") << "TriggerFilter '" << nameFilter
624  << "' requests non-existing TriggerObject key " << keys.at(iK) << "\n"
625  << "Skipping object assignment";
626  }
627  }
628  // set status from path info
629  std::map<std::string, int>::iterator iS(moduleStates.find(nameFilter));
630  if (iS != moduleStates.end()) {
631  if (!triggerFilter.setStatus(iS->second)) {
632  triggerFilter.setStatus(-1); // FIXME different code for "unvalid status determined" needed?
633  }
634  } else {
635  triggerFilter.setStatus(-1); // FIXME different code for "unknown" needed?
636  }
637  // store filter
638  triggerFilters->push_back(triggerFilter);
639  }
640  // put HLT filters to event
641  iEvent.put(std::move(triggerFilters));
642  }
643 
644  if (packPrescales_) {
645  packedPrescales.reset(new PackedTriggerPrescales(handleTriggerResults));
646  packedPrescalesL1min.reset(new PackedTriggerPrescales(handleTriggerResults));
647  packedPrescalesL1max.reset(new PackedTriggerPrescales(handleTriggerResults));
648  const edm::TriggerNames& names = iEvent.triggerNames(*handleTriggerResults);
649  //std::cout << "Run " << iEvent.id().run() << ", LS " << iEvent.id().luminosityBlock() << ": pset " << set << std::endl;
650  for (unsigned int i = 0, n = names.size(); i < n; ++i) {
651  auto pvdet = hltPrescaleProvider_.prescaleValuesInDetail(iEvent, iSetup, names.triggerName(i));
652  //int hltprescale = hltConfig_.prescaleValue(set, names.triggerName(i));
653  if (pvdet.first.empty()) {
654  packedPrescalesL1max->addPrescaledTrigger(i, 1);
655  packedPrescalesL1min->addPrescaledTrigger(i, 1);
656  } else {
657  int pmin = -1, pmax = -1;
658  for (const auto& p : pvdet.first) {
659  pmax = std::max(pmax, p.second);
660  if (p.second > 0 && (pmin == -1 || pmin > p.second))
661  pmin = p.second;
662  }
663  packedPrescalesL1max->addPrescaledTrigger(i, pmax);
664  packedPrescalesL1min->addPrescaledTrigger(i, pmin);
665  //std::cout << "\tTrigger " << names.triggerName(i) << ", L1 ps " << pmin << "-" << pmax << ", HLT ps " << hltprescale << std::endl;
666  }
667  packedPrescales->addPrescaledTrigger(i, pvdet.second);
668  //assert( hltprescale == pvdet.second );
669  }
670  iEvent.put(std::move(packedPrescales));
671  iEvent.put(std::move(packedPrescalesL1max), "l1max");
672  iEvent.put(std::move(packedPrescalesL1min), "l1min");
673  }
674 
675  } // if ( goodHlt )
676 
677  // L1 objects
678  // (needs to be done after HLT objects, since their x-links with filters rely on their collection keys)
679 
680  // map for assignments of objects to conditions
681  std::map<L1GtObject, std::vector<unsigned> > l1ObjectTypeMap;
682  if (!tagL1ExtraMu_.label().empty()) {
684  iEvent.getByLabel(tagL1ExtraMu_, handleL1ExtraMu);
685  if (handleL1ExtraMu.isValid()) {
686  std::vector<unsigned> muKeys;
687  for (size_t l1Mu = 0; l1Mu < handleL1ExtraMu->size(); ++l1Mu) {
688  if (mainBxOnly_ && handleL1ExtraMu->at(l1Mu).bx() != 0)
689  continue;
690  TriggerObject triggerObject;
691  if (saveL1Refs_) {
692  const reco::CandidateBaseRef leafCandRef(l1extra::L1MuonParticleRef(handleL1ExtraMu, l1Mu));
693  triggerObject = TriggerObject(leafCandRef);
694  } else {
695  const reco::LeafCandidate leafCandidate(*(handleL1ExtraMu->at(l1Mu).reco::LeafCandidate::clone()));
696  triggerObject = TriggerObject(leafCandidate);
697  }
698  triggerObject.setCollection(tagL1ExtraMu_);
700  if (!onlyStandAlone_)
701  triggerObjects->push_back(triggerObject);
702  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
703  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
704  if (handleL1ExtraMu->at(l1Mu).bx() == 0)
705  muKeys.push_back(triggerObjectsStandAlone->size() - 1);
706  }
707  l1ObjectTypeMap.insert(std::make_pair(Mu, muKeys));
708  } else
709  LogError("l1ExtraValid") << "l1extra::L1MuonParticleCollection product with InputTag '" << tagL1ExtraMu_.encode()
710  << "' not in event";
711  }
712  if (!tagL1ExtraNoIsoEG_.label().empty()) {
713  Handle<l1extra::L1EmParticleCollection> handleL1ExtraNoIsoEG;
714  iEvent.getByLabel(tagL1ExtraNoIsoEG_, handleL1ExtraNoIsoEG);
715  if (handleL1ExtraNoIsoEG.isValid()) {
716  std::vector<unsigned> noIsoEGKeys;
717  for (size_t l1NoIsoEG = 0; l1NoIsoEG < handleL1ExtraNoIsoEG->size(); ++l1NoIsoEG) {
718  if (mainBxOnly_ && handleL1ExtraNoIsoEG->at(l1NoIsoEG).bx() != 0)
719  continue;
720  TriggerObject triggerObject;
721  if (saveL1Refs_) {
722  const reco::CandidateBaseRef leafCandRef(l1extra::L1EmParticleRef(handleL1ExtraNoIsoEG, l1NoIsoEG));
723  triggerObject = TriggerObject(leafCandRef);
724  } else {
725  const reco::LeafCandidate leafCandidate(*(handleL1ExtraNoIsoEG->at(l1NoIsoEG).reco::LeafCandidate::clone()));
726  triggerObject = TriggerObject(leafCandidate);
727  }
728  triggerObject.setCollection(tagL1ExtraNoIsoEG_);
730  if (!onlyStandAlone_)
731  triggerObjects->push_back(triggerObject);
732  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
733  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
734  if (handleL1ExtraNoIsoEG->at(l1NoIsoEG).bx() == 0)
735  noIsoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
736  }
737  l1ObjectTypeMap.insert(std::make_pair(NoIsoEG, noIsoEGKeys));
738  } else
739  LogError("l1ExtraValid") << "l1extra::L1EmParticleCollection product with InputTag '"
740  << tagL1ExtraNoIsoEG_.encode() << "' not in event";
741  }
742  if (!tagL1ExtraIsoEG_.label().empty()) {
743  Handle<l1extra::L1EmParticleCollection> handleL1ExtraIsoEG;
744  iEvent.getByLabel(tagL1ExtraIsoEG_, handleL1ExtraIsoEG);
745  if (handleL1ExtraIsoEG.isValid()) {
746  std::vector<unsigned> isoEGKeys;
747  for (size_t l1IsoEG = 0; l1IsoEG < handleL1ExtraIsoEG->size(); ++l1IsoEG) {
748  if (mainBxOnly_ && handleL1ExtraIsoEG->at(l1IsoEG).bx() != 0)
749  continue;
750  TriggerObject triggerObject;
751  if (saveL1Refs_) {
752  const reco::CandidateBaseRef leafCandRef(l1extra::L1EmParticleRef(handleL1ExtraIsoEG, l1IsoEG));
753  triggerObject = TriggerObject(leafCandRef);
754  } else {
755  const reco::LeafCandidate leafCandidate(*(handleL1ExtraIsoEG->at(l1IsoEG).reco::LeafCandidate::clone()));
756  triggerObject = TriggerObject(leafCandidate);
757  }
758  triggerObject.setCollection(tagL1ExtraIsoEG_);
760  if (!onlyStandAlone_)
761  triggerObjects->push_back(triggerObject);
762  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
763  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
764  if (handleL1ExtraIsoEG->at(l1IsoEG).bx() == 0)
765  isoEGKeys.push_back(triggerObjectsStandAlone->size() - 1);
766  }
767  l1ObjectTypeMap.insert(std::make_pair(IsoEG, isoEGKeys));
768  } else
769  LogError("l1ExtraValid") << "l1extra::L1EmParticleCollection product with InputTag '" << tagL1ExtraIsoEG_.encode()
770  << "' not in event";
771  }
772  if (!tagL1ExtraCenJet_.label().empty()) {
773  Handle<l1extra::L1JetParticleCollection> handleL1ExtraCenJet;
774  iEvent.getByLabel(tagL1ExtraCenJet_, handleL1ExtraCenJet);
775  if (handleL1ExtraCenJet.isValid()) {
776  std::vector<unsigned> cenJetKeys;
777  for (size_t l1CenJet = 0; l1CenJet < handleL1ExtraCenJet->size(); ++l1CenJet) {
778  if (mainBxOnly_ && handleL1ExtraCenJet->at(l1CenJet).bx() != 0)
779  continue;
780  TriggerObject triggerObject;
781  if (saveL1Refs_) {
782  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraCenJet, l1CenJet));
783  triggerObject = TriggerObject(leafCandRef);
784  } else {
785  const reco::LeafCandidate leafCandidate(*(handleL1ExtraCenJet->at(l1CenJet).reco::LeafCandidate::clone()));
786  triggerObject = TriggerObject(leafCandidate);
787  }
788  triggerObject.setCollection(tagL1ExtraCenJet_);
790  if (!onlyStandAlone_)
791  triggerObjects->push_back(triggerObject);
792  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
793  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
794  if (handleL1ExtraCenJet->at(l1CenJet).bx() == 0)
795  cenJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
796  }
797  l1ObjectTypeMap.insert(std::make_pair(CenJet, cenJetKeys));
798  } else
799  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
800  << tagL1ExtraCenJet_.encode() << "' not in event";
801  }
802  if (!tagL1ExtraForJet_.label().empty()) {
803  Handle<l1extra::L1JetParticleCollection> handleL1ExtraForJet;
804  iEvent.getByLabel(tagL1ExtraForJet_, handleL1ExtraForJet);
805  if (handleL1ExtraForJet.isValid()) {
806  std::vector<unsigned> forJetKeys;
807  for (size_t l1ForJet = 0; l1ForJet < handleL1ExtraForJet->size(); ++l1ForJet) {
808  if (mainBxOnly_ && handleL1ExtraForJet->at(l1ForJet).bx() != 0)
809  continue;
810  TriggerObject triggerObject;
811  if (saveL1Refs_) {
812  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraForJet, l1ForJet));
813  triggerObject = TriggerObject(leafCandRef);
814  } else {
815  const reco::LeafCandidate leafCandidate(*(handleL1ExtraForJet->at(l1ForJet).reco::LeafCandidate::clone()));
816  triggerObject = TriggerObject(leafCandidate);
817  }
818  triggerObject.setCollection(tagL1ExtraForJet_);
820  if (!onlyStandAlone_)
821  triggerObjects->push_back(triggerObject);
822  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
823  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
824  if (handleL1ExtraForJet->at(l1ForJet).bx() == 0)
825  forJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
826  }
827  l1ObjectTypeMap.insert(std::make_pair(ForJet, forJetKeys));
828  } else
829  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
830  << tagL1ExtraForJet_.encode() << "' not in event";
831  }
832  if (!tagL1ExtraTauJet_.label().empty()) {
833  Handle<l1extra::L1JetParticleCollection> handleL1ExtraTauJet;
834  iEvent.getByLabel(tagL1ExtraTauJet_, handleL1ExtraTauJet);
835  if (handleL1ExtraTauJet.isValid()) {
836  std::vector<unsigned> tauJetKeys;
837  for (size_t l1TauJet = 0; l1TauJet < handleL1ExtraTauJet->size(); ++l1TauJet) {
838  if (mainBxOnly_ && handleL1ExtraTauJet->at(l1TauJet).bx() != 0)
839  continue;
840  TriggerObject triggerObject;
841  if (saveL1Refs_) {
842  const reco::CandidateBaseRef leafCandRef(l1extra::L1JetParticleRef(handleL1ExtraTauJet, l1TauJet));
843  triggerObject = TriggerObject(leafCandRef);
844  } else {
845  const reco::LeafCandidate leafCandidate(*(handleL1ExtraTauJet->at(l1TauJet).reco::LeafCandidate::clone()));
846  triggerObject = TriggerObject(leafCandidate);
847  }
848  triggerObject.setCollection(tagL1ExtraTauJet_);
850  if (!onlyStandAlone_)
851  triggerObjects->push_back(triggerObject);
852  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
853  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
854  if (handleL1ExtraTauJet->at(l1TauJet).bx() == 0)
855  tauJetKeys.push_back(triggerObjectsStandAlone->size() - 1);
856  }
857  l1ObjectTypeMap.insert(std::make_pair(TauJet, tauJetKeys));
858  } else
859  LogError("l1ExtraValid") << "l1extra::L1JetParticleCollection product with InputTag '"
860  << tagL1ExtraTauJet_.encode() << "' not in event";
861  }
862  if (!tagL1ExtraETM_.label().empty()) {
864  iEvent.getByLabel(tagL1ExtraETM_, handleL1ExtraETM);
865  if (handleL1ExtraETM.isValid()) {
866  std::vector<unsigned> etmKeys;
867  for (size_t l1ETM = 0; l1ETM < handleL1ExtraETM->size(); ++l1ETM) {
868  if (mainBxOnly_ && handleL1ExtraETM->at(l1ETM).bx() != 0)
869  continue;
870  TriggerObject triggerObject;
871  if (saveL1Refs_) {
872  const reco::CandidateBaseRef leafCandRef(l1extra::L1EtMissParticleRef(handleL1ExtraETM, l1ETM));
873  triggerObject = TriggerObject(leafCandRef);
874  } else {
875  const reco::LeafCandidate leafCandidate(*(handleL1ExtraETM->at(l1ETM).reco::LeafCandidate::clone()));
876  triggerObject = TriggerObject(leafCandidate);
877  }
878  triggerObject.setCollection(tagL1ExtraETM_);
880  if (!onlyStandAlone_)
881  triggerObjects->push_back(triggerObject);
882  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
883  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
884  if (handleL1ExtraETM->at(l1ETM).bx() == 0)
885  etmKeys.push_back(triggerObjectsStandAlone->size() - 1);
886  }
887  l1ObjectTypeMap.insert(std::make_pair(ETM, etmKeys));
888  } else
889  LogError("l1ExtraValid") << "l1extra::L1EtMissParticleCollection product with InputTag '"
890  << tagL1ExtraETM_.encode() << "' not in event";
891  }
892  if (!tagL1ExtraHTM_.label().empty()) {
894  iEvent.getByLabel(tagL1ExtraHTM_, handleL1ExtraHTM);
895  if (handleL1ExtraHTM.isValid()) {
896  std::vector<unsigned> htmKeys;
897  for (size_t l1HTM = 0; l1HTM < handleL1ExtraHTM->size(); ++l1HTM) {
898  if (mainBxOnly_ && handleL1ExtraHTM->at(l1HTM).bx() != 0)
899  continue;
900  TriggerObject triggerObject;
901  if (saveL1Refs_) {
902  const reco::CandidateBaseRef leafCandRef(l1extra::L1EtMissParticleRef(handleL1ExtraHTM, l1HTM));
903  triggerObject = TriggerObject(leafCandRef);
904  } else {
905  const reco::LeafCandidate leafCandidate(*(handleL1ExtraHTM->at(l1HTM).reco::LeafCandidate::clone()));
906  triggerObject = TriggerObject(leafCandidate);
907  }
908  triggerObject.setCollection(tagL1ExtraHTM_);
910  if (!onlyStandAlone_)
911  triggerObjects->push_back(triggerObject);
912  TriggerObjectStandAlone triggerObjectStandAlone(triggerObject);
913  triggerObjectsStandAlone->push_back(triggerObjectStandAlone);
914  if (handleL1ExtraHTM->at(l1HTM).bx() == 0)
915  htmKeys.push_back(triggerObjectsStandAlone->size() - 1);
916  }
917  l1ObjectTypeMap.insert(std::make_pair(HTM, htmKeys));
918  } else
919  LogError("l1ExtraValid") << "l1extra::L1EtMissParticleCollection product with InputTag '"
920  << tagL1ExtraHTM_.encode() << "' not in event";
921  }
922 
923  // Put trigger objects to event
924  if (!onlyStandAlone_)
925  iEvent.put(std::move(triggerObjects));
926 
927  // L1 algorithms
928  if (!onlyStandAlone_) {
929  auto triggerAlgos = std::make_unique<TriggerAlgorithmCollection>();
930  auto triggerConditions = std::make_unique<TriggerConditionCollection>();
931  if (addL1Algos_) {
932  // create trigger object types transalation map (yes, it's ugly!)
933  std::map<L1GtObject, trigger::TriggerObjectType> mapObjectTypes;
934  mapObjectTypes.insert(std::make_pair(Mu, trigger::TriggerL1Mu));
935  mapObjectTypes.insert(std::make_pair(NoIsoEG, trigger::TriggerL1NoIsoEG));
936  mapObjectTypes.insert(std::make_pair(IsoEG, trigger::TriggerL1IsoEG));
937  mapObjectTypes.insert(std::make_pair(CenJet, trigger::TriggerL1CenJet));
938  mapObjectTypes.insert(std::make_pair(ForJet, trigger::TriggerL1ForJet));
939  mapObjectTypes.insert(std::make_pair(TauJet, trigger::TriggerL1TauJet));
940  mapObjectTypes.insert(std::make_pair(ETM, trigger::TriggerL1ETM));
941  mapObjectTypes.insert(std::make_pair(HTM, trigger::TriggerL1HTM));
942  // get and cache L1 menu
943  L1GtUtils const& l1GtUtils = hltPrescaleProvider_.l1GtUtils();
944  ESHandle<L1GtTriggerMenu> handleL1GtTriggerMenu;
945  iSetup.get<L1GtTriggerMenuRcd>().get(handleL1GtTriggerMenu);
946  auto const& l1GtAlgorithms = handleL1GtTriggerMenu->gtAlgorithmMap();
947  auto const& l1GtTechTriggers = handleL1GtTriggerMenu->gtTechnicalTriggerMap();
948  auto const& l1GtConditionsVector = handleL1GtTriggerMenu->gtConditionMap();
949  // cache conditions in one single condition map
950  ConditionMap l1GtConditions;
951  for (size_t iCv = 0; iCv < l1GtConditionsVector.size(); ++iCv) {
952  l1GtConditions.insert(l1GtConditionsVector.at(iCv).begin(), l1GtConditionsVector.at(iCv).end());
953  }
954  triggerAlgos->reserve(l1GtAlgorithms.size() + l1GtTechTriggers.size());
955  Handle<L1GlobalTriggerObjectMaps> handleL1GlobalTriggerObjectMaps;
956  iEvent.getByToken(l1GlobalTriggerObjectMapsToken_, handleL1GlobalTriggerObjectMaps);
957  if (!handleL1GlobalTriggerObjectMaps.isValid()) {
958  LogError("l1ObjectMap") << "L1GlobalTriggerObjectMaps product with InputTag '"
959  << tagL1GlobalTriggerObjectMaps_.encode() << "' not in event\n"
960  << "No L1 objects and GTL results available for physics algorithms";
961  }
962  handleL1GlobalTriggerObjectMaps->consistencyCheck();
963  if (firstInRun_) {
965  handleL1GlobalTriggerObjectMaps->namesParameterSetID()));
966  if (l1PSet_ == nullptr) {
967  LogError("l1ObjectMap") << "ParameterSet registry not available\n"
968  << "Skipping conditions for all L1 physics algorithm names in this run";
969  }
970  } else {
971  if (l1PSet_ == nullptr) {
972  LogInfo("l1ObjectMap") << "ParameterSet registry not available\n"
973  << "Skipping conditions for all L1 physics algorithm names in this event";
974  }
975  }
976  // physics algorithms
977  for (CItAlgo iAlgo = l1GtAlgorithms.begin(); iAlgo != l1GtAlgorithms.end(); ++iAlgo) {
978  const std::string& algoName(iAlgo->second.algoName());
979  if (!(iAlgo->second.algoBitNumber() < int(L1GlobalTriggerReadoutSetup::NumberPhysTriggers))) {
980  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' has bit number "
981  << iAlgo->second.algoBitNumber()
983  << "Skipping";
984  continue;
985  }
987  int bit;
988  if (!l1GtUtils.l1AlgoTechTrigBitNumber(algoName, category, bit)) {
989  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' not found in the L1 menu\n"
990  << "Skipping";
991  continue;
992  }
993  if (category != L1GtUtils::AlgorithmTrigger) {
994  LogError("l1Algo") << "L1 physics algorithm '" << algoName
995  << "' does not have category 'AlgorithmTrigger' from 'L1GtUtils'\n"
996  << "Skipping";
997  continue;
998  }
999  bool decisionBeforeMask;
1000  bool decisionAfterMask;
1001  int prescale;
1002  int mask;
1003  int error(l1GtUtils.l1Results(iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask));
1004  if (error) {
1005  LogError("l1Algo") << "L1 physics algorithm '" << algoName << "' decision has error code " << error
1006  << " from 'L1GtUtils'\n"
1007  << "Skipping";
1008  continue;
1009  }
1010  TriggerAlgorithm triggerAlgo(algoName,
1011  iAlgo->second.algoAlias(),
1012  category == L1GtUtils::TechnicalTrigger,
1013  (unsigned)bit,
1014  (unsigned)prescale,
1015  (bool)mask,
1016  decisionBeforeMask,
1017  decisionAfterMask);
1018  triggerAlgo.setLogicalExpression(iAlgo->second.algoLogicalExpression());
1019  // GTL result and used conditions in physics algorithm
1020  if (!handleL1GlobalTriggerObjectMaps.isValid()) {
1021  triggerAlgos->push_back(triggerAlgo);
1022  continue; // LogWarning already earlier (before loop)
1023  }
1024  if (!handleL1GlobalTriggerObjectMaps->algorithmExists(bit)) {
1025  LogError("l1ObjectMap") << "L1 physics algorithm '" << algoName
1026  << "' is missing in L1GlobalTriggerObjectMaps\n"
1027  << "Skipping conditions and GTL result";
1028  triggerAlgos->push_back(triggerAlgo);
1029  continue;
1030  }
1031  bool algorithmResult = handleL1GlobalTriggerObjectMaps->algorithmResult(bit);
1032  // if ( ( algorithmResult != decisionBeforeMask ) && ( decisionBeforeMask == true || prescale == 1 ) ) {
1033  if ((algorithmResult != decisionBeforeMask) &&
1034  (decisionBeforeMask == true)) { // FIXME: understand the difference for un-prescaled algos 118, 119, 123
1035  LogInfo("l1ObjectMap") << "L1 physics algorithm '" << algoName << "' with different decisions in\n"
1036  << "L1GlobalTriggerObjectMaps (GTL result) : " << algorithmResult << "\n"
1037  << "L1GlobalTriggerReadoutRecord (decision before mask): " << decisionBeforeMask;
1038  }
1039  triggerAlgo.setGtlResult(algorithmResult);
1040  // conditions in algorithm
1042  handleL1GlobalTriggerObjectMaps->getConditionsInAlgorithm(bit);
1043  if (l1PSet_ == nullptr) {
1044  triggerAlgos->push_back(triggerAlgo);
1045  continue;
1046  }
1047  if (!l1PSet_->exists(algoName)) {
1048  if (firstInRun_) {
1049  LogError("l1ObjectMap") << "L1 physics algorithm name '" << algoName
1050  << "' not available in ParameterSet registry\n"
1051  << "Skipping conditions for this algorithm in this run";
1052  } else {
1053  LogInfo("l1ObjectMap") << "L1 physics algorithm name '" << algoName
1054  << "' not available in ParameterSet registry\n"
1055  << "Skipping conditions for this algorithm in this event";
1056  }
1057  triggerAlgos->push_back(triggerAlgo);
1058  continue;
1059  }
1060  std::vector<std::string> conditionNames(l1PSet_->getParameter<std::vector<std::string> >(algoName));
1061 
1062  for (unsigned iT = 0; iT < conditionNames.size(); ++iT) {
1063  size_t key(triggerConditions->size());
1064  for (size_t iC = 0; iC < triggerConditions->size(); ++iC) {
1065  if (conditionNames.at(iT) == triggerConditions->at(iC).name()) {
1066  key = iC;
1067  break;
1068  }
1069  }
1070  if (key == triggerConditions->size()) {
1071  if (iT >= conditions.nConditions()) {
1072  LogError("l1CondMap") << "More condition names from ParameterSet registry than the "
1073  << conditions.nConditions() << " conditions in L1GlobalTriggerObjectMaps\n"
1074  << "Skipping condition " << conditionNames.at(iT) << " in algorithm " << algoName;
1075  break;
1076  }
1077  TriggerCondition triggerCond(conditionNames[iT], conditions.getConditionResult(iT));
1078  if (l1GtConditions.find(triggerCond.name()) != l1GtConditions.end()) {
1079  triggerCond.setCategory(l1GtConditions[triggerCond.name()]->condCategory());
1080  triggerCond.setType(l1GtConditions[triggerCond.name()]->condType());
1081  const std::vector<L1GtObject> l1ObjectTypes(l1GtConditions[triggerCond.name()]->objectType());
1082  for (size_t iType = 0; iType < l1ObjectTypes.size(); ++iType) {
1083  triggerCond.addTriggerObjectType(mapObjectTypes[l1ObjectTypes.at(iType)]);
1084  }
1085  // objects in condition
1087  handleL1GlobalTriggerObjectMaps->getCombinationsInCondition(bit, iT);
1088  for (size_t iVV = 0; iVV < combinations.nCombinations(); ++iVV) {
1089  for (size_t iV = 0; iV < combinations.nObjectsPerCombination(); ++iV) {
1090  unsigned objectIndex = combinations.getObjectIndex(iVV, iV);
1091  if (iV >= l1ObjectTypes.size()) {
1092  LogError("l1CondMap") << "Index " << iV << " in combinations vector overshoots size "
1093  << l1ObjectTypes.size() << " of types vector in conditions map\n"
1094  << "Skipping object key in condition " << triggerCond.name();
1095  } else if (l1ObjectTypeMap.find(l1ObjectTypes.at(iV)) != l1ObjectTypeMap.end()) {
1096  if (objectIndex >= l1ObjectTypeMap[l1ObjectTypes.at(iV)].size()) {
1097  LogError("l1CondMap")
1098  << "Index " << objectIndex << " in combination overshoots number "
1099  << l1ObjectTypeMap[l1ObjectTypes.at(iV)].size() << "of according trigger objects\n"
1100  << "Skipping object key in condition " << triggerCond.name();
1101  }
1102  const unsigned objectKey(l1ObjectTypeMap[l1ObjectTypes.at(iV)].at(objectIndex));
1103  triggerCond.addObjectKey(objectKey);
1104  // add current condition and algorithm also to the according stand-alone trigger object
1105  triggerObjectsStandAlone->at(objectKey).addAlgorithmName(
1106  triggerAlgo.name(), (triggerAlgo.decision() && triggerCond.wasAccept()));
1107  triggerObjectsStandAlone->at(objectKey).addConditionName(triggerCond.name());
1108  }
1109  }
1110  }
1111  } else {
1112  LogWarning("l1CondMap") << "L1 conditions '" << triggerCond.name() << "' not found in the L1 menu\n"
1113  << "Remains incomplete";
1114  }
1115  triggerConditions->push_back(triggerCond);
1116  }
1117  triggerAlgo.addConditionKey(key);
1118  }
1119  triggerAlgos->push_back(triggerAlgo);
1120  }
1121  // technical triggers
1122  for (CItAlgo iAlgo = l1GtTechTriggers.begin(); iAlgo != l1GtTechTriggers.end(); ++iAlgo) {
1123  const std::string& algoName(iAlgo->second.algoName());
1124  if (!(iAlgo->second.algoBitNumber() < int(L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers))) {
1125  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' has bit number "
1126  << iAlgo->second.algoBitNumber()
1128  << "Skipping";
1129  continue;
1130  }
1132  int bit;
1133  if (!l1GtUtils.l1AlgoTechTrigBitNumber(algoName, category, bit)) {
1134  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' not found in the L1 menu\n"
1135  << "Skipping";
1136  continue;
1137  }
1138  if (category != L1GtUtils::TechnicalTrigger) {
1139  LogError("l1Algo") << "L1 technical trigger '" << algoName
1140  << "' does not have category 'TechnicalTrigger' from 'L1GtUtils'\n"
1141  << "Skipping";
1142  continue;
1143  }
1144  bool decisionBeforeMask;
1145  bool decisionAfterMask;
1146  int prescale;
1147  int mask;
1148  int error(l1GtUtils.l1Results(iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask));
1149  if (error) {
1150  LogError("l1Algo") << "L1 technical trigger '" << algoName << "' decision has error code " << error
1151  << " from 'L1GtUtils'\n"
1152  << "Skipping";
1153  continue;
1154  }
1155  TriggerAlgorithm triggerAlgo(algoName,
1156  iAlgo->second.algoAlias(),
1157  category == L1GtUtils::TechnicalTrigger,
1158  (unsigned)bit,
1159  (unsigned)prescale,
1160  (bool)mask,
1161  decisionBeforeMask,
1162  decisionAfterMask);
1163  triggerAlgo.setLogicalExpression(iAlgo->second.algoLogicalExpression());
1164  triggerAlgos->push_back(triggerAlgo);
1165  }
1166  }
1167 
1168  // Put L1 algorithms and conditions to event
1169  iEvent.put(std::move(triggerAlgos));
1170  iEvent.put(std::move(triggerConditions));
1171  }
1172 
1174  iEvent.processHistory().getConfigurationForProcess(nameProcess_, config);
1175 
1176  const edm::TriggerNames& names = iEvent.triggerNames(*handleTriggerResults);
1177  for (pat::TriggerObjectStandAlone& obj : *triggerObjectsStandAlone) {
1178  obj.setPSetID(config.parameterSetID());
1179  if (packPathNames_)
1180  obj.packPathNames(names);
1181  if (packLabels_)
1182  obj.packFilterLabels(iEvent, *handleTriggerResults);
1183  }
1184 
1185  // Put (finally) stand-alone trigger objects to event
1186  iEvent.put(std::move(triggerObjectsStandAlone));
1187 
1188  firstInRun_ = false;
1189 }
#define LogDebug(id)
unsigned int set() const
low-level const accessors for data members
unsigned int size() const
number of trigger paths in trigger table
const std::string & collectionTagEncoded(trigger::size_type index) const
Definition: TriggerEvent.h:106
T getParameter(std::string const &) const
unsigned char getObjectIndex(unsigned combination, unsigned object) const
std::vector< L1Seed > L1SeedCollection
Collection of L1Seed.
Definition: TriggerPath.h:34
bool wasrun() const
Was at least one path run?
bool saveTags(const std::string &module) const
Is module an L3 filter (ie, tracked saveTags=true)
std::pair< std::vector< std::pair< std::string, int > >, int > prescaleValuesInDetail(const edm::Event &iEvent, const edm::EventSetup &iSetup, const std::string &trigger)
Analysis-level L1 trigger algorithm class.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const std::string moduleType(const std::string &module) const
C++ class name of module.
int id() const
getters
Definition: TriggerObject.h:51
Definition: L1GtObject.h:38
trigger::size_type sizeFilters() const
Definition: TriggerEvent.h:146
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > l1GlobalTriggerObjectMapsToken_
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
enum start value shifted to 81 so as to avoid clashes with PDG codes
float phi() const
Definition: TriggerObject.h:54
std::map< std::string, L1GtCondition * > ConditionMap
map containing the conditions
Definition: L1GtObject.h:35
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
Definition: L1GtUtils.cc:329
static const unsigned int NumberTechnicalTriggers
TriggerCategory
Definition: L1GtUtils.h:96
bool accept() const
Has at least one path accepted the event?
const std::vector< std::string > & triggerNames() const
names of trigger paths
const Keys & filterKeys(trigger::size_type index) const
Definition: TriggerEvent.h:118
The single EDProduct containing the HLT Prescale Table.
trigger::size_type filterIndex(const edm::InputTag &filterTag) const
find index of filter in data-member vector from filter tag
Definition: TriggerEvent.h:132
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: config.py:1
Strings::size_type size() const
Definition: TriggerNames.cc:31
float eta() const
Definition: TriggerObject.h:53
const std::vector< ConditionMap > & gtConditionMap() const
get / set / build the condition maps
const std::map< std::string, std::vector< unsigned int > > & prescaleTable() const
uint16_t size_type
bool isRealData() const
Definition: EventBase.h:62
const std::string names[nVars_]
std::string encode() const
Definition: InputTag.cc:159
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
bool algorithmExists(int algorithmBitNumber) const
Returns true if there is an entry for this algorithm bit number.
const Keys & collectionKeys() const
Definition: TriggerEvent.h:100
Definition: HeavyIon.h:7
void put(edm::Event &evt, double value, const char *instanceName)
AlgorithmMap::const_iterator CItAlgo
iterators through map containing the algorithms
const std::vector< std::string > & saveTagsModules(unsigned int trigger) const
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:21
U second(std::pair< T, U > const &p)
Analysis-level HLTrigger filter class.
Definition: TriggerFilter.h:33
std::vector< std::string > exludeCollections_
const Vids & filterIds(trigger::size_type index) const
Definition: TriggerEvent.h:117
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
unsigned int moduleIndex(unsigned int trigger, const std::string &module) const
slot position of module on trigger path (0 to size-1)
edm::ParameterSetID const & namesParameterSetID() const
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 TriggerObjectCollection & getObjects() const
Definition: TriggerEvent.h:101
const std::vector< std::string > & labels() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
unsigned int index(const unsigned int i) const
Get index (slot position) of module giving the decision of the ith path.
std::string filterLabel(trigger::size_type index) const
Definition: TriggerEvent.h:112
bool error() const
Has any path encountered an error (exception)
const int l1Results(const edm::Event &iEvent, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
Definition: L1GtUtils.cc:624
static const unsigned int NumberPhysTriggers
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
edm::InputTag tagL1GlobalTriggerObjectMaps_
const edm::InputTag filterTag(trigger::size_type index) const
Definition: TriggerEvent.h:108
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
L1GtUtils const & l1GtUtils() const
void setCategory(L1GtConditionCategory category)
Set the condition category.
CombinationsInCondition getCombinationsInCondition(int algorithmBitNumber, unsigned conditionNumber) const
Definition: L1GtObject.h:29
trigger::size_type sizeObjects() const
Definition: TriggerEvent.h:145
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:22
std::vector< size_type > Keys
trigger::size_type sizeCollections() const
other
Definition: TriggerEvent.h:144
const std::vector< std::string > & prescaleLabels() const
low-level data member access
HLTConfigProvider const & hltConfigProvider() const
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
T get() const
Definition: EventSetup.h:73
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:23
const AlgorithmMap & gtAlgorithmMap() const
get / set the algorithm map (by name)
unsigned int prescaleSize() const
ConditionsInAlgorithm getConditionsInAlgorithm(int algorithmBitNumber) const
const AlgorithmMap & gtTechnicalTriggerMap() const
get / set the technical trigger map
float mass() const
Definition: TriggerObject.h:55
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
Definition: TriggerObject.h:82
bool algorithmResult(int algorithmBitNumber) const
Returns whether an algorithm trigger passed or failed.
static std::string const triggerPaths
Definition: EdmProvDump.cc:46
const std::map< std::string, std::vector< unsigned int > > & table() const
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:265
edm::InputTag tagL1ExtraNoIsoEG_
std::vector< int > Vids
def move(src, dest)
Definition: eostools.py:511
HLTPrescaleProvider hltPrescaleProvider_
Analysis-level trigger object class (stand-alone)
edm::ParameterSet * l1PSet_

Member Data Documentation

bool pat::PATTriggerProducer::addL1Algos_
private

Definition at line 72 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::addPathModuleLabels_
private

Definition at line 115 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::autoProcessName_
private

Definition at line 67 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraCenJet_
private

Definition at line 94 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraETM_
private

Definition at line 97 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraForJet_
private

Definition at line 95 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraHTM_
private

Definition at line 98 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraIsoEG_
private

Definition at line 93 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraMu_
private

Definition at line 91 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraNoIsoEG_
private

Definition at line 92 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraTauJet_
private

Definition at line 96 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

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

Definition at line 116 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::firstInRun_
private

Definition at line 69 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

bool pat::PATTriggerProducer::hltConfigInit_
private

Definition at line 103 of file PATTriggerProducer.h.

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

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

Definition at line 108 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

HLTPrescaleProvider pat::PATTriggerProducer::hltPrescaleProvider_
private

Definition at line 102 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

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

Definition at line 112 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 114 of file PATTriggerProducer.h.

Referenced by beginLuminosityBlock(), and produce().

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

Definition at line 111 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 113 of file PATTriggerProducer.h.

Referenced by beginLuminosityBlock(), and beginRun().

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

Definition at line 110 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 82 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 88 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 84 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 90 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 80 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 76 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 78 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 86 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 74 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

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

Definition at line 71 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

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

Definition at line 109 of file PATTriggerProducer.h.

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

bool pat::PATTriggerProducer::mainBxOnly_
private

Definition at line 99 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

ModuleLabelToPathAndFlags pat::PATTriggerProducer::moduleLabelToPathAndFlags_
private

Definition at line 147 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

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

Definition at line 66 of file PATTriggerProducer.h.

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

bool pat::PATTriggerProducer::onlyStandAlone_
private

Definition at line 68 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::packLabels_
private

Definition at line 118 of file PATTriggerProducer.h.

Referenced by produce().

bool pat::PATTriggerProducer::packPathNames_
private

Definition at line 117 of file PATTriggerProducer.h.

Referenced by produce().

bool pat::PATTriggerProducer::packPrescales_
private

Definition at line 119 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::saveL1Refs_
private

Definition at line 100 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

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

Definition at line 81 of file PATTriggerProducer.h.

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

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

Definition at line 87 of file PATTriggerProducer.h.

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

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

Definition at line 83 of file PATTriggerProducer.h.

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

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

Definition at line 89 of file PATTriggerProducer.h.

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

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

Definition at line 79 of file PATTriggerProducer.h.

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

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

Definition at line 75 of file PATTriggerProducer.h.

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

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

Definition at line 77 of file PATTriggerProducer.h.

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

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

Definition at line 85 of file PATTriggerProducer.h.

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

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

Definition at line 73 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

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

Definition at line 106 of file PATTriggerProducer.h.

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

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

Definition at line 104 of file PATTriggerProducer.h.

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

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

Definition at line 107 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 105 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().