CMS 3D CMS Logo

L1TGMTClient.cc
Go to the documentation of this file.
2 
7 
8 #include <sstream>
9 
11  parameters_ = ps;
12  initialize();
13 }
14 
15 L1TGMTClient::~L1TGMTClient() { LogDebug("TriggerDQM") << "[TriggerDQM]: ending... "; }
16 
17 //--------------------------------------------------------
19  // base folder for the contents of this job
21  LogDebug("TriggerDQM") << "Monitor name = " << monitorName_ << std::endl;
22 
24  LogDebug("TriggerDQM") << "DQM output dir = " << output_dir_ << std::endl;
25 
27  LogDebug("TriggerDQM") << "DQM input dir = " << input_dir_ << std::endl;
28 
29  m_runInEventLoop = parameters_.getUntrackedParameter<bool>("runInEventLoop", false);
30  m_runInEndLumi = parameters_.getUntrackedParameter<bool>("runInEndLumi", false);
31  m_runInEndRun = parameters_.getUntrackedParameter<bool>("runInEndRun", false);
32  m_runInEndJob = parameters_.getUntrackedParameter<bool>("runInEndJob", false);
33 }
34 
35 //--------------------------------------------------------
37  // booking histograms in the output_dir_
38 
40 
41  eff_eta_dtcsc = bookClone1DVB(ibooker, igetter, "eff_eta_dtcsc", "efficiency DTCSC vs eta", "eta_DTCSC_and_RPC");
42 
43  if (eff_eta_dtcsc != nullptr) {
44  eff_eta_dtcsc->setAxisTitle("eta", 1);
45  if (eff_eta_dtcsc->getTH1F()->GetSumw2N() == 0)
47  }
48 
49  eff_eta_rpc = bookClone1DVB(ibooker, igetter, "eff_eta_rpc", "efficiency RPC vs eta", "eta_DTCSC_and_RPC");
50 
51  if (eff_eta_rpc != nullptr) {
52  eff_eta_rpc->setAxisTitle("eta", 1);
53  if (eff_eta_rpc->getTH1F()->GetSumw2N() == 0)
55  }
56 
57  eff_phi_dtcsc = bookClone1D(ibooker, igetter, "eff_phi_dtcsc", "efficiency DTCSC vs phi", "phi_DTCSC_and_RPC");
58 
59  if (eff_phi_dtcsc != nullptr) {
60  eff_phi_dtcsc->setAxisTitle("phi (deg)", 1);
61  if (eff_phi_dtcsc->getTH1F()->GetSumw2N() == 0)
63  }
64 
65  eff_phi_rpc = bookClone1D(ibooker, igetter, "eff_phi_rpc", "efficiency RPC vs phi", "phi_DTCSC_and_RPC");
66 
67  if (eff_phi_rpc != nullptr) {
68  eff_phi_rpc->setAxisTitle("phi (deg)", 1);
69  if (eff_phi_rpc->getTH1F()->GetSumw2N() == 0)
71  }
72 
74  bookClone2D(ibooker, igetter, "eff_etaphi_dtcsc", "efficiency DTCSC vs eta and phi", "etaphi_DTCSC_and_RPC");
75 
76  if (eff_etaphi_dtcsc != nullptr) {
77  eff_etaphi_dtcsc->setAxisTitle("eta", 1);
78  eff_etaphi_dtcsc->setAxisTitle("phi (deg)", 2);
79  if (eff_etaphi_dtcsc->getTH2F()->GetSumw2N() == 0)
81  }
82 
84  bookClone2D(ibooker, igetter, "eff_etaphi_rpc", "efficiency RPC vs eta and phi", "etaphi_DTCSC_and_RPC");
85 
86  if (eff_etaphi_rpc != nullptr) {
87  eff_etaphi_rpc->setAxisTitle("eta", 1);
88  eff_etaphi_rpc->setAxisTitle("phi (deg)", 2);
89  if (eff_etaphi_rpc->getTH2F()->GetSumw2N() == 0)
91  }
92 
93  processHistograms(ibooker, igetter);
94 }
95 
96 //--------------------------------------------------------
97 
99  DQMStore::IGetter& igetter,
100  const edm::LuminosityBlock& lumiSeg,
101  const edm::EventSetup& evSetup) {}
102 
103 //--------------------------------------------------------
105  LogDebug("TriggerDQM") << "L1TGMTClient: processing..." << std::endl;
106 
107  makeEfficiency1D(ibooker, igetter, eff_eta_dtcsc, "eta_DTCSC_and_RPC", "eta_RPC_only");
108  makeEfficiency1D(ibooker, igetter, eff_eta_rpc, "eta_DTCSC_and_RPC", "eta_DTCSC_only");
109 
110  makeEfficiency1D(ibooker, igetter, eff_phi_dtcsc, "phi_DTCSC_and_RPC", "phi_RPC_only");
111  makeEfficiency1D(ibooker, igetter, eff_phi_rpc, "phi_DTCSC_and_RPC", "phi_DTCSC_only");
112 
113  makeEfficiency2D(ibooker, igetter, eff_etaphi_dtcsc, "etaphi_DTCSC_and_RPC", "etaphi_RPC_only");
114  makeEfficiency2D(ibooker, igetter, eff_etaphi_rpc, "etaphi_DTCSC_and_RPC", "etaphi_DTCSC_only");
115 }
116 
119  DQMStore::IGetter& igetter,
120  MonitorElement* mer,
121  std::string h1Name,
122  std::string h2Name) {
123  igetter.setCurrentFolder(output_dir_);
124 
125  TH1F* h1 = get1DHisto(input_dir_ + "/" + h1Name, igetter);
126  TH1F* h2 = get1DHisto(input_dir_ + "/" + h2Name, igetter);
127 
128  if (mer == nullptr) {
129  LogDebug("TriggerDQM") << "\nL1TGMTClient::makeRatio1D: monitoring element zero, not able to retrieve histogram"
130  << std::endl;
131  return;
132  }
133 
134  TH1F* hr = mer->getTH1F();
135 
136  if (hr && h1 && h2) {
137  hr->Divide(h1, h2, 1., 1., " ");
138  }
139 }
140 
143  DQMStore::IGetter& igetter,
144  MonitorElement* meeff,
145  std::string heName,
146  std::string hiName) {
147  igetter.setCurrentFolder(output_dir_);
148 
149  TH1F* he = get1DHisto(input_dir_ + "/" + heName, igetter);
150  TH1F* hi = get1DHisto(input_dir_ + "/" + hiName, igetter);
151 
152  if (meeff == nullptr) {
153  LogDebug("TriggerDQM") << "L1TGMTClient::makeEfficiency1D: monitoring element zero, not able to retrieve histogram"
154  << std::endl;
155  return;
156  }
157 
158  TH1F* heff = meeff->getTH1F();
159 
160  if (heff && he && hi) {
161  TH1F* hall = (TH1F*)he->Clone("hall");
162  hall->Add(hi);
163  heff->Divide(he, hall, 1., 1., "B");
164  delete hall;
165  }
166 }
167 
170  DQMStore::IGetter& igetter,
171  MonitorElement* meeff,
172  std::string heName,
173  std::string hiName) {
174  igetter.setCurrentFolder(output_dir_);
175 
176  TH2F* he = get2DHisto(input_dir_ + "/" + heName, igetter);
177  TH2F* hi = get2DHisto(input_dir_ + "/" + hiName, igetter);
178 
179  if (meeff == nullptr) {
180  LogDebug("TriggerDQM")
181  << "\nL1TGMTClient::makeEfficiency2D: monitoring element zero, not able to retrieve histogram" << std::endl;
182  return;
183  }
184 
185  TH2F* heff = meeff->getTH2F();
186 
187  if (heff && he && hi) {
188  TH2F* hall = (TH2F*)he->Clone("hall");
189  hall->Add(hi);
190  heff->Divide(he, hall, 1., 1., "B");
191  delete hall;
192  }
193 }
194 
197  MonitorElement* me_ = igetter.get(meName);
198 
199  if (!me_) {
200  LogDebug("TriggerDQM") << "\nL1TGMTClient: " << meName << " NOT FOUND.";
201  return nullptr;
202  }
203 
204  return me_->getTH1F();
205 }
206 
209  MonitorElement* me_ = igetter.get(meName);
210 
211  if (!me_) {
212  LogDebug("TriggerDQM") << "\nL1TGMTClient: " << meName << " NOT FOUND.";
213  return nullptr;
214  }
215  return me_->getTH2F();
216 }
217 
220  DQMStore::IGetter& igetter,
221  const std::string& name,
222  const std::string& title,
223  const std::string& hrefName) {
225 
226  TH1F* href = get1DHisto(input_dir_ + "/" + hrefName, igetter);
227 
228  if (href) {
229  LogDebug("TriggerDQM") << "\nL1TGMTClient::bookClone1D: booking histogram " << hrefName << std::endl;
230  const unsigned nbx = href->GetNbinsX();
231  const double xmin = href->GetXaxis()->GetXmin();
232  const double xmax = href->GetXaxis()->GetXmax();
233  ibooker.setCurrentFolder(output_dir_);
234  me = ibooker.book1D(name, title, nbx, xmin, xmax);
235  } else {
236  LogDebug("TriggerDQM") << "\nL1TGMTClient::bookClone1D: not able to clone histogram " << hrefName << std::endl;
237  me = nullptr;
238  }
239 
240  return me;
241 }
242 
245  DQMStore::IGetter& igetter,
246  const std::string& name,
247  const std::string& title,
248  const std::string& hrefName) {
250 
251  TH1F* href = get1DHisto(input_dir_ + "/" + hrefName, igetter);
252 
253  if (href) {
254  LogDebug("TriggerDQM") << "\nL1TGMTClient::bookClone1DVB: booking histogram " << hrefName << std::endl;
255  int nbx = href->GetNbinsX();
256  if (nbx > 99)
257  nbx = 99;
258  float xbins[100];
259  for (int i = 0; i < nbx; i++) {
260  xbins[i] = href->GetBinLowEdge(i + 1);
261  }
262  xbins[nbx] = href->GetXaxis()->GetXmax();
263 
264  ibooker.setCurrentFolder(output_dir_);
265  me = ibooker.book1D(name, title, nbx, xbins);
266 
267  } else {
268  LogDebug("TriggerDQM") << "\nL1TGMTClient::bookClone1DVB: not able to clone histogram " << hrefName << std::endl;
269  me = nullptr;
270  }
271 
272  return me;
273 }
274 
277  DQMStore::IGetter& igetter,
278  const std::string& name,
279  const std::string& title,
280  const std::string& hrefName) {
282 
283  TH2F* href = get2DHisto(input_dir_ + "/" + hrefName, igetter);
284 
285  if (href) {
286  LogDebug("TriggerDQM") << "\nL1TGMTClient::bookClone2D: booking histogram " << hrefName << std::endl;
287  const unsigned nbx = href->GetNbinsX();
288  const double xmin = href->GetXaxis()->GetXmin();
289  const double xmax = href->GetXaxis()->GetXmax();
290  const unsigned nby = href->GetNbinsY();
291  const double ymin = href->GetYaxis()->GetXmin();
292  const double ymax = href->GetYaxis()->GetXmax();
293  ibooker.setCurrentFolder(output_dir_);
294  me = ibooker.book2D(name, title, nbx, xmin, xmax, nby, ymin, ymax);
295  } else {
296  LogDebug("TriggerDQM") << "\nL1TGMTClient::bookClone2D: not able to clone histogram " << hrefName << std::endl;
297  me = nullptr;
298  }
299 
300  return me;
301 }
302 
void makeEfficiency2D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, MonitorElement *meeff, std::string heName, std::string hiName)
void processHistograms(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
std::string monitorName_
Definition: L1TGMTClient.h:64
const double xbins[]
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &evSetup) override
Definition: L1TGMTClient.cc:98
TH2F * get2DHisto(std::string meName, DQMStore::IGetter &igetter)
MonitorElement * eff_eta_rpc
Definition: L1TGMTClient.h:75
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
void makeEfficiency1D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, MonitorElement *meeff, std::string heName, std::string hiName)
bool m_runInEndJob
Definition: L1TGMTClient.h:71
MonitorElement * eff_etaphi_dtcsc
Definition: L1TGMTClient.h:78
void initialize()
Definition: L1TGMTClient.cc:18
std::string input_dir_
Definition: L1TGMTClient.h:65
T getUntrackedParameter(std::string const &, T const &) const
virtual TH2F * getTH2F() const
bool m_runInEventLoop
Definition: L1TGMTClient.h:68
Definition: EPCuts.h:4
bool m_runInEndLumi
Definition: L1TGMTClient.h:69
MonitorElement * eff_etaphi_rpc
Definition: L1TGMTClient.h:79
MonitorElement * eff_phi_rpc
Definition: L1TGMTClient.h:77
MonitorElement * eff_eta_dtcsc
Definition: L1TGMTClient.h:74
MonitorElement * bookClone1D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &name, const std::string &title, const std::string &hrefName)
MonitorElement * eff_phi_dtcsc
Definition: L1TGMTClient.h:76
void makeRatio1D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, MonitorElement *mer, std::string h1Name, std::string h2Name)
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
Definition: L1TGMTClient.cc:36
virtual TH1F * getTH1F() const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:221
MonitorElement * bookClone1DVB(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &name, const std::string &title, const std::string &hrefName)
bool m_runInEndRun
Definition: L1TGMTClient.h:70
L1TGMTClient(const edm::ParameterSet &)
Constructor.
Definition: L1TGMTClient.cc:10
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
~L1TGMTClient() override
Destructor.
Definition: L1TGMTClient.cc:15
std::string output_dir_
Definition: L1TGMTClient.h:66
MonitorElement * bookClone2D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &name, const std::string &title, const std::string &hrefName)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
TH1F * get1DHisto(std::string meName, DQMStore::IGetter &igetter)
edm::ParameterSet parameters_
Definition: L1TGMTClient.h:63
#define LogDebug(id)
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)