CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PATTriggerObjectStandAloneSlimmer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: PatAlgos
4 // Class: pat::PATTriggerObjectStandAloneSlimmer
5 //
6 //
19 
21 #include <set>
22 
23 namespace pat {
24 
26  public:
29 
30  private:
31  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
32 
35 
37  };
38 
39 } // namespace pat
40 
41 using namespace pat;
42 
44  : srcToken_(consumes<TriggerObjectStandAloneCollection>(iConfig.getParameter<edm::InputTag>("src"))),
45  triggerResultsToken_(consumes<edm::TriggerResults>(iConfig.getParameter<edm::InputTag>("triggerResults"))),
46  packFilterLabels_(iConfig.getParameter<bool>("packFilterLabels")),
47  packP4_(iConfig.getParameter<bool>("packP4")) {
48  produces<TriggerObjectStandAloneCollection>();
49  if (packFilterLabels_) {
50  produces<std::vector<std::string>>("filterLabels");
51  }
52 }
53 
56  const edm::EventSetup& iSetup) const {
58  iEvent.getByToken(srcToken_, src);
60  iEvent.getByToken(triggerResultsToken_, triggerResults);
61 
62  auto slimmed = std::make_unique<TriggerObjectStandAloneCollection>(*src);
63 
64  if (packFilterLabels_) {
65  std::set<std::string> allLabels;
66  for (auto& obj : *slimmed) {
67  obj.packFilterLabels(iEvent, *triggerResults);
68  }
69  }
70  if (packP4_) {
71  for (TriggerObjectStandAlone& obj : *slimmed) {
72  obj.packP4();
73  }
74  }
75  iEvent.put(std::move(slimmed));
76 }
77 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
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
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
Packs filter labels and/or 4-vectors of a pat::TriggerObjectStandAloneCollection. ...
static std::string const triggerResults
Definition: EdmProvDump.cc:44
const edm::EDGetTokenT< TriggerObjectStandAloneCollection > srcToken_
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
PATTriggerObjectStandAloneSlimmer(const edm::ParameterSet &iConfig)
Analysis-level trigger object class (stand-alone)