From e3c13d0253b554764d06c1a79b388b76a87429cc Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 22 Apr 2024 12:28:10 +0200 Subject: [PATCH 1/5] Protection against 0/0 when no triggers present --- DQM/DTMonitorClient/src/DTLocalTriggerTest.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/DQM/DTMonitorClient/src/DTLocalTriggerTest.cc b/DQM/DTMonitorClient/src/DTLocalTriggerTest.cc index b516fa15dc27f..bdf478dcb6c2f 100644 --- a/DQM/DTMonitorClient/src/DTLocalTriggerTest.cc +++ b/DQM/DTMonitorClient/src/DTLocalTriggerTest.cc @@ -149,8 +149,15 @@ void DTLocalTriggerTest::runClientDiagnostic(DQMStore::IBooker& ibooker, DQMStor delete BXHH; delete Flag1st; - corrFrac = besttrigsCorr / besttrigs; - secondFrac = trigsFlag2nd / trigs; + if (besttrigs != 0) + corrFrac = besttrigsCorr / besttrigs; + else + corrFrac = 1; + if (trigs != 0) + secondFrac = trigsFlag2nd / trigs; + else + secondFrac = 0; + if (corrFrac < parameters.getUntrackedParameter("corrFracError", .5)) { corrSummary = 2; } else if (corrFrac < parameters.getUntrackedParameter("corrFracWarning", .6)) { From ed5af64db4d960bd2eac571f4c3693c2f1e18f2d Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 22 Apr 2024 13:02:04 +0200 Subject: [PATCH 2/5] Enable easy reading of x-axis labels --- DQM/DTMonitorClient/src/DTBlockedROChannelsTest.cc | 3 ++- DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DQM/DTMonitorClient/src/DTBlockedROChannelsTest.cc b/DQM/DTMonitorClient/src/DTBlockedROChannelsTest.cc index 7f93db1808767..ea8c9801018da 100644 --- a/DQM/DTMonitorClient/src/DTBlockedROChannelsTest.cc +++ b/DQM/DTMonitorClient/src/DTBlockedROChannelsTest.cc @@ -154,7 +154,8 @@ void DTBlockedROChannelsTest::dqmEndLuminosityBlock(DQMStore::IBooker& ibooker, } if (!offlineMode) { - hSystFractionVsLS = new DTTimeEvolutionHisto(ibooker, "EnabledROChannelsVsLS", "% RO channels", 500, 5, true, 3); + hSystFractionVsLS = + new DTTimeEvolutionHisto(ibooker, "EnabledROChannelsVsLS", "Fraction of RO channels", 500, 5, true, 3); } } // end attempt to make these bookings only once! diff --git a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc index 04ecfc0a9ded7..917cd6666439d 100644 --- a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc +++ b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc @@ -161,8 +161,8 @@ void DTTimeEvolutionHisto::updateTimeSlot(int ls, int nEventsInLS) { if (nEventsInLastTimeSlot.size() > 1) binLabel << "-" << lastLSinTimeSlot; - //if(lastLSinTimeSlot%(3*(int)theLSPrescale)==0) - histo->setBinLabel(nBookedBins, binLabel.str(), 1); + if (lastLSinTimeSlot % (5 * (int)theLSPrescale) == 0) //JF allow easy reading of labels + histo->setBinLabel(nBookedBins, binLabel.str(), 1); // reset the counters for the time slot nEventsInLastTimeSlot.clear(); From 676ddd778259273e1f75096b2e85013ae688ca33 Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 29 Apr 2024 12:55:00 +0200 Subject: [PATCH 3/5] Fixed bin value to use as reference --- DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc index 917cd6666439d..1260151bab8d7 100644 --- a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc +++ b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc @@ -161,7 +161,7 @@ void DTTimeEvolutionHisto::updateTimeSlot(int ls, int nEventsInLS) { if (nEventsInLastTimeSlot.size() > 1) binLabel << "-" << lastLSinTimeSlot; - if (lastLSinTimeSlot % (5 * (int)theLSPrescale) == 0) //JF allow easy reading of labels + if (nBookedBins % (5 * (int)theLSPrescale) == 0) //JF allow easy reading of labels histo->setBinLabel(nBookedBins, binLabel.str(), 1); // reset the counters for the time slot From 77984955c602d3bb49509df092b0f2762d775654 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 30 Apr 2024 14:07:32 +0200 Subject: [PATCH 4/5] Count bins to set labels --- DQM/DTMonitorModule/interface/DTTimeEvolutionHisto.h | 1 + DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DQM/DTMonitorModule/interface/DTTimeEvolutionHisto.h b/DQM/DTMonitorModule/interface/DTTimeEvolutionHisto.h index 53c26f34b3ed5..4e8dc15f8754b 100644 --- a/DQM/DTMonitorModule/interface/DTTimeEvolutionHisto.h +++ b/DQM/DTMonitorModule/interface/DTTimeEvolutionHisto.h @@ -73,6 +73,7 @@ class DTTimeEvolutionHisto { int nBookedBins; int theMode; MonitorElement* histo; + int binLabelCounter; }; #endif diff --git a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc index 1260151bab8d7..01f9525bd3e41 100644 --- a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc +++ b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc @@ -35,6 +35,7 @@ DTTimeEvolutionHisto::DTTimeEvolutionHisto(DQMStore::IBooker& ibooker, : valueLastTimeSlot(0), theFirstLS(firstLS), theLSPrescale(lsPrescale), doSlide(sliding), theMode(mode) { // set the number of bins to be booked nBookedBins = nbins; + binLabelCounter = -1; if (sliding) nBookedBins++; if (!sliding && theMode == 0) @@ -158,10 +159,12 @@ void DTTimeEvolutionHisto::updateTimeSlot(int ls, int nEventsInLS) { // set the bin label stringstream binLabel; binLabel << "LS " << firstLSinTimeSlot; - if (nEventsInLastTimeSlot.size() > 1) + if (nEventsInLastTimeSlot.size() > 1) { binLabel << "-" << lastLSinTimeSlot; + binLabelCounter++; + } - if (nBookedBins % (5 * (int)theLSPrescale) == 0) //JF allow easy reading of labels + if (binLabelCounter % (5 * (int)theLSPrescale) == 0) //JF allow easy reading of labels histo->setBinLabel(nBookedBins, binLabel.str(), 1); // reset the counters for the time slot From 0c0b41d5f2495ec8d80b4ad72c5286b23576c0f7 Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 30 Apr 2024 19:54:50 +0200 Subject: [PATCH 5/5] Fix taking into account sliding --- DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc index 01f9525bd3e41..a198fc78b34eb 100644 --- a/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc +++ b/DQM/DTMonitorModule/src/DTTimeEvolutionHisto.cc @@ -97,7 +97,8 @@ void DTTimeEvolutionHisto::setTimeSlotValue(float value, int timeSlot) { } else if (bin != nBookedBins) { histo->setBinContent(bin, histo->getBinContent(bin + 1)); histo->setBinError(bin, histo->getBinError(bin + 1)); - histo->setBinLabel(bin, histo->getTH1F()->GetXaxis()->GetBinLabel(bin + 1), 1); + histo->setBinLabel(bin, histo->getTH1F()->GetXaxis()->GetBinLabel(bin + 1), 1); //slide to left + histo->setBinLabel(bin + 1, "", 1); //delete old label to avoid duplication } } histo->setBinContent(nBookedBins, value); @@ -164,8 +165,10 @@ void DTTimeEvolutionHisto::updateTimeSlot(int ls, int nEventsInLS) { binLabelCounter++; } - if (binLabelCounter % (5 * (int)theLSPrescale) == 0) //JF allow easy reading of labels + // Set only labels which can be seen in the plot without zooming + if (binLabelCounter % ((int)(nBookedBins / 25)) == 0) //around 25 labels fit in a full size hist histo->setBinLabel(nBookedBins, binLabel.str(), 1); + //first label, LS=1 ideally, is guaranteed by setting binLabelCounter=-1 in constructor // reset the counters for the time slot nEventsInLastTimeSlot.clear();