CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PATTriggerObjectStandAloneUnpacker.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PatAlgos
4 // Class: pat::PATTriggerObjectStandAloneUnpacker
5 //
6 //
22 
25 
26 namespace pat {
27 
29 
30  public:
31 
32  explicit PATTriggerObjectStandAloneUnpacker( const edm::ParameterSet & iConfig );
34 
35  private:
36 
37  void produce(edm::StreamID, edm::Event & iEvent, const edm::EventSetup& iSetup) const override;
38 
43 
44  };
45 
46 }
47 
48 
49 using namespace pat;
50 
51 
53 : patTriggerObjectsStandAloneToken_( consumes< TriggerObjectStandAloneCollection >( iConfig.getParameter< edm::InputTag >( "patTriggerObjectsStandAlone" ) ) )
54 , triggerResultsToken_( consumes< edm::TriggerResults >( iConfig.getParameter< edm::InputTag >( "triggerResults" ) ) )
55 , unpackFilterLabels_( iConfig.getParameter< bool >("unpackFilterLabels") )
56 {
57  produces< TriggerObjectStandAloneCollection >();
58 }
59 
61 {
63  iEvent.getByToken( patTriggerObjectsStandAloneToken_, patTriggerObjectsStandAlone );
65  iEvent.getByToken( triggerResultsToken_, triggerResults );
66 
67  auto patTriggerObjectsStandAloneUnpacked = std::make_unique<TriggerObjectStandAloneCollection>();
68 
69  for ( size_t iTrigObj = 0; iTrigObj < patTriggerObjectsStandAlone->size(); ++iTrigObj ) {
70  TriggerObjectStandAlone patTriggerObjectStandAloneUnpacked( patTriggerObjectsStandAlone->at( iTrigObj ) );
71  const edm::TriggerNames & names = iEvent.triggerNames( *triggerResults );
72  patTriggerObjectStandAloneUnpacked.unpackPathNames( names );
73  if (unpackFilterLabels_) patTriggerObjectStandAloneUnpacked.unpackFilterLabels(iEvent,*triggerResults );
74  patTriggerObjectsStandAloneUnpacked->push_back( patTriggerObjectStandAloneUnpacked );
75  }
76 
77  iEvent.put(std::move(patTriggerObjectsStandAloneUnpacked) );
78 }
79 
80 
const edm::EDGetTokenT< std::vector< std::string > > filterLabelsToken_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
const std::string names[nVars_]
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: HeavyIon.h:7
int iEvent
Definition: GenABIO.cc:230
static std::string const triggerResults
Definition: EdmProvDump.cc:41
PATTriggerObjectStandAloneUnpacker(const edm::ParameterSet &iConfig)
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Unpacks a pat::TriggerObjectStandAloneCollection with packed path names.
const edm::EDGetTokenT< TriggerObjectStandAloneCollection > patTriggerObjectsStandAloneToken_
HLT enums.
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:301
def move(src, dest)
Definition: eostools.py:510
Analysis-level trigger object class (stand-alone)