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.");
57 m_legError =
new TPaveText(-1, 54, 3, 57.5,
"br");
64 m_cUnpacker =
new TCanvas(
"SVDAnalysis/c_SVDDataFormat");
74 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: beginRun called.");
79 double unpackWarnLo = 0.;
80 double unpackWarnUp = 0.;
81 double unpackErrorLo = 0.;
83 B2DEBUG(10,
" SVD unpack error threshold taken from EPICS configuration file:");
89 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: event called.");
92 TH1* hnEvnts =
findHist(
"SVDExpReco/SVDDQM_nEvents",
true);
93 if (hnEvnts == NULL) {
94 B2INFO(
"no events, nothing to do here");
97 B2DEBUG(10,
"SVDExpReco/SVDDQM_nEvents found");
100 TH1* rtype =
findHist(
"DQMInfo/rtype");
102 B2DEBUG(10,
"DQMInfo/rtype found");
104 m_runtype = rtype ? rtype->GetTitle() :
"physics";
106 TString tmp = hnEvnts->GetTitle();
107 Int_t pos = tmp.Last(
'~');
108 if (pos == -1) pos = 0;
110 TString runID = tmp(pos, tmp.Length() - pos);
111 B2INFO(
"DQMHistAnalysisSVDUnpackerModule::runID = " << runID);
112 Float_t nEvents = hnEvnts->GetEntries();
115 TH1* h =
findHist(
"SVDUnpacker/DQMUnpackerHisto");
121 h->SetTitle(Form(
"SVD Data Format Monitor %s", runID.Data()));
123 bool hasError =
false;
124 for (
int un = 0; un < h->GetNcells(); un++)
140 setEpicsPV(
"UnpackError", h->GetEntries() / nEvents);
142 B2INFO(
"Histogram SVDUnpacker/DQMUnpackerHisto from SVDUnpackerDQM not found!");
157 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: endRun called");
163 B2DEBUG(10,
"DQMHistAnalysisSVDUnpacker: terminate called");
The base class for the histogram analysis module.
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).
@ c_ColorError
Analysis result: Severe issue found.
@ c_ColorDefault
default for non-coloring
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
@ c_StatusDefault
default for non-coloring
@ c_StatusError
Analysis result: Severe issue found.
@ c_StatusGood
Analysis result: Good.
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.
void initialize() override final
Initializer.
TPaveText * m_legError
plot legend, error
TString m_runtype
string with runtype: physics or cosmic
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.