14#include <dqm/analysis/modules/DQMHistAnalysisSVDEfficiency.h>
15#include <vxd/geometry/GeoCache.h>
39 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: Constructor done.");
41 setDescription(
"DQM Analysis Module that computes the average SVD sensor efficiency.");
43 addParam(
"RefHistoFile",
m_refFileName,
"Reference histogram file name", std::string(
"SVDrefHisto.root"));
44 addParam(
"effLevel_Error",
m_effError,
"Efficiency error (%) level (red)",
double(0.9));
45 addParam(
"effLevel_Warning",
m_effWarning,
"Efficiency WARNING (%) level (orange)",
double(0.94));
46 addParam(
"statThreshold",
m_statThreshold,
"minimal number of tracks per sensor to set green/red alert",
double(100));
47 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
55 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: initialize");
58 m_legProblem =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
65 m_legWarning =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
72 m_legNormal =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
78 m_legEmpty =
new TPaveText(0.62, 0.22, 0.88, 0.35,
"brNDC");
80 m_legEmpty->AddText(
"check again in a few minutes");
90 for (
VxdID& aVxdID : sensors) {
118 "Summary of SVD efficiencies (%), @view/@side Side for 3 samples");
122 "Summary of SVD efficiencies errors (%), @view/@side Side for 3 samples");
131 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents");
132 if (hnEvnts == NULL) {
133 B2INFO(
"no events, nothing to do here");
141 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: beginRun called.");
164 double effErrorLo = 0.;
165 double effWarnLo = 0.;
169 B2DEBUG(10,
" SVD efficiency thresholds taken from EPICS configuration file:");
170 B2DEBUG(10,
" EFFICIENCY: normal > " <<
m_effWarning <<
" > warning > " <<
m_effError <<
" > error with minimum statistics of " <<
176 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: event called.");
179 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
180 if (hnEvnts == NULL) {
181 B2INFO(
"no events, nothing to do here");
184 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
187 TString tmp = hnEvnts->GetTitle();
188 Int_t pos = tmp.Last(
'~');
189 if (pos == -1) pos = 0;
191 TString runID = tmp(pos, tmp.Length() - pos);
192 B2INFO(
"DQMHistAnalysisSVDEfficiencyModule::runID = " << runID);
194 gStyle->SetOptStat(0);
195 gStyle->SetPaintTextFormat(
"2.1f");
222 Float_t erreffU = -1;
223 Float_t erreffV = -1;
226 TH2F* found_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsU");
227 TH2F* matched_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsU");
229 if (matched_clusU == NULL || found_tracksU == NULL) {
230 B2INFO(
"Histograms needed for Efficiency computation are not found");
237 B2DEBUG(10,
"U-side Before loop on sensors, size :" <<
m_SVDModules.size());
239 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
243 float numU = matched_clusU->GetBinContent(bin);
244 float denU = found_tracksU->GetBinContent(bin);
249 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
254 erreffU = std::sqrt(effU * (1 - effU) / denU);
271 TH2F* found_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsV");
272 TH2F* matched_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsV");
274 if (matched_clusV == NULL || found_tracksV == NULL) {
275 B2INFO(
"Histograms needed for Efficiency computation are not found");
282 B2DEBUG(10,
"V-side Before loop on sensors, size :" <<
m_SVDModules.size());
284 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
288 float numV = matched_clusV->GetBinContent(bin);
289 float denV = found_tracksV->GetBinContent(bin);
295 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
300 erreffV = std::sqrt(effV * (1 - effV) / denV);
345 B2INFO(
"effUstatus not set properly: " <<
m_effUstatus);
383 B2INFO(
"effVstatus not set properly: " <<
m_effVstatus);
416 TH2F* found3_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3U");
417 TH2F* matched3_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3U");
419 if (matched3_clusU == NULL || found3_tracksU == NULL) {
420 B2INFO(
"Histograms needed for Efficiency computation are not found");
426 B2DEBUG(10,
"U-side Before loop on sensors, size :" <<
m_SVDModules.size());
428 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
432 float numU = matched3_clusU->GetBinContent(bin);
433 float denU = found3_tracksU->GetBinContent(bin);
438 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
444 erreffU = std::sqrt(effU * (1 - effU) / denU);
461 TH2F* found3_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3V");
462 TH2F* matched3_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3V");
464 if (matched3_clusV == NULL || found3_tracksV == NULL) {
465 B2INFO(
"Histograms needed for Efficiency computation are not found");
471 B2DEBUG(10,
"V-side Before loop on sensors, size :" <<
m_SVDModules.size());
473 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
477 float numV = matched3_clusV->GetBinContent(bin);
478 float denV = found3_tracksV->GetBinContent(bin);
484 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
489 erreffV = std::sqrt(effV * (1 - effV) / denV);
534 B2INFO(
"effUstatus not set properly: " <<
m_effUstatus);
571 B2INFO(
"effVstatus not set properly: " <<
m_effVstatus);
600 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: endRun called");
605 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: terminate called");
636 return 2 + 1 + sensor;
638 return 6 + 1 + sensor;
640 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_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.
SVDSummaryPlots * m_hEfficiency3Samples
efficiency histo for 3 samples
std::string m_refFileName
Data members.
void initialize() override final
Initializer.
TCanvas * m_cEfficiencyErrV3Samples
efficiency V error plot canvas for 3 samples
TPaveText * m_legEmpty
efficiency plot legend, empty
double m_statThreshold
minimal number of tracks per sensor to set green or red frame
TCanvas * m_cEfficiencyErrU
efficiency U error plot canvas
Int_t findBinY(Int_t layer, Int_t sensor)
find Y bin corresponding to sensor, efficiency plot
~DQMHistAnalysisSVDEfficiencyModule()
Destructor.
SVDSummaryPlots * m_hEfficiency
efficiency histo
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
effStatus m_effUstatus
number representing the status of the efficiency U side
SVDSummaryPlots * m_hEfficiencyErr3Samples
efficiency error histo for 3 samples
std::string m_pvPrefix
string prefix for EPICS PVs
double m_effWarning
warning level of the efficiency
double m_effError
error level of the efficiency
void terminate() override final
This method is called at the end of the event processing.
TPaveText * m_legWarning
efficiency plot legend, warning
void event() override final
This method is called for each event.
TCanvas * m_cEfficiencyV
efficiency V plot canvas
bool m_3Samples
if true enable 3 samples histograms analysis
TCanvas * m_cEfficiencyU
efficiency U plot canvas
TCanvas * m_cEfficiencyU3Samples
efficiency U plot canvas for 3 samples
void endRun() override final
This method is called if the current run ends.
TCanvas * m_cEfficiencyErrU3Samples
efficiency U error plot canvas for 3 samples
effStatus m_effVstatus
number representing the status of the efficiency V side
void beginRun() override final
Called when entering a new run.
TPaveText * m_legNormal
efficiency plot legend, normal
TCanvas * m_cEfficiencyV3Samples
efficiency V plot canvas for 3 samples
TCanvas * m_cEfficiencyErrV
efficiency V error plot canvas
TPaveText * m_legProblem
efficiency plot legend, problem
SVDSummaryPlots * m_hEfficiencyErr
efficiency error histo
DQMHistAnalysisSVDEfficiencyModule()
Constructor.
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
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.