CMS 3D CMS Logo

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

Public Member Functions

 PATTriggerEventProducer (const edm::ParameterSet &iConfig)
 
 ~PATTriggerEventProducer ()
 
- 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 &iLumi, 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 autoProcessName_
 
edm::ConditionsInLumiBlock condLumi_
 
edm::ConditionsInRunBlock condRun_
 
bool gtCondLumiInit_
 
bool gtCondRunInit_
 
HLTConfigProvider hltConfig_
 
bool hltConfigInit_
 
edm::EDGetTokenT
< L1GlobalTriggerReadoutRecord
l1GtToken_
 
std::string nameProcess_
 
edm::InputTag tagCondGt_
 
edm::EDGetTokenT
< edm::ConditionsInEventBlock
tagCondGtEventToken_
 
edm::EDGetTokenT
< edm::ConditionsInLumiBlock
tagCondGtLumiToken_
 
edm::EDGetTokenT
< edm::ConditionsInRunBlock
tagCondGtRunToken_
 
edm::InputTag tagL1Gt_
 
std::vector< edm::InputTagtagsTriggerMatcher_
 
edm::InputTag tagTriggerEvent_
 
edm::InputTag tagTriggerProducer_
 
edm::InputTag tagTriggerResults_
 
edm::EDGetTokenT
< TriggerAlgorithmCollection
triggerAlgorithmCollectionToken_
 
edm::EDGetTokenT
< TriggerConditionCollection
triggerConditionCollectionToken_
 
edm::EDGetTokenT
< TriggerFilterCollection
triggerFilterCollectionToken_
 
std::vector< edm::EDGetTokenT
< TriggerObjectStandAloneMatch > > 
triggerMatcherTokens_
 
edm::EDGetTokenT
< TriggerObjectCollection
triggerObjectCollectionToken_
 
edm::EDGetTokenT
< TriggerPathCollection
triggerPathCollectionToken_
 
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 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 edm::ProducerBase::callWhenNewProductsRegistered(), edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::InputTag::instance(), l1GtToken_, edm::InputTag::label(), 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 ) {
72  } );
73 
74  for ( size_t iMatch = 0; iMatch < tagsTriggerMatcher_.size(); ++iMatch ) {
75  produces< TriggerObjectMatch >( tagsTriggerMatcher_.at( iMatch ).label() );
76  }
77  produces< TriggerEvent >();
78 
79 }
T getParameter(std::string const &) const
void callWhenNewProductsRegistered(std::function< void(BranchDescription const &)> const &func)
Definition: ProducerBase.h:51
edm::EDGetTokenT< TriggerConditionCollection > triggerConditionCollectionToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
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_
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > l1GtToken_
edm::ConditionsInRunBlock condRun_
edm::EDGetTokenT< edm::ConditionsInRunBlock > tagCondGtRunToken_
std::string const & label() const
Definition: InputTag.h:42
edm::EDGetTokenT< edm::ConditionsInEventBlock > tagCondGtEventToken_
edm::ConditionsInLumiBlock condLumi_
std::string const & instance() const
Definition: InputTag.h:43
edm::EDGetTokenT< TriggerFilterCollection > triggerFilterCollectionToken_
edm::EDGetTokenT< TriggerPathCollection > triggerPathCollectionToken_
edm::EDGetTokenT< TriggerAlgorithmCollection > triggerAlgorithmCollectionToken_
pat::PATTriggerEventProducer::~PATTriggerEventProducer ( )
inline

Definition at line 55 of file PATTriggerEventProducer.h.

55 {};

Member Function Documentation

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

Reimplemented from edm::EDProducer.

Definition at line 146 of file PATTriggerEventProducer.cc.

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

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

Reimplemented from edm::EDProducer.

Definition at line 82 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::processConfiguration, edm::Run::processHistory(), HLTConfigProvider::size(), tagCondGt_, tagCondGtRunToken_, tagTriggerEvent_, and tagTriggerResults_.

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

Implements edm::EDProducer.

Definition at line 167 of file PATTriggerEventProducer.cc.

References edm::ConditionsInRunBlock::BAvgCurrent, edm::ConditionsInRunBlock::beamMode, edm::ConditionsInRunBlock::beamMomentum, edm::ConditionsInRunBlock::BStartCurrent, edm::ConditionsInRunBlock::BStopCurrent, condLumi_, condRun_, edm::InputTag::encode(), edm::AssociativeIterator< KeyRefType, AssociativeCollection, ItemGetter >::end(), edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Event::get(), edm::Event::getByLabel(), edm::Event::getByToken(), gtCondLumiInit_, gtCondRunInit_, hltConfig_, hltConfigInit_, edm::helper::Filler< Map >::insert(), edm::EventBase::isRealData(), edm::HandleBase::isValid(), l1GtToken_, edm::InputTag::label(), edm::ConditionsInRunBlock::lhcFillNumber, 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_, and triggerPathCollectionToken_.

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

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

Definition at line 63 of file PATTriggerEventProducer.h.

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

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