CP3-llbb Framework
MuonsProducer.h
1 #ifndef MUONS_PRODUCER
2 #define MUONS_PRODUCER
3 
4 #include <cp3_llbb/Framework/interface/LeptonsProducer.h>
5 #include <cp3_llbb/Framework/interface/ScaleFactors.h>
6 
7 #include <DataFormats/VertexReco/interface/Vertex.h>
8 #include <DataFormats/PatCandidates/interface/Muon.h>
9 
10 #include <utility>
11 
12 class MuonsProducer: public LeptonsProducer<pat::Muon>, public ScaleFactors {
13  public:
14  MuonsProducer(const std::string& name, const ROOT::TreeGroup& tree, const edm::ParameterSet& config):
15  LeptonsProducer(name, tree, config), ScaleFactors(const_cast<ROOT::TreeGroup&>(tree))
16  {
17  ScaleFactors::create_branches(config);
18  }
19 
20  virtual ~MuonsProducer() {}
21 
22  virtual void doConsumes(const edm::ParameterSet& config, edm::ConsumesCollector&& collector) override {
23  LeptonsProducer::doConsumes(config, std::forward<edm::ConsumesCollector>(collector));
24 
25  m_vertices_token = collector.consumes<std::vector<reco::Vertex>>(config.getUntrackedParameter<edm::InputTag>("vertices", edm::InputTag("offlineSlimmedPrimaryVertices")));
26  }
27 
28  virtual void produce(edm::Event& event, const edm::EventSetup& eventSetup) override;
29 
30  private:
31  // Tokens
32  edm::EDGetTokenT<std::vector<reco::Vertex>> m_vertices_token;
33  public:
34  // Tree members
35  std::vector<bool>& isLoose = tree["isLoose"].write<std::vector<bool>>();
36  std::vector<bool>& isSoft = tree["isSoft"].write<std::vector<bool>>();
37  std::vector<bool>& isMedium = tree["isMedium"].write<std::vector<bool>>();
38  std::vector<bool>& isMedium2016 = tree["isMedium2016"].write<std::vector<bool>>();
39  std::vector<bool>& isTight = tree["isTight"].write<std::vector<bool>>();
40  std::vector<bool>& isHighPt = tree["isHighPt"].write<std::vector<bool>>();
41 
42  BRANCH(dxy, std::vector<float>);
43  BRANCH(dz, std::vector<float>);
44  BRANCH(dca, std::vector<float>);
45 };
46 
47 #endif
ROOT::TreeGroup tree
Access point to output tree.
Definition: Producer.h:132
Definition: LeptonsProducer.h:10
virtual void doConsumes(const edm::ParameterSet &config, edm::ConsumesCollector &&collector) override
Hook for the CMSSW consumes interface.
Definition: LeptonsProducer.h:22
Definition: MuonsProducer.h:12
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Main method of the producer, called for each event.
Definition: MuonsProducer.cc:19
virtual void doConsumes(const edm::ParameterSet &config, edm::ConsumesCollector &&collector) override
Hook for the CMSSW consumes interface.
Definition: MuonsProducer.h:22
Definition: ScaleFactors.h:13