CMS 3D CMS Logo

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);
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 
const edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
std::vector< TriggerObjectStandAlone > TriggerObjectStandAloneCollection
Collection of TriggerObjectStandAlone.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Definition: HeavyIon.h:7
int iEvent
Definition: GenABIO.cc:224
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)
HLT enums.
def move(src, dest)
Definition: eostools.py:511
Analysis-level trigger object class (stand-alone)