CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  ModuleLabelToPathAndFlags
 

Public Member Functions

 PATTriggerProducer (const edm::ParameterSet &iConfig)
 
 ~PATTriggerProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void beginLuminosityBlock (const edm::LuminosityBlock &iLuminosityBlock, const edm::EventSetup &iSetup) override
 
virtual void beginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 
virtual 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_
 
HLTConfigProvider hltConfig_
 
bool hltConfigInit_
 
std::string hltPrescaleLabel_
 
edm::GetterOfProducts
< trigger::HLTPrescaleTable
hltPrescaleTableEventGetter_
 
trigger::HLTPrescaleTable hltPrescaleTableLumi_
 
edm::GetterOfProducts
< trigger::HLTPrescaleTable
hltPrescaleTableLumiGetter_
 
trigger::HLTPrescaleTable hltPrescaleTableRun_
 
edm::GetterOfProducts
< trigger::HLTPrescaleTable
hltPrescaleTableRunGetter_
 
edm::GetterOfProducts
< l1extra::L1JetParticleCollection
l1ExtraCenJetGetter_
 
edm::GetterOfProducts
< l1extra::L1EtMissParticleCollection
l1ExtraETMGetter_
 
edm::GetterOfProducts
< l1extra::L1JetParticleCollection
l1ExtraForJetGetter_
 
edm::GetterOfProducts
< l1extra::L1EtMissParticleCollection
l1ExtraHTMGetter_
 
edm::GetterOfProducts
< l1extra::L1EmParticleCollection
l1ExtraIsoEGGetter_
 
edm::GetterOfProducts
< l1extra::L1MuonParticleCollection
l1ExtraMuGetter_
 
edm::GetterOfProducts
< l1extra::L1EmParticleCollection
l1ExtraNoIsoEGGetter_
 
edm::GetterOfProducts
< l1extra::L1JetParticleCollection
l1ExtraTauJetGetter_
 
edm::EDGetTokenT
< L1GlobalTriggerObjectMaps
l1GlobalTriggerObjectMapsToken_
 
L1GtUtils l1GtUtils_
 
edm::ParameterSetl1PSet_
 
std::string labelHltPrescaleTable_
 
bool mainBxOnly_
 
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
 
std::string nameProcess_
 
bool onlyStandAlone_
 
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::TriggerEvent
triggerEventGetter_
 
edm::GetterOfProducts
< edm::TriggerResults
triggerResultsGetter_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 58 of file PATTriggerProducer.h.

Constructor & Destructor Documentation

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

Definition at line 46 of file PATTriggerProducer.cc.

References addL1Algos_, addPathModuleLabels_, autoProcessName_, autoProcessNameL1ExtraCenJet_, autoProcessNameL1ExtraETM_, autoProcessNameL1ExtraForJet_, autoProcessNameL1ExtraHTM_, autoProcessNameL1ExtraIsoEG_, autoProcessNameL1ExtraMu_, autoProcessNameL1ExtraNoIsoEG_, autoProcessNameL1ExtraTauJet_, edm::ProducerBase::callWhenNewProductsRegistered(), edm::ParameterSet::exists(), exludeCollections_, edm::ParameterSet::getParameter(), hltPrescaleLabel_, hltPrescaleTableEventGetter_, hltPrescaleTableLumiGetter_, hltPrescaleTableRunGetter_, edm::InLumi, 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(), saveL1Refs_, AlCaHLTBitMon_QueryRunRegistry::string, tagL1ExtraCenJet_, tagL1ExtraETM_, tagL1ExtraForJet_, tagL1ExtraHTM_, tagL1ExtraIsoEG_, tagL1ExtraMu_, tagL1ExtraNoIsoEG_, tagL1ExtraTauJet_, tagL1GlobalTriggerObjectMaps_, tagTriggerEvent_, tagTriggerResults_, triggerEventGetter_, and triggerResultsGetter_.

46  :
47  nameProcess_( iConfig.getParameter< std::string >( "processName" ) ),
49  onlyStandAlone_( iConfig.getParameter< bool >( "onlyStandAlone" ) ),
50  firstInRun_( true ),
51  // L1 configuration parameters
52  addL1Algos_( false ),
53  tagL1GlobalTriggerObjectMaps_( "l1L1GtObjectMap" ),
54  tagL1ExtraMu_(),
70  mainBxOnly_( true ),
71  saveL1Refs_( false ),
72  // HLTConfigProvider
73  hltConfigInit_( false ),
74  // HLT configuration parameters
75  tagTriggerResults_( "TriggerResults" ),
76  tagTriggerEvent_( "hltTriggerSummaryAOD" ),
81  addPathModuleLabels_( false ),
82  packPathNames_( iConfig.existsAs<bool>("packTriggerPathNames") ? iConfig.getParameter<bool>("packTriggerPathNames") : false ),
83  packPrescales_( iConfig.existsAs<bool>("packTriggerPrescales") ? iConfig.getParameter<bool>("packTriggerPrescales") : true )
84 {
85 
86  // L1 configuration parameters
87  if ( iConfig.exists( "addL1Algos" ) ) addL1Algos_ = iConfig.getParameter< bool >( "addL1Algos" );
88  if ( iConfig.exists( "l1GlobalTriggerObjectMaps" ) ) 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() == "*" ) {
95  }
97  }
98  if ( iConfig.exists( "l1ExtraNoIsoEG" ) ) {
99  tagL1ExtraNoIsoEG_ = iConfig.getParameter< InputTag >( "l1ExtraNoIsoEG" );
100  if ( tagL1ExtraNoIsoEG_.process() == "*" ) {
103  }
105  }
106  if ( iConfig.exists( "l1ExtraIsoEG" ) ) {
107  tagL1ExtraIsoEG_ = iConfig.getParameter< InputTag >( "l1ExtraIsoEG" );
108  if ( tagL1ExtraIsoEG_.process() == "*" ) {
111  }
113  }
114  if ( iConfig.exists( "l1ExtraCenJet" ) ) {
115  tagL1ExtraCenJet_ = iConfig.getParameter< InputTag >( "l1ExtraCenJet" );
116  if ( tagL1ExtraCenJet_.process() == "*" ) {
119  }
121  }
122  if ( iConfig.exists( "l1ExtraForJet" ) ) {
123  tagL1ExtraForJet_ = iConfig.getParameter< InputTag >( "l1ExtraForJet" );
124  if ( tagL1ExtraForJet_.process() == "*" ) {
127  }
129  }
130  if ( iConfig.exists( "l1ExtraTauJet" ) ) {
131  tagL1ExtraTauJet_ = iConfig.getParameter< InputTag >( "l1ExtraTauJet" );
132  if ( tagL1ExtraTauJet_.process() == "*" ) {
135  }
137  }
138  if ( iConfig.exists( "l1ExtraETM" ) ) {
139  tagL1ExtraETM_ = iConfig.getParameter< InputTag >( "l1ExtraETM" );
140  if ( tagL1ExtraETM_.process() == "*" ) {
143  }
145  }
146  if ( iConfig.exists( "l1ExtraHTM" ) ) {
147  tagL1ExtraHTM_ = iConfig.getParameter< InputTag >( "l1ExtraHTM" );
148  if ( tagL1ExtraHTM_.process() == "*" ) {
151  }
153  }
154  if ( iConfig.exists( "mainBxOnly" ) ) mainBxOnly_ = iConfig.getParameter< bool >( "mainBxOnly" );
155  if ( iConfig.exists( "saveL1Refs" ) ) saveL1Refs_ = iConfig.getParameter< bool >( "saveL1Refs" );
156 
157  // HLT configuration parameters
158  if ( iConfig.exists( "triggerResults" ) ) tagTriggerResults_ = iConfig.getParameter< InputTag >( "triggerResults" );
160  if ( iConfig.exists( "triggerEvent" ) ) tagTriggerEvent_ = iConfig.getParameter< InputTag >( "triggerEvent" );
162  if ( iConfig.exists( "hltPrescaleLabel" ) ) hltPrescaleLabel_ = iConfig.getParameter< std::string >( "hltPrescaleLabel" );
163  if ( iConfig.exists( "hltPrescaleTable" ) ) {
164  labelHltPrescaleTable_ = iConfig.getParameter< std::string >( "hltPrescaleTable" );
168  }
169  if ( iConfig.exists( "addPathModuleLabels" ) ) addPathModuleLabels_ = iConfig.getParameter< bool >( "addPathModuleLabels" );
170  exludeCollections_.clear();
171  if ( iConfig.exists( "exludeCollections" ) ) exludeCollections_ = iConfig.getParameter< std::vector< std::string > >( "exludeCollections" );
172 
173  callWhenNewProductsRegistered( [ this, &iConfig ]( BranchDescription const& bd ) {
174  if ( iConfig.exists( "l1ExtraMu" ) ) l1ExtraMuGetter_( bd );
175  if ( iConfig.exists( "l1ExtraNoIsoEG" ) ) l1ExtraNoIsoEGGetter_( bd );
176  if ( iConfig.exists( "l1ExtraIsoEG" ) ) l1ExtraIsoEGGetter_( bd );
177  if ( iConfig.exists( "l1ExtraCenJet" ) ) l1ExtraCenJetGetter_( bd );
178  if ( iConfig.exists( "l1ExtraForJet" ) ) l1ExtraForJetGetter_( bd );
179  if ( iConfig.exists( "l1ExtraTauJet" ) ) l1ExtraTauJetGetter_( bd );
180  if ( iConfig.exists( "l1ExtraETM" ) ) l1ExtraETMGetter_( bd );
181  if ( iConfig.exists( "l1ExtraHTM" ) ) l1ExtraHTMGetter_( bd );
182  triggerResultsGetter_( bd );
183  triggerEventGetter_( bd );
184  if ( iConfig.exists( "hltPrescaleTable" ) ) {
188  }
189  } );
190 
191  if ( ! onlyStandAlone_ ) {
192  produces< TriggerAlgorithmCollection >();
193  produces< TriggerConditionCollection >();
194  produces< TriggerPathCollection >();
195  produces< TriggerFilterCollection >();
196  produces< TriggerObjectCollection >();
197  }
198  if (packPrescales_) {
199  produces< PackedTriggerPrescales >();
200  }
201  produces< TriggerObjectStandAloneCollection >();
202 
203 }
T getParameter(std::string const &) const
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:51
edm::GetterOfProducts< l1extra::L1MuonParticleCollection > l1ExtraMuGetter_
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableEventGetter_
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
edm::GetterOfProducts< trigger::TriggerEvent > triggerEventGetter_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableLumiGetter_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraForJetGetter_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraTauJetGetter_
trigger::HLTPrescaleTable hltPrescaleTableLumi_
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > l1ExtraHTMGetter_
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > l1GlobalTriggerObjectMapsToken_
edm::GetterOfProducts< l1extra::L1EmParticleCollection > l1ExtraNoIsoEGGetter_
edm::GetterOfProducts< l1extra::L1EtMissParticleCollection > l1ExtraETMGetter_
edm::GetterOfProducts< trigger::HLTPrescaleTable > hltPrescaleTableRunGetter_
edm::InputTag tagL1GlobalTriggerObjectMaps_
edm::GetterOfProducts< l1extra::L1EmParticleCollection > l1ExtraIsoEGGetter_
edm::GetterOfProducts< l1extra::L1JetParticleCollection > l1ExtraCenJetGetter_
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
edm::GetterOfProducts< edm::TriggerResults > triggerResultsGetter_
trigger::HLTPrescaleTable hltPrescaleTableRun_
std::vector< std::string > exludeCollections_
std::string const & instance() const
Definition: InputTag.h:43
edm::InputTag tagL1ExtraNoIsoEG_
pat::PATTriggerProducer::~PATTriggerProducer ( )
inline

