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");
57 B2DEBUG(10,
" black = " << kBlack);
58 B2DEBUG(10,
" green = " << kGreen);
59 B2DEBUG(10,
" yellow = " << kYellow);
60 B2DEBUG(10,
" Red = " << kRed);
81 m_legEmpty->AddText(
"check again in a few minutes");
92 for (
VxdID& aVxdID : sensors) {
101 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents");
102 if (hnEvnts == NULL) {
103 B2INFO(
"no events, nothing to do here");
106 TString runID = TString((hnEvnts->GetTitle())).Remove(0, 21);
107 B2INFO(
"runID = " << runID);
128 Form(
"Summary of SVD efficiencies (%%), @view/@side Side for 3 samples %s", runID.Data()));
130 Form(
"Summary of SVD efficiencies errors (%%), @view/@side Side for 3 samples %s", runID.Data()));
139 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: beginRun called.");
161 double effErrorLo = 0.;
164 B2DEBUG(10,
" SVD efficiency thresholds taken from EPICS configuration file:");
165 B2DEBUG(10,
" EFFICIENCY: normal > " <<
m_effWarning <<
" > warning > " <<
m_effError <<
" > error with minimum statistics of " <<
171 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: event called.");
174 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
175 if (hnEvnts == NULL) {
176 B2INFO(
"no events, nothing to do here");
179 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
182 gStyle->SetOptStat(0);
183 gStyle->SetPaintTextFormat(
"2.1f");
197 Float_t erreffU = -1;
198 Float_t erreffV = -1;
201 TH2F* found_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsU");
202 TH2F* matched_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsU");
204 if (matched_clusU == NULL || found_tracksU == NULL) {
205 B2INFO(
"Histograms needed for Efficiency computation are not found");
208 B2DEBUG(10,
"U-side Before loop on sensors, size :" <<
m_SVDModules.size());
210 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
214 float numU = matched_clusU->GetBinContent(bin);
215 float denU = found_tracksU->GetBinContent(bin);
220 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
225 erreffU =
std::sqrt(effU * (1 - effU) / denU);
242 TH2F* found_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsV");
243 TH2F* matched_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsV");
245 if (matched_clusV == NULL || found_tracksV == NULL) {
246 B2INFO(
"Histograms needed for Efficiency computation are not found");
249 B2DEBUG(10,
"V-side Before loop on sensors, size :" <<
m_SVDModules.size());
251 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
255 float numV = matched_clusV->GetBinContent(bin);
256 float denV = found_tracksV->GetBinContent(bin);
262 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
267 erreffV =
std::sqrt(effV * (1 - effV) / denV);
314 B2INFO(
"effUstatus not set properly: " <<
m_effUstatus);
355 B2INFO(
"effVstatus not set properly: " <<
m_effVstatus);
387 TH2F* found3_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3U");
388 TH2F* matched3_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3U");
390 if (matched3_clusU == NULL || found3_tracksU == NULL) {
391 B2INFO(
"Histograms needed for Efficiency computation are not found");
394 B2DEBUG(10,
"U-side Before loop on sensors, size :" <<
m_SVDModules.size());
396 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
400 float numU = matched3_clusU->GetBinContent(bin);
401 float denU = found3_tracksU->GetBinContent(bin);
406 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
412 erreffU =
std::sqrt(effU * (1 - effU) / denU);
429 TH2F* found3_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3V");
430 TH2F* matched3_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3V");
432 if (matched3_clusV == NULL || found3_tracksV == NULL) {
433 B2INFO(
"Histograms needed for Efficiency computation are not found");
436 B2DEBUG(10,
"V-side Before loop on sensors, size :" <<
m_SVDModules.size());
438 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
442 float numV = matched3_clusV->GetBinContent(bin);
443 float denV = found3_tracksV->GetBinContent(bin);
449 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
454 erreffV =
std::sqrt(effV * (1 - effV) / denV);
501 B2INFO(
"effUstatus not set properly: " <<
m_effUstatus);
541 B2INFO(
"effVstatus not set properly: " <<
m_effVstatus);
569 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: endRun called");
574 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: terminate called");
605 return 2 + 1 + sensor;
607 return 6 + 1 + sensor;
609 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).
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 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
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.