JetMETCorrections
Modules
plugins
JetResolutionDBReader.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Author: Sébastien Brochet
4
//
5
6
// system include files
7
#include <memory>
8
#include <iostream>
9
10
// user include files
11
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
12
#include "
FWCore/Framework/interface/EDAnalyzer.h
"
13
14
#include "
FWCore/Framework/interface/Event.h
"
15
#include "
FWCore/Framework/interface/MakerMacros.h
"
16
#include "
FWCore/Framework/interface/EventSetup.h
"
17
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
18
#include "
FWCore/Framework/interface/ESHandle.h
"
19
20
#include "
CondFormats/JetMETObjects/interface/JetResolutionObject.h
"
21
#include "
CondFormats/DataRecord/interface/JetResolutionRcd.h
"
22
#include "
CondFormats/DataRecord/interface/JetResolutionScaleFactorRcd.h
"
23
24
//
25
// class declaration
26
//
27
28
class
JetResolutionDBReader
:
public
edm::EDAnalyzer
{
29
public
:
30
explicit
JetResolutionDBReader
(
const
edm::ParameterSet
&);
31
~JetResolutionDBReader
()
override
;
32
33
private
:
34
void
beginJob
()
override
;
35
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
36
void
endJob
()
override
;
37
38
std::string
m_era
;
39
std::string
m_label
;
40
41
bool
m_save_file
;
42
bool
m_print
;
43
};
44
45
class
JetResolutionScaleFactorDBReader
:
public
edm::EDAnalyzer
{
46
public
:
47
explicit
JetResolutionScaleFactorDBReader
(
const
edm::ParameterSet
&);
48
49
private
:
50
void
analyze
(
const
edm::Event
&,
const
edm::EventSetup
&)
override
;
51
52
std::string
m_era
;
53
std::string
m_label
;
54
55
bool
m_save_file
;
56
bool
m_print
;
57
};
58
59
JetResolutionDBReader::JetResolutionDBReader
(
const
edm::ParameterSet
& iConfig) {
60
m_era
= iConfig.
getUntrackedParameter
<
std::string
>(
"era"
);
61
m_label
= iConfig.
getUntrackedParameter
<
std::string
>(
"label"
);
62
m_print
= iConfig.
getUntrackedParameter
<
bool
>(
"dump"
,
true
);
63
m_save_file
= iConfig.
getUntrackedParameter
<
bool
>(
"saveFile"
,
false
);
64
}
65
66
JetResolutionDBReader::~JetResolutionDBReader
() {}
67
68
void
JetResolutionDBReader::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
69
edm::ESHandle<JME::JetResolutionObject>
jerObjectHandle;
70
std::cout
<<
"Inspecting JER payload for label: "
<<
m_label
<< std::endl;
71
72
iSetup.
get
<
JetResolutionRcd
>().
get
(
m_label
, jerObjectHandle);
73
74
if
(
m_print
) {
75
jerObjectHandle->
dump
();
76
}
77
78
if
(
m_save_file
) {
79
std::string
f
=
m_era
+
"_"
+
m_label
+
".txt"
;
80
jerObjectHandle->
saveToFile
(
f
);
81
std::cout
<<
"JER payload saved as "
<<
f
<< std::endl;
82
}
83
}
84
85
void
JetResolutionDBReader::beginJob
() {}
86
87
void
JetResolutionDBReader::endJob
() {}
88
89
JetResolutionScaleFactorDBReader::JetResolutionScaleFactorDBReader
(
const
edm::ParameterSet
& iConfig) {
90
m_era
= iConfig.
getUntrackedParameter
<
std::string
>(
"era"
);
91
m_label
= iConfig.
getUntrackedParameter
<
std::string
>(
"label"
);
92
m_print
= iConfig.
getUntrackedParameter
<
bool
>(
"dump"
,
true
);
93
m_save_file
= iConfig.
getUntrackedParameter
<
bool
>(
"saveFile"
,
false
);
94
}
95
96
void
JetResolutionScaleFactorDBReader::analyze
(
const
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
97
edm::ESHandle<JME::JetResolutionObject>
jerObjectHandle;
98
std::cout
<<
"Inspecting JER SF payload for label: "
<<
m_label
<< std::endl;
99
100
iSetup.
get
<
JetResolutionScaleFactorRcd
>().
get
(
m_label
, jerObjectHandle);
101
102
if
(
m_print
) {
103
jerObjectHandle->
dump
();
104
}
105
106
if
(
m_save_file
) {
107
std::string
f
=
m_era
+
"_"
+
m_label
+
".txt"
;
108
jerObjectHandle->
saveToFile
(
f
);
109
std::cout
<<
"JER SF payload saved as "
<<
f
<< std::endl;
110
}
111
}
112
113
//define this as a plug-in
114
DEFINE_FWK_MODULE
(
JetResolutionDBReader
);
115
DEFINE_FWK_MODULE
(
JetResolutionScaleFactorDBReader
);
JetResolutionObject.h
ESHandle.h
f
double f[11][100]
Definition:
MuScleFitUtils.cc:78
JetResolutionDBReader::beginJob
void beginJob() override
Definition:
JetResolutionDBReader.cc:85
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
JetResolutionScaleFactorDBReader::m_label
std::string m_label
Definition:
JetResolutionDBReader.cc:53
JetResolutionDBReader::m_print
bool m_print
Definition:
JetResolutionDBReader.cc:42
JetResolutionScaleFactorDBReader::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
JetResolutionDBReader.cc:96
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
EDAnalyzer.h
JetResolutionScaleFactorDBReader
Definition:
JetResolutionDBReader.cc:45
JetResolutionScaleFactorDBReader::m_era
std::string m_era
Definition:
JetResolutionDBReader.cc:52
edm::EDAnalyzer
Definition:
EDAnalyzer.h:29
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
JetResolutionDBReader::m_save_file
bool m_save_file
Definition:
JetResolutionDBReader.cc:41
JetResolutionScaleFactorDBReader::m_save_file
bool m_save_file
Definition:
JetResolutionDBReader.cc:55
JetResolutionDBReader::JetResolutionDBReader
JetResolutionDBReader(const edm::ParameterSet &)
Definition:
JetResolutionDBReader.cc:59
JetResolutionRcd
Definition:
JetResolutionRcd.h:9
JetResolutionDBReader::~JetResolutionDBReader
~JetResolutionDBReader() override
Definition:
JetResolutionDBReader.cc:66
edm::ESHandle
Definition:
DTSurvey.h:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
JetResolutionScaleFactorDBReader::m_print
bool m_print
Definition:
JetResolutionDBReader.cc:56
JetResolutionDBReader::m_era
std::string m_era
Definition:
JetResolutionDBReader.cc:38
JME::JetResolutionObject::dump
void dump() const
Definition:
JetResolutionObject.cc:283
edm::ParameterSet
Definition:
ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition:
GenABIO.cc:224
JetResolutionDBReader
Definition:
JetResolutionDBReader.cc:28
edm::EventSetup
Definition:
EventSetup.h:57
get
#define get
JetResolutionScaleFactorDBReader::JetResolutionScaleFactorDBReader
JetResolutionScaleFactorDBReader(const edm::ParameterSet &)
Definition:
JetResolutionDBReader.cc:89
JetResolutionDBReader::endJob
void endJob() override
Definition:
JetResolutionDBReader.cc:87
JetResolutionDBReader::m_label
std::string m_label
Definition:
JetResolutionDBReader.cc:39
Frameworkfwd.h
EventSetup.h
JetResolutionScaleFactorRcd.h
JetResolutionScaleFactorRcd
Definition:
JetResolutionScaleFactorRcd.h:9
ParameterSet.h
JME::JetResolutionObject::saveToFile
void saveToFile(const std::string &file) const
Definition:
JetResolutionObject.cc:327
edm::Event
Definition:
Event.h:73
JetResolutionDBReader::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
JetResolutionDBReader.cc:68
JetResolutionRcd.h
Generated for CMSSW Reference Manual by
1.8.16