Definition at line 63 of file PATTriggerProducer.h.

63 {};

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 288 of file PATTriggerProducer.cc.

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

289 {
290 
291  // Terminate, if auto process name determination failed
292  if ( nameProcess_ == "*" ) return;
293 
294  // Extract pre-scales
295  if ( hltConfigInit_ ) {
296  // Start from run
298  // Try lumi product, if configured and available
299  if ( ! labelHltPrescaleTable_.empty() ) {
300  Handle< trigger::HLTPrescaleTable > handleHltPrescaleTable;
301  iLuminosityBlock.getByLabel( InputTag( labelHltPrescaleTable_, "Lumi", nameProcess_ ), handleHltPrescaleTable );
302  if ( handleHltPrescaleTable.isValid() ) {
303  hltPrescaleTableLumi_ = trigger::HLTPrescaleTable( handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table() );
304  }
305  }
306  }
307 
308 }
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::map< std::string, std::vector< unsigned int > > & table() const
const std::vector< std::string > & labels() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
bool isValid() const
Definition: HandleBase.h:76
trigger::HLTPrescaleTable hltPrescaleTableRun_
void PATTriggerProducer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 206 of file PATTriggerProducer.cc.

References autoProcessName_, autoProcessNameL1ExtraCenJet_, autoProcessNameL1ExtraETM_, autoProcessNameL1ExtraForJet_, autoProcessNameL1ExtraHTM_, autoProcessNameL1ExtraIsoEG_, autoProcessNameL1ExtraMu_, autoProcessNameL1ExtraNoIsoEG_, autoProcessNameL1ExtraTauJet_, edm::ParameterSet::exists(), firstInRun_, edm::Run::getByLabel(), hltConfig_, hltConfigInit_, hltPrescaleTableRun_, HLTConfigProvider::init(), pat::PATTriggerProducer::ModuleLabelToPathAndFlags::init(), edm::InputTag::instance(), instance, edm::HandleBase::isValid(), l1PSet_, edm::InputTag::label(), labelHltPrescaleTable_, LogDebug, moduleLabelToPathAndFlags_, nameProcess_, edm::InputTag::process(), edm::processConfiguration, edm::Run::processHistory(), HLTConfigProvider::size(), tagL1ExtraCenJet_, tagL1ExtraETM_, tagL1ExtraForJet_, tagL1ExtraHTM_, tagL1ExtraIsoEG_, tagL1ExtraMu_, tagL1ExtraNoIsoEG_, tagL1ExtraTauJet_, tagTriggerEvent_, and tagTriggerResults_.

207 {
208 
209  // Initialize
210  firstInRun_ = true;
211  l1PSet_ = 0;
212  hltConfigInit_ = false;
213 
214  // Initialize process name
215  if ( autoProcessName_ ) {
216  // reset
217  nameProcess_ = "*";
218  // determine process name from last run TriggerSummaryProducerAOD module in process history of input
219  const ProcessHistory & processHistory( iRun.processHistory() );
221  ParameterSet processPSet;
222  // unbroken loop, which relies on time ordering (accepts the last found entry)
223  for ( ProcessHistory::const_iterator iHist = processHistory.begin(); iHist != processHistory.end(); ++iHist ) {
224  if ( processHistory.getConfigurationForProcess( iHist->processName(), processConfiguration ) &&
225  pset::Registry::instance()->getMapped( processConfiguration.parameterSetID(), processPSet ) &&
226  processPSet.exists( tagTriggerEvent_.label() )
227  ) {
228  nameProcess_ = iHist->processName();
229  LogDebug( "autoProcessName" ) << "HLT process name '" << nameProcess_ << "' discovered";
230  }
231  }
232  // terminate, if nothing is found
233  if ( nameProcess_ == "*" ) {
234  LogError( "autoProcessName" ) << "trigger::TriggerEvent product with label '" << tagTriggerEvent_.label() << "' not produced according to process history of input data\n"
235  << "No trigger information produced";
236  return;
237  }
238  LogInfo( "autoProcessName" ) << "HLT process name' " << nameProcess_ << "' used for PAT trigger information";
239  }
240  // adapt configuration of used input tags
241  if ( tagTriggerResults_.process().empty() || tagTriggerResults_.process() == "*" ) {
243  } else if ( tagTriggerEvent_.process() != nameProcess_ ) {
244  LogWarning( "inputTags" ) << "TriggerResults process name '" << tagTriggerResults_.process() << "' differs from HLT process name '" << nameProcess_ << "'";
245  }
246  if ( tagTriggerEvent_.process().empty() || tagTriggerEvent_.process() == "*" ) {
248  } else if ( tagTriggerEvent_.process() != nameProcess_ ) {
249  LogWarning( "inputTags" ) << "TriggerEvent process name '" << tagTriggerEvent_.process() << "' differs from HLT process name '" << nameProcess_ << "'";
250  }
259 
260  // Initialize HLTConfigProvider
261  bool changed( true );
262  if ( ! hltConfig_.init( iRun, iSetup, nameProcess_, changed ) ) {
263  LogError( "hltConfig" ) << "HLT config extraction error with process name '" << nameProcess_ << "'";
264  } else if ( hltConfig_.size() <= 0 ) {
265  LogError( "hltConfig" ) << "HLT config size error";
266  } else hltConfigInit_ = true;
267 
268  // Update mapping from filter names to path names
270 
271  // Extract pre-scales
272  if ( hltConfigInit_ ) {
273  // Start empty
275  // Try run product, if configured
276  if ( ! labelHltPrescaleTable_.empty() ) {
277  Handle< trigger::HLTPrescaleTable > handleHltPrescaleTable;
278  iRun.getByLabel( InputTag( labelHltPrescaleTable_, "Run", nameProcess_ ), handleHltPrescaleTable );
279  if ( handleHltPrescaleTable.isValid() ) {
280  hltPrescaleTableRun_ = trigger::HLTPrescaleTable( handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table() );
281  }
282  }
283  }
284 
285 }
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
collection_type::const_iterator const_iterator
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:200
HLTConfigProvider hltConfig_
static PFTauRenderPlugin instance
The single EDProduct containing the HLT Prescale Table.
bool exists(std::string const &parameterName) const
checks if a parameter exists
processConfiguration
Definition: Schedule.cc:369
ProcessHistory const & processHistory() const
Definition: Run.cc:108
bool isValid() const
Definition: HandleBase.h:76
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::string const & label() const
Definition: InputTag.h:42
std::string const & process() const
Definition: InputTag.h:46
trigger::HLTPrescaleTable hltPrescaleTableRun_
std::string const & instance() const
Definition: InputTag.h:43
edm::InputTag tagL1ExtraNoIsoEG_
edm::ParameterSet * l1PSet_
void PATTriggerProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 311 of file PATTriggerProducer.cc.

