10#include <dqm/analysis/modules/DQMHistAnalysisECLOutOfTimeDigits.h>
23 B2DEBUG(20,
"DQMHistAnalysisECLOutOfTimeDigits: Constructor done.");
24 setDescription(
"Module to collect and process 'out of time' ECL digits");
26 std::string(
"ECL:out_of_time_digits:"));
27 addParam(
"onlyIfUpdated",
m_onlyIfUpdated,
"If true (default), update EPICS PVs only if there histograms were updated.",
35 for (
auto& event_type : {
"rand",
"dphy",
"physics"}) {
36 for (
auto& ecl_part : {
"All",
"FWDEndcap",
"Barrel",
"BWDEndcap"}) {
37 std::string pv_name = event_type + std::string(
":") + ecl_part;
44 B2DEBUG(20,
"DQMHistAnalysisECLOutOfTimeDigits: initialized.");
50 for (
auto& event_type : {
"rand",
"dphy",
"physics"}) {
51 for (
auto& ecl_part : {
"All",
"FWDEndcap",
"Barrel",
"BWDEndcap"}) {
52 std::string pv_name = event_type + std::string(
":") + ecl_part;
53 std::string var_name = pv_name;
54 std::replace(var_name.begin(), var_name.end(),
':',
'_');
58 std::string hist_name =
"ECL/out_of_time_" + var_name;
75 B2DEBUG(20,
"DQMHistAnalysisECLOutOfTimeDigits: endRun called");
77 auto main_hist = (TH1F*)
findHist(
"ECL/out_of_time_physics_All");
79 if (main_hist ==
nullptr) {
80 m_monObj->
setVariable(
"comment_out_of_time_digits",
"No ECL out-of-time ECLCalDigits histograms available");
81 B2INFO(
"Histogram named ECL/out_of_time_physics_All is not found.");
85 TF1 gaus(
"fit_func",
"gaus");
87 for (
auto& event_type : {
"rand",
"dphy",
"physics"}) {
88 for (
auto& ecl_part : {
"All",
"FWDEndcap",
"Barrel",
"BWDEndcap"}) {
89 std::string pv_name = event_type + std::string(
":") + ecl_part;
90 std::string hist_name =
"ECL/out_of_time_" + pv_name;
91 std::string var_name =
"out_of_time_digits_" + pv_name;
93 std::replace(hist_name.begin(), hist_name.end(),
':',
'_');
94 std::replace(var_name.begin(), var_name.end(),
':',
'_');
97 auto hist = (TH1F*)
findHist(hist_name);
98 if (hist && hist->GetEntries() > 1000) {
void initialize() override final
Initialize the module.
std::map< std::string, double > m_out_of_time_digits
Out-of-time ECLCalDigits for several cases.
DQMHistAnalysisECLOutOfTimeDigitsModule()
< derived from DQMHistAnalysisModule class.
std::string m_pvPrefix
Prefix to use for PVs registered by this module.
MonitoringObject * m_monObj
monitoring object
void event() override final
Event processor.
void endRun() override final
Call when a run ends.
bool m_onlyIfUpdated
If true (default), update EPICS PVs only if there were changes in the histograms.
The base class for the histogram analysis module.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
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.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
void setDescription(const std::string &description)
Sets the description of the module.
void setVariable(const std::string &var, float val, float upErr=-1., float dwErr=-1)
set value to float variable (new variable is made if not yet existing)
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.