4 #include <cp3_llbb/Framework/interface/CandidatesProducer.h>
5 #include <cp3_llbb/Framework/interface/HLTService.h>
7 #include <FWCore/Common/interface/TriggerNames.h>
8 #include <DataFormats/Common/interface/TriggerResults.h>
9 #include <DataFormats/PatCandidates/interface/PackedTriggerPrescales.h>
10 #include <DataFormats/PatCandidates/interface/TriggerObjectStandAlone.h>
14 HLTProducer(
const std::string& name,
const ROOT::TreeGroup&
tree,
const edm::ParameterSet& config):
17 if (config.exists(
"triggers")) {
18 m_hlt_service.reset(
new HLTService(config.getUntrackedParameter<edm::FileInPath>(
"triggers").fullPath()));
19 std::cout <<
"HLT configuration: " << std::endl;
20 m_hlt_service->print();
21 std::cout << std::endl;
27 virtual void doConsumes(
const edm::ParameterSet& config, edm::ConsumesCollector&& collector)
override {
28 m_hlt_token = collector.consumes<edm::TriggerResults>(config.getUntrackedParameter<edm::InputTag>(
"hlt", edm::InputTag(
"TriggerResults",
"",
"HLT")));
29 m_prescales_token = collector.consumes<pat::PackedTriggerPrescales>(config.getUntrackedParameter<edm::InputTag>(
"prescales", edm::InputTag(
"patTrigger")));
30 m_trigger_objects_token = collector.consumes<pat::TriggerObjectStandAloneCollection>(config.getUntrackedParameter<edm::InputTag>(
"objects", edm::InputTag(
"selectedPatTrigger")));
33 virtual void produce(edm::Event& event,
const edm::EventSetup& eventSetup)
override;
38 edm::EDGetTokenT<edm::TriggerResults> m_hlt_token;
39 edm::EDGetTokenT<pat::PackedTriggerPrescales> m_prescales_token;
40 edm::EDGetTokenT<pat::TriggerObjectStandAloneCollection> m_trigger_objects_token;
43 std::shared_ptr<HLTService> m_hlt_service;
47 std::vector<std::string>& paths =
tree[
"paths"].write<std::vector<std::string>>();
48 std::vector<uint16_t>& prescales =
tree[
"prescales"].write<std::vector<uint16_t>>();
50 BRANCH(object_paths, std::vector<std::vector<std::string>>);
51 TRANSIENT_BRANCH(object_filters, std::vector<std::vector<std::string>>);
52 BRANCH(object_p4, std::vector<LorentzVector>);
53 BRANCH(object_pdg_id, std::vector<int>);
Base class for Framework producers.
Definition: Producer.h:33
ROOT::TreeGroup tree
Access point to output tree.
Definition: Producer.h:132
Producer(const std::string &name, const ROOT::TreeGroup &tree_, const edm::ParameterSet &config)
Base constructor.
Definition: Producer.h:46
Definition: HLTProducer.h:12
virtual void doConsumes(const edm::ParameterSet &config, edm::ConsumesCollector &&collector) override
Hook for the CMSSW consumes interface.
Definition: HLTProducer.h:27
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Main method of the producer, called for each event.
Definition: HLTProducer.cc:4
Definition: HLTService.h:48