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 
43 using namespace edm;
44 using namespace reco;
45 using namespace std;
46 
47 //
48 // class decleration
49 
51 public:
52  explicit PFJetBenchmarkAnalyzer(const edm::ParameterSet &);
53  ~PFJetBenchmarkAnalyzer() override;
54 
55 private:
56  void beginJob() override;
57  void analyze(const edm::Event &, const edm::EventSetup &) override;
58  void endJob() override;
59  // ----------member data ---------------------------
62 };
64 
65 // neuhaus - comment
71 double deltaRMax = 0.1;
73 double recPt;
74 double maxEta;
76 //
77 // constants, enums and typedefs
78 //
79 
80 //
81 // static data member definitions
82 //
83 
84 //
85 // constructors and destructor
86 //
88 
89 {
90  // now do what ever initialization is needed
91  sGenJetAlgo_tok_ = consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("InputTruthLabel"));
92  sJetAlgo_tok_ = consumes<reco::PFJetCollection>(iConfig.getParameter<edm::InputTag>("InputRecoLabel"));
93  outjetfilename = iConfig.getUntrackedParameter<string>("OutputFile");
94  pfjBenchmarkDebug = iConfig.getParameter<bool>("pfjBenchmarkDebug");
95  plotAgainstReco = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
96  onlyTwoJets = iConfig.getParameter<bool>("OnlyTwoJets");
97  deltaRMax = iConfig.getParameter<double>("deltaRMax");
98  benchmarkLabel_ = iConfig.getParameter<string>("BenchmarkLabel");
99  recPt = iConfig.getParameter<double>("recPt");
100  maxEta = iConfig.getParameter<double>("maxEta");
101 
103 
104  PFJetBenchmark_.setup(
105  outjetfilename, pfjBenchmarkDebug, plotAgainstReco, onlyTwoJets, deltaRMax, benchmarkLabel_, recPt, maxEta, dbe_);
106 }
107 
109  // do anything here that needs to be done at desctruction time
110  // (e.g. close files, deallocate resources etc.)
111 }
112 
113 //
114 // member functions
115 //
116 
117 // ------------ method called to for each event ------------
119  // get gen jet collection
120  Handle<GenJetCollection> genjets;
121  bool isGen = iEvent.getByToken(sGenJetAlgo_tok_, genjets);
122  if (!isGen) {
123  std::cout << "Warning : no Gen jets in input !" << std::endl;
124  return;
125  }
126 
127  // get rec PFJet collection
129  bool isReco = iEvent.getByToken(sJetAlgo_tok_, pfjets);
130  if (!isReco) {
131  std::cout << "Warning : no PF jets in input !" << std::endl;
132  return;
133  }
134  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
135  PFJetBenchmark_.process(*pfjets, *genjets);
136 }
137 
138 // ------------ method called once each job just before starting event loop
139 // ------------
141 
142 // ------------ method called once each job just after ending the event loop
143 // ------------
145  // PFJetBenchmark_.save();
146  PFJetBenchmark_.write();
147 }
148 
149 // define this as a plug-in
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool onlyTwoJets
double deltaRMax
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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=0)
string benchmarkLabel_
DQMStore * dbe_
void process(const reco::PFJetCollection &, const reco::GenJetCollection &)
PFJetBenchmarkAnalyzer(const edm::ParameterSet &)
bool plotAgainstReco
bool pfjBenchmarkDebug
fixed size matrix
HLT enums.
double recPt
void analyze(const edm::Event &, const edm::EventSetup &) override