16 #include <TDirectory.h>
30 cout <<
"[L1TTestsSummary:] Called constructor" << endl;
42 mL1TOccupancyPath = ps.
getUntrackedParameter<
string>(
"L1TOccupancyPath",
"L1T/L1TOccupancy/Certification/");
51 cout <<
"[L1TTestsSummary:] Called destructor" << endl;
64 cout <<
"[L1TTestsSummary:] Called beginRun" << endl;
69 if (mMonitorL1TRate) {
71 cout <<
"[L1TTestsSummary:] Initializing L1TRate Module Monitoring" << endl;
75 vector<string> histToMonitor = igetter.
getMEs();
76 int histLines = histToMonitor.size() + 1;
79 mL1TRateMonitor = ibooker.
book2D(
80 "RateQualitySummary",
"L1T Rates Monitor Summary", maxLS, +0.5,
double(maxLS) + 0.5, histLines, 0, histLines);
83 mL1TRateMonitor->setBinLabel(1,
"Summary", 2);
84 for (
unsigned int i = 0;
i < histToMonitor.size();
i++) {
85 string name = igetter.
get(mL1TRatePath + histToMonitor[
i])->
getTH1()->GetName();
86 mL1TRateMonitor->setBinLabel(i + 2, name, 2);
89 if (mMonitorL1TSync) {
91 cout <<
"[L1TTestsSummary:] Initializing L1TSync Module Monitoring" << endl;
95 vector<string> histToMonitor = igetter.
getMEs();
96 int histLines = histToMonitor.size() + 1;
99 mL1TSyncMonitor = ibooker.
book2D(
"SyncQualitySummary",
100 "L1T Synchronization Monitor Summary",
109 mL1TSyncMonitor->setBinLabel(1,
"Summary", 2);
110 for (
unsigned int i = 0;
i < histToMonitor.size();
i++) {
111 string name = igetter.
get(mL1TSyncPath + histToMonitor[
i])->
getTH1()->GetName();
112 mL1TSyncMonitor->setBinLabel(i + 2, name, 2);
115 if (mMonitorL1TOccupancy) {
117 cout <<
"[L1TTestsSummary:] Initializing L1TOccupancy Module Monitoring" << endl;
121 vector<string> histToMonitor = igetter.
getMEs();
122 int histLines = histToMonitor.size() + 1;
125 mL1TOccupancyMonitor = ibooker.
book2D(
126 "OccupancySummary",
"L1T Occupancy Monitor Summary", maxLS, +0.5,
double(maxLS) + 0.5, histLines, 0, histLines);
129 mL1TOccupancyMonitor->setBinLabel(1,
"Summary", 2);
130 for (
unsigned int i = 0;
i < histToMonitor.size();
i++) {
131 string name = igetter.
get(mL1TOccupancyPath + histToMonitor[
i])->
getTH1()->GetName();
132 mL1TOccupancyMonitor->setBinLabel(i + 2, name, 2);
137 int testsToMonitor = 1;
138 if (mMonitorL1TRate) {
141 if (mMonitorL1TSync) {
144 if (mMonitorL1TOccupancy) {
150 mL1TSummary = ibooker.
book2D(
151 "L1TQualitySummary",
"L1 Tests Summary", maxLS, +0.5,
double(maxLS) + 0.5, testsToMonitor, 0, testsToMonitor);
153 mL1TSummary->setBinLabel(1,
"L1T Summary", 2);
156 if (mMonitorL1TRate) {
157 mL1TSummary->setBinLabel(it,
"Rates", 2);
161 if (mMonitorL1TSync) {
162 mL1TSummary->setBinLabel(it,
"Synchronization", 2);
166 if (mMonitorL1TOccupancy) {
167 mL1TSummary->setBinLabel(it,
"Occupancy", 2);
180 book(ibooker, igetter);
183 cout <<
"[L1TTestsSummary:] Called endRun()" << endl;
186 if (mMonitorL1TRate) {
187 updateL1TRateMonitor(ibooker, igetter);
189 if (mMonitorL1TSync) {
190 updateL1TSyncMonitor(ibooker, igetter);
192 if (mMonitorL1TOccupancy) {
193 updateL1TOccupancyMonitor(ibooker, igetter);
195 updateL1TSummary(ibooker, igetter);
211 book(ibooker, igetter);
213 mProcessedLS.push_back(eventLS);
216 cout <<
"[L1TTestsSummary:] Called endLuminosityBlock()" << endl;
217 cout <<
"[L1TTestsSummary:] Lumisection: " << eventLS << endl;
220 if (mMonitorL1TRate) {
221 updateL1TRateMonitor(ibooker, igetter);
223 if (mMonitorL1TSync) {
224 updateL1TSyncMonitor(ibooker, igetter);
226 if (mMonitorL1TOccupancy) {
227 updateL1TOccupancyMonitor(ibooker, igetter);
229 updateL1TSummary(ibooker, igetter);
238 vector<string> histToMonitor = igetter.
getMEs();
240 for (
unsigned int i = 0;
i < histToMonitor.size();
i++) {
243 cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;
250 const string &qtmessage = myQReport->
getMessage();
254 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
255 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
256 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
259 for (
unsigned int i = 0; i < mProcessedLS.size() - 1; i++) {
260 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
261 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
262 mL1TRateMonitor->setBinContent(binx, biny, 100);
265 for (
unsigned int a = 0;
a < qtBadChannels.size();
a++) {
266 for (
unsigned int b = 0;
b < mProcessedLS.size() - 1;
b++) {
268 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
270 if (valueBinBad == (mProcessedLS[
b])) {
271 int binx = mL1TRateMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
272 int biny = mL1TRateMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
273 mL1TRateMonitor->setBinContent(binx, biny, 300);
281 int nBinX = mL1TRateMonitor->getTH2F()->GetXaxis()->GetNbins();
282 int nBinY = mL1TRateMonitor->getTH2F()->GetYaxis()->GetNbins();
283 for (
int binx = 1; binx <= nBinX; binx++) {
284 int GlobalStatus = 0;
285 for (
int biny = 2; biny <= nBinY; biny++) {
286 double flag = mL1TRateMonitor->getBinContent(binx, biny);
287 if (GlobalStatus < flag) {
293 mL1TRateMonitor->setBinContent(binx, 1, GlobalStatus);
294 mL1TSummary->setBinContent(binx, binYRate, GlobalStatus);
306 vector<string> histToMonitor = igetter.
getMEs();
308 for (
unsigned int i = 0;
i < histToMonitor.size();
i++) {
311 cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;
318 const string &qtmessage = myQReport->
getMessage();
322 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
323 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
324 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
327 for (
unsigned int i = 0; i < mProcessedLS.size(); i++) {
328 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
329 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
330 mL1TSyncMonitor->setBinContent(binx, biny, 100);
333 for (
unsigned int a = 0;
a < qtBadChannels.size();
a++) {
334 for (
unsigned int b = 0;
b < mProcessedLS.size();
b++) {
336 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
338 if (valueBinBad == mProcessedLS[
b]) {
339 int binx = mL1TSyncMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
340 int biny = mL1TSyncMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
341 mL1TSyncMonitor->setBinContent(binx, biny, 300);
349 int nBinX = mL1TSyncMonitor->getTH2F()->GetXaxis()->GetNbins();
350 int nBinY = mL1TSyncMonitor->getTH2F()->GetYaxis()->GetNbins();
351 for (
int binx = 1; binx <= nBinX; binx++) {
352 int GlobalStatus = 0;
353 for (
int biny = 2; biny <= nBinY; biny++) {
354 double flag = mL1TSyncMonitor->getBinContent(binx, biny);
355 if (GlobalStatus < flag) {
361 mL1TSyncMonitor->setBinContent(binx, 1, GlobalStatus);
362 mL1TSummary->setBinContent(binx, binYSync, GlobalStatus);
372 vector<string> histToMonitor = igetter.
getMEs();
374 for (
unsigned int i = 0;
i < histToMonitor.size();
i++) {
377 cout <<
"[L1TTestsSummary:] Found ME: " << me->
getTH1()->GetName() << endl;
384 const string &qtmessage = myQReport->
getMessage();
388 cout <<
"[L1TTestsSummary:] Found QReport for ME: " << me->
getTH1()->GetName() << endl;
389 cout <<
"[L1TTestsSummary:] Result=" << qtresult <<
" status=" << qtstatus <<
" message=" << qtmessage << endl;
390 cout <<
"[L1TTestsSummary:] Bad Channels size=" << qtBadChannels.size() << endl;
393 for (
unsigned int i = 0; i < mProcessedLS.size(); i++) {
394 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(mProcessedLS[i]);
395 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
396 mL1TOccupancyMonitor->setBinContent(binx, biny, 100);
399 for (
unsigned int a = 0;
a < qtBadChannels.size();
a++) {
400 for (
unsigned int b = 0;
b < mProcessedLS.size();
b++) {
402 double valueBinBad = me->
getTH1()->GetBinCenter(qtBadChannels[
a].
getBin());
404 if (valueBinBad == mProcessedLS[
b]) {
405 int binx = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->FindBin(valueBinBad);
406 int biny = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->FindBin(me->
getTH1()->GetName());
407 mL1TOccupancyMonitor->setBinContent(binx, biny, 300);
415 int nBinX = mL1TOccupancyMonitor->getTH2F()->GetXaxis()->GetNbins();
416 int nBinY = mL1TOccupancyMonitor->getTH2F()->GetYaxis()->GetNbins();
417 for (
int binx = 1; binx <= nBinX; binx++) {
418 int GlobalStatus = 0;
419 for (
int biny = 2; biny <= nBinY; biny++) {
420 double flag = mL1TOccupancyMonitor->getBinContent(binx, biny);
421 if (GlobalStatus < flag) {
427 mL1TOccupancyMonitor->setBinContent(binx, 1, GlobalStatus);
428 mL1TSummary->setBinContent(binx, binYOccpancy, GlobalStatus);
437 int nBinX = mL1TSummary->getTH2F()->GetXaxis()->GetNbins();
438 for (
int binx = 1; binx <= nBinX; binx++) {
439 int GlobalStatus = 0;
440 if (mMonitorL1TRate) {
441 if (mL1TSummary->getBinContent(binx, binYRate) > GlobalStatus) {
442 GlobalStatus = mL1TSummary->getBinContent(binx, binYRate);
445 if (mMonitorL1TSync) {
446 if (mL1TSummary->getBinContent(binx, binYSync) > GlobalStatus) {
447 GlobalStatus = mL1TSummary->getBinContent(binx, binYSync);
450 if (mMonitorL1TOccupancy) {
451 if (mL1TSummary->getBinContent(binx, binYOccpancy) > GlobalStatus) {
452 GlobalStatus = mL1TSummary->getBinContent(binx, binYOccpancy);
455 mL1TSummary->setBinContent(binx, 1, GlobalStatus);
LuminosityBlockID id() const
void updateL1TRateMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
T getUntrackedParameter(std::string const &, T const &) const
~L1TTestsSummary() override
const edm::EventSetup & c
void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) override
virtual void setCurrentFolder(std::string const &fullpath)
void updateL1TSummary(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
#define DEFINE_FWK_MODULE(type)
virtual void book(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
const MonitorElementData::QReport * getQReport(const std::string &qtname) const
get QReport corresponding to <qtname> (null pointer if QReport does not exist)
void updateL1TOccupancyMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
int getStatus() const
get test status
const std::string & getMessage() const
get message attached to test
virtual MonitorElement * get(std::string const &fullpath) const
int getBin(double x, std::vector< double > boundaries)
void updateL1TSyncMonitor(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)
void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter, const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
LuminosityBlockNumber_t luminosityBlock() const
float getQTresult() const
get test result i.e. prob value
const std::vector< DQMChannel > & getBadChannels() const
virtual std::vector< std::string > getMEs() const
L1TTestsSummary(const edm::ParameterSet &ps)
mVerbose(fConfig.getUntrackedParameter< bool >("verbose", false))
virtual TH1 * getTH1() const
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)