10#include <dqm/analysis/modules/DQMHistAnalysisECLShapers.h>
16#include "boost/format.hpp"
25 B2DEBUG(20,
"DQMHistAnalysisECLShapers: Constructor done.");
26 setDescription(
"Processes information involving ECL pedestals (widths and rms).");
38 std::string pv_name = (boost::format(
"logic_check:crate%02d") %
42 for (
auto part_id : {
"fw",
"br",
"bw",
"al"}) {
43 std::string pv_name =
"pedwidth:max_";
53 B2DEBUG(20,
"DQMHistAnalysisECLShapers: initialized.");
58 B2DEBUG(20,
"DQMHistAnalysisECLShapers: beginRun called.");
63 TH1* h_fail_crateid =
findHist(
"ECL/fail_crateid");
64 TProfile* h_pedrms_cellid = (TProfile*)
findHist(
"ECL/pedrms_cellid");
66 if (h_pedrms_cellid != NULL) {
68 std::multiset<double> barrel_pedwidth;
69 std::multiset<double> bwd_pedwidth;
70 std::multiset<double> fwd_pedwidth;
72 for (
int i = 0; i < 8736; i++) {
73 const int cellid = i + 1;
74 if (h_pedrms_cellid->GetBinEntries(cellid) < 100)
continue;
75 double pedrms = h_pedrms_cellid->GetBinContent(cellid);
77 fwd_pedwidth.insert(pedrms);
78 }
else if (cellid < 7777) {
79 barrel_pedwidth.insert(pedrms);
81 bwd_pedwidth.insert(pedrms);
87 const double adc_to_mev = 0.05;
94 for (
int i = 0; i < 4; i++) {
101 if (h_fail_crateid != NULL) {
104 std::string pv_name = (boost::format(
"logic_check:crate%02d") %
106 int errors_count = h_fail_crateid->GetBinContent(i + 1);
110 static const char* part_id[] = {
"fw",
"br",
"bw",
"al"};
111 for (
int i = 0; i < 4; i++) {
113 std::string pv_name =
"pedwidth:max_";
114 pv_name += part_id[i];
122 B2DEBUG(20,
"DQMHistAnalysisECLShapers: endRun called");
127 TProfile* h_pedrms_cellid = (TProfile*)
findHist(
"ECL/pedrms_cellid");
128 if (h_pedrms_cellid ==
nullptr) {
130 B2INFO(
"Histogram named ECL/pedrms_cellid is not found.");
135 h_pedrms_cellid->Draw();
148 int len = values.size();
154 auto end_iter = std::prev(values.end(), len * 0.1);
void initialize() override final
Initialize the module.
~DQMHistAnalysisECLShapersModule()
Destructor.
DQMHistAnalysisECLShapersModule()
< derived from DQMHistAnalysisModule class.
std::string m_pvPrefix
Prefix to use for PVs registered by this module.
MonitoringObject * m_monObj
monitoring object
double robust_max(std::multiset< double > values)
Remove upper 10% of the values, return the maximum in the remaining 90%.
double m_pedwidth_max[4]
Max pedestal width array [0] -> Max pedestal width in FWD endcap [1] -> Max pedestal width in barrel ...
void event() override final
Event processor.
TCanvas * m_c_main
main panel for monitoring object
void endRun() override final
Call when a run ends.
void beginRun() override final
Call when a run begins.
static const int c_collector_count
Number of ECLCollector modules (normally 52)
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 addCanvas(TCanvas *canv)
Add Canvas to monitoring object.
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.