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));
143 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
148 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
152 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
163 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: beginRun called.");
221 double oocErrorLoOff = 0.;
222 double oocErrorLoOn = 0.;
223 double occWarningOff = 0.;
224 double occWarningOn = 0.;
229 B2DEBUG(10,
" SVD occupancy thresholds taken from EPICS configuration file:");
234 " < error with minimum statistics of " <<
m_occEmpty);
257 m_legEmpty->AddText(
"at least one sensor is emtpy");
292 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: event called.");
295 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
296 if (hnEvnts == NULL) {
297 B2INFO(
"no events, nothing to do here");
300 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
304 TString tmp = hnEvnts->GetTitle();
305 Int_t pos = tmp.Last(
'~');
306 if (pos == -1) pos = 0;
308 TString runID = tmp(pos, tmp.Length() - pos);
309 B2INFO(
"DQMHistAnalysisSVDOccupancyModule::runID = " << runID);
310 Float_t nEvents = hnEvnts->GetEntries();
313 TH1F* hChart = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_StripCountsChip");
315 if (hChart != NULL) {
373 const Int_t colNum = 4;
375 gStyle->SetPalette(colNum, palette);
376 gStyle->SetOptStat(0);
377 gStyle->SetPaintTextFormat(
"2.3f");
381 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
387 TString tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
389 htmp = (TH1F*)
findHist(tmpname.Data());
391 B2INFO(
"Occupancy U histogram not found");
394 Float_t occU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
403 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
404 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
405 tmp_sensor, runID.Data()));
407 if (i == 0 || i == 1) {
411 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
412 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
413 tmp_sensor, runID.Data()));
420 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
422 htmp = (TH1F*)
findHist(tmpname.Data());
424 B2INFO(
"Occupancy U histogram not found for 3 samples");
428 Float_t occU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
435 TString tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
436 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
438 B2INFO(
"Occupancy U histogram for group Id0 not found");
442 Float_t occU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
448 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
450 htmp = (TH1F*)
findHist(tmpname.Data());
452 B2INFO(
"Occupancy V histogram not found");
456 Float_t occV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
465 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
466 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
467 tmp_sensor, runID.Data()));
473 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
474 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
475 tmp_sensor, runID.Data()));
482 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
484 htmp = (TH1F*)
findHist(tmpname.Data());
486 B2INFO(
"Occupancy V histogram not found");
490 Float_t occV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
497 tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
499 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
501 B2INFO(
"Occupancy U histogram for group Id0 not found");
505 Float_t occV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
511 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
513 htmp = (TH1F*)
findHist(tmpname.Data());
515 B2INFO(
"OnlineOccupancy V histogram not found");
519 Float_t onlineOccV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
522 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
523 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
525 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
531 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
533 htmp = (TH1F*)
findHist(tmpname.Data());
535 B2INFO(
"OnlineOccupancy3 V histogram not found");
539 Float_t onlineOccV =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents,
true);
542 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
543 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
545 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
551 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
553 htmp = (TH1F*)
findHist(tmpname.Data());
555 B2INFO(
"OnlineOccupancy U histogram not found");
559 Float_t onlineOccU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
562 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
563 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
565 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
571 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
573 htmp = (TH1F*)
findHist(tmpname.Data());
575 B2INFO(
"OnlineOccupancy3 U histogram not found");
579 Float_t onlineOccU =
getOccupancy(htmp->GetEntries(), tmp_layer, nEvents);
582 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
583 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
585 htmp->GetYaxis()->SetTitle(
"ZS3 occupancy (%)");
597 if (i == 0 || i == 1) {
650 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: endRun called");
656 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: terminate called");
699 for (
int module = 0; module <
m_sensors; module++) {
710 if (tmp_layer != 3 && sideV)
713 return (entries / nStrips / nEvents * 100);
720 occupancyStatus = std::max(
noStat, occupancyStatus);
722 occupancyStatus = std::max(
lowStat, occupancyStatus);
723 }
else if (occupancy < m_onlineOccWarning && occupancy >=
m_onlineOccEmpty) {
724 occupancyStatus = std::max(
good, occupancyStatus);
726 occupancyStatus = std::max(
warning, occupancyStatus);
728 occupancyStatus = std::max(
error, occupancyStatus);
732 occupancyStatus = std::max(
noStat, occupancyStatus);
734 occupancyStatus = std::max(
lowStat, occupancyStatus);
735 }
else if (occupancy < m_occWarning && occupancy >=
m_occEmpty) {
736 occupancyStatus = std::max(
good, occupancyStatus);
738 occupancyStatus = std::max(
warning, occupancyStatus);
740 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.
Class definition for common method.
TPaveText * m_legOnlineNormal
onlineOccupancy plot legend, normal
TPaveText * m_legEmpty
plot legend, empty
TPaveText * m_legLowStat
plot legend, low stats
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
void setStats(bool stats=true)
set histograms stat
void fill(int layer, int ladder, int sensor, int view, float value)
fill the histogram for
void setRunID(const TString &runID)
set run ids in title
void reset()
Reset histograms.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne 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.