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 };
66 
67 // neuhaus - comment
73 double deltaRMax = 0.1;
75 double recPt;
76 double maxEta;
78 //
79 // constants, enums and typedefs
80 //
81 
82 //
83 // static data member definitions
84 //
85 
86 //
87 // constructors and destructor
88 //
90 
91 {
92  // now do what ever initialization is needed
93  sGenJetAlgo_tok_ = consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("InputTruthLabel"));
94  sJetAlgo_tok_ = consumes<reco::PFJetCollection>(iConfig.getParameter<edm::InputTag>("InputRecoLabel"));
95  outjetfilename = iConfig.getUntrackedParameter<string>("OutputFile");
96  pfjBenchmarkDebug = iConfig.getParameter<bool>("pfjBenchmarkDebug");
97  plotAgainstReco = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
98  onlyTwoJets = iConfig.getParameter<bool>("OnlyTwoJets");
99  deltaRMax = iConfig.getParameter<double>("deltaRMax");
100  benchmarkLabel_ = iConfig.getParameter<string>("BenchmarkLabel");
101  recPt = iConfig.getParameter<double>("recPt");
102  maxEta = iConfig.getParameter<double>("maxEta");
103 
105 
108 }
109 
111  // do anything here that needs to be done at desctruction time
112  // (e.g. close files, deallocate resources etc.)
113 }
114 
115 //
116 // member functions
117 //
118 
119 // ------------ method called to for each event ------------
121  // get gen jet collection
122  Handle<GenJetCollection> genjets;
123  bool isGen = iEvent.getByToken(sGenJetAlgo_tok_, genjets);
124  if (!isGen) {
125  std::cout << "Warning : no Gen jets in input !" << std::endl;
126  return;
127  }
128 
129  // get rec PFJet collection
131  bool isReco = iEvent.getByToken(sJetAlgo_tok_, pfjets);
132  if (!isReco) {
133  std::cout << "Warning : no PF jets in input !" << std::endl;
134  return;
135  }
136  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
137  PFJetBenchmark_.process(*pfjets, *genjets);
138 }
139 
140 // ------------ method called once each job just before starting event loop
141 // ------------
143 
144 // ------------ method called once each job just after ending the event loop
145 // ------------
147  // PFJetBenchmark_.save();
149 }
150 
151 // define this as a plug-in
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool onlyTwoJets
double deltaRMax
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore * dbe_
edm::EDGetTokenT< reco::PFJetCollection > sJetAlgo_tok_
PFJetBenchmark PFJetBenchmark_
PFJet Benchmark.
double maxEta
edm::EDGetTokenT< reco::GenJetCollection > sGenJetAlgo_tok_
string outjetfilename
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
string benchmarkLabel_
void process(const reco::PFJetCollection &, const reco::GenJetCollection &)
PFJetBenchmarkAnalyzer(const edm::ParameterSet &)
bool plotAgainstReco
bool pfjBenchmarkDebug
dqm::legacy::MonitorElement MonitorElement
fixed size matrix
HLT enums.
dqm::legacy::DQMStore DQMStore
double recPt
void setup(std::string Filename, bool debug, bool plotAgainstReco=false, bool onlyTwoJets=true, double deltaRMax=0.1, std::string benchmarkLabel_="ParticleFlow", double recPt=-1, double maxEta=-1, DQMStore *dbe_store=nullptr)
void analyze(const edm::Event &, const edm::EventSetup &) override