CP3-llbb Framework
DileptonAnalyzer.h
1 #ifndef DILEPTONANALYZER_H
2 #define DILEPTONANALYZER_H
3 
4 #include <cp3_llbb/Framework/interface/Analyzer.h>
5 #include <cp3_llbb/Framework/interface/Category.h>
6 
8  enum class WorkingPoint {
9  LOOSE,
10  TIGHT
11  };
12 
13  public:
14  DileptonAnalyzer(const std::string& name, const ROOT::TreeGroup& tree_, const edm::ParameterSet& config):
15  Analyzer(name, tree_, config) {
16  m_standalone_mode = config.getUntrackedParameter<bool>("standalone", false);
17 
18  m_muons_wp = string_to_wp(config.getUntrackedParameter<std::string>("muons_wp", "loose"));
19  m_electrons_wp = string_to_wp(config.getUntrackedParameter<std::string>("electrons_wp", "loose"));
20 
21  m_electron_loose_wp_name = config.getUntrackedParameter<std::string>("electrons_loose_wp_name", "cutBasedElectronID-Summer16-80X-V1-loose");
22  m_electron_tight_wp_name = config.getUntrackedParameter<std::string>("electrons_tight_wp_name", "cutBasedElectronID-Summer16-80X-V1-tight");
23  }
24 
25  virtual void analyze(const edm::Event&, const edm::EventSetup&, const ProducersManager&, const AnalyzersManager&, const CategoryManager&) override;
26 
27  virtual void registerCategories(CategoryManager& manager, const edm::ParameterSet&) override;
28 
29  BRANCH(mumu, std::vector<LorentzVector>);
30  BRANCH(elel, std::vector<LorentzVector>);
31  BRANCH(elmu, std::vector<LorentzVector>);
32  BRANCH(muel, std::vector<LorentzVector>);
33  BRANCH(mumu_indices, std::vector<std::pair<unsigned int,unsigned int>>);
34  BRANCH(elel_indices, std::vector<std::pair<unsigned int,unsigned int>>);
35  BRANCH(elmu_indices, std::vector<std::pair<unsigned int,unsigned int>>);
36  BRANCH(muel_indices, std::vector<std::pair<unsigned int,unsigned int>>);
37 
38  private:
39  WorkingPoint string_to_wp(const std::string& wp) {
40  if (wp == "loose") {
41  return WorkingPoint::LOOSE;
42  } else if (wp == "tight") {
43  return WorkingPoint::TIGHT;
44  } else {
45  throw edm::Exception(edm::errors::NotFound, "Unsupported working point: " + wp);
46  }
47  }
48 
49  template <class T> bool passID(const T& producer, size_t index);
50 
51  bool m_standalone_mode = false;
52 
53  WorkingPoint m_muons_wp;
54  WorkingPoint m_electrons_wp;
55 
56  std::string m_electron_loose_wp_name;
57  std::string m_electron_tight_wp_name;
58 };
59 
60 
61 #endif
Definition: AnalyzersManager.h:10
Definition: Category.h:88
Definition: DileptonAnalyzer.h:7
Definition: Analyzer.h:28
Definition: ProducersManager.h:10