CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PATTriggerObjectStandAloneUnpacker.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PatAlgos
4 // Class: pat::PATTriggerObjectStandAloneUnpacker
5 //
6 //
21 
24 
25 namespace pat {
26 
28  public:
31 
32  private:
33  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
34 
39  };
40 
41 } // namespace pat
42 
43 using namespace pat;
44 
46  : patTriggerObjectsStandAloneToken_(consumes<TriggerObjectStandAloneCollection>(
47  iConfig.getParameter<edm::InputTag>("patTriggerObjectsStandAlone"))),
48  triggerResultsToken_(consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("triggerResults"))),
49  unpackFilterLabels_(iConfig.getParameter<bool>("unpackFilterLabels")) {
50  produces<TriggerObjectStandAloneCollection>();
51 }
52 
55  const edm::EventSetup& iSetup) const {
57  iEvent.getByToken(patTriggerObjectsStandAloneToken_, patTriggerObjectsStandAlone);
59  iEvent.getByToken(triggerResultsToken_, triggerResults);
60 
61  auto patTriggerObjectsStandAloneUnpacked = std::make_unique<TriggerObjectStandAloneCollection>();
62 
63  for (size_t iTrigObj = 0; iTrigObj < patTriggerObjectsStandAlone->size(); ++iTrigObj) {
64  TriggerObjectStandAlone patTriggerObjectStandAloneUnpacked(patTriggerObjectsStandAlone->at(iTrigObj));
65  const edm::TriggerNames& names = iEvent.triggerNames(*triggerResults);
66  patTriggerObjectStandAloneUnpacked.unpackPathNames(names);
68  patTriggerObjectStandAloneUnpacked.unpackFilterLabels(iEvent, *triggerResults);
69  patTriggerObjectsStandAloneUnpacked->push_back(patTriggerObjectStandAloneUnpacked);
70  }
71 
72  iEvent.put(std::move(patTriggerObjectsStandAloneUnpacked));
73 }
74 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const std::string names[nVars_]
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: Event.cc:275
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
static std::string const triggerResults
Definition: EdmProvDump.cc:44
PATTriggerObjectStandAloneUnpacker(const edm::ParameterSet &iConfig)
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
Unpacks a pat::TriggerObjectStandAloneCollection with packed path names.
const edm::EDGetTokenT< TriggerObjectStandAloneCollection > patTriggerObjectsStandAloneToken_
Analysis-level trigger object class (stand-alone)
const edm::EDGetTokenT< std::vector< std::string > > filterLabelsToken_