14#include <dqm/analysis/modules/DQMHistAnalysisSVDUnpacker.h>
15#include <vxd/geometry/GeoCache.h>
41 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: Constructor done.");
43 setDescription(
"DQM Analysis Module that produces colored canvas for a straightforward interpretation of the SVD Data Quality.");
45 addParam(
"unpackerErrorLevel",
m_unpackError,
"Maximum bin_content/ # events allowed before throwing ERROR",
double(0.00001));
47 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
55 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: initialized.");
61 m_cUnpacker =
new TCanvas(
"SVDAnalysis/c_SVDDataFormat");
71 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: beginRun called.");
76 double unpackWarnLo = 0.;
77 double unpackWarnUp = 0.;
78 double unpackErrorLo = 0.;
80 B2DEBUG(10,
" SVD unpack error threshold taken from EPICS configuration file:");
86 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: event called.");
89 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
90 if (hnEvnts == NULL) {
91 B2INFO(
"no events, nothing to do here");
94 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
97 TString tmp = hnEvnts->GetTitle();
98 Int_t pos = tmp.Last(
'~');
99 if (pos == -1) pos = 0;
101 TString runID = tmp(pos, tmp.Length() - pos);
102 B2INFO(
"DQMHistAnalysisSVDUnpackerModule::runID = " << runID);
103 Float_t nEvents = hnEvnts->GetEntries();
106 TH1* h =
findHist(
"SVDUnpacker/DQMUnpackerHisto");
112 h->SetTitle(Form(
"SVD Data Format Monitor %s", runID.Data()));
114 bool hasError =
false;
115 for (
int un = 0; un < h->GetNcells(); un++)
131 setEpicsPV(
"UnpackError", h->GetEntries() / nEvents);
133 B2INFO(
"Histogram SVDUnpacker/DQMUnpackerHisto from SVDUnpackerDQM not found!");
146 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: endRun called");
152 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: terminate called");
void colorizeCanvas(TCanvas *canvas, EStatus status)
Helper function for Canvas colorization.
static TH1 * findHist(const std::string &histname, bool onlyIfUpdated=false)
Get histogram from list (no other search).
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
@ c_StatusDefault
default for non-coloring
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.
Class definition for common method.
void setStatusOfCanvas(int status, TCanvas *canvas, bool plotLeg=true, bool online=false)
set status of Canvas
TPaveText * m_legProblem
plot legend, problem
void initialize() override final
Initializer.
std::string m_pvPrefix
string prefix for EPICS PVs
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.
bool m_printCanvas
if true print the pdf of the canvases
TCanvas * m_cUnpacker
Parameters accesible from basf2 scripts.
bool m_3Samples
if true enable 3 samples histograms analysis
DQMHistAnalysisSVDUnpackerModule()
Constructor.
void endRun() override final
This method is called if the current run ends.
void beginRun() override final
Called when entering a new run.
Double_t m_unpackError
Maximum bin_content/ # events allowed before throwing ERROR.
~DQMHistAnalysisSVDUnpackerModule()
Destructor.
void setDescription(const std::string &description)
Sets the description of the module.
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.