14#include <dqm/analysis/modules/DQMHistAnalysisSVDEfficiency.h>
15#include <vxd/geometry/GeoCache.h>
40 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: Constructor done.");
42 setDescription(
"DQM Analysis Module that computes the average SVD sensor efficiency.");
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(
"nSigma",
m_nSigma,
"Number of sigmas to set the DQM status, where sigma = efficiency uncertainty",
49 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
55 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: initialize");
62 for (
VxdID& aVxdID : sensors) {
113 "Summary of SVD efficiencies errors (%), @view/@side Side for 3 samples");
121 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents");
122 if (hnEvnts == NULL) {
123 B2INFO(
"no events, nothing to do here");
130 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: beginRun called.");
171 double effErrorLo = 0.;
172 double effWarnLo = 0.;
176 B2DEBUG(10,
" SVD efficiency thresholds taken from EPICS configuration file:");
177 B2DEBUG(10,
" EFFICIENCY: normal > " <<
m_effWarning <<
" > warning > " <<
m_effError <<
" > error with minimum statistics of " <<
200 m_legEmpty->AddText(
"Track/clusters plots are emtpy");
208 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: event called.");
211 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
212 if (hnEvnts == NULL) {
213 B2INFO(
"no events, nothing to do here");
216 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
219 TString tmp = hnEvnts->GetTitle();
220 Int_t pos = tmp.Last(
'~');
221 if (pos == -1) pos = 0;
223 TString runID = tmp(pos, tmp.Length() - pos);
224 B2INFO(
"DQMHistAnalysisSVDEfficiencyModule::runID = " << runID);
226 gStyle->SetOptStat(0);
227 gStyle->SetPaintTextFormat(
"2.1f");
254 Float_t effMinU = 9999;
255 Float_t effMinV = 9999;
256 Float_t erreffU = -1;
257 Float_t erreffV = -1;
260 TH2F* found_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsU");
261 TH2F* matched_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsU");
263 TH2F* found_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsV");
264 TH2F* matched_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsV");
266 if (matched_clusU != NULL && found_tracksU != NULL && matched_clusV != NULL && found_tracksV != NULL) {
267 B2DEBUG(10,
"Before loop on sensors, size :" <<
m_SVDModules.size());
270 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
275 int bin = found_tracksU->FindBin(ladder,
findBinY(layer, sensor));
277 float numU = matched_clusU->GetBinContent(bin);
278 float denU = found_tracksU->GetBinContent(bin);
281 erreffU = std::sqrt(effU * (1 - effU) / denU);
283 if (effU < effMinU) effMinU = effU;
286 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU <<
" +- " << erreffU);
289 float numV = matched_clusV->GetBinContent(bin);
290 float denV = found_tracksV->GetBinContent(bin);
293 erreffV = std::sqrt(effV * (1 - effV) / denV);
295 if (effV < effMinV) effMinV = effV;
298 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV <<
" +- " << erreffV);
303 if (layer == 6 && (sensor == 1 || sensor == 5)) {
304 if (denU < 100) denU = 100;
305 if (denV < 100) denV = 100;
315 if (matched_clusU == NULL || found_tracksU == NULL) {
316 B2INFO(
"Histograms needed for U-side Efficiency computation are not found");
319 if (matched_clusV == NULL || found_tracksV == NULL) {
320 B2INFO(
"Histograms needed for V-side Efficiency computation are not found");
349 TH2F* found3_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3U");
350 TH2F* matched3_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3U");
352 TH2F* found3_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3V");
353 TH2F* matched3_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3V");
355 if (matched3_clusU != NULL && found3_tracksU != NULL && matched3_clusV != NULL && found3_tracksV != NULL) {
356 B2DEBUG(10,
"Before loop on sensors, size :" <<
m_SVDModules.size());
359 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
364 int bin = found3_tracksU->FindBin(ladder,
findBinY(layer, sensor));
366 float numU = matched3_clusU->GetBinContent(bin);
367 float denU = found3_tracksU->GetBinContent(bin);
370 erreffU = std::sqrt(effU * (1 - effU) / denU);
372 if (effU < effMinU) effMinU = effU;
375 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU <<
" +- " << erreffU);
378 float numV = matched3_clusV->GetBinContent(bin);
379 float denV = found3_tracksV->GetBinContent(bin);
382 erreffV = std::sqrt(effV * (1 - effV) / denV);
384 if (effV < effMinV) effMinV = effV;
387 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV <<
" +- " << erreffV);
392 if (layer == 6 && (sensor == 1 || sensor == 5)) {
393 if (denU < 100) denU = 100;
394 if (denV < 100) denV = 100;
404 if (matched3_clusU == NULL || found3_tracksU == NULL) {
405 B2INFO(
"Histograms needed for Efficiency computation are not found");
408 if (matched3_clusV == NULL || found3_tracksV == NULL) {
409 B2INFO(
"Histograms needed for Efficiency computation are not found");
432 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: endRun called");
437 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: terminate called");
480 return 2 + 1 + sensor;
482 return 6 + 1 + sensor;
484 return 11 + 1 + sensor;
493 efficiencyStatus = std::max(
noStat, efficiencyStatus);
495 efficiencyStatus = std::max(
lowStat, efficiencyStatus);
497 efficiencyStatus = std::max(
good, efficiencyStatus);
499 efficiencyStatus = std::max(
warning, efficiencyStatus);
501 efficiencyStatus = std::max(
error, efficiencyStatus);
int registerEpicsPV(const std::string &pvname, const std::string &keyname="")
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.
TCanvas * m_cEfficiencyErrRPhiViewU
efficiency U error plot canvas
TCanvas * m_cEfficiencyErrRPhiViewV3Samples
efficiency V error plot canvas for 3 samples
SVDSummaryPlots * m_hEfficiency3Samples
efficiency histo for 3 samples
void initialize() override final
Initializer.
TCanvas * m_cEfficiencyErrV3Samples
efficiency V error plot canvas for 3 samples
double m_nSigma
number of sigmas to set the DQM status, where sigma = efficiency uncertainty
svdStatus m_effUstatus
number representing the status of the efficiency U side
TCanvas * m_cEfficiencyErrRPhiViewV
efficiency V error plot canvas
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
TCanvas * m_cEfficiencyRPhiViewV3Samples
efficiency V plot canvas for 3 samples
SVDSummaryPlots * m_hEfficiency
efficiency histo
std::vector< VxdID > m_SVDModules
IDs of all SVD Modules to iterate over.
void setEffStatus(float den, float eff, float err, svdStatus &efficiencyStatus)
set efficiency status
svdStatus m_effVstatus
number representing the status of the efficiency V 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.
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
Data members.
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
void beginRun() override final
Called when entering a new run.
TCanvas * m_cEfficiencyRPhiViewU
efficiency U plot canvas
TCanvas * m_cEfficiencyV3Samples
efficiency V plot canvas for 3 samples
TCanvas * m_cEfficiencyErrV
efficiency V error plot canvas
TCanvas * m_cEfficiencyRPhiViewV
efficiency V plot canvas
TCanvas * m_cEfficiencyErrRPhiViewU3Samples
efficiency U error plot canvas for 3 samples
SVDSummaryPlots * m_hEfficiencyErr
efficiency error histo
TCanvas * m_cEfficiencyRPhiViewU3Samples
efficiency U plot canvas for 3 samples
DQMHistAnalysisSVDEfficiencyModule()
Constructor.
int m_colzMaximum
Maximum of the histogram.
static TString getHistoNameFromCanvas(TString cName, TString view="", TString cPrefix="c_", TString hPrefix="")
get histogram name from Canvas name
TPaveText * m_legEmpty
plot legend, empty
int m_colzMinimum
Minimum of the histogram.
void updateCanvases(SVDSummaryPlots *histo, TCanvas *canvas, TCanvas *canvasRPhi, svdStatus status, bool isU, int histoType=kOffline)
update canvases
TPaveText * m_legLowStat
plot legend, low stats
TPaveText * m_legWarning
plot legend, warning
TArrow * m_arrowx
x-axis direction
std::vector< TText * > m_sensorsText
list of sensors to write on the cancas
float m_valueMinimum
Minimum value of parameter.
TPaveText * m_legNormal
plot legend, normal
TArrow * m_arrowy
y-axis direction
std::vector< TText * > m_laddersText
list of ladders to write on the canvas
TPaveText * m_legProblem
plot legend, problem
DQMHistAnalysisSVDModule(bool panelTop=false, bool online=false, bool groupIDs=false)
Constructor.
void updateErrCanvases(SVDSummaryPlots *histo, TCanvas *canvas, TCanvas *canvasRPhi, bool isU)
update error canvases
bool m_setColzRange
set the range of the histogram in colz
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.