26 #include "TEfficiency.h" 28 #include "TGraphAsymmErrors.h" 35 m_dir = handler.
m_dir;
42 edm::LogInfo(
"L1TEfficiency_Harvesting") <<
"Booking efficiency histo for " << m_dir <<
" and " << m_plotName;
48 edm::LogInfo(
"L1TEfficiency_Harvesting") << (!num && !den ?
"Num && Den" : !num ?
"Num" :
"Den") <<
" not gettable. Quitting booking";
55 edm::LogInfo(
"L1TEfficiency_Harvesting") << (!numH && !denH ?
"Num && Den" : !numH ?
"Num" :
"Den") <<
" is not TH1F. Quitting booking";
59 int nBinsNum = numH->GetNbinsX();
60 int nBinsDen = denH->GetNbinsX();
62 if (nBinsNum != nBinsDen) {
63 edm::LogInfo(
"L1TEfficiency_Harvesting") <<
"# bins in num and den is different. Quitting booking";
67 double min = numH->GetXaxis()->GetXmin();
68 double max = numH->GetXaxis()->GetXmax();
72 string pt_sketo =
"EffvsPt";
74 string ptS20 =
"EffvsPt_SINGLE_20";
75 string etaS20 =
"EffvsEta_SINGLE_20";
76 string phiS20 =
"EffvsPhi_SINGLE_20";
78 string ptS16 =
"EffvsPt_SINGLE_16";
79 string etaS16 =
"EffvsEta_SINGLE_16";
80 string phiS16 =
"EffvsPhi_SINGLE_16";
82 string ptS25 =
"EffvsPt_SINGLE_25";
83 string etaS25 =
"EffvsEta_SINGLE_25";
84 string phiS25 =
"EffvsPhi_SINGLE_25";
86 if (m_plotName == pt_sketo.c_str()) {
87 string title =
"L1T Efficiency vs pt [-]";
88 float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
89 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),32,
xbins);
91 if (m_plotName == ptS20.c_str()) {
93 float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
94 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),32,
xbins);
96 else if (m_plotName == etaS20.c_str()) {
98 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),nBinsNum,
min,
max);
100 else if (m_plotName == phiS20.c_str()) {
102 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),nBinsNum,
min,
max);
104 else if (m_plotName == ptS16.c_str()) {
106 float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
107 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),32,
xbins);
109 else if (m_plotName == etaS16.c_str()) {
111 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),nBinsNum,
min,
max);
113 else if (m_plotName == phiS16.c_str()) {
115 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),nBinsNum,
min,
max);
117 else if (m_plotName == ptS25.c_str()) {
119 float xbins[33] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 80, 90, 100};
120 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),32,
xbins);
122 else if (m_plotName == etaS25.c_str()) {
124 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),nBinsNum,
min,
max);
126 else if (m_plotName == phiS25.c_str()) {
128 m_effHisto = ibooker.
book1D(m_plotName,title.c_str(),nBinsNum,
min,
max);
131 m_effHisto = ibooker.
book1D(m_plotName,m_plotName,nBinsNum,min,max);
137 if (!m_effHisto)
return;
139 edm::LogInfo(
"L1TEfficiency_Harvesting") <<
"Computing efficiency for " << m_plotName;
150 TH1F *effH = m_effHisto->getTH1F();
154 string pt_sketo =
"EffvsPt";
156 string ptS20 =
"EffvsPt_SINGLE_20";
157 string etaS20 =
"EffvsEta_SINGLE_20";
158 string phiS20 =
"EffvsPhi_SINGLE_20";
160 string ptS16 =
"EffvsPt_SINGLE_16";
161 string etaS16 =
"EffvsEta_SINGLE_16";
162 string phiS16 =
"EffvsPhi_SINGLE_16";
164 string ptS25 =
"EffvsPt_SINGLE_25";
165 string etaS25 =
"EffvsEta_SINGLE_25";
166 string phiS25 =
"EffvsPhi_SINGLE_25";
168 if (m_plotName == ptS20.c_str()) {
169 effH->GetXaxis()->SetTitle(
"p_{T}\\,(\\text{Reco} \\, \\mu) ~\\text{[GeV]}");
170 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 20 \\, \\text{GeV}");
172 else if (m_plotName == etaS20.c_str()) {
173 effH->GetXaxis()->SetTitle(
"\\eta \\,(\\text{Reco} \\, \\mu) ");
174 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 20 \\, \\text{GeV}");
176 else if (m_plotName == phiS20.c_str()) {
177 effH->GetXaxis()->SetTitle(
"\\phi \\,(\\text{Reco} \\, \\mu) ~\\text{[rad]}");
178 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 20 \\, \\text{GeV}");
180 else if (m_plotName == ptS16.c_str()) {
181 effH->GetXaxis()->SetTitle(
"p_{T}\\,(\\text{Reco} \\, \\mu) ~\\text{[GeV]}");
182 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 16 \\, \\text{GeV}");
184 else if (m_plotName == etaS16.c_str()) {
185 effH->GetXaxis()->SetTitle(
"\\eta \\,(\\text{Reco} \\, \\mu) ");
186 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 16 \\, \\text{GeV}");
188 else if (m_plotName == phiS16.c_str()) {
189 effH->GetXaxis()->SetTitle(
"\\phi \\,(\\text{Reco} \\, \\mu) ~\\text{[rad]}");
190 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 16 \\, \\text{GeV}");
192 else if (m_plotName == ptS25.c_str()) {
193 effH->GetXaxis()->SetTitle(
"p_{T}\\,(\\text{Reco} \\, \\mu) ~\\text{[GeV]}");
194 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 25 \\, \\text{GeV}");
196 else if (m_plotName == etaS25.c_str()) {
197 effH->GetXaxis()->SetTitle(
"\\eta \\,(\\text{Reco} \\, \\mu) ");
198 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 25 \\, \\text{GeV}");
200 else if (m_plotName == phiS25.c_str()) {
201 effH->GetXaxis()->SetTitle(
"\\phi \\,(\\text{Reco} \\, \\mu) ~\\text{[rad]}");
202 effH->SetTitle(
"\\text{Single} \\, \\, \\text{Muon} \\, \\, \\text{Quality} ~[\\geq 12] ~/~ p_{T}(\\text{L1} \\, \\mu) \\geq 25 \\, \\text{GeV}");
205 effH->GetXaxis()->SetTitle(
"not");
206 effH->SetTitle(
"not");
209 effH->GetYaxis()->SetTitle(
"L1T Efficiency");
210 effH->GetXaxis()->SetTitleSize(0.028);
211 effH->GetYaxis()->SetTitleSize(0.028);
212 effH->SetTitleSize(0.028);
213 effH->SetTitleOffset(1.29,
"X");
214 effH->GetXaxis()->SetLabelSize(0.028);
215 effH->GetYaxis()->SetLabelSize(0.028);
216 effH->SetLineStyle(1);
217 effH->SetLineWidth(2);
218 effH->SetLineColor(2);
221 effH->Divide(numH,denH, 1.0, 1.0,
"B");
223 effH->SetMinimum(0.);
224 effH->SetMaximum(1.1);
229 m_verbose(ps.getUntrackedParameter<bool>(
"verbose"))
233 edm::LogInfo(
"L1TEfficiency_Harvesting") <<
"____________ Storage initialization ____________ ";
234 edm::LogInfo(
"L1TEfficiency_Harvesting") <<
"Setting up dbe folder: L1T/Efficiency";
237 vector<ParameterSet>::const_iterator plotCfgIt = plotCfgs.begin();
238 vector<ParameterSet>::const_iterator plotCfgEnd = plotCfgs.end();
240 for (; plotCfgIt!=plotCfgEnd; ++plotCfgIt) {
241 string dir = plotCfgIt->getUntrackedParameter<
string>(
"dqmBaseDir");
242 vector<string>
plots = plotCfgIt->getUntrackedParameter<vector<string>>(
"plots");
243 vector<string>::const_iterator plotIt = plots.begin();
244 vector<string>::const_iterator plotEnd = plots.end();
256 edm::LogInfo(
"L1TEfficiency_Harvesting") <<
"Called endRun.";
259 vector<L1TEfficiencyPlotHandler>::iterator plotHandlerIt =
m_plotHandlers.begin();
260 vector<L1TEfficiencyPlotHandler>::iterator plotHandlerEnd =
m_plotHandlers.end();
262 for(; plotHandlerIt!=plotHandlerEnd; ++plotHandlerIt) {
263 plotHandlerIt->book(ibooker, igetter);
264 plotHandlerIt->computeEfficiency(ibooker, igetter);
LuminosityBlockID id() const
T getUntrackedParameter(std::string const &, T const &) const
L1TEfficiencyPlotHandler(std::string dir, std::string plotName)
L1TEfficiency_Harvesting(const edm::ParameterSet &ps)
MonitorElement * get(const std::string &path)
#define DEFINE_FWK_MODULE(type)
virtual void dqmEndLuminosityBlock(DQMStore::IGetter &igetter, edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &c)
virtual void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
std::vector< L1TEfficiencyPlotHandler > m_plotHandlers
virtual ~L1TEfficiency_Harvesting()
MonitorElement * book1D(Args &&...args)
EventID const & min(EventID const &lh, EventID const &rh)
void book(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void setCurrentFolder(const std::string &fullpath)
TH1F * getTH1F(void) const
LuminosityBlockNumber_t luminosityBlock() const
void computeEfficiency(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
EventID const & max(EventID const &lh, EventID const &rh)
MonitorElement * m_effHisto