CMS 3D CMS Logo

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

Produces the central entry point to full PAT trigger information. More...

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

Inheritance diagram for pat::PATTriggerEventProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PATTriggerEventProducer (const edm::ParameterSet &iConfig)
 
 ~PATTriggerEventProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginLuminosityBlock (const edm::LuminosityBlock &iLumi, 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 autoProcessName_
 
edm::ConditionsInLumiBlock condLumi_
 
edm::ConditionsInRunBlock condRun_
 
bool gtCondLumiInit_
 
bool gtCondRunInit_
 
HLTConfigProvider hltConfig_
 
bool hltConfigInit_
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordl1GtToken_
 
std::string nameProcess_
 
edm::InputTag tagCondGt_
 
edm::EDGetTokenT< edm::ConditionsInEventBlocktagCondGtEventToken_
 
edm::EDGetTokenT< edm::ConditionsInLumiBlocktagCondGtLumiToken_
 
edm::EDGetTokenT< edm::ConditionsInRunBlocktagCondGtRunToken_
 
edm::InputTag tagL1Gt_
 
std::vector< edm::InputTagtagsTriggerMatcher_
 
edm::InputTag tagTriggerEvent_
 
edm::InputTag tagTriggerProducer_
 
edm::InputTag tagTriggerResults_
 
edm::EDGetTokenT< TriggerAlgorithmCollectiontriggerAlgorithmCollectionToken_
 
edm::EDGetTokenT< TriggerConditionCollectiontriggerConditionCollectionToken_
 
edm::EDGetTokenT< TriggerFilterCollectiontriggerFilterCollectionToken_
 
std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > triggerMatcherTokens_
 
edm::EDGetTokenT< TriggerObjectCollectiontriggerObjectCollectionToken_
 
edm::EDGetTokenT< TriggerPathCollectiontriggerPathCollectionToken_
 
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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 central entry point to full PAT trigger information.

This producer extract general trigger and conditions information from

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

Author
Volker Adler
Version
Id
PATTriggerEventProducer.h,v 1.11 2010/11/27 15:16:20 vadler Exp

Definition at line 50 of file PATTriggerEventProducer.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file PATTriggerEventProducer.cc.

References autoProcessName_, edm::ProducerBase::callWhenNewProductsRegistered(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::InputTag::instance(), l1GtToken_, edm::InputTag::label(), edm::stream::EDProducerBase::moduleDescription(), nameProcess_, edm::ModuleDescription::processName(), edm::BranchDescription::processName(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, tagCondGt_, tagCondGtEventToken_, tagCondGtLumiToken_, tagCondGtRunToken_, tagL1Gt_, tagsTriggerMatcher_, tagTriggerEvent_, tagTriggerProducer_, tagTriggerResults_, triggerAlgorithmCollectionToken_, triggerConditionCollectionToken_, triggerFilterCollectionToken_, triggerMatcherTokens_, triggerObjectCollectionToken_, triggerPathCollectionToken_, triggerResultsGetter_, and edm::vector_transform().

29  :
30  nameProcess_( iConfig.getParameter< std::string >( "processName" ) ),
32  tagTriggerProducer_( "patTrigger" ),
34  // L1 configuration parameters
35  tagL1Gt_(),
36  // HLTConfigProvider
37  hltConfigInit_( false ),
38  // HLT configuration parameters
39  tagTriggerResults_( "TriggerResults" ),
40  tagTriggerEvent_( "hltTriggerSummaryAOD" ),
41  // Conditions configuration parameters
42  tagCondGt_(),
43  // Conditions
44  condRun_(),
45  condLumi_(),
46  gtCondRunInit_( false ),
47  gtCondLumiInit_( false )
48 {
49 
50  if ( iConfig.exists( "triggerResults" ) ) tagTriggerResults_ = iConfig.getParameter< InputTag >( "triggerResults" );
52  if ( iConfig.exists( "triggerEvent" ) ) tagTriggerEvent_ = iConfig.getParameter< InputTag >( "triggerEvent" );
53  if ( iConfig.exists( "patTriggerProducer" ) ) tagTriggerProducer_ = iConfig.getParameter< InputTag >( "patTriggerProducer" );
54  triggerAlgorithmCollectionToken_ = mayConsume< TriggerAlgorithmCollection >( tagTriggerProducer_ );
55  triggerConditionCollectionToken_ = mayConsume< TriggerConditionCollection >( tagTriggerProducer_ );
56  triggerPathCollectionToken_ = mayConsume< TriggerPathCollection >( tagTriggerProducer_ );
57  triggerFilterCollectionToken_ = mayConsume< TriggerFilterCollection >( tagTriggerProducer_ );
58  triggerObjectCollectionToken_ = mayConsume< TriggerObjectCollection >( tagTriggerProducer_ );
59  if ( iConfig.exists( "condGtTag" ) ) {
60  tagCondGt_ = iConfig.getParameter< InputTag >( "condGtTag" );
61  tagCondGtRunToken_ = mayConsume< ConditionsInRunBlock, InRun >( tagCondGt_ );
62  tagCondGtLumiToken_ = mayConsume< ConditionsInLumiBlock, InLumi >( tagCondGt_ );
63  tagCondGtEventToken_ = mayConsume< ConditionsInEventBlock >( tagCondGt_ );
64  }
65  if ( iConfig.exists( "l1GtTag" ) ) tagL1Gt_ = iConfig.getParameter< InputTag >( "l1GtTag" );
66  l1GtToken_ = mayConsume< L1GlobalTriggerReadoutRecord >( tagL1Gt_ );
67  if ( iConfig.exists( "patTriggerMatches" ) ) tagsTriggerMatcher_ = iConfig.getParameter< std::vector< InputTag > >( "patTriggerMatches" );
68  triggerMatcherTokens_ = vector_transform( tagsTriggerMatcher_, [this](InputTag const & tag) { return mayConsume< TriggerObjectStandAloneMatch >( tag ); } );
69 
70  callWhenNewProductsRegistered( [ this, &iConfig ]( BranchDescription const& bd ) {
71  if(not ( this->autoProcessName_ and bd.processName()==this->moduleDescription().processName()) ) {
73  }
74  } );
75 
76  for ( size_t iMatch = 0; iMatch < tagsTriggerMatcher_.size(); ++iMatch ) {
77  produces< TriggerObjectMatch >( tagsTriggerMatcher_.at( iMatch ).label() );
78  }
79  produces< TriggerEvent >();
80 
81 }
T getParameter(std::string const &) const
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:76
edm::EDGetTokenT< TriggerConditionCollection > triggerConditionCollectionToken_
std::string const & processName() const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string const & processName() const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
edm::EDGetTokenT< edm::ConditionsInLumiBlock > tagCondGtLumiToken_
edm::GetterOfProducts< edm::TriggerResults > triggerResultsGetter_
edm::EDGetTokenT< TriggerObjectCollection > triggerObjectCollectionToken_
std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > triggerMatcherTokens_
std::vector< edm::InputTag > tagsTriggerMatcher_
ModuleDescription const & moduleDescription() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > l1GtToken_
edm::ConditionsInRunBlock condRun_
edm::EDGetTokenT< edm::ConditionsInRunBlock > tagCondGtRunToken_
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< edm::ConditionsInEventBlock > tagCondGtEventToken_
edm::ConditionsInLumiBlock condLumi_
std::string const & instance() const
Definition: InputTag.h:37
edm::EDGetTokenT< TriggerFilterCollection > triggerFilterCollectionToken_
edm::EDGetTokenT< TriggerPathCollection > triggerPathCollectionToken_
edm::EDGetTokenT< TriggerAlgorithmCollection > triggerAlgorithmCollectionToken_
pat::PATTriggerEventProducer::~PATTriggerEventProducer ( )
inlineoverride

Definition at line 55 of file PATTriggerEventProducer.h.

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

55 {};

Member Function Documentation

void PATTriggerEventProducer::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 148 of file PATTriggerEventProducer.cc.

References condLumi_, edm::InputTag::encode(), edm::LuminosityBlock::getByToken(), gtCondLumiInit_, edm::HandleBase::isValid(), edm::InputTag::label(), nameProcess_, tagCondGt_, and tagCondGtLumiToken_.

Referenced by ~PATTriggerEventProducer().

149 {
150 
151  // Terminate, if auto process name determination failed
152  if ( nameProcess_ == "*" ) return;
153 
154  gtCondLumiInit_ = false;
155  if ( ! tagCondGt_.label().empty() ) {
156  Handle< ConditionsInLumiBlock > condLumiBlock;
157  iLuminosityBlock.getByToken( tagCondGtLumiToken_, condLumiBlock );
158  if ( condLumiBlock.isValid() ) {
159  condLumi_ = *condLumiBlock;
160  gtCondLumiInit_ = true;
161  } else {
162  LogError( "conditionsInEdm" ) << "ConditionsInLumiBlock product with InputTag '" << tagCondGt_.encode() << "' not in lumi";
163  }
164  }
165 
166 }
edm::EDGetTokenT< edm::ConditionsInLumiBlock > tagCondGtLumiToken_
std::string encode() const
Definition: InputTag.cc:166
bool isValid() const
Definition: HandleBase.h:74
std::string const & label() const
Definition: InputTag.h:36
edm::ConditionsInLumiBlock condLumi_
void PATTriggerEventProducer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 84 of file PATTriggerEventProducer.cc.

References autoProcessName_, condRun_, edm::InputTag::encode(), edm::ParameterSet::exists(), edm::Run::getByToken(), gtCondRunInit_, hltConfig_, hltConfigInit_, HLTConfigProvider::init(), edm::InputTag::instance(), instance, edm::HandleBase::isValid(), edm::InputTag::label(), LogDebug, nameProcess_, edm::InputTag::process(), edm::Run::processHistory(), HLTConfigProvider::size(), tagCondGt_, tagCondGtRunToken_, tagTriggerEvent_, and tagTriggerResults_.

Referenced by ~PATTriggerEventProducer().

85 {
86 
87  // Initialize process name
88  if ( autoProcessName_ ) {
89  // reset
90  nameProcess_ = "*";
91  // determine process name from last run TriggerSummaryProducerAOD module in process history of input
92  const ProcessHistory & processHistory( iRun.processHistory() );
93  ProcessConfiguration processConfiguration;
94  ParameterSet processPSet;
95  // unbroken loop, which relies on time ordering (accepts the last found entry)
96  for ( ProcessHistory::const_iterator iHist = processHistory.begin(); iHist != processHistory.end(); ++iHist ) {
97  if ( processHistory.getConfigurationForProcess( iHist->processName(), processConfiguration ) &&
98  pset::Registry::instance()->getMapped( processConfiguration.parameterSetID(), processPSet ) &&
99  processPSet.exists( tagTriggerEvent_.label() )
100  ) {
101  nameProcess_ = iHist->processName();
102  LogDebug( "autoProcessName" ) << "HLT process name '" << nameProcess_ << "' discovered";
103  }
104  }
105  // terminate, if nothing is found
106  if ( nameProcess_ == "*" ) {
107  LogError( "autoProcessName" ) << "trigger::TriggerEvent product with label '" << tagTriggerEvent_.label() << "' not produced according to process history of input data\n"
108  << "No trigger information produced.";
109  return;
110  }
111  LogInfo( "autoProcessName" ) << "HLT process name " << nameProcess_ << " used for PAT trigger information";
112  }
113  // adapt configuration of used input tags
114  if ( tagTriggerResults_.process().empty() || tagTriggerResults_.process() == "*" ) {
116  } else if ( tagTriggerEvent_.process() != nameProcess_ ) {
117  LogWarning( "triggerResultsTag" ) << "TriggerResults process name '" << tagTriggerResults_.process() << "' differs from HLT process name '" << nameProcess_ << "'";
118  }
119  if ( tagTriggerEvent_.process().empty() || tagTriggerEvent_.process() == "*" ) {
121  } else if ( tagTriggerEvent_.process() != nameProcess_ ) {
122  LogWarning( "triggerEventTag" ) << "TriggerEvent process name '" << tagTriggerEvent_.process() << "' differs from HLT process name '" << nameProcess_ << "'";
123  }
124 
125  gtCondRunInit_ = false;
126  if ( ! tagCondGt_.label().empty() ) {
127  Handle< ConditionsInRunBlock > condRunBlock;
128  iRun.getByToken( tagCondGtRunToken_, condRunBlock );
129  if ( condRunBlock.isValid() ) {
130  condRun_ = *condRunBlock;
131  gtCondRunInit_ = true;
132  } else {
133  LogError( "conditionsInEdm" ) << "ConditionsInRunBlock product with InputTag '" << tagCondGt_.encode() << "' not in run";
134  }
135  }
136 
137  // Initialize HLTConfigProvider
138  hltConfigInit_ = false;
139  bool changed( true );
140  if ( ! hltConfig_.init( iRun, iSetup, nameProcess_, changed ) ) {
141  LogError( "hltConfigExtraction" ) << "HLT config extraction error with process name '" << nameProcess_ << "'";
142  } else if ( hltConfig_.size() <= 0 ) {
143  LogError( "hltConfigSize" ) << "HLT config size error";
144  } else hltConfigInit_ = true;
145 
146 }
#define LogDebug(id)
unsigned int size() const
number of trigger paths in trigger table
collection_type::const_iterator const_iterator
static PFTauRenderPlugin instance
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string encode() const
Definition: InputTag.cc:166
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Run.h:287
ProcessHistory const & processHistory() const
Definition: Run.cc:120
bool isValid() const
Definition: HandleBase.h:74
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
edm::ConditionsInRunBlock condRun_
edm::EDGetTokenT< edm::ConditionsInRunBlock > tagCondGtRunToken_
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
std::string const & instance() const
Definition: InputTag.h:37
void PATTriggerEventProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 169 of file PATTriggerEventProducer.cc.

References edm::HLTGlobalStatus::accept(), edm::ConditionsInRunBlock::BAvgCurrent, edm::ConditionsInRunBlock::beamMode, edm::ConditionsInRunBlock::beamMomentum, edm::ConditionsInRunBlock::BStartCurrent, edm::ConditionsInEventBlock::bstMasterStatus, edm::ConditionsInRunBlock::BStopCurrent, condLumi_, condRun_, DEFINE_FWK_MODULE, edm::InputTag::encode(), edm::AssociativeIterator< KeyRefType, AssociativeCollection, ItemGetter >::end(), edm::HLTGlobalStatus::error(), edm::EventSetup::get(), edm::Event::get(), edm::Event::getByLabel(), edm::Event::getByToken(), gtCondLumiInit_, gtCondRunInit_, L1GlobalTriggerReadoutRecord::gtFdlWord(), L1GtTriggerMenu::gtTriggerMenuName(), hltConfig_, hltConfigInit_, edm::EventBase::isRealData(), edm::HandleBase::isValid(), l1GtToken_, edm::InputTag::label(), edm::ConditionsInRunBlock::lhcFillNumber, eostools::move(), nameProcess_, L1GtFdlWord::physicsDeclared(), edm::Event::put(), AlCaHLTBitMon_QueryRunRegistry::string, HLTConfigProvider::tableName(), tagCondGt_, tagCondGtEventToken_, tagL1Gt_, tagsTriggerMatcher_, tagTriggerProducer_, tagTriggerResults_, edm::ConditionsInLumiBlock::totalIntensityBeam1, edm::ConditionsInLumiBlock::totalIntensityBeam2, triggerAlgorithmCollectionToken_, triggerConditionCollectionToken_, triggerFilterCollectionToken_, triggerMatcherTokens_, triggerObjectCollectionToken_, triggerPathCollectionToken_, edm::ConditionsInEventBlock::turnCountNumber, and edm::HLTGlobalStatus::wasrun().

Referenced by ~PATTriggerEventProducer().

170 {
171 
172  // Terminate, if auto process name determination failed
173  if ( nameProcess_ == "*" ) return;
174 
175  if ( ! hltConfigInit_ ) return;
176 
177  ESHandle< L1GtTriggerMenu > handleL1GtTriggerMenu;
178  iSetup.get< L1GtTriggerMenuRcd >().get( handleL1GtTriggerMenu );
179  Handle< TriggerResults > handleTriggerResults;
180  iEvent.getByLabel( tagTriggerResults_, handleTriggerResults );
181 // iEvent.getByToken( triggerResultsToken_, handleTriggerResults );
182  if ( ! handleTriggerResults.isValid() ) {
183  LogError( "triggerResultsValid" ) << "TriggerResults product with InputTag '" << tagTriggerResults_.encode() << "' not in event\n"
184  << "No trigger information produced";
185  return;
186  }
187  Handle< TriggerAlgorithmCollection > handleTriggerAlgorithms;
188  iEvent.getByToken( triggerAlgorithmCollectionToken_, handleTriggerAlgorithms );
189  Handle< TriggerConditionCollection > handleTriggerConditions;
190  iEvent.getByToken( triggerConditionCollectionToken_, handleTriggerConditions );
191  Handle< TriggerPathCollection > handleTriggerPaths;
192  iEvent.getByToken( triggerPathCollectionToken_, handleTriggerPaths );
193  Handle< TriggerFilterCollection > handleTriggerFilters;
194  iEvent.getByToken( triggerFilterCollectionToken_, handleTriggerFilters );
195  Handle< TriggerObjectCollection > handleTriggerObjects;
196  iEvent.getByToken( triggerObjectCollectionToken_, handleTriggerObjects );
197 
198  bool physDecl( false );
199  if ( iEvent.isRealData() && ! tagL1Gt_.label().empty() ) {
200  Handle< L1GlobalTriggerReadoutRecord > handleL1GlobalTriggerReadoutRecord;
201  iEvent.getByToken( l1GtToken_, handleL1GlobalTriggerReadoutRecord );
202  if ( handleL1GlobalTriggerReadoutRecord.isValid() ) {
203  L1GtFdlWord fdlWord = handleL1GlobalTriggerReadoutRecord->gtFdlWord();
204  if ( fdlWord.physicsDeclared() == 1 ) {
205  physDecl = true;
206  }
207  } else {
208  LogError( "l1GlobalTriggerReadoutRecordValid" ) << "L1GlobalTriggerReadoutRecord product with InputTag '" << tagL1Gt_.encode() << "' not in event";
209  }
210  } else {
211  physDecl = true;
212  }
213 
214 
215  // produce trigger event
216 
217  auto triggerEvent = std::make_unique<TriggerEvent>( handleL1GtTriggerMenu->gtTriggerMenuName(), std::string( hltConfig_.tableName() ), handleTriggerResults->wasrun(), handleTriggerResults->accept(), handleTriggerResults->error(), physDecl );
218  // set product references to trigger collections
219  if ( handleTriggerAlgorithms.isValid() ) {
220  triggerEvent->setAlgorithms( handleTriggerAlgorithms );
221  } else {
222  LogError( "triggerAlgorithmsValid" ) << "pat::TriggerAlgorithmCollection product with InputTag '" << tagTriggerProducer_.encode() << "' not in event";
223  }
224  if ( handleTriggerConditions.isValid() ) {
225  triggerEvent->setConditions( handleTriggerConditions );
226  } else {
227  LogError( "triggerConditionsValid" ) << "pat::TriggerConditionCollection product with InputTag '" << tagTriggerProducer_.encode() << "' not in event";
228  }
229  if ( handleTriggerPaths.isValid() ) {
230  triggerEvent->setPaths( handleTriggerPaths );
231  } else {
232  LogError( "triggerPathsValid" ) << "pat::TriggerPathCollection product with InputTag '" << tagTriggerProducer_.encode() << "' not in event";
233  }
234  if ( handleTriggerFilters.isValid() ) {
235  triggerEvent->setFilters( handleTriggerFilters );
236  } else {
237  LogError( "triggerFiltersValid" ) << "pat::TriggerFilterCollection product with InputTag '" << tagTriggerProducer_.encode() << "' not in event";
238  }
239  if ( handleTriggerObjects.isValid() ) {
240  triggerEvent->setObjects( handleTriggerObjects );
241  } else {
242  LogError( "triggerObjectsValid" ) << "pat::TriggerObjectCollection product with InputTag '" << tagTriggerProducer_.encode() << "' not in event";
243  }
244  if ( gtCondRunInit_ ) {
245  triggerEvent->setLhcFill( condRun_.lhcFillNumber );
246  triggerEvent->setBeamMode( condRun_.beamMode );
247  triggerEvent->setBeamMomentum( condRun_.beamMomentum );
248  triggerEvent->setBCurrentStart( condRun_.BStartCurrent );
249  triggerEvent->setBCurrentStop( condRun_.BStopCurrent );
250  triggerEvent->setBCurrentAvg( condRun_.BAvgCurrent );
251  }
252  if ( gtCondLumiInit_ ) {
253  triggerEvent->setIntensityBeam1( condLumi_.totalIntensityBeam1 );
254  triggerEvent->setIntensityBeam2( condLumi_.totalIntensityBeam2 );
255  }
256  if ( ! tagCondGt_.label().empty() ) {
257  Handle< ConditionsInEventBlock > condEventBlock;
258  iEvent.getByToken( tagCondGtEventToken_, condEventBlock );
259  if ( condEventBlock.isValid() ) {
260  triggerEvent->setBstMasterStatus( condEventBlock->bstMasterStatus );
261  triggerEvent->setTurnCount( condEventBlock->turnCountNumber );
262  } else {
263  LogError( "conditionsInEdm" ) << "ConditionsInEventBlock product with InputTag '" << tagCondGt_.encode() << "' not in event";
264  }
265  }
266 
267  // produce trigger match association and set references
268  if ( handleTriggerObjects.isValid() ) {
269  for ( size_t iMatch = 0; iMatch < tagsTriggerMatcher_.size(); ++iMatch ) {
270  const std::string labelTriggerObjectMatcher( tagsTriggerMatcher_.at( iMatch ).label() );
271  // copy trigger match association using TriggerObjectStandAlone to those using TriggerObject
272  // relying on the fact, that only one candidate collection is present in the association
273  Handle< TriggerObjectStandAloneMatch > handleTriggerObjectStandAloneMatch;
274  iEvent.getByToken( triggerMatcherTokens_.at( iMatch ), handleTriggerObjectStandAloneMatch );
275  if ( ! handleTriggerObjectStandAloneMatch.isValid() ) {
276  LogError( "triggerMatchValid" ) << "pat::TriggerObjectStandAloneMatch product with InputTag '" << labelTriggerObjectMatcher << "' not in event";
277  continue;
278  }
279  AssociativeIterator< reco::CandidateBaseRef, TriggerObjectStandAloneMatch > it( *handleTriggerObjectStandAloneMatch, EdmEventItemGetter< reco::CandidateBaseRef >( iEvent ) ), itEnd( it.end() );
280  Handle< reco::CandidateView > handleCands;
281  if ( it != itEnd ) iEvent.get( it->first.id(), handleCands );
282  std::vector< int > indices;
283  while ( it != itEnd ) {
284  indices.push_back( it->second.key() );
285  ++it;
286  }
287  auto triggerObjectMatch = std::make_unique<TriggerObjectMatch>(handleTriggerObjects);
288  TriggerObjectMatch::Filler matchFiller( *triggerObjectMatch );
289  if ( handleCands.isValid() ) {
290  matchFiller.insert( handleCands, indices.begin(), indices.end() );
291  }
292  matchFiller.fill();
293  OrphanHandle< TriggerObjectMatch > handleTriggerObjectMatch( iEvent.put(std::move(triggerObjectMatch), labelTriggerObjectMatcher ) );
294  // set product reference to trigger match association
295  if ( ! handleTriggerObjectMatch.isValid() ) {
296  LogError( "triggerMatchValid" ) << "pat::TriggerObjectMatch product with InputTag '" << labelTriggerObjectMatcher << "' not in event";
297  continue;
298  }
299  if ( ! ( triggerEvent->addObjectMatchResult( handleTriggerObjectMatch, labelTriggerObjectMatcher ) ) ) {
300  LogWarning( "triggerObjectMatchReplication" ) << "pat::TriggerEvent contains already a pat::TriggerObjectMatch from matcher module '" << labelTriggerObjectMatcher << "'";
301  }
302  }
303  }
304 
305  iEvent.put(std::move(triggerEvent) );
306 
307 }
const std::string & gtTriggerMenuName() const
bool wasrun() const
Was at least one path run?
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
edm::EDGetTokenT< TriggerConditionCollection > triggerConditionCollectionToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
bool accept() const
Has at least one path accepted the event?
boost::uint32_t lhcFillNumber
boost::uint32_t totalIntensityBeam1
const std::string & tableName() const
HLT ConfDB table name.
bool isRealData() const
Definition: EventBase.h:64
std::string encode() const
Definition: InputTag.cc:166
boost::uint32_t totalIntensityBeam2
Helper class that fetches some type of Ref given ProductID and index, using the edm::Event.
bool error() const
Has any path encountered an error (exception)
edm::EDGetTokenT< TriggerObjectCollection > triggerObjectCollectionToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:341
std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > triggerMatcherTokens_
boost::uint16_t bstMasterStatus
bool isValid() const
Definition: HandleBase.h:74
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:475
std::vector< edm::InputTag > tagsTriggerMatcher_
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > l1GtToken_
const L1GtFdlWord gtFdlWord(int bxInEventValue) const
get / set FDL word (record) in the GT readout record
const T & get() const
Definition: EventSetup.h:58
const cms_uint16_t physicsDeclared() const
get/set "physics declared" bit
Definition: L1GtFdlWord.h:227
edm::ConditionsInRunBlock condRun_
std::string const & label() const
Definition: InputTag.h:36
boost::uint32_t turnCountNumber
edm::EDGetTokenT< edm::ConditionsInEventBlock > tagCondGtEventToken_
edm::ConditionsInLumiBlock condLumi_
boost::uint16_t beamMomentum
def move(src, dest)
Definition: eostools.py:510
edm::EDGetTokenT< TriggerFilterCollection > triggerFilterCollectionToken_
edm::EDGetTokenT< TriggerPathCollection > triggerPathCollectionToken_
edm::EDGetTokenT< TriggerAlgorithmCollection > triggerAlgorithmCollectionToken_

Member Data Documentation

bool pat::PATTriggerEventProducer::autoProcessName_
private

Definition at line 64 of file PATTriggerEventProducer.h.

Referenced by beginRun(), and PATTriggerEventProducer().

edm::ConditionsInLumiBlock pat::PATTriggerEventProducer::condLumi_
private

Definition at line 88 of file PATTriggerEventProducer.h.

Referenced by beginLuminosityBlock(), and produce().

edm::ConditionsInRunBlock pat::PATTriggerEventProducer::condRun_
private

Definition at line 87 of file PATTriggerEventProducer.h.

Referenced by beginRun(), and produce().

bool pat::PATTriggerEventProducer::gtCondLumiInit_
private

Definition at line 90 of file PATTriggerEventProducer.h.

Referenced by beginLuminosityBlock(), and produce().

bool pat::PATTriggerEventProducer::gtCondRunInit_
private

Definition at line 89 of file PATTriggerEventProducer.h.

Referenced by beginRun(), and produce().

HLTConfigProvider pat::PATTriggerEventProducer::hltConfig_
private

Definition at line 77 of file PATTriggerEventProducer.h.

Referenced by beginRun(), and produce().

bool pat::PATTriggerEventProducer::hltConfigInit_
private

Definition at line 78 of file PATTriggerEventProducer.h.

Referenced by beginRun(), and produce().

edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > pat::PATTriggerEventProducer::l1GtToken_
private

Definition at line 75 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

std::string pat::PATTriggerEventProducer::nameProcess_
private
edm::InputTag pat::PATTriggerEventProducer::tagCondGt_
private
edm::EDGetTokenT< edm::ConditionsInEventBlock > pat::PATTriggerEventProducer::tagCondGtEventToken_
private

Definition at line 86 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

edm::EDGetTokenT< edm::ConditionsInLumiBlock > pat::PATTriggerEventProducer::tagCondGtLumiToken_
private

Definition at line 85 of file PATTriggerEventProducer.h.

Referenced by beginLuminosityBlock(), and PATTriggerEventProducer().

edm::EDGetTokenT< edm::ConditionsInRunBlock > pat::PATTriggerEventProducer::tagCondGtRunToken_
private

Definition at line 84 of file PATTriggerEventProducer.h.

Referenced by beginRun(), and PATTriggerEventProducer().

edm::InputTag pat::PATTriggerEventProducer::tagL1Gt_
private

Definition at line 74 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

std::vector< edm::InputTag > pat::PATTriggerEventProducer::tagsTriggerMatcher_
private

Definition at line 71 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

edm::InputTag pat::PATTriggerEventProducer::tagTriggerEvent_
private

Definition at line 81 of file PATTriggerEventProducer.h.

Referenced by beginRun(), and PATTriggerEventProducer().

edm::InputTag pat::PATTriggerEventProducer::tagTriggerProducer_
private

Definition at line 65 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

edm::InputTag pat::PATTriggerEventProducer::tagTriggerResults_
private

Definition at line 79 of file PATTriggerEventProducer.h.

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

edm::EDGetTokenT< TriggerAlgorithmCollection > pat::PATTriggerEventProducer::triggerAlgorithmCollectionToken_
private

Definition at line 66 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

edm::EDGetTokenT< TriggerConditionCollection > pat::PATTriggerEventProducer::triggerConditionCollectionToken_
private

Definition at line 67 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

edm::EDGetTokenT< TriggerFilterCollection > pat::PATTriggerEventProducer::triggerFilterCollectionToken_
private

Definition at line 69 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

std::vector< edm::EDGetTokenT< TriggerObjectStandAloneMatch > > pat::PATTriggerEventProducer::triggerMatcherTokens_
private

Definition at line 72 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

edm::EDGetTokenT< TriggerObjectCollection > pat::PATTriggerEventProducer::triggerObjectCollectionToken_
private

Definition at line 70 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

edm::EDGetTokenT< TriggerPathCollection > pat::PATTriggerEventProducer::triggerPathCollectionToken_
private

Definition at line 68 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer(), and produce().

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

Definition at line 80 of file PATTriggerEventProducer.h.

Referenced by PATTriggerEventProducer().