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 
21 // system include files
22 #include <memory>
23 
24 // user include files
27 
30 
44 using namespace edm;
45 using namespace reco;
46 using namespace std;
47 
48 //
49 // class decleration
50 
51 
53 public:
55  ~PFJetBenchmarkAnalyzer() override;
56 
57 
58 private:
59  void beginJob() override ;
60  void analyze(const edm::Event&, const edm::EventSetup&) override;
61  void endJob() override ;
62  // ----------member data ---------------------------
65 
66 };
68 
69 //neuhaus - comment
75 double deltaRMax=0.1;
77 double recPt;
78 double maxEta;
80 //
81 // constants, enums and typedefs
82 //
83 
84 //
85 // static data member definitions
86 //
87 
88 //
89 // constructors and destructor
90 //
92 
93 {
94  //now do what ever initialization is needed
95  sGenJetAlgo_tok_ = consumes<reco::GenJetCollection> (iConfig.getParameter<edm::InputTag>("InputTruthLabel") );
96  sJetAlgo_tok_ = consumes<reco::PFJetCollection> (iConfig.getParameter<edm::InputTag>("InputRecoLabel") );
97  outjetfilename = iConfig.getUntrackedParameter<string>("OutputFile");
98  pfjBenchmarkDebug = iConfig.getParameter<bool>("pfjBenchmarkDebug");
99  plotAgainstReco = iConfig.getParameter<bool>("PlotAgainstRecoQuantities");
100  onlyTwoJets = iConfig.getParameter<bool>("OnlyTwoJets");
101  deltaRMax = iConfig.getParameter<double>("deltaRMax");
102  benchmarkLabel_ = iConfig.getParameter<string>("BenchmarkLabel");
103  recPt = iConfig.getParameter<double>("recPt");
104  maxEta = iConfig.getParameter<double>("maxEta");
105 
107 
108  PFJetBenchmark_.setup(
110  pfjBenchmarkDebug,
111  plotAgainstReco,
112  onlyTwoJets,
113  deltaRMax,
114  benchmarkLabel_,
115  recPt,
116  maxEta,
117  dbe_);
118 }
119 
120 
122 {
123  // do anything here that needs to be done at desctruction time
124  // (e.g. close files, deallocate resources etc.)
125 }
126 
127 
128 //
129 // member functions
130 //
131 
132 // ------------ method called to for each event ------------
133 void
135  const edm::EventSetup& iSetup)
136 {
137  // get gen jet collection
138  Handle<GenJetCollection> genjets;
139  bool isGen = iEvent.getByToken(sGenJetAlgo_tok_, genjets);
140  if (!isGen) {
141  std::cout << "Warning : no Gen jets in input !" << std::endl;
142  return;
143  }
144 
145  // get rec PFJet collection
147  bool isReco = iEvent.getByToken(sJetAlgo_tok_, pfjets);
148  if (!isReco) {
149  std::cout << "Warning : no PF jets in input !" << std::endl;
150  return;
151  }
152  // Analyse (no "z" in "analyse" : we are in Europe, dammit!)
153  PFJetBenchmark_.process(*pfjets, *genjets);
154 }
155 
156 
157 // ------------ method called once each job just before starting event loop ------------
158 void
160 {
161 
162 }
163 
164 // ------------ method called once each job just after ending the event loop ------------
165 void
167 // PFJetBenchmark_.save();
168  PFJetBenchmark_.write();
169 }
170 
171 //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:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< reco::PFJetCollection > sJetAlgo_tok_
PFJetBenchmark PFJetBenchmark_
PFJet Benchmark.
double maxEta
edm::EDGetTokenT< reco::GenJetCollection > sGenJetAlgo_tok_
string outjetfilename
void beginJob()
Definition: Breakpoints.cc:15
int iEvent
Definition: GenABIO.cc:230
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
virtual example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void analyze(const edm::Event &, const edm::EventSetup &) override