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(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
58 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: initialize");
65 for (
VxdID& aVxdID : sensors) {
116 "Summary of SVD efficiencies errors (%), @view/@side Side for 3 samples");
124 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents");
125 if (hnEvnts == NULL) {
126 B2INFO(
"no events, nothing to do here");
133 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: beginRun called.");
174 double effErrorLo = 0.;
175 double effWarnLo = 0.;
179 B2DEBUG(10,
" SVD efficiency thresholds taken from EPICS configuration file:");
180 B2DEBUG(10,
" EFFICIENCY: normal > " <<
m_effWarning <<
" > warning > " <<
m_effError <<
" > error with minimum statistics of " <<
203 m_legEmpty->AddText(
"Track/clusters plots are emtpy");
211 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: event called.");
214 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
215 if (hnEvnts == NULL) {
216 B2INFO(
"no events, nothing to do here");
219 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
222 TString tmp = hnEvnts->GetTitle();
223 Int_t pos = tmp.Last(
'~');
224 if (pos == -1) pos = 0;
226 TString runID = tmp(pos, tmp.Length() - pos);
227 B2INFO(
"DQMHistAnalysisSVDEfficiencyModule::runID = " << runID);
229 gStyle->SetOptStat(0);
230 gStyle->SetPaintTextFormat(
"2.1f");
257 Float_t effMinU = 9999;
258 Float_t effMinV = 9999;
259 Float_t erreffU = -1;
260 Float_t erreffV = -1;
263 TH2F* found_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsU");
264 TH2F* matched_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsU");
266 TH2F* found_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHitsV");
267 TH2F* matched_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHitsV");
269 if (matched_clusU != NULL && found_tracksU != NULL && matched_clusV != NULL && found_tracksV != NULL) {
270 B2DEBUG(10,
"Before loop on sensors, size :" <<
m_SVDModules.size());
273 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
278 float numU = matched_clusU->GetBinContent(bin);
279 float denU = found_tracksU->GetBinContent(bin);
282 erreffU = std::sqrt(effU * (1 - effU) / denU);
284 if (effU < effMinU) effMinU = effU;
287 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
290 float numV = matched_clusV->GetBinContent(bin);
291 float denV = found_tracksV->GetBinContent(bin);
294 erreffV = std::sqrt(effV * (1 - effV) / denV);
296 if (effV < effMinV) effMinV = effV;
299 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
308 if (matched_clusU == NULL || found_tracksU == NULL) {
309 B2INFO(
"Histograms needed for U-side Efficiency computation are not found");
312 if (matched_clusV == NULL || found_tracksV == NULL) {
313 B2INFO(
"Histograms needed for V-side Efficiency computation are not found");
342 TH2F* found3_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3U");
343 TH2F* matched3_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3U");
345 TH2F* found3_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3V");
346 TH2F* matched3_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3V");
348 if (matched3_clusU != NULL && found3_tracksU != NULL && matched3_clusV != NULL && found3_tracksV != NULL) {
349 B2DEBUG(10,
"Before loop on sensors, size :" <<
m_SVDModules.size());
352 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
357 float numU = matched3_clusU->GetBinContent(bin);
358 float denU = found3_tracksU->GetBinContent(bin);
361 erreffU = std::sqrt(effU * (1 - effU) / denU);
363 if (effU < effMinU) effMinU = effU;
366 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
369 float numV = matched3_clusV->GetBinContent(bin);
370 float denV = found3_tracksV->GetBinContent(bin);
373 erreffV = std::sqrt(effV * (1 - effV) / denV);
375 if (effV < effMinV) effMinV = effV;
378 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
387 if (matched3_clusU == NULL || found3_tracksU == NULL) {
388 B2INFO(
"Histograms needed for Efficiency computation are not found");
391 if (matched3_clusV == NULL || found3_tracksV == NULL) {
392 B2INFO(
"Histograms needed for Efficiency computation are not found");
415 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: endRun called");
420 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: terminate called");
463 return 2 + 1 + sensor;
465 return 6 + 1 + sensor;
467 return 11 + 1 + sensor;
483 *efficiencyStatus = std::max(
noStat, *efficiencyStatus);
485 *efficiencyStatus = std::max(
lowStat, *efficiencyStatus);
487 *efficiencyStatus = std::max(
good, *efficiencyStatus);
489 *efficiencyStatus = std::max(
warning, *efficiencyStatus);
491 *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
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.
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 setEffStatus(float den, float eff, bool isU=false)
set efficiency status
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.
Class definition for common method.
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
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
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 setMinimum(Int_t value=0)
set histogram minimum
void setRunID(const TString &runID)
set run ids in title
void reset()
Reset histograms.
void setMaximum(Int_t value=0)
set histogram maximum
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.