14 #include <dqm/analysis/modules/DQMHistAnalysisSVDEfficiency.h>
15 #include <vxd/geometry/GeoCache.h>
33 DQMHistAnalysisSVDEfficiencyModule::DQMHistAnalysisSVDEfficiencyModule()
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");
236 B2DEBUG(10,
"U-side Before loop on sensors, size :" <<
m_SVDModules.size());
238 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
242 float numU = matched_clusU->GetBinContent(bin);
243 float denU = found_tracksU->GetBinContent(bin);
248 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
253 erreffU =
std::sqrt(effU * (1 - effU) / denU);
270 TH2F* found_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsV");
271 TH2F* matched_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsV");
273 if (matched_clusV == NULL || found_tracksV == NULL) {
274 B2INFO(
"Histograms needed for Efficiency computation are not found");
280 B2DEBUG(10,
"V-side Before loop on sensors, size :" <<
m_SVDModules.size());
282 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
286 float numV = matched_clusV->GetBinContent(bin);
287 float denV = found_tracksV->GetBinContent(bin);
293 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
298 erreffV =
std::sqrt(effV * (1 - effV) / denV);
343 B2INFO(
"effUstatus not set properly: " <<
m_effUstatus);
381 B2INFO(
"effVstatus not set properly: " <<
m_effVstatus);
414 TH2F* found3_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3U");
415 TH2F* matched3_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3U");
417 if (matched3_clusU == NULL || found3_tracksU == NULL) {
418 B2INFO(
"Histograms needed for Efficiency computation are not found");
424 B2DEBUG(10,
"U-side Before loop on sensors, size :" <<
m_SVDModules.size());
426 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
430 float numU = matched3_clusU->GetBinContent(bin);
431 float denU = found3_tracksU->GetBinContent(bin);
436 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
442 erreffU =
std::sqrt(effU * (1 - effU) / denU);
459 TH2F* found3_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3V");
460 TH2F* matched3_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3V");
462 if (matched3_clusV == NULL || found3_tracksV == NULL) {
463 B2INFO(
"Histograms needed for Efficiency computation are not found");
469 B2DEBUG(10,
"V-side Before loop on sensors, size :" <<
m_SVDModules.size());
471 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
475 float numV = matched3_clusV->GetBinContent(bin);
476 float denV = found3_tracksV->GetBinContent(bin);
482 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
487 erreffV =
std::sqrt(effV * (1 - effV) / denV);
532 B2INFO(
"effUstatus not set properly: " <<
m_effUstatus);
569 B2INFO(
"effVstatus not set properly: " <<
m_effVstatus);
598 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: endRun called");
603 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: terminate called");
634 return 2 + 1 + sensor;
636 return 6 + 1 + sensor;
638 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.
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.
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
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.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.