CP3-llbb Framework
TestAnalyzer.h
1 #ifndef TESTANALYZER_H
2 #define TESTANALYZER_H
3 
4 #include <cp3_llbb/Framework/interface/Analyzer.h>
5 #include <cp3_llbb/Framework/interface/Category.h>
6 
7 #include <cp3_llbb/Framework/interface/MuonsProducer.h>
8 
9 class TwoMuonsCategory: public Category {
10  virtual bool event_in_category_pre_analyzers(const ProducersManager& producers) const override {
11  const MuonsProducer& muons = producers.get<MuonsProducer>("muons");
12  return muons.p4.size() >= 2;
13  };
14 
15  virtual bool event_in_category_post_analyzers(const ProducersManager& producers, const AnalyzersManager& analyzers) const override {
16  return true;
17  };
18 
19  virtual void register_cuts(CutManager& manager) override {
20  manager.new_cut("muon_1_pt", "pt > 30");
21  manager.new_cut("muon_2_pt", "pt > 10");
22  };
23 
24  virtual void evaluate_cuts_pre_analyzers(CutManager& manager, const ProducersManager& producers) const override {
25  const MuonsProducer& muons = producers.get<MuonsProducer>("muons");
26  if (muons.p4[0].Pt() > 30)
27  manager.pass_cut("muon_1_pt");
28 
29  if (muons.p4[1].Pt() > 10)
30  manager.pass_cut("muon_2_pt");
31  }
32 };
33 
35  public:
36  TestAnalyzer(const std::string& name, const ROOT::TreeGroup& tree_, const edm::ParameterSet& config):
37  Analyzer(name, tree_, config) {
38 
39  }
40 
41  virtual void analyze(const edm::Event&, const edm::EventSetup&, const ProducersManager&, const AnalyzersManager&, const CategoryManager&) override;
42 
43  virtual void registerCategories(CategoryManager& manager, const edm::ParameterSet& config) {
44  manager.new_category<TwoMuonsCategory>("two_muons", "At least two muons category", config);
45  }
46 
47  private:
48 
49 };
50 
51 #endif
Definition: AnalyzersManager.h:10
Definition: Category.h:88
Definition: Category.h:20
Definition: Cut.h:27
Definition: Analyzer.h:28
Definition: MuonsProducer.h:12
Definition: ProducersManager.h:10
Definition: TestAnalyzer.h:34
Definition: TestAnalyzer.h:9