References pat::TriggerAlgorithm::addConditionKey(), pat::TriggerObjectStandAlone::addFilterLabel(), addL1Algos_, pat::TriggerFilter::addObjectKey(), addPathModuleLabels_, pat::TriggerObjectStandAlone::addPathName(), pat::TriggerFilter::addTriggerObjectType(), pat::TriggerObject::addTriggerObjectType(), L1GtUtils::AlgorithmTrigger, L1GtTriggerMenu::buildGtConditionMap(), python.rootplot.argparse::category, CenJet, pat::TriggerAlgorithm::decision(), relativeConstraints::empty, edm::InputTag::encode(), relativeConstraints::error, trigger::TriggerObject::eta(), ETM, edm::ParameterSet::exists(), exludeCollections_, firstInRun_, ForJet, edm::EventSetup::get(), edm::Event::getByLabel(), edm::Event::getByToken(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::getConditionResult(), L1GtUtils::getL1GtRunCache(), L1GlobalTriggerObjectMaps::CombinationsInCondition::getObjectIndex(), edm::ParameterSet::getParameter(), L1GtTriggerMenu::gtAlgorithmMap(), L1GtTriggerMenu::gtConditionMap(), L1GtTriggerMenu::gtTechnicalTriggerMap(), pat::TriggerObjectStandAlone::hasCollection(), hltConfig_, hltConfigInit_, HLTConfigProvider::hltL1GTSeeds(), hltPrescaleLabel_, hltPrescaleTableLumi_, HTM, i, trigger::TriggerObject::id(), instance, IsoEG, edm::EventBase::isRealData(), edm::HandleBase::isValid(), combine::key, relativeConstraints::keys, L1GtUtils::l1AlgoTechTrigBitNumber(), l1GlobalTriggerObjectMapsToken_, l1GtUtils_, l1PSet_, L1GtUtils::l1Results(), diffTwoXMLs::label, edm::InputTag::label(), labelHltPrescaleTable_, trigger::HLTPrescaleTable::labels(), LogDebug, mainBxOnly_, trigger::TriggerObject::mass(), HLTConfigProvider::moduleIndex(), HLTConfigProvider::moduleLabel(), moduleLabelToPathAndFlags_, HLTConfigProvider::moduleType(), Mu, n, pat::TriggerAlgorithm::name(), nameProcess_, cscdqm::h::names, L1GlobalTriggerObjectMaps::CombinationsInCondition::nCombinations(), L1GlobalTriggerObjectMaps::ConditionsInAlgorithm::nConditions(), L1GlobalTriggerObjectMaps::CombinationsInCondition::nObjectsPerCombination(), NoIsoEG, L1GlobalTriggerReadoutSetup::NumberPhysTriggers, L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers, getGTfromDQMFile::obj, onlyStandAlone_, packPathNames_, packPrescales_, mergeAndRegister::paths, trigger::TriggerObject::phi(), HLTConfigProvider::prescaleLabels(), HLTConfigProvider::prescaleSet(), HLTConfigProvider::prescaleSize(), HLTConfigProvider::prescaleTable(), HLTConfigProvider::prescaleValue(), 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(), edm::TriggerNames::size(), HLTConfigProvider::size(), AlCaHLTBitMon_QueryRunRegistry::string, trigger::HLTPrescaleTable::table(), tagL1ExtraCenJet_, tagL1ExtraETM_, tagL1ExtraForJet_, tagL1ExtraHTM_, tagL1ExtraIsoEG_, tagL1ExtraMu_, tagL1ExtraNoIsoEG_, tagL1ExtraTauJet_, tagL1GlobalTriggerObjectMaps_, tagTriggerEvent_, tagTriggerResults_, TauJet, L1GtUtils::TechnicalTrigger, JetPDSkim_cfg::triggerConditions, trigger::TriggerL1CenJet, trigger::TriggerL1ETM, trigger::TriggerL1ForJet, trigger::TriggerL1HTM, trigger::TriggerL1IsoEG, trigger::TriggerL1Mu, trigger::TriggerL1NoIsoEG, trigger::TriggerL1TauJet, edm::TriggerNames::triggerName(), HLTConfigProvider::triggerNames(), edm::Event::triggerNames(), triggerPaths, useL1EventSetup(), and useL1GtTriggerMenuLite().

312 {
313 
314  // Terminate, if auto process name determination failed
315  if ( nameProcess_ == "*" ) return;
316 
317  std::auto_ptr< TriggerObjectCollection > triggerObjects( new TriggerObjectCollection() );
318  std::auto_ptr< TriggerObjectStandAloneCollection > triggerObjectsStandAlone( new TriggerObjectStandAloneCollection() );
319  std::auto_ptr< PackedTriggerPrescales > packedPrescales;
320 
321  // HLT
322 
323  // Get and check HLT event data
324  Handle< trigger::TriggerEvent > handleTriggerEvent;
325  iEvent.getByLabel( tagTriggerEvent_, handleTriggerEvent );
326  Handle< TriggerResults > handleTriggerResults;
327  iEvent.getByLabel( tagTriggerResults_, handleTriggerResults );
328  bool goodHlt( hltConfigInit_ );
329  if ( goodHlt ) {
330  if( ! handleTriggerResults.isValid() ) {
331  LogError( "triggerResultsValid" ) << "TriggerResults product with InputTag '" << tagTriggerResults_.encode() << "' not in event\n"
332  << "No HLT information produced";
333  goodHlt = false;
334  } else if ( ! handleTriggerEvent.isValid() ) {
335  LogError( "triggerEventValid" ) << "trigger::TriggerEvent product with InputTag '" << tagTriggerEvent_.encode() << "' not in event\n"
336  << "No HLT information produced";
337  goodHlt = false;
338  }
339  }
340 
341  // Produce HLT paths and determine status of modules
342 
343  if ( goodHlt ) {
344 
345  // Extract pre-scales
346  // Start from lumi
348  // Try event product, if configured and available
349  if ( ! labelHltPrescaleTable_.empty() ) {
350  Handle< trigger::HLTPrescaleTable > handleHltPrescaleTable;
351  iEvent.getByLabel( InputTag( labelHltPrescaleTable_, "Event", nameProcess_ ), handleHltPrescaleTable );
352  if ( handleHltPrescaleTable.isValid() ) {
353  hltPrescaleTable = trigger::HLTPrescaleTable( handleHltPrescaleTable->set(), handleHltPrescaleTable->labels(), handleHltPrescaleTable->table() );
354  }
355  }
356  // Try event setup, if no product
357  if ( hltPrescaleTable.size() == 0 ) {
358  if ( ! labelHltPrescaleTable_.empty() ) {
359  LogWarning( "hltPrescaleInputTag" ) << "HLTPrescaleTable product with label '" << labelHltPrescaleTable_ << "' not found in process" << nameProcess_ << "\n"
360  << "Using default from event setup";
361  }
362  if ( hltConfig_.prescaleSize() > 0 ) {
363  if ( hltConfig_.prescaleSet( iEvent, iSetup ) != -1 ) {
365  LogDebug( "hltPrescaleTable" ) << "HLT prescale table found in event setup";
366  } else {
367  LogWarning( "hltPrescaleSet" ) << "HLTPrescaleTable from event setup has error";
368  }
369  }
370  }
371  unsigned set( hltPrescaleTable.set() );
372  if ( hltPrescaleTable.size() > 0 ) {
373  if ( hltPrescaleLabel_.size() > 0 ) {
374  bool foundPrescaleLabel( false );
375  for ( unsigned iLabel = 0; iLabel < hltPrescaleTable.labels().size(); ++iLabel ) {
376  if ( hltPrescaleTable.labels().at( iLabel ) == hltPrescaleLabel_ ) {
377  set = iLabel;
378  foundPrescaleLabel = true;
379  break;
380  }
381  }
382  if ( ! foundPrescaleLabel ) {
383  LogWarning( "hltPrescaleLabel" ) << "HLT prescale label '" << hltPrescaleLabel_ << "' not in prescale table\n"
384  << "Using default";
385  }
386  }
387  } else if ( iEvent.isRealData() ) {
388  if ( ( labelHltPrescaleTable_.empty() && firstInRun_ ) || ! labelHltPrescaleTable_.empty() ) {
389  LogError( "hltPrescaleTable" ) << "No HLT prescale table found\n"
390  << "Using default empty table with all prescales 1";
391  }
392  }
393 
394  const unsigned sizePaths( hltConfig_.size() );
395  const unsigned sizeFilters( handleTriggerEvent->sizeFilters() );
396  const unsigned sizeObjects( handleTriggerEvent->sizeObjects() );
397 
398  std::map< std::string, int > moduleStates;
399 
400  if ( ! onlyStandAlone_ ) {
401  std::auto_ptr< TriggerPathCollection > triggerPaths( new TriggerPathCollection() );
402  triggerPaths->reserve( sizePaths );
403  const std::vector<std::string> & pathNames = hltConfig_.triggerNames();
404  for ( size_t indexPath = 0; indexPath < sizePaths; ++indexPath ) {
405  const std::string & namePath = pathNames.at( indexPath );
406  unsigned indexLastFilterPathModules( handleTriggerResults->index( indexPath ) + 1 );
407  unsigned indexLastFilterFilters( sizeFilters );
408  while ( indexLastFilterPathModules > 0 ) {
409  --indexLastFilterPathModules;
410  const std::string & labelLastFilterPathModules( hltConfig_.moduleLabel( indexPath, indexLastFilterPathModules ) );
411  indexLastFilterFilters = handleTriggerEvent->filterIndex( InputTag( labelLastFilterPathModules, "", nameProcess_ ) );
412  if ( indexLastFilterFilters < sizeFilters ) {
413  if ( hltConfig_.moduleType( labelLastFilterPathModules ) == "HLTBool" ) continue;
414  break;
415  }
416  }
417  TriggerPath triggerPath( namePath, indexPath, hltConfig_.prescaleValue( set, namePath ), handleTriggerResults->wasrun( indexPath ), handleTriggerResults->accept( indexPath ), handleTriggerResults->error( indexPath ), indexLastFilterPathModules, hltConfig_.saveTagsModules( namePath ).size() );
418  // add module names to path and states' map
419  const unsigned sizeModulesPath( hltConfig_.size( indexPath ) );
420  assert( indexLastFilterPathModules < sizeModulesPath );
421  std::map< unsigned, std::string > indicesModules;
422  for ( size_t iM = 0; iM < sizeModulesPath; ++iM ) {
423  const std::string nameModule( hltConfig_.moduleLabel( indexPath, iM ) );
424  if ( addPathModuleLabels_ ) {
425  triggerPath.addModule( nameModule );
426  }
427  const unsigned indexFilter( handleTriggerEvent->filterIndex( InputTag( nameModule, "", nameProcess_ ) ) );
428  if ( indexFilter < sizeFilters ) {
429  triggerPath.addFilterIndex( indexFilter );
430  }
431  const unsigned slotModule( hltConfig_.moduleIndex( indexPath, nameModule ) );
432  indicesModules.insert( std::pair< unsigned, std::string >( slotModule, nameModule ) );
433  }
434  // add L1 seeds
435  const L1SeedCollection l1Seeds( hltConfig_.hltL1GTSeeds( namePath ) );
436  for ( L1SeedCollection::const_iterator iSeed = l1Seeds.begin(); iSeed != l1Seeds.end(); ++iSeed ) {
437  triggerPath.addL1Seed( *iSeed );
438  }
439  // store path
440  triggerPaths->push_back( triggerPath );
441  // cache module states to be used for the filters
442  for ( std::map< unsigned, std::string >::const_iterator iM = indicesModules.begin(); iM != indicesModules.end(); ++iM ) {
443  if ( iM->first < indexLastFilterPathModules ) {
444  moduleStates[ iM->second ] = 1;
445  } else if ( iM->first == indexLastFilterPathModules ) {
446  moduleStates[ iM->second ] = handleTriggerResults->accept( indexPath );
447  } else if ( moduleStates.find( iM->second ) == moduleStates.end() ) {
448  moduleStates[ iM->second ] = -1;
449  }
450  }
451  }
452  // Put HLT paths to event
453  iEvent.put( triggerPaths );
454  }
455 
456  // Store used trigger objects and their types for HLT filters
457  // (only active filter(s) available from trigger::TriggerEvent)
458 
459  std::multimap< trigger::size_type, int > objectTypes;
460  std::multimap< trigger::size_type, std::string > filterLabels;
461 
462  for ( size_t iF = 0; iF < sizeFilters; ++iF ) {
463  const std::string nameFilter( handleTriggerEvent->filterLabel( iF ) );
464  const trigger::Keys & keys = handleTriggerEvent->filterKeys( iF );
465  const trigger::Vids & types = handleTriggerEvent->filterIds( iF );
466  assert( types.size() == keys.size() );
467  for ( size_t iK = 0; iK < keys.size(); ++iK ) {
468  filterLabels.insert( std::pair< trigger::size_type, std::string >( keys[ iK ], nameFilter ) );
469  objectTypes.insert( std::pair< trigger::size_type, int >( keys[ iK ], types[ iK ] ) );
470  }
471  }
472 
473  // HLT objects
474 
475  triggerObjects->reserve( onlyStandAlone_ ? 0 : sizeObjects );
476  triggerObjectsStandAlone->reserve( sizeObjects );
477 
478  const trigger::Keys & collectionKeys( handleTriggerEvent->collectionKeys() );
479  std::map< trigger::size_type, trigger::size_type > newObjectKeys;
480  for ( size_t iO = 0, iC = 0, nC = handleTriggerEvent->sizeCollections(); iO < sizeObjects && iC < nC; ++iO ) {
481  const trigger::TriggerObject tobj = handleTriggerEvent->getObjects().at( iO );
482  TriggerObject triggerObject( reco::Particle::PolarLorentzVector(tobj.pt(), tobj.eta(), tobj.phi(), tobj.mass()), tobj.id() );
483  // set collection
484  while ( iO >= collectionKeys[ iC ] ) ++iC; // relies on well ordering of trigger objects with respect to the collections
485  triggerObject.setCollection( handleTriggerEvent->collectionTagEncoded( iC ) );
486  // set filter ID
487  typedef std::multimap< trigger::size_type, int >::const_iterator it_type;
488  for (std::pair<it_type,it_type> trange = objectTypes.equal_range(iO);
489  trange.first != trange.second; ++trange.first) {
490  triggerObject.addTriggerObjectType( trange.first->second );
491  }
492 
493  // stand-alone trigger object
494  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
495  // check for excluded collections
496  bool excluded( false );
497  for ( size_t iE = 0; iE < exludeCollections_.size(); ++iE ) {
498  if ( triggerObjectStandAlone.hasCollection( exludeCollections_.at( iE ) ) ) {
499  if ( ! onlyStandAlone_ ) newObjectKeys[ iO ] = trigger::size_type( sizeObjects );
500  excluded = true;
501  break;
502  }
503  }
504  if ( excluded ) continue;
505  typedef std::multimap< trigger::size_type, std::string >::const_iterator it_fl;
506  for (std::pair<it_fl,it_fl> frange = filterLabels.equal_range(iO); frange.first != frange.second; ++frange.first) {
507  triggerObjectStandAlone.addFilterLabel( frange.first->second );
508  const std::vector<ModuleLabelToPathAndFlags::PathAndFlags> & paths = moduleLabelToPathAndFlags_[frange.first->second];
509  for (std::vector<ModuleLabelToPathAndFlags::PathAndFlags>::const_iterator iP = paths.begin(); iP != paths.end(); ++iP) {
510  bool pathFired = handleTriggerResults->wasrun( iP->pathIndex ) && handleTriggerResults->accept( iP->pathIndex );
511  triggerObjectStandAlone.addPathName( iP->pathName, pathFired && iP->lastFilter, pathFired && iP->l3Filter );
512  }
513  }
514 
515  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
516  if ( ! onlyStandAlone_ ) {
517  triggerObjects->push_back( triggerObject );
518  newObjectKeys[ iO ] = trigger::size_type( triggerObjects->size() - 1 );
519  }
520  }
521 
522  // Re-iterate HLT filters and finally produce them in order to account for optionally skipped objects
523  if ( ! onlyStandAlone_ ) {
524  std::auto_ptr< TriggerFilterCollection > triggerFilters( new TriggerFilterCollection() );
525  triggerFilters->reserve( sizeFilters );
526  for ( size_t iF = 0; iF < sizeFilters; ++iF ) {
527  const std::string nameFilter( handleTriggerEvent->filterTag( iF ).label() );
528  const trigger::Keys & keys = handleTriggerEvent->filterKeys( iF ); // not cached
529  const trigger::Vids & types = handleTriggerEvent->filterIds( iF ); // not cached
530  TriggerFilter triggerFilter( nameFilter );
531  // set filter type
532  const std::string typeFilter( hltConfig_.moduleType( nameFilter ) );
533  triggerFilter.setType( typeFilter );
534  triggerFilter.setSaveTags( hltConfig_.saveTags( nameFilter ) );
535  // set keys and trigger object types of used objects
536  for ( size_t iK = 0; iK < keys.size(); ++iK ) { // identical to types.size()
537  // check, if current object is excluded
538  if ( newObjectKeys.find( keys.at( iK ) ) != newObjectKeys.end() ) {
539  if ( newObjectKeys[ keys.at( iK ) ] == sizeObjects ) continue;
540  triggerFilter.addObjectKey( newObjectKeys[ keys.at( iK ) ] );
541  triggerFilter.addTriggerObjectType( types.at( iK ) );
542  } else {
543  LogWarning( "triggerObjectKey" ) << "TriggerFilter '" << nameFilter << "' requests non-existing TriggerObject key " << keys.at( iK ) << "\n"
544  << "Skipping object assignment";
545  }
546  }
547  // set status from path info
548  std::map< std::string, int >::iterator iS( moduleStates.find( nameFilter ) );
549  if ( iS != moduleStates.end() ) {
550  if ( ! triggerFilter.setStatus( iS->second ) ) {
551  triggerFilter.setStatus( -1 ); // FIXME different code for "unvalid status determined" needed?
552  }
553  } else {
554  triggerFilter.setStatus( -1 ); // FIXME different code for "unknown" needed?
555  }
556  // store filter
557  triggerFilters->push_back( triggerFilter );
558  }
559  // put HLT filters to event
560  iEvent.put( triggerFilters );
561  }
562 
563  if (packPrescales_) {
564  packedPrescales.reset(new PackedTriggerPrescales(handleTriggerResults));
565  const edm::TriggerNames & names = iEvent.triggerNames(*handleTriggerResults);
566  for (unsigned int i = 0, n = names.size(); i < n; ++i) {
567  packedPrescales->addPrescaledTrigger(i, hltConfig_.prescaleValue(set, names.triggerName(i)));
568  }
569  iEvent.put( packedPrescales );
570  }
571 
572  } // if ( goodHlt )
573 
574  // L1 objects
575  // (needs to be done after HLT objects, since their x-links with filters rely on their collection keys)
576 
577  // map for assignments of objects to conditions
578  std::map< L1GtObject, std::vector< unsigned > > l1ObjectTypeMap;
579  if ( ! tagL1ExtraMu_.label().empty() ) {
581  iEvent.getByLabel( tagL1ExtraMu_, handleL1ExtraMu );
582  if ( handleL1ExtraMu.isValid() ) {
583  std::vector< unsigned > muKeys;
584  for ( size_t l1Mu = 0; l1Mu < handleL1ExtraMu->size(); ++l1Mu ) {
585  if ( mainBxOnly_ && handleL1ExtraMu->at( l1Mu ).bx() != 0 ) continue;
586  TriggerObject triggerObject;
587  if ( saveL1Refs_ ) {
588  const reco::CandidateBaseRef leafCandRef( l1extra::L1MuonParticleRef( handleL1ExtraMu, l1Mu ) );
589  triggerObject = TriggerObject( leafCandRef );
590  } else {
591  const reco::LeafCandidate leafCandidate( *( handleL1ExtraMu->at( l1Mu ).reco::LeafCandidate::clone() ) );
592  triggerObject = TriggerObject( leafCandidate );
593  }
594  triggerObject.setCollection( tagL1ExtraMu_ );
596  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
597  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
598  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
599  if ( handleL1ExtraMu->at( l1Mu ).bx() == 0 ) muKeys.push_back( triggerObjectsStandAlone->size() - 1 );
600  }
601  l1ObjectTypeMap.insert( std::make_pair( Mu, muKeys ) );
602  } else LogError( "l1ExtraValid" ) << "l1extra::L1MuonParticleCollection product with InputTag '" << tagL1ExtraMu_.encode() << "' not in event";
603  }
604  if ( ! tagL1ExtraNoIsoEG_.label().empty() ) {
605  Handle< l1extra::L1EmParticleCollection > handleL1ExtraNoIsoEG;
606  iEvent.getByLabel( tagL1ExtraNoIsoEG_, handleL1ExtraNoIsoEG );
607  if ( handleL1ExtraNoIsoEG.isValid() ) {
608  std::vector< unsigned > noIsoEGKeys;
609  for ( size_t l1NoIsoEG = 0; l1NoIsoEG < handleL1ExtraNoIsoEG->size(); ++l1NoIsoEG ) {
610  if ( mainBxOnly_ && handleL1ExtraNoIsoEG->at( l1NoIsoEG ).bx() != 0 ) continue;
611  TriggerObject triggerObject;
612  if ( saveL1Refs_ ) {
613  const reco::CandidateBaseRef leafCandRef( l1extra::L1EmParticleRef( handleL1ExtraNoIsoEG, l1NoIsoEG ) );
614  triggerObject = TriggerObject( leafCandRef );
615  } else {
616  const reco::LeafCandidate leafCandidate( *( handleL1ExtraNoIsoEG->at( l1NoIsoEG ).reco::LeafCandidate::clone() ) );
617  triggerObject = TriggerObject( leafCandidate );
618  }
619  triggerObject.setCollection( tagL1ExtraNoIsoEG_ );
621  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
622  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
623  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
624  if ( handleL1ExtraNoIsoEG->at( l1NoIsoEG ).bx() == 0 ) noIsoEGKeys.push_back( triggerObjectsStandAlone->size() - 1 );
625  }
626  l1ObjectTypeMap.insert( std::make_pair( NoIsoEG, noIsoEGKeys ) );
627  } else LogError( "l1ExtraValid" ) << "l1extra::L1EmParticleCollection product with InputTag '" << tagL1ExtraNoIsoEG_.encode() << "' not in event";
628  }
629  if ( ! tagL1ExtraIsoEG_.label().empty() ) {
631  iEvent.getByLabel( tagL1ExtraIsoEG_, handleL1ExtraIsoEG );
632  if ( handleL1ExtraIsoEG.isValid() ) {
633  std::vector< unsigned > isoEGKeys;
634  for ( size_t l1IsoEG = 0; l1IsoEG < handleL1ExtraIsoEG->size(); ++l1IsoEG ) {
635  if ( mainBxOnly_ && handleL1ExtraIsoEG->at( l1IsoEG ).bx() != 0 ) continue;
636  TriggerObject triggerObject;
637  if ( saveL1Refs_ ) {
638  const reco::CandidateBaseRef leafCandRef( l1extra::L1EmParticleRef( handleL1ExtraIsoEG, l1IsoEG ) );
639  triggerObject = TriggerObject( leafCandRef );
640  } else {
641  const reco::LeafCandidate leafCandidate( *( handleL1ExtraIsoEG->at( l1IsoEG ).reco::LeafCandidate::clone() ) );
642  triggerObject = TriggerObject( leafCandidate );
643  }
644  triggerObject.setCollection( tagL1ExtraIsoEG_ );
646  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
647  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
648  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
649  if ( handleL1ExtraIsoEG->at( l1IsoEG ).bx() == 0 ) isoEGKeys.push_back( triggerObjectsStandAlone->size() - 1 );
650  }
651  l1ObjectTypeMap.insert( std::make_pair( IsoEG, isoEGKeys ) );
652  } else LogError( "l1ExtraValid" ) << "l1extra::L1EmParticleCollection product with InputTag '" << tagL1ExtraIsoEG_.encode() << "' not in event";
653  }
654  if ( ! tagL1ExtraCenJet_.label().empty() ) {
655  Handle< l1extra::L1JetParticleCollection > handleL1ExtraCenJet;
656  iEvent.getByLabel( tagL1ExtraCenJet_, handleL1ExtraCenJet );
657  if ( handleL1ExtraCenJet.isValid() ) {
658  std::vector< unsigned > cenJetKeys;
659  for ( size_t l1CenJet = 0; l1CenJet < handleL1ExtraCenJet->size(); ++l1CenJet ) {
660  if ( mainBxOnly_ && handleL1ExtraCenJet->at( l1CenJet ).bx() != 0 ) continue;
661  TriggerObject triggerObject;
662  if ( saveL1Refs_ ) {
663  const reco::CandidateBaseRef leafCandRef( l1extra::L1JetParticleRef( handleL1ExtraCenJet, l1CenJet ) );
664  triggerObject = TriggerObject( leafCandRef );
665  } else {
666  const reco::LeafCandidate leafCandidate( *( handleL1ExtraCenJet->at( l1CenJet ).reco::LeafCandidate::clone() ) );
667  triggerObject = TriggerObject( leafCandidate );
668  }
669  triggerObject.setCollection( tagL1ExtraCenJet_ );
671  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
672  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
673  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
674  if ( handleL1ExtraCenJet->at( l1CenJet ).bx() == 0 ) cenJetKeys.push_back( triggerObjectsStandAlone->size() - 1 );
675  }
676  l1ObjectTypeMap.insert( std::make_pair( CenJet, cenJetKeys ) );
677  } else LogError( "l1ExtraValid" ) << "l1extra::L1JetParticleCollection product with InputTag '" << tagL1ExtraCenJet_.encode() << "' not in event";
678  }
679  if ( ! tagL1ExtraForJet_.label().empty() ) {
680  Handle< l1extra::L1JetParticleCollection > handleL1ExtraForJet;
681  iEvent.getByLabel( tagL1ExtraForJet_, handleL1ExtraForJet );
682  if ( handleL1ExtraForJet.isValid() ) {
683  std::vector< unsigned > forJetKeys;
684  for ( size_t l1ForJet = 0; l1ForJet < handleL1ExtraForJet->size(); ++l1ForJet ) {
685  if ( mainBxOnly_ && handleL1ExtraForJet->at( l1ForJet ).bx() != 0 ) continue;
686  TriggerObject triggerObject;
687  if ( saveL1Refs_ ) {
688  const reco::CandidateBaseRef leafCandRef( l1extra::L1JetParticleRef( handleL1ExtraForJet, l1ForJet ) );
689  triggerObject = TriggerObject( leafCandRef );
690  } else {
691  const reco::LeafCandidate leafCandidate( *( handleL1ExtraForJet->at( l1ForJet ).reco::LeafCandidate::clone() ) );
692  triggerObject = TriggerObject( leafCandidate );
693  }
694  triggerObject.setCollection( tagL1ExtraForJet_ );
696  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
697  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
698  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
699  if ( handleL1ExtraForJet->at( l1ForJet ).bx() == 0 ) forJetKeys.push_back( triggerObjectsStandAlone->size() - 1 );
700  }
701  l1ObjectTypeMap.insert( std::make_pair( ForJet, forJetKeys ) );
702  } else LogError( "l1ExtraValid" ) << "l1extra::L1JetParticleCollection product with InputTag '" << tagL1ExtraForJet_.encode() << "' not in event";
703  }
704  if ( ! tagL1ExtraTauJet_.label().empty() ) {
705  Handle< l1extra::L1JetParticleCollection > handleL1ExtraTauJet;
706  iEvent.getByLabel( tagL1ExtraTauJet_, handleL1ExtraTauJet );
707  if ( handleL1ExtraTauJet.isValid() ) {
708  std::vector< unsigned > tauJetKeys;
709  for ( size_t l1TauJet = 0; l1TauJet < handleL1ExtraTauJet->size(); ++l1TauJet ) {
710  if ( mainBxOnly_ && handleL1ExtraTauJet->at( l1TauJet ).bx() != 0 ) continue;
711  TriggerObject triggerObject;
712  if ( saveL1Refs_ ) {
713  const reco::CandidateBaseRef leafCandRef( l1extra::L1JetParticleRef( handleL1ExtraTauJet, l1TauJet ) );
714  triggerObject = TriggerObject( leafCandRef );
715  } else {
716  const reco::LeafCandidate leafCandidate( *( handleL1ExtraTauJet->at( l1TauJet ).reco::LeafCandidate::clone() ) );
717  triggerObject = TriggerObject( leafCandidate );
718  }
719  triggerObject.setCollection( tagL1ExtraTauJet_ );
721  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
722  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
723  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
724  if ( handleL1ExtraTauJet->at( l1TauJet ).bx() == 0 ) tauJetKeys.push_back( triggerObjectsStandAlone->size() - 1 );
725  }
726  l1ObjectTypeMap.insert( std::make_pair( TauJet, tauJetKeys ) );
727  } else LogError( "l1ExtraValid" ) << "l1extra::L1JetParticleCollection product with InputTag '" << tagL1ExtraTauJet_.encode() << "' not in event";
728  }
729  if ( ! tagL1ExtraETM_ .label().empty()) {
731  iEvent.getByLabel( tagL1ExtraETM_, handleL1ExtraETM );
732  if ( handleL1ExtraETM.isValid() ) {
733  std::vector< unsigned > etmKeys;
734  for ( size_t l1ETM = 0; l1ETM < handleL1ExtraETM->size(); ++l1ETM ) {
735  if ( mainBxOnly_ && handleL1ExtraETM->at( l1ETM ).bx() != 0 ) continue;
736  TriggerObject triggerObject;
737  if ( saveL1Refs_ ) {
738  const reco::CandidateBaseRef leafCandRef( l1extra::L1EtMissParticleRef( handleL1ExtraETM, l1ETM ) );
739  triggerObject = TriggerObject( leafCandRef );
740  } else {
741  const reco::LeafCandidate leafCandidate( *( handleL1ExtraETM->at( l1ETM ).reco::LeafCandidate::clone() ) );
742  triggerObject = TriggerObject( leafCandidate );
743  }
744  triggerObject.setCollection( tagL1ExtraETM_ );
746  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
747  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
748  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
749  if ( handleL1ExtraETM->at( l1ETM ).bx() == 0 ) etmKeys.push_back( triggerObjectsStandAlone->size() - 1 );
750  }
751  l1ObjectTypeMap.insert( std::make_pair( ETM, etmKeys ) );
752  } else LogError( "l1ExtraValid" ) << "l1extra::L1EtMissParticleCollection product with InputTag '" << tagL1ExtraETM_.encode() << "' not in event";
753  }
754  if ( ! tagL1ExtraHTM_.label().empty() ) {
756  iEvent.getByLabel( tagL1ExtraHTM_, handleL1ExtraHTM );
757  if ( handleL1ExtraHTM.isValid() ) {
758  std::vector< unsigned > htmKeys;
759  for ( size_t l1HTM = 0; l1HTM < handleL1ExtraHTM->size(); ++l1HTM ) {
760  if ( mainBxOnly_ && handleL1ExtraHTM->at( l1HTM ).bx() != 0 ) continue;
761  TriggerObject triggerObject;
762  if ( saveL1Refs_ ) {
763  const reco::CandidateBaseRef leafCandRef( l1extra::L1EtMissParticleRef( handleL1ExtraHTM, l1HTM ) );
764  triggerObject = TriggerObject( leafCandRef );
765  } else {
766  const reco::LeafCandidate leafCandidate( *( handleL1ExtraHTM->at( l1HTM ).reco::LeafCandidate::clone() ) );
767  triggerObject = TriggerObject( leafCandidate );
768  }
769  triggerObject.setCollection( tagL1ExtraHTM_ );
771  if ( ! onlyStandAlone_ ) triggerObjects->push_back( triggerObject );
772  TriggerObjectStandAlone triggerObjectStandAlone( triggerObject );
773  triggerObjectsStandAlone->push_back( triggerObjectStandAlone );
774  if ( handleL1ExtraHTM->at( l1HTM ).bx() == 0 ) htmKeys.push_back( triggerObjectsStandAlone->size() - 1 );
775  }
776  l1ObjectTypeMap.insert( std::make_pair( HTM, htmKeys ) );
777  } else LogError( "l1ExtraValid" ) << "l1extra::L1EtMissParticleCollection product with InputTag '" << tagL1ExtraHTM_.encode() << "' not in event";
778  }
779 
780  // Put trigger objects to event
781  if ( ! onlyStandAlone_ ) iEvent.put( triggerObjects );
782 
783  // L1 algorithms
784  if ( ! onlyStandAlone_ ) {
785  std::auto_ptr< TriggerAlgorithmCollection > triggerAlgos( new TriggerAlgorithmCollection() );
786  std::auto_ptr< TriggerConditionCollection > triggerConditions( new TriggerConditionCollection() );
787  if ( addL1Algos_ ) {
788  // create trigger object types transalation map (yes, it's ugly!)
789  std::map< L1GtObject, trigger::TriggerObjectType > mapObjectTypes;
790  mapObjectTypes.insert( std::make_pair( Mu , trigger::TriggerL1Mu ) );
791  mapObjectTypes.insert( std::make_pair( NoIsoEG, trigger::TriggerL1NoIsoEG ) );
792  mapObjectTypes.insert( std::make_pair( IsoEG , trigger::TriggerL1IsoEG ) );
793  mapObjectTypes.insert( std::make_pair( CenJet , trigger::TriggerL1CenJet ) );
794  mapObjectTypes.insert( std::make_pair( ForJet , trigger::TriggerL1ForJet ) );
795  mapObjectTypes.insert( std::make_pair( TauJet , trigger::TriggerL1TauJet ) );
796  mapObjectTypes.insert( std::make_pair( ETM , trigger::TriggerL1ETM ) );
797  mapObjectTypes.insert( std::make_pair( HTM , trigger::TriggerL1HTM ) );
798  // get and cache L1 menu
800  ESHandle< L1GtTriggerMenu > handleL1GtTriggerMenu;
801  iSetup.get< L1GtTriggerMenuRcd >().get( handleL1GtTriggerMenu );
802  L1GtTriggerMenu l1GtTriggerMenu( *handleL1GtTriggerMenu );
803  const AlgorithmMap l1GtAlgorithms( l1GtTriggerMenu.gtAlgorithmMap() );
804  const AlgorithmMap l1GtTechTriggers( l1GtTriggerMenu.gtTechnicalTriggerMap() );
805  l1GtTriggerMenu.buildGtConditionMap();
806  const std::vector< ConditionMap > l1GtConditionsVector( l1GtTriggerMenu.gtConditionMap() );
807  // cache conditions in one single condition map
808  ConditionMap l1GtConditions;
809  for ( size_t iCv = 0; iCv < l1GtConditionsVector.size(); ++iCv ) {
810  l1GtConditions.insert( l1GtConditionsVector.at( iCv ).begin(), l1GtConditionsVector.at( iCv ).end() );
811  }
812  triggerAlgos->reserve( l1GtAlgorithms.size() + l1GtTechTriggers.size() );
813  Handle< L1GlobalTriggerObjectMaps > handleL1GlobalTriggerObjectMaps;
814  iEvent.getByToken( l1GlobalTriggerObjectMapsToken_, handleL1GlobalTriggerObjectMaps );
815  if( ! handleL1GlobalTriggerObjectMaps.isValid() ) {
816  LogError( "l1ObjectMap" ) << "L1GlobalTriggerObjectMaps product with InputTag '" << tagL1GlobalTriggerObjectMaps_.encode() << "' not in event\n"
817  << "No L1 objects and GTL results available for physics algorithms";
818  }
819  handleL1GlobalTriggerObjectMaps->consistencyCheck();
820  if ( firstInRun_ ) {
821  l1PSet_ = ( ParameterSet* )( pset::Registry::instance()->getMapped(handleL1GlobalTriggerObjectMaps->namesParameterSetID()) );
822  if (l1PSet_ == 0) {
823  LogError( "l1ObjectMap" ) << "ParameterSet registry not available\n"
824  << "Skipping conditions for all L1 physics algorithm names in this run";
825  }
826  } else {
827  if (l1PSet_ == 0) {
828  LogInfo( "l1ObjectMap" ) << "ParameterSet registry not available\n"
829  << "Skipping conditions for all L1 physics algorithm names in this event";
830  }
831  }
832  // physics algorithms
833  for ( CItAlgo iAlgo = l1GtAlgorithms.begin(); iAlgo != l1GtAlgorithms.end(); ++iAlgo ) {
834  const std::string & algoName( iAlgo->second.algoName() );
835  if ( ! ( iAlgo->second.algoBitNumber() < int( L1GlobalTriggerReadoutSetup::NumberPhysTriggers ) ) ) {
836  LogError( "l1Algo" ) << "L1 physics algorithm '" << algoName << "' has bit number " << iAlgo->second.algoBitNumber() << " >= " << L1GlobalTriggerReadoutSetup::NumberPhysTriggers << "\n"
837  << "Skipping";
838  continue;
839  }
841  int bit;
842  if ( ! l1GtUtils_.l1AlgoTechTrigBitNumber( algoName, category, bit ) ) {
843  LogError( "l1Algo" ) << "L1 physics algorithm '" << algoName << "' not found in the L1 menu\n"
844  << "Skipping";
845  continue;
846  }
847  if ( category != L1GtUtils::AlgorithmTrigger ) {
848  LogError( "l1Algo" ) << "L1 physics algorithm '" << algoName << "' does not have category 'AlgorithmTrigger' from 'L1GtUtils'\n"
849  << "Skipping";
850  continue;
851  }
852  bool decisionBeforeMask;
853  bool decisionAfterMask;
854  int prescale;
855  int mask;
856  int error( l1GtUtils_.l1Results( iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask ) );
857  if ( error ) {
858  LogError( "l1Algo" ) << "L1 physics algorithm '" << algoName << "' decision has error code " << error << " from 'L1GtUtils'\n"
859  << "Skipping";
860  continue;
861  }
862  TriggerAlgorithm triggerAlgo( algoName, iAlgo->second.algoAlias(), category == L1GtUtils::TechnicalTrigger, (unsigned)bit, (unsigned)prescale, (bool)mask, decisionBeforeMask, decisionAfterMask );
863  triggerAlgo.setLogicalExpression( iAlgo->second.algoLogicalExpression() );
864  // GTL result and used conditions in physics algorithm
865  if( ! handleL1GlobalTriggerObjectMaps.isValid() ) {
866  triggerAlgos->push_back( triggerAlgo );
867  continue; // LogWarning already earlier (before loop)
868  }
869  if ( ! handleL1GlobalTriggerObjectMaps->algorithmExists(bit)) {
870  LogError( "l1ObjectMap" ) << "L1 physics algorithm '" << algoName << "' is missing in L1GlobalTriggerObjectMaps\n"
871  << "Skipping conditions and GTL result";
872  triggerAlgos->push_back( triggerAlgo );
873  continue;
874  }
875  bool algorithmResult = handleL1GlobalTriggerObjectMaps->algorithmResult(bit);
876 // if ( ( algorithmResult != decisionBeforeMask ) && ( decisionBeforeMask == true || prescale == 1 ) ) {
877  if ( ( algorithmResult != decisionBeforeMask ) && ( decisionBeforeMask == true ) ) { // FIXME: understand the difference for un-prescaled algos 118, 119, 123
878  LogInfo( "l1ObjectMap" ) << "L1 physics algorithm '" << algoName << "' with different decisions in\n"
879  << "L1GlobalTriggerObjectMaps (GTL result) : " << algorithmResult << "\n"
880  << "L1GlobalTriggerReadoutRecord (decision before mask): " << decisionBeforeMask;
881  }
882  triggerAlgo.setGtlResult( algorithmResult );
883  // conditions in algorithm
884  L1GlobalTriggerObjectMaps::ConditionsInAlgorithm conditions = handleL1GlobalTriggerObjectMaps->getConditionsInAlgorithm(bit);
885  if (l1PSet_ == 0) {
886  triggerAlgos->push_back( triggerAlgo );
887  continue;
888  }
889  if (!l1PSet_->exists(algoName)) {
890  if ( firstInRun_ ) {
891  LogError( "l1ObjectMap" ) << "L1 physics algorithm name '" << algoName << "' not available in ParameterSet registry\n"
892  << "Skipping conditions for this algorithm in this run";
893  } else {
894  LogInfo( "l1ObjectMap" ) << "L1 physics algorithm name '" << algoName << "' not available in ParameterSet registry\n"
895  << "Skipping conditions for this algorithm in this event";
896  }
897  triggerAlgos->push_back( triggerAlgo );
898  continue;
899  }
900  std::vector<std::string> conditionNames( l1PSet_->getParameter<std::vector<std::string> >(algoName) );
901 
902  for ( unsigned iT = 0; iT < conditionNames.size(); ++iT ) {
903  size_t key( triggerConditions->size() );
904  for ( size_t iC = 0; iC < triggerConditions->size(); ++iC ) {
905  if ( conditionNames.at(iT) == triggerConditions->at( iC ).name() ) {
906  key = iC;
907  break;
908  }
909  }
910  if ( key == triggerConditions->size() ) {
911  if ( iT >= conditions.nConditions() ) {
912  LogError( "l1CondMap" ) << "More condition names from ParameterSet registry than the " << conditions.nConditions() << " conditions in L1GlobalTriggerObjectMaps\n"
913  << "Skipping condition " << conditionNames.at(iT) << " in algorithm " << algoName;
914  break;
915  }
916  TriggerCondition triggerCond( conditionNames[iT], conditions.getConditionResult(iT) );
917  if ( l1GtConditions.find( triggerCond.name() ) != l1GtConditions.end() ) {
918  triggerCond.setCategory( l1GtConditions[ triggerCond.name() ]->condCategory() );
919  triggerCond.setType( l1GtConditions[ triggerCond.name() ]->condType() );
920  const std::vector< L1GtObject > l1ObjectTypes( l1GtConditions[ triggerCond.name() ]->objectType() );
921  for ( size_t iType = 0 ; iType < l1ObjectTypes.size(); ++iType ) {
922  triggerCond.addTriggerObjectType( mapObjectTypes[ l1ObjectTypes.at( iType ) ] );
923  }
924  // objects in condition
925  L1GlobalTriggerObjectMaps::CombinationsInCondition combinations = handleL1GlobalTriggerObjectMaps->getCombinationsInCondition(bit, iT);
926  for ( size_t iVV = 0; iVV < combinations.nCombinations(); ++iVV ) {
927  for ( size_t iV = 0; iV < combinations.nObjectsPerCombination(); ++iV ) {
928 
929  unsigned objectIndex = combinations.getObjectIndex(iVV, iV);
930  if ( iV >= l1ObjectTypes.size() ) {
931  LogError( "l1CondMap" ) << "Index " << iV << " in combinations vector overshoots size " << l1ObjectTypes.size() << " of types vector in conditions map\n"
932  << "Skipping object key in condition " << triggerCond.name();
933  } else if ( l1ObjectTypeMap.find( l1ObjectTypes.at( iV ) ) != l1ObjectTypeMap.end() ) {
934  if ( objectIndex >= l1ObjectTypeMap[ l1ObjectTypes.at( iV ) ].size() ) {
935  LogError( "l1CondMap" ) << "Index " << objectIndex << " in combination overshoots number " << l1ObjectTypeMap[ l1ObjectTypes.at( iV ) ].size() << "of according trigger objects\n"
936  << "Skipping object key in condition " << triggerCond.name();
937  }
938  const unsigned objectKey( l1ObjectTypeMap[ l1ObjectTypes.at( iV ) ].at( objectIndex ) );
939  triggerCond.addObjectKey( objectKey );
940  // add current condition and algorithm also to the according stand-alone trigger object
941  triggerObjectsStandAlone->at( objectKey ).addAlgorithmName( triggerAlgo.name(), ( triggerAlgo.decision() && triggerCond.wasAccept() ) );
942  triggerObjectsStandAlone->at( objectKey ).addConditionName( triggerCond.name() );
943  }
944  }
945  }
946  } else {
947  LogWarning( "l1CondMap" ) << "L1 conditions '" << triggerCond.name() << "' not found in the L1 menu\n"
948  << "Remains incomplete";
949  }
950  triggerConditions->push_back( triggerCond );
951  }
952  triggerAlgo.addConditionKey( key );
953  }
954  triggerAlgos->push_back( triggerAlgo );
955  }
956  // technical triggers
957  for ( CItAlgo iAlgo = l1GtTechTriggers.begin(); iAlgo != l1GtTechTriggers.end(); ++iAlgo ) {
958  const std::string & algoName( iAlgo->second.algoName() );
959  if ( ! ( iAlgo->second.algoBitNumber() < int( L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers ) ) ) {
960  LogError( "l1Algo" ) << "L1 technical trigger '" << algoName << "' has bit number " << iAlgo->second.algoBitNumber() << " >= " << L1GlobalTriggerReadoutSetup::NumberTechnicalTriggers << "\n"
961  << "Skipping";
962  continue;
963  }
965  int bit;
966  if ( ! l1GtUtils_.l1AlgoTechTrigBitNumber( algoName, category, bit ) ) {
967  LogError( "l1Algo" ) << "L1 technical trigger '" << algoName << "' not found in the L1 menu\n"
968  << "Skipping";
969  continue;
970  }
971  if ( category != L1GtUtils::TechnicalTrigger ) {
972  LogError( "l1Algo" ) << "L1 technical trigger '" << algoName << "' does not have category 'TechnicalTrigger' from 'L1GtUtils'\n"
973  << "Skipping";
974  continue;
975  }
976  bool decisionBeforeMask;
977  bool decisionAfterMask;
978  int prescale;
979  int mask;
980  int error( l1GtUtils_.l1Results( iEvent, algoName, decisionBeforeMask, decisionAfterMask, prescale, mask ) );
981  if ( error ) {
982  LogError( "l1Algo" ) << "L1 technical trigger '" << algoName << "' decision has error code " << error << " from 'L1GtUtils'\n"
983  << "Skipping";
984  continue;
985  }
986  TriggerAlgorithm triggerAlgo( algoName, iAlgo->second.algoAlias(), category == L1GtUtils::TechnicalTrigger, (unsigned)bit, (unsigned)prescale, (bool)mask, decisionBeforeMask, decisionAfterMask );
987  triggerAlgo.setLogicalExpression( iAlgo->second.algoLogicalExpression() );
988  triggerAlgos->push_back( triggerAlgo );
989  }
990  }
991 
992  // Put L1 algorithms and conditions to event
993  iEvent.put( triggerAlgos );
994  iEvent.put( triggerConditions );
995  }
996 
997 
998  if (packPathNames_) {
999  const edm::TriggerNames & names = iEvent.triggerNames(*handleTriggerResults);
1000  for (pat::TriggerObjectStandAlone &obj : *triggerObjectsStandAlone) {
1001  obj.packPathNames(names);
1002  }
1003  }
1004  // Put (finally) stand-alone trigger objects to event
1005  iEvent.put( triggerObjectsStandAlone );
1006 
1007  firstInRun_ = false;
1008 
1009 }
#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
T getParameter(std::string const &) const
unsigned char getObjectIndex(unsigned combination, unsigned object) const
int i
Definition: DBlmapReader.cc:9
bool saveTags(const std::string &module) const
Is module an L3 filter (ie, tracked saveTags=true)
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:204
Analysis-level L1 trigger algorithm class.
const int l1Results(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, bool &decisionBeforeMask, bool &decisionAfterMask, int &prescaleFactor, int &triggerMask) const
Definition: L1GtUtils.cc:885
const std::string moduleType(const std::string &module) const
C++ class name of module.
int id() const
getters
Definition: TriggerObject.h:55
Definition: L1GtObject.h:39
static const bool useL1EventSetup(true)
static const HistoName names[]
HLTConfigProvider hltConfig_
static PFTauRenderPlugin instance
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
enum start value shifted to 81 so as to avoid clashes with PDG codes
float phi() const
Definition: TriggerObject.h:58
std::map< std::string, L1GtCondition * > ConditionMap
map containing the conditions
Definition: L1GtObject.h:36
tuple triggerConditions
std::map< std::string, L1GtAlgorithm > AlgorithmMap
map containing the algorithms
const bool l1AlgoTechTrigBitNumber(const std::string &nameAlgoTechTrig, TriggerCategory &trigCategory, int &bitNumber) const
Definition: L1GtUtils.cc:548
static const unsigned int NumberTechnicalTriggers
TriggerCategory
Definition: L1GtUtils.h:58
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
const std::vector< std::string > & triggerNames() const
names of trigger paths
The single EDProduct containing the HLT Prescale Table.
bool exists(std::string const &parameterName) const
checks if a parameter exists
Strings::size_type size() const
Definition: TriggerNames.cc:39
float eta() const
Definition: TriggerObject.h:57
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
const std::map< std::string, std::vector< unsigned int > > & prescaleTable() const
Analysis-level trigger object class.
Definition: TriggerObject.h:47
uint16_t size_type
bool isRealData() const
Definition: EventBase.h:60
const std::map< std::string, std::vector< unsigned int > > & table() const
std::string encode() const
Definition: InputTag.cc:164
const std::string & moduleLabel(unsigned int trigger, unsigned int module) const
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:22
U second(std::pair< T, U > const &p)
std::vector< TriggerAlgorithm > TriggerAlgorithmCollection
Collection of TriggerAlgorithm.
Analysis-level HLTrigger filter class.
Definition: TriggerFilter.h:35
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)
void setCollection(const std::string &collName)
Methods.
Definition: TriggerObject.h:84
Analysis-level L1 trigger condition class.
Analysis-level HLTrigger path class.
Definition: TriggerPath.h:39
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
const std::vector< std::string > & labels() const
trigger::HLTPrescaleTable hltPrescaleTableLumi_
static const unsigned int NumberPhysTriggers
bool isValid() const
Definition: HandleBase.h:76
edm::EDGetTokenT< L1GlobalTriggerObjectMaps > l1GlobalTriggerObjectMapsToken_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
edm::InputTag tagL1GlobalTriggerObjectMaps_
static const bool useL1GtTriggerMenuLite(false)
std::vector< TriggerFilter > TriggerFilterCollection
Collection of TriggerFilter.
void getL1GtRunCache(const edm::Run &, const edm::EventSetup &, const bool, const bool, const edm::InputTag &)
get all the run-constant quantities for L1 trigger and cache them
Definition: L1GtUtils.cc:311
ModuleLabelToPathAndFlags moduleLabelToPathAndFlags_
void setCategory(L1GtConditionCategory category)
Set the condition category.
int prescaleSet(const edm::Event &iEvent, const edm::EventSetup &iSetup) const
Definition: L1GtObject.h:30
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
std::vector< size_type > Keys
const T & get() const
Definition: EventSetup.h:55
const std::vector< std::string > & prescaleLabels() const
low-level data member access
std::string const & label() const
Definition: InputTag.h:42
list key
Definition: combine.py:13
std::vector< TriggerObject > TriggerObjectCollection
Collection of TriggerObject.
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Particle.h:29
unsigned int prescaleSize() const
std::vector< TriggerCondition > TriggerConditionCollection
Collection of TriggerCondition.
std::vector< std::string > exludeCollections_
std::vector< L1Seed > L1SeedCollection
Collection of L1Seed.
Definition: TriggerPath.h:37
float mass() const
Definition: TriggerObject.h:59
if(conf.exists("allCellsPositionCalc"))
void addTriggerObjectType(trigger::TriggerObjectType triggerObjectType)
Add a new trigger object type identifier.
Definition: TriggerObject.h:87
static std::string const triggerPaths
Definition: EdmProvDump.cc:42
std::vector< TriggerPath > TriggerPathCollection
Collection of TriggerPath.
Definition: TriggerPath.h:153
edm::InputTag tagL1ExtraNoIsoEG_
std::vector< int > Vids
Analysis-level trigger object class (stand-alone)
edm::ParameterSet * l1PSet_

