14#include <dqm/analysis/modules/DQMHistAnalysisSVDGeneral.h>
15#include <vxd/geometry/GeoCache.h>
41 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: Constructor done.");
43 setDescription(
"DQM Analysis Module that produces colored canvas for a straightforward interpretation of the SVD Data Quality.");
45 addParam(
"RefHistoFile",
m_refFileName,
"Reference histrogram file name", std::string(
"SVDrefHisto.root"));
46 addParam(
"unpackerErrorLevel",
m_unpackError,
"Maximum bin_content/ # events allowed before throwing ERROR",
double(0.00001));
47 addParam(
"occLevel_Error",
m_occError,
"Maximum Occupancy (%) allowed for safe operations (red)",
double(5));
48 addParam(
"occLevel_Warning",
m_occWarning,
"Occupancy (%) at WARNING level (orange)",
double(3));
49 addParam(
"occLevel_Empty",
m_occEmpty,
"Maximum Occupancy (%) for which the sensor is considered empty",
double(0));
50 addParam(
"onlineOccLevel_Error",
m_onlineOccError,
"Maximum OnlineOccupancy (%) allowed for safe operations (red)",
double(10));
52 addParam(
"onlineOccLevel_Empty",
m_onlineOccEmpty,
"Maximum OnlineOccupancy (%) for which the sensor is considered empty",
56 addParam(
"timeThreshold",
m_timeThreshold,
"Acceptable difference between mean of central peak for present and reference run",
58 addParam(
"refMCTP",
m_refMeanP,
"Mean of the signal time peak from Physics reference run",
float(0.0));
59 addParam(
"refMCTC",
m_refMeanC,
"Mean of the signal time peak from Cosmic reference run",
float(0.0));
61 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
69 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: initialized.");
80 for (
VxdID& aVxdID : sensors) {
103 m_cStripOccupancyU[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
104 m_cStripOccupancyV[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
108 m_cUnpacker =
new TCanvas(
"SVDAnalysis/c_SVDDataFormat");
141 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for cluster time group Id = 0");
146 "Average OFFLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
150 "Average ONLINE Sensor Occupancy (%), @view/@side Side for 3 samples");
166 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: beginRun called.");
192 double oocErrorLoOff = 0.;
193 double oocErrorLoOn = 0.;
197 B2DEBUG(10,
" SVD occupancy thresholds taken from EPICS configuration file:");
202 " < error with minimum statistics of " <<
m_occEmpty);
204 double timeWarnUp = 0.;
205 double timeErrorLo = 0.;
206 double timeWarnLo = 0.;
208 B2DEBUG(10,
" SVD cluster time on track threshold taken from EPICS configuration file:");
211 double unpackWarnLo = 0.;
212 double unpackWarnUp = 0.;
213 double unpackErrorLo = 0.;
215 B2DEBUG(10,
" SVD unpack error threshold taken from EPICS configuration file:");
242 m_legEmpty->AddText(
"from at least one sensor");
281 m_legTiNormal =
new TPaveText(0.15, 0.65, 0.35, 0.80,
"NDC");
287 m_legTiEmpty =
new TPaveText(0.15, 0.65, 0.35, 0.80,
"NDC");
304 m_legTi3Empty =
new TPaveText(0.15, 0.65, 0.35, 0.80,
"NDC");
312 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: event called.");
315 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
316 if (hnEvnts == NULL) {
317 B2INFO(
"no events, nothing to do here");
320 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
323 TH1* rtype =
findHist(
"DQMInfo/rtype");
325 B2DEBUG(10,
"DQMInfo/rtype found");
327 m_runtype = rtype ? rtype->GetTitle() :
"physics";
329 TString tmp = hnEvnts->GetTitle();
330 Int_t pos = tmp.Last(
'~');
331 if (pos == -1) pos = 0;
333 TString runID = tmp(pos, tmp.Length() - pos);
334 B2INFO(
"DQMHistAnalysisSVDGeneralModule::runID = " << runID);
335 Float_t nEvents = hnEvnts->GetEntries();
338 TH1* h =
findHist(
"SVDUnpacker/DQMUnpackerHisto");
344 h->SetTitle(Form(
"SVD Data Format Monitor %s", runID.Data()));
346 bool hasError =
false;
347 for (
int un = 0; un < h->GetNcells(); un++)
363 setEpicsPV(
"UnpackError", h->GetEntries() / nEvents);
365 B2INFO(
"Histogram SVDUnpacker/DQMUnpackerHisto from SVDUnpackerDQM not found!");
377 TH1F* hChart = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_StripCountsChip");
379 if (hChart != NULL) {
396 double ratio3_6 = 0.;
397 TH1* m_h =
findHist(
"SVDClsTrk/SVDTRK_ClusterTimeV456");
398 bool hasError =
false;
399 bool lowStat =
false;
411 Float_t difference_physics = fabs(mean_PeakInCenter -
m_refMeanP);
416 Float_t difference_cosmic = fabs(mean_PeakInCenter -
m_refMeanC);
421 B2WARNING(
"Run type:" <<
m_runtype <<
"taken cosmics criteria");
422 Float_t difference_cosmic = fabs(mean_PeakInCenter -
m_refMeanC);
447 B2INFO(
"Histogram SVDClsTrk/c_SVDTRK_ClusterTimeV456 from SVDDQMClustersOnTrack module not found!");
470 m_h =
findHist(
"SVDClsTrk/SVDTRK_Cluster3TimeV456");
471 bool hasError3 =
false;
472 bool lowStat3 =
false;
484 Float_t difference_physics = fabs(mean_PeakInCenter -
m_refMeanP);
489 Float_t difference_cosmic = fabs(mean_PeakInCenter -
m_refMeanC);
516 B2INFO(
"Histogram SVDClsTrk/c_SVDTRK_Cluster3TimeV456 from SVDDQMClustersOnTrack module not found!");
580 const Int_t colNum = 4;
582 gStyle->SetPalette(colNum, palette);
583 gStyle->SetOptStat(0);
584 gStyle->SetPaintTextFormat(
"2.3f");
588 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
594 TString tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
596 htmp = (TH1F*)
findHist(tmpname.Data());
598 B2INFO(
"Occupancy U histogram not found");
607 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
625 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
626 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
627 tmp_sensor, runID.Data()));
629 if (i == 0 || i == 1) {
633 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
634 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
635 tmp_sensor, runID.Data()));
642 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
644 htmp = (TH1F*)
findHist(tmpname.Data());
646 B2INFO(
"Occupancy U histogram not found for 3 samples");
655 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
672 TString tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
673 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
675 B2INFO(
"Occupancy U histogram for group Id0 not found");
684 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
699 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
701 htmp = (TH1F*)
findHist(tmpname.Data());
703 B2INFO(
"Occupancy V histogram not found");
714 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
731 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
732 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
733 tmp_sensor, runID.Data()));
735 if (i == 0 || i == 1) {
739 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
740 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number %s", tmp_layer, tmp_ladder,
741 tmp_sensor, runID.Data()));
748 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
750 htmp = (TH1F*)
findHist(tmpname.Data());
752 B2INFO(
"Occupancy V histogram not found");
763 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
779 tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
781 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
783 B2INFO(
"Occupancy U histogram for group Id0 not found");
794 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
809 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
811 htmp = (TH1F*)
findHist(tmpname.Data());
813 B2INFO(
"OnlineOccupancy V histogram not found");
824 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
828 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
829 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
831 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
846 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
848 htmp = (TH1F*)
findHist(tmpname.Data());
850 B2INFO(
"OnlineOccupancy3 V histogram not found");
861 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
864 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
865 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
867 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
883 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
885 htmp = (TH1F*)
findHist(tmpname.Data());
887 B2INFO(
"OnlineOccupancy U histogram not found");
896 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
899 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
900 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
902 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
917 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
919 htmp = (TH1F*)
findHist(tmpname.Data());
921 B2INFO(
"OnlineOccupancy3 U histogram not found");
930 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
933 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
934 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
936 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
957 if (i == 0 || i == 1) {
1248 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: endRun called");
1254 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: terminate called");
1284 for (
int module = 0;
module < m_sensors;
module++) {
1285 delete m_cStripOccupancyU[module];
1288 delete m_cStripOccupancyU;
1289 delete m_cStripOccupancyV;
1291 delete m_cClusterOnTrackTime_L456V;
1299 return 2 + 1 + sensor;
1301 return 6 + 1 + sensor;
1303 return 11 + 1 + sensor;
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
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
DQMHistAnalysisModule()
Constructor / Destructor.
@ 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.
TPaveText * m_legTiEmpty
cluster time on tracks plot legend, empty
DQMHistAnalysisSVDGeneralModule()
Constructor.
TCanvas * m_cClusterOnTrackTimeL456V3Samples
time for clusters on Track for L456V canvas for 3 sampples
TCanvas * m_cOnlineOccupancyU
online occupancy U histo canvas
std::string m_refFileName
Parameters accessible from basf2 scripts.
Int_t m_onlineOccV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 samples
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.
double m_statThreshold
minimal number of events to compare histograms
Int_t findBinY(Int_t layer, Int_t sensor)
find Y bin corresponding to sensor, occupancy plot
TCanvas * m_cOccupancyU
occupancy U histo canvas
double m_timeThreshold
difference between mean of cluster time for present and reference run
TPaveText * m_legTi3Normal
cluster time on tracks for 3 samples plot legend, normal
TString m_runtype
string with runtype: physics or cosmic
Int_t m_occUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
TPaveText * m_legTiProblem
cluster time on tracks plot legend, problem
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
float m_refMeanC
mean of the signal time peak from Cosmic reference run
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 samples
SVDSummaryPlots * m_hOccupancy
occupancy histos
std::string m_pvPrefix
string prefix for EPICS PVs
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 samples
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
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
TCanvas * m_cUnpacker
unpacker plot canvas
bool m_3Samples
if true enable 3 samples histograms analysis
TH1F m_hClusterOnTrackTime_L456V
time for clusters on Track for L456V histo
TPaveText * m_legTi3Empty
cluster time on tracks for 3 samples plot legend, empty
void endRun() override final
This method is called if the current run ends.
~DQMHistAnalysisSVDGeneralModule()
Destructor.
TCanvas * m_cClusterOnTrackTime_L456V
time for clusters on Track for L456V canvas
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.
Double_t m_unpackError
Maximum bin_content/ # events allowed before throwing ERROR.
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 samples
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.
TPaveText * m_legTiNormal
cluster time on tracks plot legend, normal
double m_occError
error level of the occupancy
float m_refMeanP
mean of the signal time peak from Physics reference run
TH1F m_hClusterOnTrackTimeL456V3Samples
time for clusters on Track for L456V histo for 3 samples
TPaveText * m_legTi3Problem
cluster time on tracks for 3 samples plot legend, problem
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 samples
TH1F m_hStripOccupancyU[172]
u-side strip chart occupancy histos
TFile * m_refFile
The pointer to the reference file.
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.