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  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 {
59  edm::Handle< TriggerObjectStandAloneCollection > patTriggerObjectsStandAlone;
60  iEvent.getByToken( patTriggerObjectsStandAloneToken_, patTriggerObjectsStandAlone );
62  iEvent.getByToken( triggerResultsToken_, triggerResults );
63 
64  std::auto_ptr< TriggerObjectStandAloneCollection > patTriggerObjectsStandAloneUnpacked( new 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( patTriggerObjectsStandAloneUnpacked );
74 }
75 
76 
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: Event.cc:208
static const HistoName names[]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
triggerResultsToken_(consumes< edm::TriggerResults >(edm::InputTag("TriggerResults")))
tuple TriggerResults
Definition: old-fu_pass.py:28
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
virtual void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
static std::string const triggerResults
Definition: EdmProvDump.cc:40
PATTriggerObjectStandAloneUnpacker(const edm::ParameterSet &iConfig)
Unpacks a pat::TriggerObjectStandAloneCollection with packed path names.
const edm::EDGetTokenT< TriggerObjectStandAloneCollection > patTriggerObjectsStandAloneToken_
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
Analysis-level trigger object class (stand-alone)