CMS 3D CMS Logo

PFJetBenchmarkAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package:
4 // Class: PFJetBenchmarkAnalyzer.cc
5 //
14 //
15 // Original Author: Michel Della Negra
16 // Created: Wed Jan 23 10:11:13 CET 2008
17 // Extensions by Joanna Weng
18 //
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
42 using namespace edm;
43 using namespace reco;
44 using namespace std;
45 
46 //
47 // class decleration
48 
50 public:
53 
54  explicit PFJetBenchmarkAnalyzer(const edm::ParameterSet &);
55  ~PFJetBenchmarkAnalyzer() override;
56 
57 private:
58  void beginJob() override;
59  void analyze(const edm::Event &, const edm::EventSetup &) override;
60  void endJob() override;
61  // ----------member data ---------------------------
64 
65  // neuhaus - comment
71  double deltaRMax = 0.1;
73  double recPt;
74  double maxEta;
76 };
78 
79 //
80 // constants, enums and typedefs
81 //
82 
83 //
84 // static data member definitions
85 //
86 
87 //
88 // constructors and destructor
89 //
91 
92 {
93  // now do what ever initialization is needed
94  sGenJetAlgo_tok_ = consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("InputTruthLabel"));
95  sJetAlgo_tok_ = consumes<reco::PFJetCollection>(iConfig.getParameter<edm::InputTag>("InputRecoLabel"));
96  outjetfilename = iConfig.getUntrackedParameter<string>("OutputFile");
97  pfjBenchmarkDebug = iConfig.getParameter<bool>("pfjBenchmarkDebug");
98  plotAgainstReco = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
99  onlyTwoJets = iConfig.getParameter<bool>("OnlyTwoJets");
100  deltaRMax = iConfig.getParameter<double>("deltaRMax");
101  benchmarkLabel_ = iConfig.getParameter<string>("BenchmarkLabel");
102  recPt = iConfig.getParameter<double>("recPt");
103  maxEta = iConfig.getParameter<double>("maxEta");
104 
105  dbe_ = edm::Service<DQMStore>().operator->();
106 
107  PFJetBenchmark_.setup(
108  outjetfilename, pfjBenchmarkDebug, plotAgainstReco, onlyTwoJets, deltaRMax, benchmarkLabel_, recPt, maxEta, dbe_);
109 }
110 
112  // do anything here that needs to be done at desctruction time
113  // (e.g. close files, deallocate resources etc.)
114 }
115 
116 //
117 // member functions
118 //
119 
120 // ------------ method called to for each event ------------
122  // get gen jet collection
123  Handle<GenJetCollection> genjets;
124  bool isGen = iEvent.getByToken(sGenJetAlgo_tok_, genjets);
125  if (!isGen) {
126  std::cout << "Warning : no Gen jets in input !" << std::endl;
127  return;
128  }
129 
130  // get rec PFJet collection
132  bool isReco = iEvent.getByToken(sJetAlgo_tok_, pfjets);
133  if (!isReco) {
134  std::cout << "Warning : no PF jets in input !" << std::endl;
135  return;
136  }
137  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
138  PFJetBenchmark_.process(*pfjets, *genjets);
139 }
140 
141 // ------------ method called once each job just before starting event loop
142 // ------------
144 
145 // ------------ method called once each job just after ending the event loop
146 // ------------
148  // PFJetBenchmark_.save();
149  PFJetBenchmark_.write();
150 }
151 
152 // define this as a plug-in
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
dqm::legacy::DQMStore * dbe_
edm::EDGetTokenT< reco::PFJetCollection > sJetAlgo_tok_
edm::EDGetTokenT< reco::GenJetCollection > sGenJetAlgo_tok_
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void beginJob()
Definition: Breakpoints.cc:14
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
PFJetBenchmarkAnalyzer(const edm::ParameterSet &)
PFJet Benchmark.
dqm::legacy::MonitorElement MonitorElement
fixed size matrix
HLT enums.
dqm::legacy::DQMStore DQMStore
void analyze(const edm::Event &, const edm::EventSetup &) override