CMS 3D CMS Logo

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  virtual void produce(edm::StreamID, edm::Event & iEvent, const edm::EventSetup& iSetup) const override;
38 
41 
42  };
43 
44 }
45 
46 
47 using namespace pat;
48 
49 
51 : patTriggerObjectsStandAloneToken_( consumes< TriggerObjectStandAloneCollection >( iConfig.getParameter< edm::InputTag >( "patTriggerObjectsStandAlone" ) ) )
52 , triggerResultsToken_( consumes< edm::TriggerResults >( iConfig.getParameter< edm::InputTag >( "triggerResults" ) ) )
53 {
54  produces< TriggerObjectStandAloneCollection >();
55 }
56 
58 {
60  iEvent.getByToken( patTriggerObjectsStandAloneToken_, patTriggerObjectsStandAlone );
62  iEvent.getByToken( triggerResultsToken_, triggerResults );
63 
64  auto patTriggerObjectsStandAloneUnpacked = std::make_unique<TriggerObjectStandAloneCollection>();
65 
66  for ( size_t iTrigObj = 0; iTrigObj < patTriggerObjectsStandAlone->size(); ++iTrigObj ) {
67  TriggerObjectStandAlone patTriggerObjectStandAloneUnpacked( patTriggerObjectsStandAlone->at( iTrigObj ) );
68  const edm::TriggerNames & names = iEvent.triggerNames( *triggerResults );
69  patTriggerObjectStandAloneUnpacked.unpackPathNames( names );
70  patTriggerObjectsStandAloneUnpacked->push_back( patTriggerObjectStandAloneUnpacked );
71  }
72 
73  iEvent.put(std::move(patTriggerObjectsStandAloneUnpacked) );
74 }
75 
76 
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:234
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
static const HistoName names[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
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)
virtual 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_
def move(src, dest)
Definition: eostools.py:510
Analysis-level trigger object class (stand-alone)