1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
#include "DQMOffline/Muon/interface/TriggerMatchEfficiencyPlotter.h"
/** \class TriggerMatch monitor
* * *
* * * DQM monitoring source for Trigger matching efficiency plotter feature added to miniAOD
* * *
* * * \author Bibhuprasad Mahakud (Purdue University, West Lafayette, USA)
* * */
// Framework
#include <FWCore/Framework/interface/Event.h>
#include "DataFormats/Common/interface/Handle.h"
#include <FWCore/Framework/interface/ESHandle.h>
#include <FWCore/Framework/interface/MakerMacros.h>
#include <FWCore/Framework/interface/EventSetup.h>
#include <FWCore/ParameterSet/interface/ParameterSet.h>
#include "DQMServices/Core/interface/DQMStore.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Framework/interface/Run.h"
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include "TF1.h"
#include "TH1F.h"
using namespace edm;
using namespace std;
//#define DEBUG
TriggerMatchEfficiencyPlotter::TriggerMatchEfficiencyPlotter(const edm::ParameterSet &ps) {
#ifdef DEBUG
cout << "TriggerMatchEfficiencyPlotter(): Constructor " << endl;
#endif
parameters = ps;
triggerhistName1_ = parameters.getParameter<string>("triggerhistName1");
triggerhistName2_ = parameters.getParameter<string>("triggerhistName2");
theFolder = parameters.getParameter<string>("folder");
}
TriggerMatchEfficiencyPlotter::~TriggerMatchEfficiencyPlotter() {}
void TriggerMatchEfficiencyPlotter::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) {
ibooker.setCurrentFolder(theFolder);
// efficiency plot
h_eff_Path1_eta_tight = ibooker.book1D(
"matchingEff_eta_" + triggerhistName1_ + "_tight", triggerhistName1_ + ":matching Eff. vs #eta", 8, -2.5, 2.5);
h_eff_Path1_pt_tight = ibooker.book1D(
"matchingEff_pt_" + triggerhistName1_ + "_tight", triggerhistName1_ + ":matching Eff. vs pt", 10, 20, 220);
h_eff_Path1_phi_tight = ibooker.book1D(
"matchingEff_phi_" + triggerhistName1_ + "_tight", triggerhistName1_ + ":matching Eff. vs #phi", 8, -3.0, 3.0);
h_eff_Path2_eta_tight = ibooker.book1D(
"matchingEff_eta_" + triggerhistName2_ + "_tight", triggerhistName2_ + ":matching Eff. vs #eta", 8, -2.5, 2.5);
h_eff_Path2_pt_tight = ibooker.book1D(
"matchingEff_pt_" + triggerhistName2_ + "_tight", triggerhistName2_ + ":matching Eff. vs pt", 10, 20, 220);
h_eff_Path2_phi_tight = ibooker.book1D(
"matchingEff_phi_" + triggerhistName2_ + "_tight", triggerhistName2_ + ":matching Eff. vs #phi", 8, -3.0, 3.0);
// This prevents this ME to be normalized when drawn into the GUI
h_eff_Path1_eta_tight->setEfficiencyFlag();
h_eff_Path1_pt_tight->setEfficiencyFlag();
h_eff_Path1_phi_tight->setEfficiencyFlag();
h_eff_Path2_eta_tight->setEfficiencyFlag();
h_eff_Path2_pt_tight->setEfficiencyFlag();
h_eff_Path2_phi_tight->setEfficiencyFlag();
// AXIS TITLES....
h_eff_Path1_eta_tight->setAxisTitle("#eta", 1);
h_eff_Path1_pt_tight->setAxisTitle("pt", 1);
h_eff_Path1_phi_tight->setAxisTitle("#phi", 1);
h_eff_Path2_eta_tight->setAxisTitle("#eta", 1);
h_eff_Path2_pt_tight->setAxisTitle("pt", 1);
h_eff_Path2_phi_tight->setAxisTitle("#phi", 1);
/// --- Tight Muon trigger mathcing efficiency
string inputdir = "Muons_miniAOD/TriggerMatchMonitor/EfficiencyInput";
string numpath_eta_path1 = inputdir + "/passHLT" + triggerhistName1_ + "_eta_Tight";
string denpath_eta_path1 = inputdir + "/totalHLT" + triggerhistName1_ + "_eta_Tight";
string numpath_pt_path1 = inputdir + "/passHLT" + triggerhistName1_ + "_pt_Tight";
string denpath_pt_path1 = inputdir + "/totalHLT" + triggerhistName1_ + "_pt_Tight";
string numpath_phi_path1 = inputdir + "/passHLT" + triggerhistName1_ + "_phi_Tight";
string denpath_phi_path1 = inputdir + "/totalHLT" + triggerhistName1_ + "_phi_Tight";
string numpath_eta_path2 = inputdir + "/passHLT" + triggerhistName2_ + "_eta_Tight";
string denpath_eta_path2 = inputdir + "/totalHLT" + triggerhistName2_ + "_eta_Tight";
string numpath_pt_path2 = inputdir + "/passHLT" + triggerhistName2_ + "_pt_Tight";
string denpath_pt_path2 = inputdir + "/totalHLT" + triggerhistName2_ + "_pt_Tight";
string numpath_phi_path2 = inputdir + "/passHLT" + triggerhistName2_ + "_phi_Tight";
string denpath_phi_path2 = inputdir + "/totalHLT" + triggerhistName2_ + "_phi_Tight";
MonitorElement *Numerator_eta_path1 = igetter.get(numpath_eta_path1);
MonitorElement *Denominator_eta_path1 = igetter.get(denpath_eta_path1);
MonitorElement *Numerator_pt_path1 = igetter.get(numpath_pt_path1);
MonitorElement *Denominator_pt_path1 = igetter.get(denpath_pt_path1);
MonitorElement *Numerator_phi_path1 = igetter.get(numpath_phi_path1);
MonitorElement *Denominator_phi_path1 = igetter.get(denpath_phi_path1);
MonitorElement *Numerator_eta_path2 = igetter.get(numpath_eta_path2);
MonitorElement *Denominator_eta_path2 = igetter.get(denpath_eta_path2);
MonitorElement *Numerator_pt_path2 = igetter.get(numpath_pt_path2);
MonitorElement *Denominator_pt_path2 = igetter.get(denpath_pt_path2);
MonitorElement *Numerator_phi_path2 = igetter.get(numpath_phi_path2);
MonitorElement *Denominator_phi_path2 = igetter.get(denpath_phi_path2);
if (Numerator_eta_path1 && Denominator_eta_path1) {
TH1F *h_numerator_eta_path1 = Numerator_eta_path1->getTH1F();
TH1F *h_denominator_eta_path1 = Denominator_eta_path1->getTH1F();
TH1F *h_eff_eta_path1 = h_eff_Path1_eta_tight->getTH1F();
if (h_eff_eta_path1->GetSumw2N() == 0)
h_eff_eta_path1->Sumw2();
h_eff_eta_path1->Divide(h_numerator_eta_path1, h_denominator_eta_path1, 1., 1., "B");
}
if (Numerator_pt_path1 && Denominator_pt_path1) {
TH1F *h_numerator_pt_path1 = Numerator_pt_path1->getTH1F();
TH1F *h_denominator_pt_path1 = Denominator_pt_path1->getTH1F();
TH1F *h_eff_pt_path1 = h_eff_Path1_pt_tight->getTH1F();
if (h_eff_pt_path1->GetSumw2N() == 0)
h_eff_pt_path1->Sumw2();
h_eff_pt_path1->Divide(h_numerator_pt_path1, h_denominator_pt_path1, 1., 1., "B");
}
if (Numerator_phi_path1 && Denominator_phi_path1) {
TH1F *h_numerator_phi_path1 = Numerator_phi_path1->getTH1F();
TH1F *h_denominator_phi_path1 = Denominator_phi_path1->getTH1F();
TH1F *h_eff_phi_path1 = h_eff_Path1_phi_tight->getTH1F();
if (h_eff_phi_path1->GetSumw2N() == 0)
h_eff_phi_path1->Sumw2();
h_eff_phi_path1->Divide(h_numerator_phi_path1, h_denominator_phi_path1, 1., 1., "B");
}
//trigger path2
if (Numerator_eta_path2 && Denominator_eta_path2) {
TH1F *h_numerator_eta_path2 = Numerator_eta_path2->getTH1F();
TH1F *h_denominator_eta_path2 = Denominator_eta_path2->getTH1F();
TH1F *h_eff_eta_path2 = h_eff_Path2_eta_tight->getTH1F();
if (h_eff_eta_path2->GetSumw2N() == 0)
h_eff_eta_path2->Sumw2();
h_eff_eta_path2->Divide(h_numerator_eta_path2, h_denominator_eta_path2, 1., 1., "B");
}
if (Numerator_pt_path2 && Denominator_pt_path2) {
TH1F *h_numerator_pt_path2 = Numerator_pt_path2->getTH1F();
TH1F *h_denominator_pt_path2 = Denominator_pt_path2->getTH1F();
TH1F *h_eff_pt_path2 = h_eff_Path2_pt_tight->getTH1F();
if (h_eff_pt_path2->GetSumw2N() == 0)
h_eff_pt_path2->Sumw2();
h_eff_pt_path2->Divide(h_numerator_pt_path2, h_denominator_pt_path2, 1., 1., "B");
}
if (Numerator_phi_path2 && Denominator_phi_path2) {
TH1F *h_numerator_phi_path2 = Numerator_phi_path2->getTH1F();
TH1F *h_denominator_phi_path2 = Denominator_phi_path2->getTH1F();
TH1F *h_eff_phi_path2 = h_eff_Path2_phi_tight->getTH1F();
if (h_eff_phi_path2->GetSumw2N() == 0)
h_eff_phi_path2->Sumw2();
h_eff_phi_path2->Divide(h_numerator_phi_path2, h_denominator_phi_path2, 1., 1., "B");
}
}
|