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(5));
46 addParam(
"occLevel_Warning",
m_occWarning,
"Occupancy (%) at WARNING level (orange)",
double(3));
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",
54 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
62 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: initialized.");
68 for (
VxdID& aVxdID : sensors) {
91 m_cStripOccupancyU[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
92 m_cStripOccupancyV[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
125 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
130 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
134 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
146 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: beginRun called.");
168 double oocErrorLoOff = 0.;
169 double oocErrorLoOn = 0.;
173 B2DEBUG(10,
" SVD occupancy thresholds taken from EPICS configuration file:");
178 " < error with minimum statistics of " <<
m_occEmpty);
182 m_legProblem =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
189 m_legWarning =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
196 m_legNormal =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
202 m_legEmpty =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
204 m_legEmpty->AddText(
"from at least one sensor");
223 m_legOnNormal =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
229 m_legOnEmpty =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
238 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: event called.");
241 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
242 if (hnEvnts == NULL) {
243 B2INFO(
"no events, nothing to do here");
246 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
249 TString tmp = hnEvnts->GetTitle();
250 Int_t pos = tmp.Last(
'~');
251 if (pos == -1) pos = 0;
253 TString runID = tmp(pos, tmp.Length() - pos);
254 B2INFO(
"DQMHistAnalysisSVDOccupancyModule::runID = " << runID);
255 Float_t nEvents = hnEvnts->GetEntries();
258 TH1F* hChart = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_StripCountsChip");
260 if (hChart != NULL) {
315 const Int_t colNum = 4;
317 gStyle->SetPalette(colNum, palette);
318 gStyle->SetOptStat(0);
319 gStyle->SetPaintTextFormat(
"2.3f");
323 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
329 TString tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
331 htmp = (TH1F*)
findHist(tmpname.Data());
333 B2INFO(
"Occupancy U histogram not found");
342 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
360 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
361 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
362 tmp_sensor, runID.Data()));
364 if (i == 0 || i == 1) {
368 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
369 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
370 tmp_sensor, runID.Data()));
377 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
379 htmp = (TH1F*)
findHist(tmpname.Data());
381 B2INFO(
"Occupancy U histogram not found for 3 samples");
390 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
407 TString tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
408 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
410 B2INFO(
"Occupancy U histogram for group Id0 not found");
419 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
434 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
436 htmp = (TH1F*)
findHist(tmpname.Data());
438 B2INFO(
"Occupancy V histogram not found");
449 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
466 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
467 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
468 tmp_sensor, runID.Data()));
474 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
475 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
476 tmp_sensor, runID.Data()));
483 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
485 htmp = (TH1F*)
findHist(tmpname.Data());
487 B2INFO(
"Occupancy V histogram not found");
498 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
514 tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
516 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
518 B2INFO(
"Occupancy U histogram for group Id0 not found");
529 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
544 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
546 htmp = (TH1F*)
findHist(tmpname.Data());
548 B2INFO(
"OnlineOccupancy V histogram not found");
559 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
563 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
564 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
566 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
581 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
583 htmp = (TH1F*)
findHist(tmpname.Data());
585 B2INFO(
"OnlineOccupancy3 V histogram not found");
596 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
599 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
600 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
602 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
617 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
619 htmp = (TH1F*)
findHist(tmpname.Data());
621 B2INFO(
"OnlineOccupancy U histogram not found");
630 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
633 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
634 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
636 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
651 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
653 htmp = (TH1F*)
findHist(tmpname.Data());
655 B2INFO(
"OnlineOccupancy3 U histogram not found");
664 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
667 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
668 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
670 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
691 if (i == 0 || i == 1) {
982 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: endRun called");
988 B2DEBUG(10,
"DQMHistAnalysisSVDOccupancy: terminate called");
1017 for (
int module = 0; module <
m_sensors; module++) {
1030 return 2 + 1 + sensor;
1032 return 6 + 1 + sensor;
1034 return 11 + 1 + sensor;
The base class for the histogram analysis module.
void colorizeCanvas(TCanvas *canvas, EStatus status)
Helper function for Canvas colorization.
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.
@ c_ColorDefault
default for non-coloring
@ c_StatusDefault
default for non-coloring
@ c_StatusTooFew
Not enough entries/event to judge.
@ c_StatusError
Analysis result: Severe issue found.
@ c_StatusWarning
Analysis result: Warning, there may be minor issues.
@ c_StatusGood
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.
TCanvas * m_cOnlineOccupancyU
online occupancy U histo canvas
Int_t m_onlineOccV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampes
TCanvas * m_cOccupancyV
occupancy V histo canvas
void initialize() override final
Initializer.
TPaveText * m_legOnProblem
onlineOccupancy plot legend, problem
TPaveText * m_legError
OfflineOccupancy plot legend, error.
TPaveText * m_legEmpty
OfflineOccupancy plot legend, empty.
Int_t findBinY(Int_t layer, Int_t sensor)
find Y bin corresponding to sensor, occupancy plot
TCanvas * m_cOccupancyU
occupancy U histo canvas
DQMHistAnalysisSVDOccupancyModule()
Constructor.
Int_t m_occUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
int m_sensors
number of sensors to considired
TCanvas ** m_cStripOccupancyV
u-side strip chart occupancy canvas
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
double m_onlineOccError
error level of the onlineOccupancy
TCanvas * m_cOccupancyVGroupId0
occupancy V histo canvas for cluster time group Id = 0
SVDSummaryPlots * m_hOccupancy3Samples
occupancy histos for 3 samples
Int_t m_onlineOccUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
Int_t m_onlineOccVstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
double m_onlineOccEmpty
empty level of the occupancy
TPaveText * m_legOnEmpty
onlineOccupancy plot legend, empty
SVDSummaryPlots * m_hOnlineOccupancy3Samples
online occupancy histos for 3 sampels
SVDSummaryPlots * m_hOccupancy
Parameters accesible from basf2 scripts.
std::string m_pvPrefix
string prefix for EPICS PVs
TH2F * m_hOnlineOccupancyV
online Occupancy V histo
double m_occWarning
warning level of the occupancy
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
TPaveText * m_legWarning
OfflineOccupancy plot legend, warning.
TCanvas * m_cOnlineOccupancyV3Samples
online Occupancy V histo canvas for 3 samples
TCanvas * m_cOccupancyChartChip
occupancy chart histo canvas
TH2F * m_hOnlineOccupancyU
online occupancy U histo
TPaveText * m_legOnError
onlineOccupancy plot legend, error
void event() override final
This method is called for each event.
bool m_printCanvas
if true print the pdf of the canvases
TH1F m_hOccupancyChartChip
occupancy chart histo
TCanvas ** m_cStripOccupancyU
u-side strip chart occupancy canvas
TH1F m_hStripOccupancyV[172]
u-side strip chart occupancy histos
Int_t m_occUGroupId0
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 samples
TPaveText * m_legOnNormal
onlineOccupancy plot legend, normal
bool m_3Samples
if true enable 3 samples histograms analysis
void endRun() override final
This method is called if the current run ends.
Int_t m_onlineOccU3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sample
void beginRun() override final
Called when entering a new run.
SVDSummaryPlots * m_hOnlineOccupancy
online occupancy histos
bool m_additionalPlots
additional plots flag
Int_t m_occVstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
TPaveText * m_legNormal
OfflineOccupancy plot legend, normal.
TPaveText * m_legOnWarning
onlineOccupancy plot legend, warning
double m_occEmpty
empty level of the occupancy
Int_t m_occV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampels
TCanvas * m_cOnlineOccupancyV
online Occupancy V histo canvas
TCanvas * m_cOccupancyUGroupId0
occupancy U histo canvas for cluster time group Id = 0
Int_t m_occU3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 samples
TCanvas * m_cOccupancyV3Samples
occupancy V histo canvas for 3 samples
double m_onlineOccWarning
warning level of the onlineOccupancy
TPaveText * m_legProblem
OfflineOccupancy plot legend, problem.
double m_occError
error level of the occupancy
TCanvas * m_cOnlineOccupancyU3Samples
online occupancy U histo canvas for 3 samples
Int_t m_occVGroupId0
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampels
~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
TH2F * getHistogram(int view)
get a reference to 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.