14#include <dqm/analysis/modules/DQMHistAnalysisSVDOccupancy.h>
15#include <vxd/geometry/GeoCache.h>
41 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: Constructor done.");
43 setDescription(
"DQM Analysis Module that produces colored canvas for a straightforward interpretation of the SVD Data Quality.");
45 addParam(
"occLevel_Error",
m_occError,
"Maximum Occupancy (%) allowed for safe operations (red)",
double(2));
46 addParam(
"occLevel_Warning",
m_occWarning,
"Occupancy (%) at WARNING level (orange)",
double(1.5));
47 addParam(
"occLevel_Empty",
m_occEmpty,
"Maximum Occupancy (%) for which the sensor is considered empty",
double(0));
48 addParam(
"onlineOccLevel_Error",
m_onlineOccError,
"Maximum OnlineOccupancy (%) allowed for safe operations (red)",
double(10));
50 addParam(
"onlineOccLevel_Empty",
m_onlineOccEmpty,
"Maximum OnlineOccupancy (%) for which the sensor is considered empty",
56 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
64 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: initialized.");
70 for (
VxdID& aVxdID : sensors) {
93 m_cStripOccupancyU[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
94 m_cStripOccupancyV[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
131 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
155 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
167 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: beginRun called.");
225 double oocErrorLoOff = 0.;
226 double oocErrorLoOn = 0.;
227 double occWarningOff = 0.;
228 double occWarningOn = 0.;
233 B2DEBUG(10,
" SVD occupancy thresholds taken from EPICS configuration file:");
238 " < error with minimum statistics of " <<
m_occEmpty);
261 m_legEmpty->AddText(
"at least one sensor is emtpy");
296 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: event called.");
299 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
300 if (hnEvnts == NULL) {
301 B2INFO(
"no events, nothing to do here");
304 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
308 TString tmp = hnEvnts->GetTitle();
309 Int_t pos = tmp.Last(
'~');
310 if (pos == -1) pos = 0;
312 TString runID = tmp(pos, tmp.Length() - pos);
313 B2INFO(
"DQMHistAnalysisSVDOccupancyModule::runID = " << runID);
314 Float_t nEvents = hnEvnts->GetEntries();
317 TH1F* hChart = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_StripCountsChip");
319 if (hChart != NULL) {
377 const Int_t colNum = 4;
379 gStyle->SetPalette(colNum, palette);
380 gStyle->SetOptStat(0);
381 gStyle->SetPaintTextFormat(
"2.3f");
385 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
391 TString tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
393 htmp = (TH1F*)
findHist(tmpname.Data());
395 B2INFO(
"Occupancy U histogram not found");
398 Float_t occU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
407 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
408 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
409 tmp_sensor, runID.Data()));
411 if (i == 0 || i == 1) {
415 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
416 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
417 tmp_sensor, runID.Data()));
424 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
426 htmp = (TH1F*)
findHist(tmpname.Data());
428 B2INFO(
"Occupancy U histogram not found for 3 samples");
432 Float_t occU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
439 TString tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
440 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
442 B2INFO(
"Occupancy U histogram for group Id0 not found");
446 Float_t occU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
452 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
454 htmp = (TH1F*)
findHist(tmpname.Data());
456 B2INFO(
"Occupancy V histogram not found");
460 Float_t occV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
469 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
470 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
471 tmp_sensor, runID.Data()));
477 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
478 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
479 tmp_sensor, runID.Data()));
486 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
488 htmp = (TH1F*)
findHist(tmpname.Data());
490 B2INFO(
"Occupancy V histogram not found");
494 Float_t occV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
501 tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
503 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
505 B2INFO(
"Occupancy U histogram for group Id0 not found");
509 Float_t occV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
515 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
517 htmp = (TH1F*)
findHist(tmpname.Data());
519 B2INFO(
"OnlineOccupancy V histogram not found");
523 Float_t onlineOccV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
526 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
527 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
529 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
535 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
537 htmp = (TH1F*)
findHist(tmpname.Data());
539 B2INFO(
"OnlineOccupancy3 V histogram not found");
543 Float_t onlineOccV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
546 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
547 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
549 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
555 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
557 htmp = (TH1F*)
findHist(tmpname.Data());
559 B2INFO(
"OnlineOccupancy U histogram not found");
563 Float_t onlineOccU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
566 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
567 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
569 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
575 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
577 htmp = (TH1F*)
findHist(tmpname.Data());
579 B2INFO(
"OnlineOccupancy3 U histogram not found");
583 Float_t onlineOccU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
586 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
587 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
589 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
601 if (i == 0 || i == 1) {
654 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: endRun called");
660 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: terminate called");
703 for (
int module = 0;
module < m_sensors;
module++) {
704 delete m_cStripOccupancyU[module];
707 delete m_cStripOccupancyU;
708 delete m_cStripOccupancyV;
714 if (tmp_layer != 3 && sideV)
717 return (entries / nStrips / nEvents * 100);
724 occupancyStatus = std::max(
noStat, occupancyStatus);
726 occupancyStatus = std::max(
lowStat, occupancyStatus);
727 }
else if (occupancy < m_onlineOccWarning && occupancy >=
m_onlineOccEmpty) {
728 occupancyStatus = std::max(
good, occupancyStatus);
730 occupancyStatus = std::max(
warning, occupancyStatus);
732 occupancyStatus = std::max(
error, occupancyStatus);
736 occupancyStatus = std::max(
noStat, occupancyStatus);
738 occupancyStatus = std::max(
lowStat, occupancyStatus);
739 }
else if (occupancy < m_occWarning && occupancy >=
m_occEmpty) {
740 occupancyStatus = std::max(
good, occupancyStatus);
742 occupancyStatus = std::max(
warning, occupancyStatus);
744 occupancyStatus = std::max(
error, occupancyStatus);
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
@ c_ColorWarning
Analysis result: Warning, there may be minor issues.
@ c_ColorError
Analysis result: Severe issue found.
@ c_ColorGood
Analysis result: Good.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
TPaveText * m_legOnlineNormal
onlineOccupancy plot legend, normal
TString getHistoNameFromCanvas(TString cName, TString view="", TString cPrefix="c_", TString hPrefix="")
get histogram name from Canvas name
TPaveText * m_legEmpty
plot legend, empty
TPaveText * m_legLowStat
plot legend, low stats
DQMHistAnalysisSVDModule(bool panelTop=false, bool online=false)
Constructor.
TPaveText * m_legWarning
plot legend, warning
TPaveText * m_legNormal
plot legend, normal
TPaveText * m_legProblem
plot legend, problem
TPaveText * m_legOnlineProblem
onlineOccupancy plot legend, problem
TPaveText * m_legOnlineWarning
onlineOccupancy plot legend, warning
void updateCanvases(SVDSummaryPlots *histo, TCanvas *canvas, TCanvas *canvasRPhi, svdStatus status, bool isU, bool online=false)
update canvases
TCanvas * m_cOnlineOccupancyU
online occupancy U histo canvas
TCanvas * m_cOccupancyV
occupancy V histo canvas
void initialize() override final
Initializer.
svdStatus m_onlineOccV3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sampes
svdStatus m_occVstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
TCanvas * m_cOccupancyU
occupancy U histo canvas
TCanvas * m_cOccupancyRPhiViewVGroupId0
occupancy V histo canvas for cluster time group Id = 0
DQMHistAnalysisSVDOccupancyModule()
Constructor.
TCanvas * m_cOccupancyRPhiViewV3Samples
occupancy V plot canvas for 3 samples
TCanvas * m_cOnlineOccupancyRPhiViewU3Samples
occupancy U plot canvas for 3 samples
int m_sensors
number of sensors to considired
TCanvas ** m_cStripOccupancyV
u-side strip chart occupancy canvas
svdStatus m_occVGroupId0
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sampels
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
double m_onlineOccError
error level of the onlineOccupancy
TCanvas * m_cOccupancyRPhiViewUGroupId0
occupancy U histo canvas for cluster time group Id = 0
TCanvas * m_cOccupancyVGroupId0
occupancy V histo canvas for cluster time group Id = 0
SVDSummaryPlots * m_hOccupancy3Samples
occupancy histos for 3 samples
svdStatus m_occU3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 samples
double m_onlineOccEmpty
empty level of the occupancy
svdStatus m_onlineOccUstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
SVDSummaryPlots * m_hOnlineOccupancy3Samples
online occupancy histos for 3 sampels
SVDSummaryPlots * m_hOccupancy
occupancy histos
std::string m_pvPrefix
string prefix for EPICS PVs
TCanvas * m_cOnlineOccupancyRPhiViewV
online occupancy V plot canvas
double m_occWarning
warning level of the occupancy
svdStatus m_occUGroupId0
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 samples
void terminate() override final
This method is called at the end of the event processing.
TCanvas * m_cOccupancyU3Samples
occupancy U histo canvas for 3 sampes
SVDSummaryPlots * m_hOccupancyGroupId0
occupancy histos for cluster time group id=0
TCanvas * m_cOnlineOccupancyV3Samples
online Occupancy V histo canvas for 3 samples
TCanvas * m_cOccupancyChartChip
occupancy chart histo canvas
void event() override final
This method is called for each event.
bool m_printCanvas
Parameters accesible from basf2 scripts.
TH1F m_hOccupancyChartChip
occupancy chart histo
TCanvas * m_cOnlineOccupancyRPhiViewV3Samples
occupancy V plot canvas for 3 samples
TCanvas ** m_cStripOccupancyU
u-side strip chart occupancy canvas
TH1F m_hStripOccupancyV[172]
u-side strip chart occupancy histos
Float_t getOccupancy(float entries, int tmp_layer, int nEvents, bool sideV=false)
get occupancy value
svdStatus m_occV3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sampels
bool m_RPhiView
RPhi plots flag.
bool m_3Samples
if true enable 3 samples histograms analysis
svdStatus m_onlineOccVstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
svdStatus m_onlineOccU3Samples
0 = normal, 4 = empty, 1 = warning, 2 = error for 3 sample
void endRun() override final
This method is called if the current run ends.
void setOccStatus(float occ, svdStatus &occupancyStatus, bool online=false)
set occupancy status
TCanvas * m_cOccupancyRPhiViewU3Samples
occupancy U plot canvas for 3 samples
bool m_RPhiViewId0
additional plots flag
void beginRun() override final
Called when entering a new run.
SVDSummaryPlots * m_hOnlineOccupancy
online occupancy histos
bool m_additionalPlots
additional plots flag
TCanvas * m_cOccupancyRPhiViewU
occupancy U plot canvas
TCanvas * m_cOnlineOccupancyRPhiViewU
online occupancy U plot canvas
double m_occEmpty
empty level of the occupancy
TCanvas * m_cOnlineOccupancyV
online Occupancy V histo canvas
TCanvas * m_cOccupancyUGroupId0
occupancy U histo canvas for cluster time group Id = 0
TCanvas * m_cOccupancyV3Samples
occupancy V histo canvas for 3 samples
double m_onlineOccWarning
warning level of the onlineOccupancy
double m_occError
error level of the occupancy
TCanvas * m_cOnlineOccupancyU3Samples
online occupancy U histo canvas for 3 samples
svdStatus m_occUstatus
0 = normal, 4 = empty, 1 = warning, 2 = error
TCanvas * m_cOccupancyRPhiViewV
occupancy V plot canvas
~DQMHistAnalysisSVDOccupancyModule()
Destructor.
TH1F m_hStripOccupancyU[172]
u-side strip chart occupancy histos
void setDescription(const std::string &description)
Sets the description of the module.
class to summarize SVD quantities per sensor and side
Class to facilitate easy access to sensor information of the VXD like coordinate transformations or p...
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a reference to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.