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));
60 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: initialize");
67 for (
VxdID& aVxdID : sensors) {
118 "Summary of SVD efficiencies errors (%), @view/@side Side for 3 samples");
126 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents");
127 if (hnEvnts == NULL) {
128 B2INFO(
"no events, nothing to do here");
135 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: beginRun called.");
176 double effErrorLo = 0.;
177 double effWarnLo = 0.;
181 B2DEBUG(10,
" SVD efficiency thresholds taken from EPICS configuration file:");
182 B2DEBUG(10,
" EFFICIENCY: normal > " <<
m_effWarning <<
" > warning > " <<
m_effError <<
" > error with minimum statistics of " <<
205 m_legEmpty->AddText(
"Track/clusters plots are emtpy");
213 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: event called.");
216 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
217 if (hnEvnts == NULL) {
218 B2INFO(
"no events, nothing to do here");
221 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
224 TString tmp = hnEvnts->GetTitle();
225 Int_t pos = tmp.Last(
'~');
226 if (pos == -1) pos = 0;
228 TString runID = tmp(pos, tmp.Length() - pos);
229 B2INFO(
"DQMHistAnalysisSVDEfficiencyModule::runID = " << runID);
231 gStyle->SetOptStat(0);
232 gStyle->SetPaintTextFormat(
"2.1f");
259 Float_t effMinU = 9999;
260 Float_t effMinV = 9999;
261 Float_t erreffU = -1;
262 Float_t erreffV = -1;
265 TH2F* found_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsU");
266 TH2F* matched_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsU");
268 TH2F* found_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsV");
269 TH2F* matched_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsV");
271 if (matched_clusU != NULL && found_tracksU != NULL && matched_clusV != NULL && found_tracksV != NULL) {
272 B2DEBUG(10,
"Before loop on sensors, size :" <<
m_SVDModules.size());
275 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
280 int bin = found_tracksU->FindBin(ladder,
findBinY(layer, sensor));
282 float numU = matched_clusU->GetBinContent(bin);
283 float denU = found_tracksU->GetBinContent(bin);
286 erreffU = std::sqrt(effU * (1 - effU) / denU);
288 if (effU < effMinU) effMinU = effU;
291 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU <<
" +- " << erreffU);
294 float numV = matched_clusV->GetBinContent(bin);
295 float denV = found_tracksV->GetBinContent(bin);
298 erreffV = std::sqrt(effV * (1 - effV) / denV);
300 if (effV < effMinV) effMinV = effV;
303 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV <<
" +- " << erreffV);
308 if (layer == 6 && (sensor == 1 || sensor == 5)) {
309 if (denU < 100) denU = 100;
310 if (denV < 100) denV = 100;
320 if (matched_clusU == NULL || found_tracksU == NULL) {
321 B2INFO(
"Histograms needed for U-side Efficiency computation are not found");
324 if (matched_clusV == NULL || found_tracksV == NULL) {
325 B2INFO(
"Histograms needed for V-side Efficiency computation are not found");
354 TH2F* found3_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3U");
355 TH2F* matched3_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3U");
357 TH2F* found3_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3V");
358 TH2F* matched3_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3V");
360 if (matched3_clusU != NULL && found3_tracksU != NULL && matched3_clusV != NULL && found3_tracksV != NULL) {
361 B2DEBUG(10,
"Before loop on sensors, size :" <<
m_SVDModules.size());
364 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
369 int bin = found3_tracksU->FindBin(ladder,
findBinY(layer, sensor));
371 float numU = matched3_clusU->GetBinContent(bin);
372 float denU = found3_tracksU->GetBinContent(bin);
375 erreffU = std::sqrt(effU * (1 - effU) / denU);
377 if (effU < effMinU) effMinU = effU;
380 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU <<
" +- " << erreffU);
383 float numV = matched3_clusV->GetBinContent(bin);
384 float denV = found3_tracksV->GetBinContent(bin);
387 erreffV = std::sqrt(effV * (1 - effV) / denV);
389 if (effV < effMinV) effMinV = effV;
392 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV <<
" +- " << erreffV);
397 if (layer == 6 && (sensor == 1 || sensor == 5)) {
398 if (denU < 100) denU = 100;
399 if (denV < 100) denV = 100;
409 if (matched3_clusU == NULL || found3_tracksU == NULL) {
410 B2INFO(
"Histograms needed for Efficiency computation are not found");
413 if (matched3_clusV == NULL || found3_tracksV == NULL) {
414 B2INFO(
"Histograms needed for Efficiency computation are not found");
437 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: endRun called");
442 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: terminate called");
485 return 2 + 1 + sensor;
487 return 6 + 1 + sensor;
489 return 11 + 1 + sensor;
498 efficiencyStatus = std::max(
noStat, efficiencyStatus);
500 efficiencyStatus = std::max(
lowStat, efficiencyStatus);
502 efficiencyStatus = std::max(
good, efficiencyStatus);
504 efficiencyStatus = std::max(
warning, efficiencyStatus);
506 efficiencyStatus = std::max(
error, efficiencyStatus);
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
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.
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
~DQMHistAnalysisSVDEfficiencyModule()
Destructor.
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.
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.
TPaveText * m_legLowStat
plot legend, low stats
DQMHistAnalysisSVDModule(bool panelTop=false, bool online=false)
Constructor.
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
void updateErrCanvases(SVDSummaryPlots *histo, TCanvas *canvas, TCanvas *canvasRPhi, bool isU)
update error canvases
void updateCanvases(SVDSummaryPlots *histo, TCanvas *canvas, TCanvas *canvasRPhi, svdStatus status, bool isU, bool online=false)
update 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.