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 
L1TGMTClient::eff_etaphi_rpc
MonitorElement * eff_etaphi_rpc
Definition: L1TGMTClient.h:80
fw3dlego::xbins
const double xbins[]
Definition: fw3dlego_xbins.cc:16
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
L1TGMTClient::eff_eta_dtcsc
MonitorElement * eff_eta_dtcsc
Definition: L1TGMTClient.h:75
L1TGMTClient::bookClone1D
MonitorElement * bookClone1D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &name, const std::string &title, const std::string &hrefName)
Definition: L1TGMTClient.cc:219
L1TGMTClient::eff_phi_dtcsc
MonitorElement * eff_phi_dtcsc
Definition: L1TGMTClient.h:77
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
L1TGMTClient::~L1TGMTClient
~L1TGMTClient() override
Destructor.
Definition: L1TGMTClient.cc:15
L1TGMTClient::dqmEndJob
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
Definition: L1TGMTClient.cc:36
L1TGMTClient::makeRatio1D
void makeRatio1D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, MonitorElement *mer, std::string h1Name, std::string h2Name)
Definition: L1TGMTClient.cc:118
L1TGMTClient::bookClone1DVB
MonitorElement * bookClone1DVB(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &name, const std::string &title, const std::string &hrefName)
Definition: L1TGMTClient.cc:244
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
L1TGMTClient::input_dir_
std::string input_dir_
Definition: L1TGMTClient.h:66
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
L1TGMTClient::eff_eta_rpc
MonitorElement * eff_eta_rpc
Definition: L1TGMTClient.h:76
dqm::legacy::MonitorElement::getTH1F
virtual TH1F * getTH1F() const
Definition: MonitorElement.h:478
L1TGMTClient::m_runInEndLumi
bool m_runInEndLumi
Definition: L1TGMTClient.h:70
L1TGMTClient::L1TGMTClient
L1TGMTClient(const edm::ParameterSet &)
Constructor.
Definition: L1TGMTClient.cc:10
L1TGMTClient::bookClone2D
MonitorElement * bookClone2D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const std::string &name, const std::string &title, const std::string &hrefName)
Definition: L1TGMTClient.cc:276
L1TOccupancyClient_cfi.ymax
ymax
Definition: L1TOccupancyClient_cfi.py:43
L1TGMTClient::m_runInEndJob
bool m_runInEndJob
Definition: L1TGMTClient.h:72
L1TGMTClient.h
Service.h
L1TGMTClient::get1DHisto
TH1F * get1DHisto(std::string meName, DQMStore::IGetter &igetter)
Definition: L1TGMTClient.cc:196
L1TGMTClient::makeEfficiency2D
void makeEfficiency2D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, MonitorElement *meeff, std::string heName, std::string hiName)
Definition: L1TGMTClient.cc:169
L1TGMTClient::m_runInEndRun
bool m_runInEndRun
Definition: L1TGMTClient.h:71
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
L1TGMTClient::processHistograms
void processHistograms(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
Definition: L1TGMTClient.cc:104
L1TGMTClient::initialize
void initialize()
Definition: L1TGMTClient.cc:18
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::ParameterSet
Definition: ParameterSet.h:36
L1TGMTClient::get2DHisto
TH2F * get2DHisto(std::string meName, DQMStore::IGetter &igetter)
Definition: L1TGMTClient.cc:208
L1TGMTClient::dqmEndLuminosityBlock
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &evSetup) override
Definition: L1TGMTClient.cc:98
L1TGMTClient::makeEfficiency1D
void makeEfficiency1D(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, MonitorElement *meeff, std::string heName, std::string hiName)
Definition: L1TGMTClient.cc:142
L1TGMTClient::monitorName_
std::string monitorName_
Definition: L1TGMTClient.h:65
edm::EventSetup
Definition: EventSetup.h:57
L1TGMTClient::eff_etaphi_dtcsc
MonitorElement * eff_etaphi_dtcsc
Definition: L1TGMTClient.h:79
L1TGMTClient::output_dir_
std::string output_dir_
Definition: L1TGMTClient.h:67
overlapproblemtsosanalyzer_cfi.title
title
Definition: overlapproblemtsosanalyzer_cfi.py:7
hi
Definition: HiEvtPlaneList.h:38
L1TOccupancyClient_cfi.ymin
ymin
Definition: L1TOccupancyClient_cfi.py:43
hcalSimParameters_cfi.he
he
Definition: hcalSimParameters_cfi.py:75
dqm::implementation::IGetter
Definition: DQMStore.h:484
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
dqm::implementation::IBooker::book2D
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:177
postprocess-scan-build.href
href
Definition: postprocess-scan-build.py:16
L1TGMTClient::parameters_
edm::ParameterSet parameters_
Definition: L1TGMTClient.h:64
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
L1TGMTClient::eff_phi_rpc
MonitorElement * eff_phi_rpc
Definition: L1TGMTClient.h:78
L1TGMTClient::m_runInEventLoop
bool m_runInEventLoop
Definition: L1TGMTClient.h:69
ParameterSet.h
dqm::impl::MonitorElement::enableSumw2
virtual void enableSumw2()
Definition: MonitorElement.cc:872
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:56
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
dqm::legacy::MonitorElement::getTH2F
virtual TH2F * getTH2F() const
Definition: MonitorElement.h:490