Member Data Documentation

bool pat::PATTriggerProducer::addL1Algos_
private

Definition at line 78 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::addPathModuleLabels_
private

Definition at line 121 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::autoProcessName_
private

Definition at line 72 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraCenJet_
private

Definition at line 100 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraETM_
private

Definition at line 103 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraForJet_
private

Definition at line 101 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraHTM_
private

Definition at line 104 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraIsoEG_
private

Definition at line 99 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraMu_
private

Definition at line 97 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraNoIsoEG_
private

Definition at line 98 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

bool pat::PATTriggerProducer::autoProcessNameL1ExtraTauJet_
private

Definition at line 102 of file PATTriggerProducer.h.

Referenced by beginRun(), and PATTriggerProducer().

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

Definition at line 122 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::firstInRun_
private

Definition at line 74 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

HLTConfigProvider pat::PATTriggerProducer::hltConfig_
private

Definition at line 108 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

bool pat::PATTriggerProducer::hltConfigInit_
private

Definition at line 109 of file PATTriggerProducer.h.

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

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

Definition at line 114 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

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

Definition at line 118 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 120 of file PATTriggerProducer.h.

Referenced by beginLuminosityBlock(), and produce().

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

Definition at line 117 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 119 of file PATTriggerProducer.h.

Referenced by beginLuminosityBlock(), and beginRun().

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

