10#include <dqm/analysis/modules/DQMHistAnalysisTRGGDL.h>
40 setDescription(
"Modify and analyze the data quality histograms of TRGGDL");
55 for (
unsigned iskim = 0; iskim <
nskim_gdldqm; iskim++) {
56 char charhist_eff[1000];
57 sprintf(charhist_eff,
"hGDL_ana_eff_%s",
skim_smap[iskim].c_str());
59 sprintf(charhist_eff,
"hGDL_ana_eff_fast_%s",
skim_smap[iskim].c_str());
61 for (
int i = 0; i <
n_eff; i++) {
62 m_h_eff[iskim]->GetXaxis()->SetBinLabel(i + 1,
c_eff[i]);
65 char charhist_c_eff[1000];
66 sprintf(charhist_c_eff,
"TRGGDL/hGDL_ana_eff_%s",
skim_smap[iskim].c_str());
67 m_c_eff[iskim] =
new TCanvas(charhist_c_eff);
68 sprintf(charhist_c_eff,
"TRGGDL/hGDL_ana_eff_fast_%s",
skim_smap[iskim].c_str());
80 const std::string eff_shifter_prefix =
"shifter_eff_";
105 std::string aa =
"TRGAna:eff_shift_" + std::to_string(i);
106 SEVCHK(ca_create_channel(aa.c_str(), NULL, NULL, 10, &mychid[i]),
"ca_create_channel failure");
111 std::string aa =
"TRGAna:entry_" + std::to_string(i);
112 SEVCHK(ca_create_channel(aa.c_str(), NULL, NULL, 10, &mychid_entry[i]),
"ca_create_channel failure");
117 B2DEBUG(20,
"DQMHistAnalysisTRGGDL: initialized.");
124 for (
unsigned iskim = 0; iskim <
nskim_gdldqm; iskim++) {
128 sprintf(c_psn,
"TRGGDL/hGDL_psn_extra_fast_%s",
skim_smap[iskim].c_str());
132 B2WARNING(
"Histogram/canvas named TRGGDL/hGDL_psn_extra_fast is not found.");
347 for (
unsigned iskim = 0; iskim <
nskim_gdldqm; iskim++) {
351 sprintf(c_psn,
"TRGGDL/hGDL_psn_extra_%s",
skim_smap[iskim].c_str());
355 B2WARNING(
"Histogram/canvas named TRGGDL/hGDL_psn_extra is not found.");
360 if (
m_h_psn_extra[iskim]->GetBinContent(0 + 1) == 0)
continue;
361 if (
m_h_psn_extra[iskim]->GetBinContent(5 + 1) == 0)
continue;
387 if (
m_h_psn_extra[iskim]->GetBinContent(6 + 1) == 0)
continue;
457 if (
m_h_psn_extra[iskim]->GetBinContent(14 + 1) == 0)
continue;
592 B2WARNING(
"Histogram/canvas named hGDL_psn_pure_extra is not found.");
620 for (
unsigned iskim = 0; iskim <
nskim_gdldqm; iskim++) {
628 for (
unsigned iskim = 0; iskim <
nskim_gdldqm; iskim++) {
670 double eff_err_min = eff - 2 * err;
671 double eff_err_max = eff + 2 * err;
674 double eff_err_min_fast = eff_fast - 2 * err_fast;
675 double eff_err_max_fast = eff_fast + 2 * err_fast;
684 if (error_check == 1) {
758 if (mychid[i]) SEVCHK(ca_put(DBR_DOUBLE, mychid[i], (
void*)&data),
"ca_set failure");
763 B2WARNING(
"Histogram/canvas named hGDL_psn_extra is not found.");
765 B2WARNING(
"Histogram/canvas named hGDL_psn_extra is not found.");
767 if (i == 0 || i == 6) {
774 if (mychid_entry[i]) SEVCHK(ca_put(DBR_DOUBLE, mychid_entry[i], (
void*)&data),
"ca_set failure");
783 B2DEBUG(20,
"DQMHistAnalysisTRGGDL : beginRun called");
785 double lo_limit, hi_limit, dummy;
786 lo_limit = std::numeric_limits<double>::quiet_NaN();
787 hi_limit = std::numeric_limits<double>::quiet_NaN();
788 const std::string eff_shifter_prefix =
"shifter_eff_";
792 if (std::isnan(lo_limit)) lo_limit = 0;
793 if (std::isnan(hi_limit)) hi_limit = 1;
807 B2DEBUG(20,
"DQMHistAnalysisTRGGDL : endRun called");
824 if (mychid[i]) SEVCHK(ca_clear_channel(mychid[i]),
"ca_clear_channel failure");
827 if (mychid_entry[i]) SEVCHK(ca_clear_channel(mychid_entry[i]),
"ca_clear_channel failure");
831 B2DEBUG(20,
"terminate called");
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).
static const std::string & getRunType(void)
Get the list of the reference histograms.
void setEpicsPV(std::string keyname, double value)
Write value to a EPICS PV.
bool getUseEpics(void)
Getter for EPICS usage.
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.
TH1D * m_h_eff_shifter_fast
Histogram for TRGGDL efficiency, simplified one for CR shifter.
void initialize() override final
Initialize the Module.
static const int n_eff_shifter
number of bins for the simplified efficiency histogram
TCanvas * m_c_eff_shifter_fast
Canvas for TRGGDL efficiency, simplified one for CR shifter.
TCanvas * m_c_eff_fast[nskim_gdldqm]
Canvas for TRGGDL efficiency in each HLT skim.
std::vector< double > m_temp_hi_limit
upper limit threshold for the efficiencies monitored by shifters
bool m_IsPhysicsRun
Run type flag for physics runs.
TH1D * m_h_eff_fast[nskim_gdldqm]
Histogram for TRGGDL efficiency in each HLT skim.
bool m_enableAlert
Enable alert by base color of canvases.
static const int nskim_gdldqm
number of HLT skims
TLine * m_line_limit_high_shifter[n_eff_shifter]
upper limit line for the simplified efficiency histogram
TH1D * m_h_pure_eff
Histogram for TRGGDL efficiency with offline selection.
Belle2::MonitoringObject * m_mon_h_eff_shifter_fast
Mirabelle, MonitoringObject for m_h_eff_shifter_fast.
std::string m_pvPrefix
Prefix for the PV variables of TRGGDL.
TLine * m_line_limit_low_shifter[n_eff_shifter]
lower limit line for the simplified efficiency histogram
void terminate() override final
Termination action.
std::vector< double > m_temp_lo_limit
lower limit threshold for the efficiencies monitored by shifters
TH1D * m_h_eff[nskim_gdldqm]
Histogram for TRGGDL efficiency in each HLT skim.
const char * c_eff[n_eff]
label of bins for the efficiency histogram
std::vector< std::string > m_temp_pvnames
Names of PVs for the efficiencies monitored by shifters.
void event() override final
Event processor.
std::string skim_smap[nskim_gdldqm]
name of HLT skims
TH1D * m_h_eff_shifter
Histogram for TRGGDL efficiency, simplified one for CR shifter.
TH1D * m_h_psn_extra_fast[nskim_gdldqm]
DQM Histogram for PSN bits in each HLT skim.
TH1D * m_h_psn_pure_extra
DQM Histogram for PSN bits with offline selection.
static const int n_pure_eff
number of bins for the efficiency histogram with offline selection
TH1D * m_h_psn_extra[nskim_gdldqm]
DQM Histogram for PSN bits in each HLT skim.
TCanvas * m_c_pure_eff
Canvas for TRGGDL efficiency with offline selection.
void endRun() override final
End-of-run action.
const char * c_mon_eff_shifter[n_eff_shifter]
The name of the Mirabelle variable and the PVs for the bin labels of the simplified efficiency histog...
void beginRun() override final
Begin-of-run action.
DQMHistAnalysisTRGGDLModule()
Constructor.
TCanvas * m_c_eff[nskim_gdldqm]
Canvas for TRGGDL efficiency in each HLT skim.
const char * c_pure_eff[n_pure_eff]
label of bins for the efficiency histogram with offline selection
~DQMHistAnalysisTRGGDLModule()
Destructor.
TCanvas * m_c_eff_shifter
Canvas for TRGGDL efficiency, simplified one for CR shifter.
static const int n_eff
number of bins for the efficiency histogram
const char * c_eff_shifter[n_eff_shifter]
label of bins for the simplified efficiency histogram
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
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.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.