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) {
106 "Summary of SVD efficiencies (%), @view/@side Side for 3 samples");
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 float numU = matched_clusU->GetBinContent(bin);
276 float denU = found_tracksU->GetBinContent(bin);
279 erreffU = std::sqrt(effU * (1 - effU) / denU);
281 if (effU < effMinU) effMinU = effU;
284 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
287 float numV = matched_clusV->GetBinContent(bin);
288 float denV = found_tracksV->GetBinContent(bin);
291 erreffV = std::sqrt(effV * (1 - effV) / denV);
293 if (effV < effMinV) effMinV = effV;
296 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
305 if (matched_clusU == NULL || found_tracksU == NULL) {
306 B2INFO(
"Histograms needed for U-side Efficiency computation are not found");
309 if (matched_clusV == NULL || found_tracksV == NULL) {
310 B2INFO(
"Histograms needed for V-side Efficiency computation are not found");
339 TH2F* found3_tracksU = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3U");
340 TH2F* matched3_clusU = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3U");
342 TH2F* found3_tracksV = (TH2F*)
findHist(
"SVDEfficiency/TrackHits3V");
343 TH2F* matched3_clusV = (TH2F*)
findHist(
"SVDEfficiency/MatchedHits3V");
345 if (matched3_clusU != NULL && found3_tracksU != NULL && matched3_clusV != NULL && found3_tracksV != NULL) {
346 B2DEBUG(10,
"Before loop on sensors, size :" <<
m_SVDModules.size());
349 for (
unsigned int i = 0; i <
m_SVDModules.size(); i++) {
354 float numU = matched3_clusU->GetBinContent(bin);
355 float denU = found3_tracksU->GetBinContent(bin);
358 erreffU = std::sqrt(effU * (1 - effU) / denU);
360 if (effU < effMinU) effMinU = effU;
363 B2DEBUG(10,
"effU = " << numU <<
"/" << denU <<
" = " << effU);
366 float numV = matched3_clusV->GetBinContent(bin);
367 float denV = found3_tracksV->GetBinContent(bin);
370 erreffV = std::sqrt(effV * (1 - effV) / denV);
372 if (effV < effMinV) effMinV = effV;
375 B2DEBUG(10,
"effV = " << numV <<
"/" << denV <<
" = " << effV);
384 if (matched3_clusU == NULL || found3_tracksU == NULL) {
385 B2INFO(
"Histograms needed for Efficiency computation are not found");
388 if (matched3_clusV == NULL || found3_tracksV == NULL) {
389 B2INFO(
"Histograms needed for Efficiency computation are not found");
412 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: endRun called");
417 B2DEBUG(10,
"DQMHistAnalysisSVDEfficiency: terminate called");
460 return 2 + 1 + sensor;
462 return 6 + 1 + sensor;
464 return 11 + 1 + sensor;
480 *efficiencyStatus = std::max(
noStat, *efficiencyStatus);
482 *efficiencyStatus = std::max(
lowStat, *efficiencyStatus);
484 *efficiencyStatus = std::max(
good, *efficiencyStatus);
486 *efficiencyStatus = std::max(
warning, *efficiencyStatus);
488 *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.
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 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.
Abstract base class for different kinds of events.