Definition at line 116 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 88 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 94 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 90 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 96 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 86 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 82 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 84 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 92 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 80 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

L1GtUtils pat::PATTriggerProducer::l1GtUtils_
private

Definition at line 76 of file PATTriggerProducer.h.

Referenced by produce().

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

Definition at line 77 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

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

Definition at line 115 of file PATTriggerProducer.h.

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

bool pat::PATTriggerProducer::mainBxOnly_
private

Definition at line 105 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

ModuleLabelToPathAndFlags pat::PATTriggerProducer::moduleLabelToPathAndFlags_
private

Definition at line 149 of file PATTriggerProducer.h.

Referenced by beginRun(), and produce().

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

Definition at line 71 of file PATTriggerProducer.h.

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

bool pat::PATTriggerProducer::onlyStandAlone_
private

Definition at line 73 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::packPathNames_
private

Definition at line 123 of file PATTriggerProducer.h.

Referenced by produce().

bool pat::PATTriggerProducer::packPrescales_
private

Definition at line 124 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

bool pat::PATTriggerProducer::saveL1Refs_
private

Definition at line 106 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

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

Definition at line 87 of file PATTriggerProducer.h.

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

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

Definition at line 93 of file PATTriggerProducer.h.

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

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

Definition at line 89 of file PATTriggerProducer.h.

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

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

Definition at line 95 of file PATTriggerProducer.h.

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

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

Definition at line 85 of file PATTriggerProducer.h.

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

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

Definition at line 81 of file PATTriggerProducer.h.

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

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

Definition at line 83 of file PATTriggerProducer.h.

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

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

Definition at line 91 of file PATTriggerProducer.h.

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

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

Definition at line 79 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer(), and produce().

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

Definition at line 112 of file PATTriggerProducer.h.

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

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

Definition at line 110 of file PATTriggerProducer.h.

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

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

Definition at line 113 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().

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

Definition at line 111 of file PATTriggerProducer.h.

Referenced by PATTriggerProducer().