14 #include <dqm/analysis/modules/DQMHistAnalysisSVDGeneral.h>
15 #include <vxd/geometry/GeoCache.h>
37 DQMHistAnalysisSVDGeneralModule::DQMHistAnalysisSVDGeneralModule()
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) {
99 m_cStripOccupancyU[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyU_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
100 m_cStripOccupancyV[i] =
new TCanvas(Form(
"SVDOccupancy/c_StripOccupancyV_%d_%d_%d", tmp_layer, tmp_ladder, tmp_sensor));
105 m_yTitle =
new TText(-0.75, 13,
"layer.ladder.sensor");
111 m_cUnpacker =
new TCanvas(
"SVDAnalysis/c_SVDDataFormat");
138 TString Ylabels[nY] = {
"",
"L3.x.1",
"L3.x.2",
139 "",
"L4.x.1",
"L4.x.2",
"L4.x.3",
140 "",
"L5.x.1",
"L5.x.2",
"L5.x.3",
"L5.x.4",
141 "",
"L6.x.1",
"L6.x.2",
"L6.x.3",
"L6.x.4",
"L6.x.5",
""
145 m_hOccupancyV =
new TH2F(
"hOccupancyV",
"Average OFFLINE Sensor Occupancy (%), V side ", 16, 0.5, 16.5, 19, 0, 19);
149 for (
unsigned short i = 0; i < nY; i++)
m_hOccupancyV->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
151 m_hOccupancyU =
new TH2F(
"hOccupancyU",
"Average OFFLINE Sensor Occupancy (%), U side ", 16, 0.5, 16.5, 19, 0, 19);
155 for (
unsigned short i = 0; i < nY; i++)
m_hOccupancyU->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
157 m_hOnlineOccupancyV =
new TH2F(
"hOnlineOccupancyV",
"Average ONLINE Sensor Occupancy (%), V side ", 16, 0.5, 16.5, 19, 0, 19);
161 for (
unsigned short i = 0; i < nY; i++)
m_hOnlineOccupancyV->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
163 m_hOnlineOccupancyU =
new TH2F(
"hOnlineOccupancyU",
"Average ONLINE Sensor Occupancy (%), U side ", 16, 0.5, 16.5, 19, 0, 19);
167 for (
unsigned short i = 0; i < nY; i++)
m_hOnlineOccupancyU->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
170 m_hOccupancyV3Samples =
new TH2F(
"hOccupancy3V",
"Average OFFLINE Sensor Occupancy (%), V side for 3 samples", 16, 0.5, 16.5, 19,
175 for (
unsigned short i = 0; i < nY; i++)
m_hOccupancyV3Samples->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
178 m_hOccupancyU3Samples =
new TH2F(
"hOccupancy3U",
"Average OFFLINE Sensor Occupancy (%), U side for 3 samples", 16, 0.5, 16.5, 19,
183 for (
unsigned short i = 0; i < nY; i++)
m_hOccupancyU3Samples->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
201 "Average OFFLINE Sensor Occupancy (%), V side for cluster time group Id = 0", 16, 0.5, 16.5, 19, 0, 19);
205 for (
unsigned short i = 0; i < nY; i++)
m_hOccupancyVGroupId0->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
208 "Average OFFLINE Sensor Occupancy (%), U side for cluster time group Id = 0", 16, 0.5, 16.5, 19, 0, 19);
212 for (
unsigned short i = 0; i < nY; i++)
m_hOccupancyUGroupId0->GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
216 B2DEBUG(10,
"DQMInfo/rtype found");
232 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: beginRun called.");
241 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
259 double oocErrorLoOff = 0.;
260 double oocErrorLoOn = 0.;
264 B2DEBUG(10,
" SVD occupancy thresholds taken from EPICS configuration file:");
269 " < error with minimum statistics of " <<
m_occEmpty);
271 double timeWarnUp = 0.;
272 double timeErrorLo = 0.;
274 B2DEBUG(10,
" SVD cluster time on track threshold taken from EPICS configuration file:");
277 double unpackWarnLo = 0.;
278 double unpackWarnUp = 0.;
279 double unpackErrorLo = 0.;
281 B2DEBUG(10,
" SVD unpack error threshold taken from EPICS configuration file:");
304 m_legEmpty->AddText(
"from at least one sensor");
336 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: event called.");
339 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
340 if (hnEvnts == NULL) {
341 B2INFO(
"no events, nothing to do here");
344 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
347 TString runID = TString((hnEvnts->GetTitle())).Remove(0, 21);
348 B2INFO(
"runID = " << runID);
349 Float_t nEvents = hnEvnts->GetEntries();
352 TH1* h =
findHist(
"SVDUnpacker/DQMUnpackerHisto");
358 h->SetTitle(
"SVD Data Format Monitor " + runID);
360 bool hasError =
false;
361 for (
int un = 0; un < h->GetNcells(); un++)
372 setEpicsPV(
"UnpackError", h->GetEntries() / nEvents);
378 B2INFO(
"Histogram SVDUnpacker/DQMUnpackerHisto from SVDUnpackerDQM not found!");
389 TH1F* hChart = (TH1F*)
findHist(
"SVDExpReco/SVDDQM_StripCountsChip");
391 if (hChart != NULL) {
408 double ratio3_6 = 0.;
409 TH1* m_h =
findHist(
"SVDClsTrk/SVDTRK_ClusterTimeV456");
417 bool hasError =
false;
418 bool lowStat =
false;
422 Float_t difference_physics = fabs(mean_PeakInCenter -
m_refMeanP);
426 }
else if (
runtype ==
"cosmic") {
427 Float_t difference_cosmic = fabs(mean_PeakInCenter -
m_refMeanC);
432 B2WARNING(
"Run type:" <<
runtype);
453 B2INFO(
"Histogram SVDClsTrk/c_SVDTRK_ClusterTimeV456 from SVDDQMClustersOnTrack module not found!");
469 m_h =
findHist(
"SVDClsTrk/SVDTRK_Cluster3TimeV456");
477 bool hasError =
false;
478 bool lowStat =
false;
482 Float_t difference_physics = fabs(mean_PeakInCenter -
m_refMeanP);
486 }
else if (
runtype ==
"cosmic") {
487 Float_t difference_cosmic = fabs(mean_PeakInCenter -
m_refMeanC);
492 B2WARNING(
"Run type:" <<
runtype);
512 B2INFO(
"Histogram SVDClsTrk/c_SVDTRK_Cluster3TimeV456 from SVDDQMClustersOnTrack module not found!");
544 m_hOccupancyU->SetTitle(
"Average OFFLINE Sensor Occupancy (%), U side " + runID);
546 m_hOccupancyV->SetTitle(
"Average OFFLINE Sensor Occupancy (%), V side " + runID);
556 m_hOccupancyU3Samples->SetTitle(
"Average OFFLINE Sensor Occupancy (%), U side for 3 samples" + runID);
558 m_hOccupancyV3Samples->SetTitle(
"Average OFFLINE Sensor Occupancy (%), V side for 3 samples" + runID);
568 const Int_t colNum = 4;
569 Int_t palette[colNum] {kBlack, kGreen, kYellow, kRed};
570 gStyle->SetPalette(colNum, palette);
571 gStyle->SetOptStat(0);
572 gStyle->SetPaintTextFormat(
"2.3f");
576 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
585 TString tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountU", tmp_layer, tmp_ladder, tmp_sensor);
587 htmp = (TH1F*)
findHist(tmpname.Data());
589 B2INFO(
"Occupancy U histogram not found");
595 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
613 m_hStripOccupancyU[i].SetName(Form(
"%d_%d_%d_OccupancyU", tmp_layer, tmp_ladder, tmp_sensor));
614 m_hStripOccupancyU[i].SetTitle(Form(
"SVD Sensor %d_%d_%d U-Strip OFFLINE Occupancy vs Strip Number", tmp_layer, tmp_ladder,
621 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
623 htmp = (TH1F*)
findHist(tmpname.Data());
625 B2INFO(
"Occupancy U histogram not found for 3 samples");
631 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
648 TString tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0U", tmp_layer, tmp_ladder, tmp_sensor);
650 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
652 B2INFO(
"Occupancy U histogram for group Id0 not found");
658 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
673 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountV", tmp_layer, tmp_ladder, tmp_sensor);
675 htmp = (TH1F*)
findHist(tmpname.Data());
677 B2INFO(
"Occupancy V histogram not found");
685 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
702 m_hStripOccupancyV[i].SetName(Form(
"%d_%d_%d_OccupancyV", tmp_layer, tmp_ladder, tmp_sensor));
703 m_hStripOccupancyV[i].SetTitle(Form(
"SVD Sensor %d_%d_%d V-Strip OFFLINE Occupancy vs Strip Number", tmp_layer, tmp_ladder,
711 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_Strip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
713 htmp = (TH1F*)
findHist(tmpname.Data());
715 B2INFO(
"Occupancy V histogram not found");
723 Float_t occV = htmp->GetEntries() / nStrips / nEvents * 100;
739 tmpnameGrpId0 = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_StripCountGroupId0V", tmp_layer, tmp_ladder, tmp_sensor);
741 htmp = (TH1F*)
findHist(tmpnameGrpId0.Data());
743 B2INFO(
"Occupancy U histogram for group Id0 not found");
749 Float_t occU = htmp->GetEntries() / nStrips / nEvents * 100;
764 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountV", tmp_layer, tmp_ladder, tmp_sensor);
766 htmp = (TH1F*)
findHist(tmpname.Data());
768 B2INFO(
"OnlineOccupancy V histogram not found");
776 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
779 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
780 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
782 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
797 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountV", tmp_layer, tmp_ladder, tmp_sensor);
799 htmp = (TH1F*)
findHist(tmpname.Data());
801 B2INFO(
"OnlineOccupancy3 V histogram not found");
809 Float_t onlineOccV = htmp->GetEntries() / nStrips / nEvents * 100;
812 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
813 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
815 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
831 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStripCountU", tmp_layer, tmp_ladder, tmp_sensor);
833 htmp = (TH1F*)
findHist(tmpname.Data());
835 B2INFO(
"OnlineOccupancy U histogram not found");
841 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
844 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
845 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
847 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
862 tmpname = Form(
"SVDExpReco/SVDDQM_%d_%d_%d_OnlineZSStrip3CountU", tmp_layer, tmp_ladder, tmp_sensor);
864 htmp = (TH1F*)
findHist(tmpname.Data());
866 B2INFO(
"OnlineOccupancy3 U histogram not found");
872 Float_t onlineOccU = htmp->GetEntries() / nStrips / nEvents * 100;
875 for (
int b = 1; b < htmp->GetNbinsX() + 1; b++) {
876 htmp->SetBinContent(b, htmp->GetBinContent(b) / nEvents * 100);
878 htmp->GetYaxis()->SetTitle(
"ZS3 ccupancy (%)");
1233 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: endRun called");
1239 B2DEBUG(10,
"DQMHistAnalysisSVDGeneral: terminate called");
1269 for (
int module = 0; module <
nSensors; module++) {
1284 return 2 + 1 + sensor;
1286 return 6 + 1 + sensor;
1288 return 11 + 1 + sensor;
The base class for the histogram analysis module.
int registerEpicsPV(std::string pvname, std::string keyname="", bool update_pvs=true)
EPICS related Functions.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.
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 accesible from basf2 scripts.
Int_t m_onlineOccV3Samples
0 = normal, 1 = empty, 2 = warning, 3 = error for 3 sampes
TCanvas * m_cOccupancyV
occupancy V histo canvas
const int nSensors
total number of sensors
TH2F * m_hOccupancyUGroupId0
occupancy U histo for cluster time group Id = 0
void initialize() override final
Initializer.
TPaveText * m_legOnProblem
onlineOccupancy plot legend, problem
TPaveText * m_legError
OfflineOccupancy plot legend, error.
TH2F * m_hOccupancyV3Samples
occupancy V histo for 3 samples
TPaveText * m_legEmpty
OfflineOccupancy plot legend, empty.
double m_statThreshold
minimal number of events to compare histograms
TH2F * m_hOnlineOccupancyV3Samples
online Occupancy V histo for 3 sample
TH2F * m_hOccupancyU3Samples
occupancy U histo for 3 samples
Int_t findBinY(Int_t layer, Int_t sensor)
find Y bin corresponding to sensor, occupancy plot
TCanvas * m_cOccupancyU
occupancy U histo canvas
TH1 * rtype
histogram from DQMInfo with runtype
double m_timeThreshold
difference between mean of cluster time for present and reference run
Int_t m_occUstatus
0 = normal, 1 = empty, 2 = warning, 3 = error
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
TH2F * m_hOccupancyVGroupId0
occupancy V histo for cluster time group Id = 0
TCanvas * m_cOccupancyVGroupId0
occupancy V histo canvas for cluster time group Id = 0
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
std::string m_pvPrefix
string prefix for EPICS PVs
TH2F * m_hOnlineOccupancyV
online Occupancy V histo
TString runtype
string with runtype: physics or cosmic
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
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
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
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
TH2F * m_hOccupancyU
occupancy U histo
void beginRun() override final
Called when entering a new run.
Double_t m_unpackError
Maximum bin_content/ # events allowed before throwing ERROR.
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
TH2F * m_hOnlineOccupancyU3Samples
online occupancy U histo for 3 sample
double m_onlineOccWarning
warning level of the onlineOccupancy
TPaveText * m_legProblem
OfflineOccupancy plot legend, problem.
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
TH2F * m_hOccupancyV
occupancy V histo
TText * m_yTitle
y axis title text
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
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 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.