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 
104  dbe_ = edm::Service<DQMStore>().operator->();
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
CaloJetCollection.h
bk::beginJob
void beginJob()
Definition: Breakpoints.cc:14
PFJetBenchmarkAnalyzer::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: PFJetBenchmarkAnalyzer.cc:52
edm::EDGetTokenT< reco::GenJetCollection >
PFJetBenchmarkAnalyzer::endJob
void endJob() override
Definition: PFJetBenchmarkAnalyzer.cc:146
edm
HLT enums.
Definition: AlignableModifier.h:19
gather_cfg.cout
cout
Definition: gather_cfg.py:144
PFJet.h
PFJetBenchmarkAnalyzer::PFJetBenchmarkAnalyzer
PFJetBenchmarkAnalyzer(const edm::ParameterSet &)
Definition: PFJetBenchmarkAnalyzer.cc:89
BasicJetCollection.h
DQMStore.h
Jet.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
PFJetBenchmark_
PFJetBenchmark PFJetBenchmark_
PFJet Benchmark.
Definition: PFJetBenchmarkAnalyzer.cc:68
edm::Handle
Definition: AssociativeIterator.h:50
onlyTwoJets
bool onlyTwoJets
Definition: PFJetBenchmarkAnalyzer.cc:72
PFJetBenchmarkAnalyzer::~PFJetBenchmarkAnalyzer
~PFJetBenchmarkAnalyzer() override
Definition: PFJetBenchmarkAnalyzer.cc:110
edm::EDAnalyzer
Definition: EDAnalyzer.h:29
recPt
double recPt
Definition: PFJetBenchmarkAnalyzer.cc:75
CandidateFwd.h
PFJetBenchmark::process
void process(const reco::PFJetCollection &, const reco::GenJetCollection &)
Definition: PFJetBenchmark.cc:232
MakerMacros.h
PFJetBenchmark.h
PFJetBenchmarkAnalyzer
Definition: PFJetBenchmarkAnalyzer.cc:49
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
dqm::legacy::DQMStore
Definition: DQMStore.h:727
deltaRMax
double deltaRMax
Definition: PFJetBenchmarkAnalyzer.cc:73
Service.h
maxEta
double maxEta
Definition: PFJetBenchmarkAnalyzer.cc:76
PFJetBenchmarkAnalyzer::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: PFJetBenchmarkAnalyzer.cc:51
dbe_
dqm::legacy::DQMStore * dbe_
Definition: PFJetBenchmarkAnalyzer.cc:77
PFJetBenchmark
Definition: PFJetBenchmark.h:28
PFJetBenchmark::write
void write()
Definition: PFJetBenchmark.cc:54
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
outjetfilename
string outjetfilename
Definition: PFJetBenchmarkAnalyzer.cc:69
PFJetBenchmarkAnalyzer::beginJob
void beginJob() override
Definition: PFJetBenchmarkAnalyzer.cc:142
PFJetBenchmarkAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: PFJetBenchmarkAnalyzer.cc:120
edm::Service
Definition: Service.h:30
iEvent
int iEvent
Definition: GenABIO.cc:224
PFJetBenchmark::setup
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)
Definition: PFJetBenchmark.cc:69
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
edm::EventSetup
Definition: EventSetup.h:57
plotAgainstReco
bool plotAgainstReco
Definition: PFJetBenchmarkAnalyzer.cc:71
PFJetBenchmarkAnalyzer::sJetAlgo_tok_
edm::EDGetTokenT< reco::PFJetCollection > sJetAlgo_tok_
Definition: PFJetBenchmarkAnalyzer.cc:63
pfjBenchmarkDebug
bool pfjBenchmarkDebug
Definition: PFJetBenchmarkAnalyzer.cc:70
InputTag.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
std
Definition: JetResolutionObject.h:76
Frameworkfwd.h
PFJetBenchmarkAnalyzer::sGenJetAlgo_tok_
edm::EDGetTokenT< reco::GenJetCollection > sGenJetAlgo_tok_
Definition: PFJetBenchmarkAnalyzer.cc:62
GenJet.h
Candidate.h
TauSpinner_cfi.isReco
isReco
Definition: TauSpinner_cfi.py:4
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
benchmarkLabel_
string benchmarkLabel_
Definition: PFJetBenchmarkAnalyzer.cc:74