Belle II Software release-09-00-00
DQMHistAnalysisKLM2Module Class Referencefinal

Analysis of KLM DQM histograms. More...

#include <DQMHistAnalysisKLM2.h>

Inheritance diagram for DQMHistAnalysisKLM2Module:
Collaboration diagram for DQMHistAnalysisKLM2Module:

Public Types

enum  EStatus {
  c_StatusTooFew = 0 ,
  c_StatusDefault = 1 ,
  c_StatusGood = 2 ,
  c_StatusWarning = 3 ,
  c_StatusError = 4
}
 Status flag of histogram/canvas. More...
 
enum  EStatusColor {
  c_ColorTooFew = kGray ,
  c_ColorDefault = kWhite ,
  c_ColorGood = kGreen ,
  c_ColorWarning = kYellow ,
  c_ColorError = kRed
}
 Status colors of histogram/canvas (corresponding to status) More...
 
typedef std::map< std::string, HistObjectHistList
 The type of list of histograms.
 
typedef std::map< std::string, MonitoringObjectMonObjList
 The type of list of MonitoringObjects.
 
typedef std::map< std::string, HistDeltaDeltaList
 The type of list of delta settings and histograms.
 
typedef std::map< std::string, bool > CanvasUpdatedList
 The type of list of canvas updated status.
 
enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 DQMHistAnalysisKLM2Module ()
 Constructor.
 
void initialize () override final
 Initializer.
 
void beginRun () override final
 Called when entering a new run.
 
void event () override final
 This method is called for each event.
 
void endRun () override final
 This method is called if the current run ends.
 
void clearlist (void)
 Clear all static global lists.
 
void setRunType (std::string &t)
 Set the Run Type.
 
void setEventProcessed (int e)
 Set the number of processed events.
 
TCanvas * findCanvas (TString cname)
 Find canvas by name.
 
TH1 * findHistInCanvas (const std::string &hname, TCanvas **canvas=nullptr)
 Find histogram in corresponding canvas.
 
double getSigma68 (TH1 *h) const
 Helper function to compute half of the central interval covering 68% of a distribution.
 
void clearCanvases (void)
 Clear content of all Canvases.
 
void resetDeltaList (void)
 Reset Delta.
 
TH1 * getDelta (const std::string &fullname, int n=0, bool onlyIfUpdated=true)
 Get Delta histogram.
 
TH1 * getDelta (const std::string &dirname, const std::string &histname, int n=0, bool onlyIfUpdated=true)
 Get Delta histogram.
 
void addDeltaPar (const std::string &dirname, const std::string &histname, HistDelta::EDeltaType t, int p, unsigned int a=1)
 Add Delta histogram parameters.
 
bool hasDeltaPar (const std::string &dirname, const std::string &histname)
 Check if Delta histogram parameters exist for histogram.
 
void UpdateCanvas (std::string name, bool updated=true)
 Mark canvas as updated (or not)
 
void UpdateCanvas (TCanvas *canvas, bool updated=true)
 Mark canvas as updated (or not)
 
void ExtractRunType (std::vector< TH1 * > &hs)
 Extract Run Type from histogram title, called from input module.
 
void ExtractEvent (std::vector< TH1 * > &hs)
 Extract event processed from daq histogram, called from input module.
 
int registerEpicsPV (std::string pvname, std::string keyname="")
 EPICS related Functions.
 
int registerExternalEpicsPV (std::string pvname, std::string keyname="")
 Register a PV with its name and a key name.
 
void setEpicsPV (std::string keyname, double value)
 Write value to a EPICS PV.
 
void setEpicsPV (std::string keyname, int value)
 Write value to a EPICS PV.
 
void setEpicsPV (int index, double value)
 Write value to a EPICS PV.
 
void setEpicsPV (int index, int value)
 Write value to a EPICS PV.
 
void setEpicsStringPV (std::string keyname, std::string value)
 Write string to a EPICS PV.
 
void setEpicsStringPV (int index, std::string value)
 Write string to a EPICS PV.
 
double getEpicsPV (std::string keyname)
 Read value from a EPICS PV.
 
double getEpicsPV (int index)
 Read value from a EPICS PV.
 
std::string getEpicsStringPV (std::string keyname, bool &status)
 Read value from a EPICS PV.
 
std::string getEpicsStringPV (int index, bool &status)
 Read value from a EPICS PV.
 
int updateEpicsPVs (float timeout)
 Update all EPICS PV (flush to network)
 
chid getEpicsPVChID (std::string keyname)
 Get EPICS PV Channel Id.
 
chid getEpicsPVChID (int index)
 Get EPICS PV Channel Id.
 
bool requestLimitsFromEpicsPVs (chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
 Get Alarm Limits from EPICS PV.
 
bool requestLimitsFromEpicsPVs (std::string keyname, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
 Get Alarm Limits from EPICS PV.
 
bool requestLimitsFromEpicsPVs (int index, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
 Get Alarm Limits from EPICS PV.
 
void setUseEpics (bool flag)
 Setter for EPICS usage.
 
void setUseEpicsReadOnly (bool flag)
 Setter EPICS flag in read only mode.
 
bool getUseEpics (void)
 Getter for EPICS usage.
 
bool getUseEpicsReadOnly (void)
 Getter EPICS flag in read only mode.
 
void cleanupEpicsPVs (void)
 Unsubscribe from EPICS PVs on terminate.
 
std::string & getPVPrefix (void)
 get global Prefix for EPICS PVs
 
void setPVPrefix (std::string &prefix)
 set global Prefix for EPICS PVs
 
EStatus makeStatus (bool enough, bool warn_flag, bool error_flag)
 Helper function to judge the status for coloring and EPICS.
 
void colorizeCanvas (TCanvas *canvas, EStatus status)
 Helper function for Canvas colorization.
 
EStatusColor getStatusColor (EStatus status)
 Return color for canvas state.
 
void checkPVStatus (void)
 Check the status of all PVs and report if disconnected or not found.
 
void printPVStatus (chid pv, bool onlyError=true)
 check the status of a PVs and report if disconnected or not found
 
void CheckEpicsError (int state, const std::string &message, const std::string &name)
 check the return status and check PV in case of error
 
void CheckEpicsError (int state, const std::string &message, chid id)
 check the return status and check PV in case of error
 
std::vector< std::string > StringSplit (const std::string &s, const char delim)
 Helper function for string token split.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
virtual void terminate ()
 This method is called at the end of the event processing.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

static HistListgetHistList ()
 Get the list of the histograms.
 
static MonObjListgetMonObjList ()
 Get the list of MonitoringObjects.
 
static const DeltaListgetDeltaList ()
 Get the list of the delta histograms.
 
static const CanvasUpdatedListgetCanvasUpdatedList ()
 Get the list of the canvas update status.
 
static const std::string & getRunType (void)
 Get the Run Type.
 
static int getEventProcessed (void)
 Get the number of processed events.
 
static TH1 * findHist (const std::string &histname, bool onlyIfUpdated=false)
 Get histogram from list (no other search).
 
static TH1 * findHist (const std::string &dirname, const std::string &histname, bool onlyIfUpdated=false)
 Find histogram.
 
static TH1 * findHistInFile (TFile *file, const std::string &histname)
 Find histogram in specific TFile (e.g.
 
static MonitoringObjectfindMonitoringObject (const std::string &objName)
 Find MonitoringObject.
 
static bool addHist (const std::string &dirname, const std::string &histname, TH1 *h)
 Add histogram.
 
static MonitoringObjectgetMonitoringObject (const std::string &name)
 Get MonitoringObject with given name (new object is created if non-existing)
 
static void initHistListBeforeEvent (void)
 Reset the list of histograms.
 
static void clearHistList (void)
 Clears the list of histograms.
 
static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Static Public Attributes

static DeltaList s_deltaList
 The list of Delta Histograms and settings.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python.
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side.
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module.
 
void setType (const std::string &type)
 Set the module type.
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module.
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module.
 
void setReturnValue (int value)
 Sets the return value for this module as integer.
 
void setReturnValue (bool value)
 Sets the return value for this module as bool.
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Member Functions

void processEfficiencyHistogram (TH1 *effHist, TH1 *denominator, TH1 *numerator, TCanvas *canvas)
 Process histogram containing the efficiencies.
 
void processPlaneHistogram (const std::string &histName, TH1 *histogram)
 Process histogram containing the number of hits in plane.
 
void process2DEffHistogram (TH1 *mainHist, TH1 *refHist, TH2 *planeHist, TH2 *errHist, int layers, int sectors, bool ratioPlot, int *pvcount, double layerLimit, TCanvas *eff2dCanv)
 Process 2D efficiency histograms.
 
int registerEpicsPVwithPrefix (std::string prefix, std::string pvname, std::string keyname="")
 Register a PV with its name and a key name.
 
std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

TLine m_PlaneLine
 TLine for boundary in plane histograms.
 
TText m_PlaneText
 TText for names in plane histograms.
 
bool m_IsPhysicsRun = false
 Run type flag for null runs.
 
bool m_IsNullRun
 Run type flag for null runs.
 
TH1 * m_eff_bklm = NULL
 Histogram for BKLM plane efficiency.
 
TCanvas * m_c_eff_bklm = NULL
 BKLM plane efficiency canvas.
 
TH1 * m_eff_eklm = NULL
 Histogram for EKLM plane efficiency.
 
TCanvas * m_c_eff_eklm = NULL
 EKLM plane efficiency canvas.
 
TH1 * m_eff_bklm_sector = NULL
 Histogram for BKLM sector efficiency.
 
TCanvas * m_c_eff_bklm_sector = NULL
 Histogram for BKLM sector efficiency.
 
TH1 * m_eff_eklm_sector = NULL
 Histogram for EKLM sector efficiency.
 
TCanvas * m_c_eff_eklm_sector = NULL
 Histogram for EKLM sector efficiency.
 
MonitoringObjectm_monObj {}
 Monitoring object.
 
const EKLMElementNumbersm_EklmElementNumbers
 EKLM element numbers.
 
std::string m_refFileName
 2D layer-sector efficiency differences
 
TFile * m_refFile = nullptr
 reference histogram file
 
float m_warnThr = 0
 efficiency ratio warning threshold
 
float m_alarmThr = 0
 efficiency ratio alarm threshold
 
float m_stopThr = 0
 efficiency ratio (run-)stop threshold
 
float m_min = 0
 efficiency ratio min z scale
 
float m_max = 2
 efficiency ratio max z scale
 
bool m_ratio = true
 show efficiency ratio or difference
 
TH1 * m_ref_efficiencies_bklm = NULL
 BKLM efficiencies reference histogram.
 
TH2 * m_eff2d_bklm = NULL
 BKLM efficiencies 2dim histogram.
 
TH2 * m_err_bklm = NULL
 BKLM efficiencies error histogram.
 
TCanvas * m_c_eff2d_bklm = NULL
 BKLM efficiencies ratio canvas.
 
TH1 * m_ref_efficiencies_eklm = NULL
 ELM efficiencies reference histogram.
 
TH2 * m_eff2d_eklm = NULL
 EKLM efficiencies 2dim histogram.
 
TH2 * m_err_eklm = NULL
 EKLM efficiencies error histogram.
 
TCanvas * m_c_eff2d_eklm = NULL
 EKLM efficiencies ratio canvas.
 
std::string m_histogramDirectoryName
 Name of histogram directory.
 
std::string m_refHistogramDirectoryName
 Name of histogram directory for reference file.
 
double m_minEntries
 Minimal number of entries for delta histogram and PV update.
 
int m_nEffBKLMLayers
 Number of inefficient BKLM layers.
 
int m_nEffEKLMLayers
 Number of inefficient EKLM Layers.
 
double m_BKLMLayerWarn
 alarm limits from inefficient BKLM layers PV
 
double m_EKLMLayerWarn
 alarm limits from inefficient EKLM layers PV
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Static Private Attributes

static HistList s_histList
 The list of Histograms.
 
static MonObjList s_monObjList
 The list of MonitoringObjects.
 
static CanvasUpdatedList s_canvasUpdatedList
 The list of canvas updated status.
 
static int s_eventProcessed = 0
 Number of Events processed to fill histograms.
 
static std::string s_runType = ""
 The Run type.
 
static bool m_useEpics = false
 Flag if to use EPICS do not set by yourself, use EpicsEnable module to set.
 
static bool m_epicsReadOnly
 Flag if to use EPICS in ReadOnly mode (for reading limits) do not set by yourself, use EpicsEnable module to set.
 
static std::string m_PVPrefix = "TEST:"
 The Prefix for EPICS PVs.
 

Detailed Description

Analysis of KLM DQM histograms.

Definition at line 39 of file DQMHistAnalysisKLM2.h.

Member Typedef Documentation

◆ CanvasUpdatedList

typedef std::map<std::string, bool> CanvasUpdatedList
inherited

The type of list of canvas updated status.

Definition at line 81 of file DQMHistAnalysis.h.

◆ DeltaList

typedef std::map<std::string, HistDelta> DeltaList
inherited

The type of list of delta settings and histograms.

Definition at line 76 of file DQMHistAnalysis.h.

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

◆ HistList

typedef std::map<std::string, HistObject> HistList
inherited

The type of list of histograms.

Definition at line 67 of file DQMHistAnalysis.h.

◆ MonObjList

typedef std::map<std::string, MonitoringObject> MonObjList
inherited

The type of list of MonitoringObjects.

Definition at line 71 of file DQMHistAnalysis.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

77 {
78 c_Input = 1,
79 c_Output = 2,
85 };
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
Definition: Module.h:81
@ c_Input
This module is an input module (reads data).
Definition: Module.h:78
@ c_DontCollectStatistics
No statistics is collected for this module.
Definition: Module.h:84
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
Definition: Module.h:82
@ c_Output
This module is an output module (writes data).
Definition: Module.h:79
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition: Module.h:83

◆ EStatus

enum EStatus
inherited

Status flag of histogram/canvas.

Enumerator
c_StatusTooFew 

Not enough entries/event to judge.

c_StatusDefault 

default for non-coloring

c_StatusGood 

Analysis result: Good.

c_StatusWarning 

Analysis result: Warning, there may be minor issues.

c_StatusError 

Analysis result: Severe issue found.

Definition at line 45 of file DQMHistAnalysis.h.

45 {
46 c_StatusTooFew = 0,
47 c_StatusDefault = 1,
48 c_StatusGood = 2,
49 c_StatusWarning = 3,
50 c_StatusError = 4
51 };
@ c_StatusDefault
default for non-coloring
@ c_StatusTooFew
Not enough entries/event to judge.
@ c_StatusError
Analysis result: Severe issue found.
@ c_StatusWarning
Analysis result: Warning, there may be minor issues.
@ c_StatusGood
Analysis result: Good.

◆ EStatusColor

enum EStatusColor
inherited

Status colors of histogram/canvas (corresponding to status)

Enumerator
c_ColorTooFew 

Not enough entries/event to judge.

c_ColorDefault 

default for non-coloring

c_ColorGood 

Analysis result: Good.

c_ColorWarning 

Analysis result: Warning, there may be minor issues.

c_ColorError 

Analysis result: Severe issue found.

Definition at line 56 of file DQMHistAnalysis.h.

56 {
57 c_ColorTooFew = kGray,
58 c_ColorDefault = kWhite,
59 c_ColorGood = kGreen,
60 c_ColorWarning = kYellow,
61 c_ColorError = kRed
62 };
@ c_ColorWarning
Analysis result: Warning, there may be minor issues.
@ c_ColorError
Analysis result: Severe issue found.
@ c_ColorTooFew
Not enough entries/event to judge.
@ c_ColorGood
Analysis result: Good.
@ c_ColorDefault
default for non-coloring

Constructor & Destructor Documentation

◆ DQMHistAnalysisKLM2Module()

Constructor.

Definition at line 27 of file DQMHistAnalysisKLM2.cc.

29 m_IsNullRun{false},
31{
32 setDescription("Module used to analyze KLM Efficiency DQM histograms (depends on tracking variables).");
33 addParam("HistogramDirectoryName", m_histogramDirectoryName, "Name of histogram directory", std::string("KLMEfficiencyDQM"));
34 addParam("RefHistogramDirectoryName", m_refHistogramDirectoryName, "Name of ref histogram directory",
35 std::string("ref/KLMEfficiencyDQM"));
36 addParam("RefHistoFile", m_refFileName, "Reference histogram file name", std::string("KLM_DQM_REF_BEAM.root"));
37 addParam("RunStopThreshold", m_stopThr, "Set stop threshold", float(0.20));
38 addParam("AlarmThreshold", m_alarmThr, "Set alarm threshold", float(0.5));
39 addParam("WarnThreshold", m_warnThr, "Set warn threshold", float(0.92));
40 addParam("Min2DEff", m_min, "2D efficiency min", float(0.5));
41 addParam("Max2DEff", m_max, "2D efficiency max", float(2));
42 addParam("RatioPlot", m_ratio, "2D efficiency ratio or difference plot ", bool(true));
43 addParam("MinEntries", m_minEntries, "Minimum entries for delta histogram update", 30000.);
44
45 m_PlaneLine.SetLineColor(kMagenta);
46 m_PlaneLine.SetLineWidth(1);
47 m_PlaneLine.SetLineStyle(2); // dashed
48 m_PlaneText.SetTextAlign(22); // centered, middle
49 m_PlaneText.SetTextColor(kMagenta);
50 m_PlaneText.SetTextFont(42); // Helvetica regular
51 m_PlaneText.SetTextSize(0.02); // 2% of TPad's full height
52}
std::string m_refFileName
2D layer-sector efficiency differences
TLine m_PlaneLine
TLine for boundary in plane histograms.
std::string m_refHistogramDirectoryName
Name of histogram directory for reference file.
float m_stopThr
efficiency ratio (run-)stop threshold
double m_minEntries
Minimal number of entries for delta histogram and PV update.
const EKLMElementNumbers * m_EklmElementNumbers
EKLM element numbers.
float m_max
efficiency ratio max z scale
float m_alarmThr
efficiency ratio alarm threshold
float m_warnThr
efficiency ratio warning threshold
std::string m_histogramDirectoryName
Name of histogram directory.
float m_min
efficiency ratio min z scale
TText m_PlaneText
TText for names in plane histograms.
bool m_ratio
show efficiency ratio or difference
bool m_IsNullRun
Run type flag for null runs.
DQMHistAnalysisModule()
Constructor / Destructor.
static const EKLMElementNumbers & Instance()
Instantiation.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560

Member Function Documentation

◆ addDeltaPar()

void addDeltaPar ( const std::string &  dirname,
const std::string &  histname,
HistDelta::EDeltaType  t,
int  p,
unsigned int  a = 1 
)
inherited

Add Delta histogram parameters.

Parameters
dirnamedirectory
histnamename of histogram
ttype of delta histogramming
pnumerical parameter depnding on type, e.g. number of entries
aamount of histograms in the past

Definition at line 79 of file DQMHistAnalysis.cc.

81{
82 std::string fullname;
83 if (dirname.size() > 0) {
84 fullname = dirname + "/" + histname;
85 } else {
86 fullname = histname;
87 }
88 s_deltaList[fullname].set(t, p, a);
89}
static DeltaList s_deltaList
The list of Delta Histograms and settings.

◆ addHist()

bool addHist ( const std::string &  dirname,
const std::string &  histname,
TH1 *  h 
)
staticinherited

Add histogram.

Parameters
dirnameThe name of the directory.
histnameThe name of the histogram.
hThe TH1 pointer for the histogram.
Returns
histogram was updated flag

Definition at line 57 of file DQMHistAnalysis.cc.

58{
59 std::string fullname;
60 if (dirname.size() > 0) {
61 fullname = dirname + "/" + histname;
62 } else {
63 fullname = histname;
64 }
65
66 if (s_histList[fullname].update(h)) {
67 // only if histogram changed, check if delta histogram update needed
68 auto it = s_deltaList.find(fullname);
69 if (it != s_deltaList.end()) {
70 B2DEBUG(20, "Found Delta" << fullname);
71 it->second.update(h); // update
72 }
73 return true; // histogram changed
74 }
75
76 return false; // histogram didnt change
77}
static HistList s_histList
The list of Histograms.

◆ beginRun()

void beginRun ( void  )
finaloverridevirtual

Called when entering a new run.

Reimplemented from Module.

Definition at line 268 of file DQMHistAnalysisKLM2.cc.

269{
270 m_IsPhysicsRun = (getRunType() == "physics");
271 m_IsNullRun = (getRunType() == "null");
272
273 double unused = NAN;
274 //ratio/diff mode should only be possible if references exist
275 if (m_refFile && m_refFile->IsOpen()) {
276 // values for LOLO, LOW & High error are used for (run-)stopThr, alarmThr and warnThr settings
277 // default values should be initially defined in input parameters?
278 double tempStop = (double) m_stopThr;
279 double tempAlarm = (double) m_alarmThr;
280 double tempWarn = (double) m_warnThr;
281 requestLimitsFromEpicsPVs("2DEffSettings", tempStop, tempAlarm, tempWarn, unused);
282
283 // Create an array of the Thresholds
284 double valuesThr[] = { tempStop, tempAlarm, tempWarn };
285
286 // Sort the array from lowest to highest
287 std::sort(std::begin(valuesThr), std::end(valuesThr));
288
289 // Assign the sorted threshold values
290 m_stopThr = (float)(valuesThr[0]); // lowest value i.e, //lolo
291 m_alarmThr = (float)(valuesThr[1]); // middle value i.e, //low
292 m_warnThr = (float)(valuesThr[2]); // highest value i.e, //high
293
294 // EPICS should catch if this happens but just in case
296 B2WARNING("DQMHistAnalysisKLM2Module: Found that alarmThr or alarmStop is greater than warnThr...");
297 }
298 }
299 m_BKLMLayerWarn = 5;
300 m_EKLMLayerWarn = 5;
301 requestLimitsFromEpicsPVs("nEffBKLMLayers", unused, unused, unused, m_BKLMLayerWarn);
302 requestLimitsFromEpicsPVs("nEffEKLMLayers", unused, unused, unused, m_EKLMLayerWarn);
303
304}
double m_EKLMLayerWarn
alarm limits from inefficient EKLM layers PV
bool m_IsPhysicsRun
Run type flag for null runs.
double m_BKLMLayerWarn
alarm limits from inefficient BKLM layers PV
TFile * m_refFile
reference histogram file
static const std::string & getRunType(void)
Get the Run Type.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.

◆ CheckEpicsError() [1/2]

void CheckEpicsError ( int  state,
const std::string &  message,
chid  id = nullptr 
)
inherited

check the return status and check PV in case of error

Parameters
statereturn state of epics function
messagemessage to print out
idthe chid of the affected PV

Definition at line 740 of file DQMHistAnalysis.cc.

741{
742 if (state != ECA_NORMAL) {
743 std::string name;
744 if (id) name = ca_name(id);
745 B2WARNING(message << ": " << name);
746 printPVStatus(id, false);
747 }
748}
void printPVStatus(chid pv, bool onlyError=true)
check the status of a PVs and report if disconnected or not found

◆ CheckEpicsError() [2/2]

void CheckEpicsError ( int  state,
const std::string &  message,
const std::string &  name 
)
inherited

check the return status and check PV in case of error

Parameters
statereturn state of epics function
messagemessage to print out
namethe (key)name of the affected PV

Definition at line 732 of file DQMHistAnalysis.cc.

733{
734 if (state != ECA_NORMAL) {
735 B2WARNING(message << ": " << name);
736 printPVStatus(m_epicsNameToChID[name], false);
737 }
738}

◆ checkPVStatus()

void checkPVStatus ( void  )
inherited

Check the status of all PVs and report if disconnected or not found.

Definition at line 696 of file DQMHistAnalysis.cc.

697{
698 B2INFO("Check PV Connections");
699
700 for (auto& it : m_epicsChID) {
701 printPVStatus(it);
702 }
703 B2INFO("Check PVs done");
704}

◆ cleanupEpicsPVs()

void cleanupEpicsPVs ( void  )
inherited

Unsubscribe from EPICS PVs on terminate.

Definition at line 577 of file DQMHistAnalysis.cc.

578{
579 // this should be called in terminate function of analysis modules
580#ifdef _BELLE2_EPICS
581 if (getUseEpics()) {
582 for (auto& it : m_epicsChID) CheckEpicsError(ca_clear_channel(it), "ca_clear_channel failure", it);
583 updateEpicsPVs(5.0);
584 // Make sure we clean up both afterwards!
585 m_epicsChID.clear();
586 m_epicsNameToChID.clear();
587 }
588#endif
589}
bool getUseEpics(void)
Getter for EPICS usage.
void CheckEpicsError(int state, const std::string &message, const std::string &name)
check the return status and check PV in case of error
int updateEpicsPVs(float timeout)
Update all EPICS PV (flush to network)

◆ clearCanvases()

void clearCanvases ( void  )
inherited

Clear content of all Canvases.

Definition at line 248 of file DQMHistAnalysis.cc.

249{
250 TIter nextckey(gROOT->GetListOfCanvases());
251 TObject* cobj = nullptr;
252
253 while ((cobj = dynamic_cast<TObject*>(nextckey()))) {
254 if (cobj->IsA()->InheritsFrom("TCanvas")) {
255 TCanvas* cnv = dynamic_cast<TCanvas*>(cobj);
256 cnv->Clear();
258 }
259 }
260}
void colorizeCanvas(TCanvas *canvas, EStatus status)
Helper function for Canvas colorization.

◆ clearHistList()

void clearHistList ( void  )
staticinherited

Clears the list of histograms.

Definition at line 276 of file DQMHistAnalysis.cc.

277{
278 s_histList.clear();
279}

◆ clearlist()

void clearlist ( void  )
inherited

Clear all static global lists.

Definition at line 49 of file DQMHistAnalysis.cc.

50{
51 s_histList.clear();
52// s_monObjList;
53 s_deltaList.clear();
54 s_canvasUpdatedList.clear();
55}
static CanvasUpdatedList s_canvasUpdatedList
The list of canvas updated status.

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

180{
182 newModule->m_moduleParamList.setParameters(getParamList());
183 newModule->setName(getName());
184 newModule->m_package = m_package;
185 newModule->m_propertyFlags = m_propertyFlags;
186 newModule->m_logConfig = m_logConfig;
187 newModule->m_conditions = m_conditions;
188
189 return newModule;
190}
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
const ModuleParamList & getParamList() const
Return module param list.
Definition: Module.h:363
const std::string & getName() const
Returns the name of the module.
Definition: Module.h:187
const std::string & getType() const
Returns the type of the module (i.e.
Definition: Module.cc:41
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
Definition: Module.h:512
LogConfig m_logConfig
The log system configuration of the module.
Definition: Module.h:514
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition: Module.h:521
std::string m_package
Package this module is found in (may be empty).
Definition: Module.h:510
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition: Module.h:43

◆ colorizeCanvas()

void colorizeCanvas ( TCanvas *  canvas,
EStatus  status 
)
inherited

Helper function for Canvas colorization.

Parameters
canvasCanvas to change
statusstatus to color

Definition at line 683 of file DQMHistAnalysis.cc.

684{
685 if (!canvas) return;
686 auto color = getStatusColor(stat);
687
688 canvas->Pad()->SetFillColor(color);
689
690 canvas->Pad()->SetFrameFillColor(10); // White (kWhite is not used since it results in transparent!)
691 canvas->Pad()->SetFrameFillStyle(1001);// White
692 canvas->Pad()->Modified();
693 canvas->Pad()->Update();
694}
EStatusColor getStatusColor(EStatus status)
Return color for canvas state.

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

426{ beginRun(); }
virtual void beginRun()
Called when entering a new run.
Definition: Module.h:147

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

439{ endRun(); }
virtual void endRun()
This method is called if the current run ends.
Definition: Module.h:166

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

432{ event(); }
virtual void event()
This method is the core of the module.
Definition: Module.h:157

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

420{ initialize(); }
virtual void initialize()
Initialize the Module.
Definition: Module.h:109

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

445{ terminate(); }
virtual void terminate()
This method is called at the end of the event processing.
Definition: Module.h:176

◆ endRun()

void endRun ( void  )
finaloverridevirtual

This method is called if the current run ends.

Reimplemented from Module.

Definition at line 306 of file DQMHistAnalysisKLM2.cc.

307{
308 std::string name;
309
310 int bklmMaxLayer = BKLMElementNumbers::getMaximalLayerNumber();//15
311 int bklmMaxSector = BKLMElementNumbers::getMaximalSectorNumber();//8
312
314 int eklmLocalMaxSector = EKLMElementNumbers::getMaximalSectorNumber();//4
316
317 // Looping over the sectors
318 for (int bin = 0; bin < m_eff_bklm_sector->GetXaxis()->GetNbins(); bin++) {
319 name = "eff_B";
320 if (bin < bklmMaxSector)
321 name += "B";
322 else
323 name += "F";
324 name += std::to_string(bin % bklmMaxSector);
325 m_monObj->setVariable(name, m_eff_bklm_sector->GetBinContent(bin + 1));
326 }
327
328 for (int bin = 0; bin < m_eff_eklm_sector->GetXaxis()->GetNbins(); bin++) {
329 name = "eff_E";
330 if (bin < eklmLocalMaxSector) //(bin < 4)
331 name += "B";
332 else
333 name += "F";
334 name += std::to_string(bin % eklmLocalMaxSector);
335 m_monObj->setVariable(name, m_eff_eklm_sector->GetBinContent(bin + 1));
336 }
337
338 // Looping over the planes
339 for (int layer = 0; layer < m_eff_bklm->GetXaxis()->GetNbins(); layer++) {
340 name = "eff_B";
341 //layer/15 < 8
342 if (layer / bklmMaxLayer < bklmMaxSector) {
343 name += "B";
344 } else {
345 name += "F";
346 }
347 name += std::to_string(int(layer / bklmMaxLayer) % bklmMaxSector) + "_layer" + std::to_string(1 + (layer % bklmMaxLayer));
348 m_monObj->setVariable(name, m_eff_bklm->GetBinContent(layer + 1));
349 }
350 for (int layer = 0; layer < m_eff_eklm->GetXaxis()->GetNbins(); layer++) {
351 name = "eff_E";
352 if (layer / eklmGlobalMaxSector < eklmBLayerCount) //(layer/8 < 12)
353 name += "B" + std::to_string(layer / eklmGlobalMaxSector + 1);
354 else
355 name += "F" + std::to_string(layer / eklmGlobalMaxSector - eklmBLayerCount + 1);
356 name += + "_num" + std::to_string(((layer) % eklmGlobalMaxSector) + 1);
357 m_monObj->setVariable(name, m_eff_eklm->GetBinContent(layer + 1));
358
359 }
360}
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
static constexpr int getMaximalSectorNumber()
Get maximal sector number (1-based).
TH1 * m_eff_bklm_sector
Histogram for BKLM sector efficiency.
TH1 * m_eff_eklm
Histogram for EKLM plane efficiency.
TH1 * m_eff_eklm_sector
Histogram for EKLM sector efficiency.
MonitoringObject * m_monObj
Monitoring object.
TH1 * m_eff_bklm
Histogram for BKLM plane efficiency.
int getMaximalDetectorLayerNumber(int section) const
Get maximal detector layer number.
static constexpr int getMaximalSectorNumber()
Get maximal sector number.
static constexpr int getMaximalSectorGlobalNumberKLMOrder()
Get maximal sector global number with KLM ordering (section, sector).
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)

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

97{
98 if (m_conditions.empty()) return false;
99
100 //okay, a condition was set for this Module...
101 if (!m_hasReturnValue) {
102 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
103 }
104
105 for (const auto& condition : m_conditions) {
106 if (condition.evaluate(m_returnValue)) {
107 return true;
108 }
109 }
110 return false;
111}
int m_returnValue
The return value.
Definition: Module.h:519
bool m_hasReturnValue
True, if the return value is set.
Definition: Module.h:518

◆ event()

void event ( void  )
finaloverridevirtual

This method is called for each event.

Reimplemented from Module.

Definition at line 567 of file DQMHistAnalysisKLM2.cc.

568{
569 /* If KLM is not included, stop here and return. */
570 TH1* daqInclusion = findHist("KLM/daq_inclusion");
571 if (not(daqInclusion == NULL)) {
572 int isKlmIncluded = daqInclusion->GetBinContent(daqInclusion->GetXaxis()->FindBin("Yes"));
573 if (isKlmIncluded == 0)
574 return;
575 }
576
577
578 /* Obtain plots necessary for efficiency plots */
579 TH1F* all_ext_bklm = (TH1F*)findHist(m_histogramDirectoryName + "/all_ext_hitsBKLM");
580 TH1F* matched_hits_bklm = (TH1F*)findHist(m_histogramDirectoryName + "/matched_hitsBKLM");
581
582 TH1F* all_ext_eklm = (TH1F*)findHist(m_histogramDirectoryName + "/all_ext_hitsEKLM");
583 TH1F* matched_hits_eklm = (TH1F*)findHist(m_histogramDirectoryName + "/matched_hitsEKLM");
584
585
586 TH1F* all_ext_bklm_sector = (TH1F*)findHist(m_histogramDirectoryName + "/all_ext_hitsBKLMSector");
587 TH1F* matched_hits_bklm_sector = (TH1F*)findHist(m_histogramDirectoryName + "/matched_hitsBKLMSector");
588
589 TH1F* all_ext_eklm_sector = (TH1F*)findHist(m_histogramDirectoryName + "/all_ext_hitsEKLMSector");
590 TH1F* matched_hits_eklm_sector = (TH1F*)findHist(m_histogramDirectoryName + "/matched_hitsEKLMSector");
591
592 /* Check if efficiency histograms exist*/
593 if ((all_ext_bklm == nullptr || matched_hits_bklm == nullptr) && (m_IsPhysicsRun)) {
594 B2INFO("Histograms needed for BKLM plane efficiency computation are not found");
595 }
596
597 if ((all_ext_eklm == nullptr || matched_hits_eklm == nullptr) && (m_IsPhysicsRun)) {
598 B2INFO("Histograms needed for EKLM plane efficiency computation are not found");
599 }
600 if ((all_ext_bklm_sector == nullptr || matched_hits_bklm_sector == nullptr) && (m_IsPhysicsRun)) {
601 B2INFO("Histograms needed for BKLM sector efficiency computation are not found");
602 }
603 if ((all_ext_eklm_sector == nullptr || matched_hits_eklm_sector == nullptr) && (m_IsPhysicsRun)) {
604 B2INFO("Histograms needed for EKLM sector efficiency computation are not found");
605 }
606
607
608 /* Draw histograms onto canvases*/
609 processEfficiencyHistogram(m_eff_bklm, all_ext_bklm, matched_hits_bklm, m_c_eff_bklm);
610 processEfficiencyHistogram(m_eff_eklm, all_ext_eklm, matched_hits_eklm, m_c_eff_eklm);
611
612 processEfficiencyHistogram(m_eff_bklm_sector, all_ext_bklm_sector, matched_hits_bklm_sector, m_c_eff_bklm_sector);
613 processEfficiencyHistogram(m_eff_eklm_sector, all_ext_eklm_sector, matched_hits_eklm_sector, m_c_eff_eklm_sector);
614
615 processPlaneHistogram("eff_bklm_plane", m_eff_bklm);
616 processPlaneHistogram("eff_eklm_plane", m_eff_eklm);
617
618 /* Make Diff 2D plots */
622
627 /* Set EPICS PV Values*/
628 B2DEBUG(20, "DQMHistAnalysisKLM2: Updating EPICS PVs");
629 // only update PVs if there's enough statistics and datasize != 0
630 // Check if it's a null run, if so, don't update EPICS PVs
631 if (m_IsNullRun) {
632 B2INFO("DQMHistAnalysisKLM2: Null run detected. No PV Update.");
633 return;
634 }
635 auto* daqDataSize = findHist("DAQ/KLMDataSize");
636 double meanDAQDataSize = 0.;
637 if (daqDataSize != nullptr) {
638 meanDAQDataSize = daqDataSize->GetMean();
639 B2INFO("DAQ/KLMDataSize's mean is " << meanDAQDataSize);
640 } else
641 B2WARNING("DQMHistAnalysisKLM2: Cannot find KLMDataSize");
642 if ((daqDataSize != nullptr) and (meanDAQDataSize != 0.)) {
643 int procesedEvents = DQMHistAnalysisModule::getEventProcessed();
644 if (procesedEvents > (int)m_minEntries) {
645 if (static_cast<int>(m_eff_bklm->GetEntries()) > (int)m_minEntries) {
646 setEpicsPV("nEffBKLMLayers", m_nEffBKLMLayers);
647 }
648 if (static_cast<int>(m_eff_eklm->GetEntries()) > (int)m_minEntries) {
649 setEpicsPV("nEffEKLMLayers", m_nEffEKLMLayers);
650 }
651 }
652 } else
653 B2INFO("DQMHistAnalysisKLM2: KLM Not included. No PV Update. ");
654
655}
static constexpr int getMaximalSectorGlobalNumber()
Get maximal sector global number.
TH1 * m_ref_efficiencies_bklm
BKLM efficiencies reference histogram.
int m_nEffEKLMLayers
Number of inefficient EKLM Layers.
TCanvas * m_c_eff2d_bklm
BKLM efficiencies ratio canvas.
TCanvas * m_c_eff2d_eklm
EKLM efficiencies ratio canvas.
void processPlaneHistogram(const std::string &histName, TH1 *histogram)
Process histogram containing the number of hits in plane.
void processEfficiencyHistogram(TH1 *effHist, TH1 *denominator, TH1 *numerator, TCanvas *canvas)
Process histogram containing the efficiencies.
TCanvas * m_c_eff_eklm_sector
Histogram for EKLM sector efficiency.
TH1 * m_ref_efficiencies_eklm
ELM efficiencies reference histogram.
void process2DEffHistogram(TH1 *mainHist, TH1 *refHist, TH2 *planeHist, TH2 *errHist, int layers, int sectors, bool ratioPlot, int *pvcount, double layerLimit, TCanvas *eff2dCanv)
Process 2D efficiency histograms.
TCanvas * m_c_eff_bklm_sector
Histogram for BKLM sector efficiency.
TH2 * m_err_bklm
BKLM efficiencies error histogram.
TH2 * m_eff2d_bklm
BKLM efficiencies 2dim histogram.
TCanvas * m_c_eff_bklm
BKLM plane efficiency canvas.
TCanvas * m_c_eff_eklm
EKLM plane efficiency canvas.
TH2 * m_err_eklm
EKLM efficiencies error histogram.
TH2 * m_eff2d_eklm
EKLM efficiencies 2dim histogram.
int m_nEffBKLMLayers
Number of inefficient BKLM layers.
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.
static int getEventProcessed(void)
Get the number of processed events.
static constexpr int getMaximalPlaneGlobalNumber()
Get maximal plane global number.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

326{
327 // to avoid confusion between std::arg and boost::python::arg we want a shorthand namespace as well
328 namespace bp = boost::python;
329
330 docstring_options options(true, true, false); //userdef, py sigs, c++ sigs
331
332 void (Module::*setReturnValueInt)(int) = &Module::setReturnValue;
333
334 enum_<Module::EAfterConditionPath>("AfterConditionPath",
335 R"(Determines execution behaviour after a conditional path has been executed:
336
337.. attribute:: END
338
339 End processing of this path after the conditional path. (this is the default for if_value() etc.)
340
341.. attribute:: CONTINUE
342
343 After the conditional path, resume execution after this module.)")
344 .value("END", Module::EAfterConditionPath::c_End)
345 .value("CONTINUE", Module::EAfterConditionPath::c_Continue)
346 ;
347
348 /* Do not change the names of >, <, ... we use them to serialize conditional pathes */
349 enum_<Belle2::ModuleCondition::EConditionOperators>("ConditionOperator")
356 ;
357
358 enum_<Module::EModulePropFlags>("ModulePropFlags",
359 R"(Flags to indicate certain low-level features of modules, see :func:`Module.set_property_flags()`, :func:`Module.has_properties()`. Most useful flags are:
360
361.. attribute:: PARALLELPROCESSINGCERTIFIED
362
363 This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)
364
365.. attribute:: HISTOGRAMMANAGER
366
367 This module is used to manage histograms accumulated by other modules
368
369.. attribute:: TERMINATEINALLPROCESSES
370
371 When using parallel processing, call this module's terminate() function in all processes. This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.
372)")
373 .value("INPUT", Module::EModulePropFlags::c_Input)
374 .value("OUTPUT", Module::EModulePropFlags::c_Output)
375 .value("PARALLELPROCESSINGCERTIFIED", Module::EModulePropFlags::c_ParallelProcessingCertified)
376 .value("HISTOGRAMMANAGER", Module::EModulePropFlags::c_HistogramManager)
377 .value("INTERNALSERIALIZER", Module::EModulePropFlags::c_InternalSerializer)
378 .value("TERMINATEINALLPROCESSES", Module::EModulePropFlags::c_TerminateInAllProcesses)
379 ;
380
381 //Python class definition
382 class_<Module, PyModule> module("Module", R"(
383Base class for Modules.
384
385A module is the smallest building block of the framework.
386A typical event processing chain consists of a Path containing
387modules. By inheriting from this base class, various types of
388modules can be created. To use a module, please refer to
389:func:`Path.add_module()`. A list of modules is available by running
390``basf2 -m`` or ``basf2 -m package``, detailed information on parameters is
391given by e.g. ``basf2 -m RootInput``.
392
393The 'Module Development' section in the manual provides detailed information
394on how to create modules, setting parameters, or using return values/conditions:
395https://xwiki.desy.de/xwiki/rest/p/f4fa4/#HModuleDevelopment
396
397)");
398 module
399 .def("__str__", &Module::getPathString)
400 .def("name", &Module::getName, return_value_policy<copy_const_reference>(),
401 "Returns the name of the module. Can be changed via :func:`set_name() <Module.set_name()>`, use :func:`type() <Module.type()>` for identifying a particular module class.")
402 .def("type", &Module::getType, return_value_policy<copy_const_reference>(),
403 "Returns the type of the module (i.e. class name minus 'Module')")
404 .def("set_name", &Module::setName, args("name"), R"(
405Set custom name, e.g. to distinguish multiple modules of the same type.
406
407>>> path.add_module('EventInfoSetter')
408>>> ro = path.add_module('RootOutput', branchNames=['EventMetaData'])
409>>> ro.set_name('RootOutput_metadata_only')
410>>> print(path)
411[EventInfoSetter -> RootOutput_metadata_only]
412
413)")
414 .def("description", &Module::getDescription, return_value_policy<copy_const_reference>(),
415 "Returns the description of this module.")
416 .def("package", &Module::getPackage, return_value_policy<copy_const_reference>(),
417 "Returns the package this module belongs to.")
418 .def("available_params", &_getParamInfoListPython,
419 "Return list of all module parameters as `ModuleParamInfo` instances")
420 .def("has_properties", &Module::hasProperties, (bp::arg("properties")),
421 R"DOCSTRING(Allows to check if the module has the given properties out of `ModulePropFlags` set.
422
423>>> if module.has_properties(ModulePropFlags.PARALLELPROCESSINGCERTIFIED):
424>>> ...
425
426Parameters:
427 properties (int): bitmask of `ModulePropFlags` to check for.
428)DOCSTRING")
429 .def("set_property_flags", &Module::setPropertyFlags, args("property_mask"),
430 "Set module properties in the form of an OR combination of `ModulePropFlags`.");
431 {
432 // python signature is too crowded, make ourselves
433 docstring_options subOptions(true, false, false); //userdef, py sigs, c++ sigs
434 module
435 .def("if_value", &Module::if_value,
436 (bp::arg("expression"), bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
437 R"DOCSTRING(if_value(expression, condition_path, after_condition_path=AfterConditionPath.END)
438
439Sets a conditional sub path which will be executed after this
440module if the return value set in the module passes the given ``expression``.
441
442Modules can define a return value (int or bool) using ``setReturnValue()``,
443which can be used in the steering file to split the Path based on this value, for example
444
445>>> module_with_condition.if_value("<1", another_path)
446
447In case the return value of the ``module_with_condition`` for a given event is
448less than 1, the execution will be diverted into ``another_path`` for this event.
449
450You could for example set a special return value if an error occurs, and divert
451the execution into a path containing :b2:mod:`RootOutput` if it is found;
452saving only the data producing/produced by the error.
453
454After a conditional path has executed, basf2 will by default stop processing
455the path for this event. This behaviour can be changed by setting the
456``after_condition_path`` argument.
457
458Parameters:
459 expression (str): Expression to determine if the conditional path should be executed.
460 This should be one of the comparison operators ``<``, ``>``, ``<=``,
461 ``>=``, ``==``, or ``!=`` followed by a numerical value for the return value
462 condition_path (Path): path to execute in case the expression is fulfilled
463 after_condition_path (AfterConditionPath): What to do once the ``condition_path`` has been executed.
464)DOCSTRING")
465 .def("if_false", &Module::if_false,
466 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
467 R"DOC(if_false(condition_path, after_condition_path=AfterConditionPath.END)
468
469Sets a conditional sub path which will be executed after this module if
470the return value of the module evaluates to False. This is equivalent to
471calling `if_value` with ``expression=\"<1\"``)DOC")
472 .def("if_true", &Module::if_true,
473 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
474 R"DOC(if_true(condition_path, after_condition_path=AfterConditionPath.END)
475
476Sets a conditional sub path which will be executed after this module if
477the return value of the module evaluates to True. It is equivalent to
478calling `if_value` with ``expression=\">=1\"``)DOC");
479 }
480 module
481 .def("has_condition", &Module::hasCondition,
482 "Return true if a conditional path has been set for this module "
483 "using `if_value`, `if_true` or `if_false`")
484 .def("get_all_condition_paths", &_getAllConditionPathsPython,
485 "Return a list of all conditional paths set for this module using "
486 "`if_value`, `if_true` or `if_false`")
487 .def("get_all_conditions", &_getAllConditionsPython,
488 "Return a list of all conditional path expressions set for this module using "
489 "`if_value`, `if_true` or `if_false`")
490 .add_property("logging", make_function(&Module::getLogConfig, return_value_policy<reference_existing_object>()),
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">"
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "=="
@ c_ST
Smaller than: "<"
Base class for Modules.
Definition: Module.h:72
LogConfig & getLogConfig()
Returns the log system configuration.
Definition: Module.h:225
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
Definition: Module.cc:79
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
Definition: Module.cc:90
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:220
void setLogConfig(const LogConfig &logConfig)
Set the log system configuration.
Definition: Module.h:230
const std::string & getDescription() const
Returns the description of the module.
Definition: Module.h:202
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
Definition: Module.cc:85
bool hasCondition() const
Returns true if at least one condition was set for the module.
Definition: Module.h:311
const std::string & getPackage() const
Returns the package this module is in.
Definition: Module.h:197
void setName(const std::string &name)
Set the name of the module.
Definition: Module.h:214
bool hasProperties(unsigned int propertyFlags) const
Returns true if all specified property flags are available in this module.
Definition: Module.cc:160
std::string getPathString() const override
return the module name.
Definition: Module.cc:192

◆ ExtractEvent()

void ExtractEvent ( std::vector< TH1 * > &  hs)
inherited

Extract event processed from daq histogram, called from input module.

Definition at line 310 of file DQMHistAnalysis.cc.

311{
313 for (size_t i = 0; i < hs.size(); i++) {
314 if (hs[i]->GetName() == std::string("DAQ/Nevent")) {
315 s_eventProcessed = hs[i]->GetEntries();
316 return;
317 }
318 }
319 B2ERROR("ExtractEvent: Histogram \"DAQ/Nevent\" missing");
320}
static int s_eventProcessed
Number of Events processed to fill histograms.

◆ ExtractRunType()

void ExtractRunType ( std::vector< TH1 * > &  hs)
inherited

Extract Run Type from histogram title, called from input module.

Definition at line 298 of file DQMHistAnalysis.cc.

299{
300 s_runType = "";
301 for (size_t i = 0; i < hs.size(); i++) {
302 if (hs[i]->GetName() == std::string("DQMInfo/rtype")) {
303 s_runType = hs[i]->GetTitle();
304 return;
305 }
306 }
307 B2ERROR("ExtractRunType: Histogram \"DQMInfo/rtype\" missing");
308}
static std::string s_runType
The Run type.

◆ findCanvas()

TCanvas * findCanvas ( TString  cname)
inherited

Find canvas by name.

Parameters
cnameName of the canvas
Returns
The pointer to the canvas, or nullptr if not found.

Definition at line 130 of file DQMHistAnalysis.cc.

131{
132 TIter nextkey(gROOT->GetListOfCanvases());
133 TObject* obj{};
134
135 while ((obj = dynamic_cast<TObject*>(nextkey()))) {
136 if (obj->IsA()->InheritsFrom("TCanvas")) {
137 if (obj->GetName() == canvas_name)
138 return dynamic_cast<TCanvas*>(obj);
139 }
140 }
141 return nullptr;
142}

◆ findHist() [1/2]

TH1 * findHist ( const std::string &  dirname,
const std::string &  histname,
bool  onlyIfUpdated = false 
)
staticinherited

Find histogram.

Parameters
dirnameThe name of the directory.
histnameThe name of the histogram.
onlyIfUpdatedreq only updated hists, return nullptr otherwise
Returns
The found histogram, or nullptr if not found.

Definition at line 158 of file DQMHistAnalysis.cc.

159{
160 if (dirname.size() > 0) {
161 return findHist(dirname + "/" + histname, updated);
162 }
163 return findHist(histname, updated);
164}

◆ findHist() [2/2]

TH1 * findHist ( const std::string &  histname,
bool  onlyIfUpdated = false 
)
staticinherited

Get histogram from list (no other search).

Parameters
histnameThe name of the histogram (incl dir).
onlyIfUpdatedreq only updated hists, return nullptr otherwise
Returns
The found histogram, or nullptr if not found.

Definition at line 144 of file DQMHistAnalysis.cc.

145{
146 if (s_histList.find(histname) != s_histList.end()) {
147 if (was_updated && !s_histList[histname].isUpdated()) return nullptr;
148 if (s_histList[histname].getHist()) {
149 return s_histList[histname].getHist();
150 } else {
151 B2ERROR("Histogram " << histname << " in histogram list but nullptr.");
152 }
153 }
154 B2INFO("Histogram " << histname << " not in list.");
155 return nullptr;
156}

◆ findHistInCanvas()

TH1 * findHistInCanvas ( const std::string &  hname,
TCanvas **  canvas = nullptr 
)
inherited

Find histogram in corresponding canvas.

Parameters
hnameName of the histogram (dir+name)
canvasptr to specific canvas ptr or nullptr
Returns
The pointer to the histogram, or nullptr if not found.

Definition at line 166 of file DQMHistAnalysis.cc.

167{
168
169 TCanvas* cnv = nullptr;
170 // try to get canvas from outside
171 if (cobj) cnv = *cobj;
172 // if no canvas search for it
173 if (cnv == nullptr) {
174 // parse the dir+histo name and create the corresponding canvas name
175 auto s = StringSplit(histo_name, '/');
176 if (s.size() != 2) {
177 B2ERROR("findHistInCanvas: histoname not valid (missing dir?), should be 'dirname/histname': " << histo_name);
178 return nullptr;
179 }
180 auto dirname = s.at(0);
181 auto hname = s.at(1);
182 std::string canvas_name = dirname + "/c_" + hname;
183 cnv = findCanvas(canvas_name);
184 // set canvas pointer for outside
185 if (cnv && cobj) *cobj = cnv;
186 }
187
188 // get histogram pointer
189 if (cnv != nullptr) {
190 TIter nextkey(cnv->GetListOfPrimitives());
191 TObject* obj{};
192 while ((obj = dynamic_cast<TObject*>(nextkey()))) {
193 if (obj->IsA()->InheritsFrom("TH1")) {
194 if (obj->GetName() == histo_name)
195 return dynamic_cast<TH1*>(obj);
196 }
197 }
198 }
199 return nullptr;
200}
TCanvas * findCanvas(TString cname)
Find canvas by name.
std::vector< std::string > StringSplit(const std::string &s, const char delim)
Helper function for string token split.

◆ findHistInFile()

TH1 * findHistInFile ( TFile *  file,
const std::string &  histname 
)
staticinherited

Find histogram in specific TFile (e.g.

ref file).

Parameters
fileThe TFile to search.
histnameThe name of the histogram, can incl directory
Returns
The found histogram, or nullptr if not found.

Definition at line 202 of file DQMHistAnalysis.cc.

203{
204 // find histogram by name in file, histname CAN contain directory!
205 // will return nullptr if file is zeroptr, not found or not correct type
206 if (file && file->IsOpen()) {
207 auto obj = file->Get(histname.data());
208 if (obj != nullptr) {
209 // check class type
210 if (obj->IsA()->InheritsFrom("TH1")) {
211 B2DEBUG(20, "Histogram " << histname << " found in file");
212 return dynamic_cast<TH1*>(obj);
213 } else {
214 B2INFO("Found Object " << histname << " in file is not a histogram");
215 }
216 } else {
217 B2INFO("Histogram " << histname << " not found in file");
218 }
219 }
220 return nullptr;
221}

◆ findMonitoringObject()

MonitoringObject * findMonitoringObject ( const std::string &  objName)
staticinherited

Find MonitoringObject.

Parameters
objNameThe name of the MonitoringObject.
Returns
The found MonitoringObject, or nullptr if not found.

Definition at line 223 of file DQMHistAnalysis.cc.

224{
225 if (s_monObjList.find(objName) != s_monObjList.end()) {
226 return &s_monObjList[objName];
227 }
228 B2INFO("MonitoringObject " << objName << " not in memfile.");
229 return NULL;
230}
static MonObjList s_monObjList
The list of MonitoringObjects.

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

134{
135 if (m_conditions.empty()) return EAfterConditionPath::c_End;
136
137 //okay, a condition was set for this Module...
138 if (!m_hasReturnValue) {
139 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
140 }
141
142 for (const auto& condition : m_conditions) {
143 if (condition.evaluate(m_returnValue)) {
144 return condition.getAfterConditionPath();
145 }
146 }
147
148 return EAfterConditionPath::c_End;
149}

◆ getAllConditionPaths()

std::vector< std::shared_ptr< Path > > getAllConditionPaths ( ) const
inherited

Return all condition paths currently set (no matter if the condition is true or not).

Definition at line 150 of file Module.cc.

151{
152 std::vector<std::shared_ptr<Path>> allConditionPaths;
153 for (const auto& condition : m_conditions) {
154 allConditionPaths.push_back(condition.getPath());
155 }
156
157 return allConditionPaths;
158}

◆ getAllConditions()

const std::vector< ModuleCondition > & getAllConditions ( ) const
inlineinherited

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCanvasUpdatedList()

static const CanvasUpdatedList & getCanvasUpdatedList ( )
inlinestaticinherited

Get the list of the canvas update status.

Returns
The list of the canvases.

Definition at line 181 of file DQMHistAnalysis.h.

181{ return s_canvasUpdatedList;};

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

Return a pointer to the first condition (or nullptr, if none was set)

Definition at line 314 of file Module.h.

315 {
316 if (m_conditions.empty()) {
317 return nullptr;
318 } else {
319 return &m_conditions.front();
320 }
321 }

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).


Definition at line 113 of file Module.cc.

114{
115 PathPtr p;
116 if (m_conditions.empty()) return p;
117
118 //okay, a condition was set for this Module...
119 if (!m_hasReturnValue) {
120 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
121 }
122
123 for (const auto& condition : m_conditions) {
124 if (condition.evaluate(m_returnValue)) {
125 return condition.getPath();
126 }
127 }
128
129 // if none of the conditions were true, return a null pointer.
130 return p;
131}
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:35

◆ getDelta() [1/2]

TH1 * getDelta ( const std::string &  dirname,
const std::string &  histname,
int  n = 0,
bool  onlyIfUpdated = true 
)
inherited

Get Delta histogram.

Parameters
dirnamedirectory
histnamename of histogram
nindex of delta histogram, 0 is most recent one
onlyIfUpdatedreq only updated deltas, return nullptr otherwise
Returns
delta histogram or nullptr

Definition at line 102 of file DQMHistAnalysis.cc.

103{
104 std::string fullname;
105 if (dirname.size() > 0) {
106 fullname = dirname + "/" + histname;
107 } else {
108 fullname = histname;
109 }
110 return getDelta(fullname, n, onlyIfUpdated);
111}
TH1 * getDelta(const std::string &fullname, int n=0, bool onlyIfUpdated=true)
Get Delta histogram.

◆ getDelta() [2/2]

TH1 * getDelta ( const std::string &  fullname,
int  n = 0,
bool  onlyIfUpdated = true 
)
inherited

Get Delta histogram.

Parameters
fullnamedirectory+name of histogram
nindex of delta histogram, 0 is most recent one
onlyIfUpdatedreq only updated deltas, return nullptr otherwise
Returns
delta histogram or nullptr

Definition at line 113 of file DQMHistAnalysis.cc.

114{
115 auto it = s_deltaList.find(fullname);
116 if (it != s_deltaList.end()) {
117 return it->second.getDelta(n, onlyIfUpdated);
118 }
119 B2WARNING("Delta hist " << fullname << " not found");
120 return nullptr;
121}

◆ getDeltaList()

static const DeltaList & getDeltaList ( )
inlinestaticinherited

Get the list of the delta histograms.

Returns
The list of the delta histograms.

Definition at line 175 of file DQMHistAnalysis.h.

175{ return s_deltaList;};

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

202{return m_description;}
std::string m_description
The description of the module.
Definition: Module.h:511

◆ getEpicsPV() [1/2]

double getEpicsPV ( int  index)
inherited

Read value from a EPICS PV.

Parameters
indexindex of PV
Returns
value or NAN if not existing

Definition at line 463 of file DQMHistAnalysis.cc.

464{
465 double value{NAN};
466 if (!m_useEpics) return value;
467#ifdef _BELLE2_EPICS
468 if (index < 0 || index >= (int)m_epicsChID.size()) {
469 B2ERROR("Epics PV with " << index << " not registered!");
470 return value;
471 }
472 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value cant be assumed to be stable
473 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
474 // outstanding get requests are not automatically reissued following reconnect.
475 auto r = ca_get(DBR_DOUBLE, m_epicsChID[index], (void*)&value);
476 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
477 if (r == ECA_NORMAL) {
478 return value;
479 } else {
480 CheckEpicsError(r, "Read PV failed in ca_get or ca_pend_io failure", m_epicsChID[index]);
481 }
482#endif
483 return NAN;
484}
static bool m_useEpics
Flag if to use EPICS do not set by yourself, use EpicsEnable module to set.

◆ getEpicsPV() [2/2]

double getEpicsPV ( std::string  keyname)
inherited

Read value from a EPICS PV.

Parameters
keynamekey name (or full PV name) of PV
Returns
value or NAN if not existing

Definition at line 440 of file DQMHistAnalysis.cc.

441{
442 double value{NAN};
443 if (!m_useEpics) return value;
444#ifdef _BELLE2_EPICS
445 if (m_epicsNameToChID[keyname] == nullptr) {
446 B2ERROR("Epics PV " << keyname << " not registered!");
447 return value;
448 }
449 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value cant be assumed to be stable
450 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
451 // outstanding get requests are not automatically reissued following reconnect.
452 auto r = ca_get(DBR_DOUBLE, m_epicsNameToChID[keyname], (void*)&value);
453 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
454 if (r == ECA_NORMAL) {
455 return value;
456 } else {
457 CheckEpicsError(r, "Read PV failed in ca_get or ca_pend_io failure", keyname);
458 }
459#endif
460 return NAN;
461}

◆ getEpicsPVChID() [1/2]

chid getEpicsPVChID ( int  index)
inherited

Get EPICS PV Channel Id.

Parameters
indexindex of PV
Returns
Channel ID is written on success, otherwise nullptr

Definition at line 550 of file DQMHistAnalysis.cc.

551{
552#ifdef _BELLE2_EPICS
553 if (m_useEpics) {
554 if (index >= 0 && index < (int)m_epicsChID.size()) {
555 return m_epicsChID[index];
556 } else {
557 B2ERROR("Epics PV with " << index << " not registered!");
558 }
559 }
560#endif
561 return nullptr;
562}

◆ getEpicsPVChID() [2/2]

chid getEpicsPVChID ( std::string  keyname)
inherited

Get EPICS PV Channel Id.

Parameters
keynamekey name (or full PV name) of PV
Returns
Channel ID is written on success, otherwise nullptr

Definition at line 536 of file DQMHistAnalysis.cc.

537{
538#ifdef _BELLE2_EPICS
539 if (m_useEpics) {
540 if (m_epicsNameToChID[keyname] != nullptr) {
541 return m_epicsNameToChID[keyname];
542 } else {
543 B2ERROR("Epics PV " << keyname << " not registered!");
544 }
545 }
546#endif
547 return nullptr;
548}

◆ getEpicsStringPV() [1/2]

std::string getEpicsStringPV ( int  index,
bool &  status 
)
inherited

Read value from a EPICS PV.

Parameters
indexindex of PV
statusreturn status (true on success)
Returns
string value (empty string if non existing)

Definition at line 511 of file DQMHistAnalysis.cc.

512{
513 status = false;
514 char value[40] = "";
515 if (!m_useEpics) return std::string(value);
516#ifdef _BELLE2_EPICS
517 if (index < 0 || index >= (int)m_epicsChID.size()) {
518 B2ERROR("Epics PV with " << index << " not registered!");
519 return std::string(value);
520 }
521 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value cant be assumed to be stable
522 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
523 // outstanding get requests are not automatically reissued following reconnect.
524 auto r = ca_get(DBR_DOUBLE, m_epicsChID[index], value);
525 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
526 if (r == ECA_NORMAL) {
527 status = true;
528 return std::string(value);
529 } else {
530 CheckEpicsError(r, "Read PV (string) failed in ca_get or ca_pend_io failure", m_epicsChID[index]);
531 }
532#endif
533 return std::string(value);
534}

◆ getEpicsStringPV() [2/2]

std::string getEpicsStringPV ( std::string  keyname,
bool &  status 
)
inherited

Read value from a EPICS PV.

Parameters
keynamekey name (or full PV name) of PV
statusreturn status (true on success)
Returns
string value (empty string if non existing)

Definition at line 486 of file DQMHistAnalysis.cc.

487{
488 status = false;
489 char value[40] = "";
490 if (!m_useEpics) return std::string(value);
491#ifdef _BELLE2_EPICS
492 if (m_epicsNameToChID[keyname] == nullptr) {
493 B2ERROR("Epics PV " << keyname << " not registered!");
494 return std::string(value);
495 }
496 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value cant be assumed to be stable
497 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
498 // outstanding get requests are not automatically reissued following reconnect.
499 auto r = ca_get(DBR_STRING, m_epicsNameToChID[keyname], value);
500 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
501 if (r == ECA_NORMAL) {
502 status = true;
503 return std::string(value);
504 } else {
505 CheckEpicsError(r, "Read PV (string) failed in ca_get or ca_pend_io failure", keyname);
506 }
507#endif
508 return std::string(value);
509}

◆ getEventProcessed()

static int getEventProcessed ( void  )
inlinestaticinherited

Get the number of processed events.

(Attention, asynch histogram updates!)

Returns
Processed events.

Definition at line 193 of file DQMHistAnalysis.h.

193{ return s_eventProcessed;};

◆ getFileNames()

virtual std::vector< std::string > getFileNames ( bool  outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootInputModule, StorageRootOutputModule, and RootOutputModule.

Definition at line 134 of file Module.h.

135 {
136 return std::vector<std::string>();
137 }

◆ getHistList()

static HistList & getHistList ( )
inlinestaticinherited

Get the list of the histograms.

Returns
The list of the histograms.

Definition at line 163 of file DQMHistAnalysis.h.

163{ return s_histList;};

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

std::list< ModulePtr > getModules ( ) const
inlineoverrideprivatevirtualinherited

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

506{ return std::list<ModulePtr>(); }

◆ getMonitoringObject()

MonitoringObject * getMonitoringObject ( const std::string &  name)
staticinherited

Get MonitoringObject with given name (new object is created if non-existing)

Parameters
namename of MonitoringObject to get
Returns
The MonitoringObject

Definition at line 123 of file DQMHistAnalysis.cc.

124{
125 auto obj = &s_monObjList[objName];
126 obj->SetName(objName.c_str());
127 return obj;
128}

◆ getMonObjList()

static MonObjList & getMonObjList ( )
inlinestaticinherited

Get the list of MonitoringObjects.

Returns
The list of the MonitoringObjects.

Definition at line 169 of file DQMHistAnalysis.h.

169{ return s_monObjList;};

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 187 of file Module.h.

187{return m_name;}
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition: Module.h:508

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

280{
282}
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition: Module.h:516

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

193{
194
195 std::string output = getName();
196
197 for (const auto& condition : m_conditions) {
198 output += condition.getString();
199 }
200
201 return output;
202}

◆ getPVPrefix()

std::string & getPVPrefix ( void  )
inlineinherited

get global Prefix for EPICS PVs

Returns
prefix in use

Definition at line 539 of file DQMHistAnalysis.h.

539{return m_PVPrefix;};
static std::string m_PVPrefix
The Prefix for EPICS PVs.

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getRunType()

static const std::string & getRunType ( void  )
inlinestaticinherited

Get the Run Type.

Returns
Run type string.

Definition at line 187 of file DQMHistAnalysis.h.

187{ return s_runType;};

◆ getSigma68()

double getSigma68 ( TH1 *  h) const
inherited

Helper function to compute half of the central interval covering 68% of a distribution.

This quantity is an alternative to the standard deviation.

Parameters
hhistogram
Returns
Half of the central interval covering 68% of a distribution.

Definition at line 232 of file DQMHistAnalysis.cc.

233{
234 double probs[2] = {0.16, 1 - 0.16};
235 double quant[2] = {0, 0};
236 h->GetQuantiles(2, quant, probs);
237 const double sigma68 = (-quant[0] + quant[1]) / 2;
238 return sigma68;
239}

◆ getStatusColor()

DQMHistAnalysisModule::EStatusColor getStatusColor ( EStatus  status)
inherited

Return color for canvas state.

Parameters
statuscanvas status
Returns
alarm color

Definition at line 656 of file DQMHistAnalysis.cc.

657{
658 // white color is the default, if no colorize
660 switch (stat) {
661 case c_StatusTooFew:
662 color = c_ColorTooFew; // Magenta or Gray
663 break;
664 case c_StatusDefault:
665 color = c_ColorDefault; // default no colors
666 break;
667 case c_StatusGood:
668 color = c_ColorGood; // Good
669 break;
670 case c_StatusWarning:
671 color = c_ColorWarning; // Warning
672 break;
673 case c_StatusError:
674 color = c_ColorError; // Severe
675 break;
676 default:
677 color = c_ColorDefault; // default no colors
678 break;
679 }
680 return color;
681}
EStatusColor
Status colors of histogram/canvas (corresponding to status)

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

42{
43 if (m_type.empty())
44 B2FATAL("Module type not set for " << getName());
45 return m_type;
46}
std::string m_type
The type of the module, saved as a string.
Definition: Module.h:509

◆ getUseEpics()

bool getUseEpics ( void  )
inlineinherited

Getter for EPICS usage.

Returns
flag is in use

Definition at line 522 of file DQMHistAnalysis.h.

522{return m_useEpics;};

◆ getUseEpicsReadOnly()

bool getUseEpicsReadOnly ( void  )
inlineinherited

Getter EPICS flag in read only mode.

Returns
flag if read only

Definition at line 528 of file DQMHistAnalysis.h.

528{return m_epicsReadOnly;};
static bool m_epicsReadOnly
Flag if to use EPICS in ReadOnly mode (for reading limits) do not set by yourself,...

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

Returns true if at least one condition was set for the module.

Definition at line 311 of file Module.h.

311{ return not m_conditions.empty(); };

◆ hasDeltaPar()

bool hasDeltaPar ( const std::string &  dirname,
const std::string &  histname 
)
inherited

Check if Delta histogram parameters exist for histogram.

Parameters
dirnamedirectory
histnamename of histogram
Returns
true if parameters have been set already

Definition at line 91 of file DQMHistAnalysis.cc.

92{
93 std::string fullname;
94 if (dirname.size() > 0) {
95 fullname = dirname + "/" + histname;
96 } else {
97 fullname = histname;
98 }
99 return s_deltaList.find(fullname) != s_deltaList.end(); // contains() if we switch to C++20
100}

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

161{
162 return (propertyFlags & m_propertyFlags) == propertyFlags;
163}

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

Return true if this module has a valid return value set.

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.

Definition at line 166 of file Module.cc.

167{
169 std::string allMissing = "";
170 for (const auto& s : missing)
171 allMissing += s + " ";
172 if (!missing.empty())
173 B2ERROR("The following required parameters of Module '" << getName() << "' were not specified: " << allMissing <<
174 "\nPlease add them to your steering file.");
175 return !missing.empty();
176}
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.

◆ if_false()

void if_false ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

86{
87 if_value("<1", path, afterConditionPath);
88}

◆ if_true()

void if_true ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

91{
92 if_value(">=1", path, afterConditionPath);
93}

◆ if_value()

void if_value ( const std::string &  expression,
const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://xwiki.desy.de/xwiki/rest/p/a94f2 or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

80{
81 m_conditions.emplace_back(expression, path, afterConditionPath);
82}

◆ initHistListBeforeEvent()

void initHistListBeforeEvent ( void  )
staticinherited

Reset the list of histograms.

Definition at line 262 of file DQMHistAnalysis.cc.

263{
264 for (auto& it : s_histList) {
265 // attention, we must use reference, otherwise we work on a copy
266 it.second.resetBeforeEvent();
267 }
268 for (auto& it : s_deltaList) {
269 // attention, we must use reference, otherwise we work on a copy
270 it.second.setNotUpdated();
271 }
272
273 s_canvasUpdatedList.clear();
274}

◆ initialize()

void initialize ( void  )
finaloverridevirtual

Initializer.

Reimplemented from Module.

Definition at line 56 of file DQMHistAnalysisKLM2.cc.

57{
59
60 //register EPICS PVs
61 registerEpicsPV("KLM:Eff:nEffBKLMLayers", "nEffBKLMLayers");
62 registerEpicsPV("KLM:Eff:nEffEKLMLayers", "nEffEKLMLayers");
63 registerEpicsPV("KLM:Eff:2DEffSettings", "2DEffSettings");
64
65 if (m_refFileName != "") {
66 m_refFile = TFile::Open(m_refFileName.data(), "READ");
67 }
68
69 // Get Reference Histograms
70 if (m_refFile && m_refFile->IsOpen()) {
71 B2INFO("DQMHistAnalysisKLM2: reference root file (" << m_refFileName << ") FOUND, able to read ref histograms");
72
73 m_ref_efficiencies_bklm = (TH1F*)m_refFile->Get((m_refHistogramDirectoryName + "/eff_bklm_plane").data());
74 if (m_ref_efficiencies_bklm != nullptr) {
75 B2INFO("DQMHistAnalysisKLM2: eff_bklm_plane histogram was found in reference");
76 m_ref_efficiencies_bklm->SetLineColor(2);
77 m_ref_efficiencies_bklm->SetOption("HIST");
78 m_ref_efficiencies_bklm->SetStats(false);
79 } else {
80 B2WARNING("DQMHistAnalysisKLM2: eff_bklm_plane histogram not found in reference");
81 m_ref_efficiencies_bklm = new TH1F("eff_bklm_plane", "Plane Efficiency in BKLM", BKLMElementNumbers::getMaximalLayerGlobalNumber(),
83 for (int lay_id = 0; lay_id < BKLMElementNumbers::getMaximalLayerGlobalNumber(); lay_id++) {
84 if (m_ratio) {
85 m_ref_efficiencies_bklm->SetBinContent(lay_id + 1, 1);
86 } else {
87 m_ref_efficiencies_bklm->SetBinContent(lay_id + 1, 0);
88 }
89 }
90 }
91
92
93 m_ref_efficiencies_eklm = (TH1F*)m_refFile->Get((m_refHistogramDirectoryName + "/eff_eklm_plane").data());
94 if (m_ref_efficiencies_eklm != nullptr) {
95 B2INFO("DQMHistAnalysisKLM2: eff_eklm_plane histogram was found in reference");
96 m_ref_efficiencies_eklm->SetLineColor(2);
97 m_ref_efficiencies_eklm->SetOption("HIST");
98 m_ref_efficiencies_eklm->SetStats(false);
99 } else {
100 B2WARNING("DQMHistAnalysisKLM2: eff_eklm_plane histogram not found in reference");
101 m_ref_efficiencies_eklm = new TH1F("eff_eklm_plane", "Plane Efficiency in EKLM", EKLMElementNumbers::getMaximalPlaneGlobalNumber(),
103 for (int lay_id = 0; lay_id < EKLMElementNumbers::getMaximalPlaneGlobalNumber(); lay_id++) {
104 if (m_ratio) {
105 m_ref_efficiencies_eklm->SetBinContent(lay_id + 1, 1);
106 } else {
107 m_ref_efficiencies_eklm->SetBinContent(lay_id + 1, 0);
108 }
109 }
110 }
111 } else {
112 B2WARNING("DQMHistAnalysisKLM2: reference root file (" << m_refFileName << ") not found, or closed");
113
114 // Switch to absolute 2D efficiencies if reference histogram is not found
115 m_stopThr = 0.0;
116 m_alarmThr = 0.35;
117 m_warnThr = 0.5; //contigency value to still spot some problems
118 m_ref_efficiencies_bklm = new TH1F("eff_bklm_plane", "Plane Efficiency in BKLM", BKLMElementNumbers::getMaximalLayerGlobalNumber(),
120 for (int lay_id = 0; lay_id < BKLMElementNumbers::getMaximalLayerGlobalNumber(); lay_id++) {
121 if (m_ratio) {
122 m_ref_efficiencies_bklm->SetBinContent(lay_id + 1, 1);
123 } else {
124 m_ref_efficiencies_bklm->SetBinContent(lay_id + 1, 0);
125 }
126 }
127
128 m_ref_efficiencies_eklm = new TH1F("eff_eklm_plane", "Plane Efficiency in EKLM", EKLMElementNumbers::getMaximalPlaneGlobalNumber(),
130 for (int lay_id = 0; lay_id < EKLMElementNumbers::getMaximalPlaneGlobalNumber(); lay_id++) {
131 if (m_ratio) {
132 m_ref_efficiencies_eklm->SetBinContent(lay_id + 1, 1);
133 } else {
134 m_ref_efficiencies_eklm->SetBinContent(lay_id + 1, 0);
135 }
136 }
137
138 }
139 gROOT->cd();
140 m_c_eff_bklm = new TCanvas((m_histogramDirectoryName + "/c_eff_bklm_plane").data());
141 m_c_eff_eklm = new TCanvas((m_histogramDirectoryName + "/c_eff_eklm_plane").data());
142 m_c_eff_bklm_sector = new TCanvas((m_histogramDirectoryName + "/c_eff_bklm_sector").data());
143 m_c_eff_eklm_sector = new TCanvas((m_histogramDirectoryName + "/c_eff_eklm_sector").data());
144
145 m_c_eff2d_bklm = new TCanvas((m_histogramDirectoryName + "/c_eff2d_bklm").data());
146 m_c_eff2d_eklm = new TCanvas((m_histogramDirectoryName + "/c_eff2d_eklm").data());
147
148 m_eff_bklm = new TH1F((m_histogramDirectoryName + "/eff_bklm_plane").data(),
149 "Plane Efficiency in BKLM",
151 m_eff_bklm->GetXaxis()->SetTitle("Layer number");
152 m_eff_bklm->SetStats(false);
153 m_eff_bklm->SetOption("HIST");
154
155 m_eff_eklm = new TH1F((m_histogramDirectoryName + "/eff_eklm_plane").data(),
156 "Plane Efficiency in EKLM",
158 m_eff_eklm->GetXaxis()->SetTitle("Plane number");
159 m_eff_eklm->SetStats(false);
160 m_eff_eklm->SetOption("HIST");
161
162 m_eff_bklm_sector = new TH1F((m_histogramDirectoryName + "/eff_bklm_sector").data(),
163 "Sector Efficiency in BKLM",
165 m_eff_bklm_sector->GetXaxis()->SetTitle("Sector number");
166 m_eff_bklm_sector->SetStats(false);
167 m_eff_bklm_sector->SetOption("HIST");
168
169 m_eff_eklm_sector = new TH1F((m_histogramDirectoryName + "/eff_eklm_sector").data(),
170 "Sector Efficiency in EKLM",
172 m_eff_eklm_sector->GetXaxis()->SetTitle("Sector number");
173 m_eff_eklm_sector->SetStats(false);
174 m_eff_eklm_sector->SetOption("HIST");
175
176 /* register plots for delta histogramming */
177 // all ext hits
178 addDeltaPar(m_histogramDirectoryName, "all_ext_hitsBKLM", HistDelta::c_Entries, m_minEntries, 1);
179 addDeltaPar(m_histogramDirectoryName, "all_ext_hitsEKLM", HistDelta::c_Entries, m_minEntries, 1);
180 addDeltaPar(m_histogramDirectoryName, "all_ext_hitsBKLMSector", HistDelta::c_Entries, m_minEntries, 1);
181 addDeltaPar(m_histogramDirectoryName, "all_ext_hitsEKLMSector", HistDelta::c_Entries, m_minEntries, 1);
182
183 // matched hits
184 addDeltaPar(m_histogramDirectoryName, "matched_hitsBKLM", HistDelta::c_Entries, m_minEntries, 1);
185 addDeltaPar(m_histogramDirectoryName, "matched_hitsEKLM", HistDelta::c_Entries, m_minEntries, 1);
186 addDeltaPar(m_histogramDirectoryName, "matched_hitsBKLMSector", HistDelta::c_Entries, m_minEntries, 1);
187 addDeltaPar(m_histogramDirectoryName, "matched_hitsEKLMSector", HistDelta::c_Entries, m_minEntries, 1);
188
189 // 2D Efficiency Histograms
190 TString eff2d_hist_bklm_title;
191 TString eff2d_hist_eklm_title;
192 if (m_ratio) {
193 eff2d_hist_bklm_title = "Plane Efficiency Ratios in BKLM";
194 eff2d_hist_eklm_title = "Plane Efficiency Ratios in EKLM";
195 } else {
196 eff2d_hist_bklm_title = "Plane Efficiency Diffs in BKLM";
197 eff2d_hist_eklm_title = "Plane Efficiency Diffs in EKLM";
198 }
199
200 // BKLM
201 m_eff2d_bklm = new TH2F((m_histogramDirectoryName + "/eff2d_bklm_sector").data(), eff2d_hist_bklm_title,
204 m_eff2d_bklm->GetXaxis()->SetTitle("Sector");
205 m_eff2d_bklm->GetYaxis()->SetTitle("Layer");
206 m_eff2d_bklm->SetStats(false);
207
208 m_err_bklm = new TH2F((m_histogramDirectoryName + "/err_bklm_sector").data(), eff2d_hist_bklm_title,
211 m_err_bklm->GetXaxis()->SetTitle("Sector");
212 m_err_bklm->GetYaxis()->SetTitle("Layer");
213 m_err_bklm->SetStats(false);
214
215 for (int sec_id = 0; sec_id < BKLMElementNumbers::getMaximalSectorNumber(); sec_id++) {
216 std::string BB_sec = "BB" + std::to_string(sec_id);
217 m_eff2d_bklm->GetXaxis()->SetBinLabel(sec_id + 1, BB_sec.c_str());
218
219 std::string BF_sec = "BF" + std::to_string(sec_id);
220 m_eff2d_bklm->GetXaxis()->SetBinLabel(BKLMElementNumbers::getMaximalSectorNumber() + sec_id + 1, BF_sec.c_str());
221 }
222
223 for (int lay_id = 0; lay_id < BKLMElementNumbers::getMaximalLayerNumber(); lay_id++) {
224 std::string B_lay = std::to_string(lay_id);
225 m_eff2d_bklm->GetYaxis()->SetBinLabel(lay_id + 1, B_lay.c_str());
226 }
227
228 // EKLM
230
231 m_eff2d_eklm = new TH2F((m_histogramDirectoryName + "/eff2d_eklm_sector").data(), eff2d_hist_eklm_title,
232 n_sectors_eklm, 0.5, n_sectors_eklm + 0.5,
234 m_eff2d_eklm->GetXaxis()->SetTitle("Layer");
235 m_eff2d_eklm->GetYaxis()->SetTitle("Sector");
236 m_eff2d_eklm->SetStats(false);
237
238 m_err_eklm = new TH2F((m_histogramDirectoryName + "/err_eklm_sector").data(), eff2d_hist_eklm_title,
239 n_sectors_eklm, 0.5, n_sectors_eklm + 0.5,
241 m_err_eklm->GetXaxis()->SetTitle("Layer");
242 m_err_eklm->GetYaxis()->SetTitle("Sector");
243 m_err_eklm->SetStats(false);
244
245 std::string name;
246 const double maximalLayer = EKLMElementNumbers::getMaximalLayerGlobalNumber();
247 for (int layerGlobal = 1; layerGlobal <= maximalLayer; ++layerGlobal) {
248 int section, layer;
250 layerGlobal, &section, &layer);
252 name = "B";
253 else
254 name = "F";
255 name += std::to_string(layer);
256 m_eff2d_eklm->GetXaxis()->SetBinLabel(layerGlobal, name.c_str());
257 }
258
259 for (int lay_id = 0; lay_id < EKLMElementNumbers::getMaximalSectorGlobalNumberKLMOrder(); lay_id++) {
260 std::string E_lay = std::to_string(lay_id);
261 m_eff2d_eklm->GetYaxis()->SetBinLabel(lay_id + 1, E_lay.c_str());
262 }
263
264
265}
static constexpr int getMaximalLayerGlobalNumber()
Get maximal layer global number.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
void addDeltaPar(const std::string &dirname, const std::string &histname, HistDelta::EDeltaType t, int p, unsigned int a=1)
Add Delta histogram parameters.
int registerEpicsPV(std::string pvname, std::string keyname="")
EPICS related Functions.
static constexpr int getMaximalLayerGlobalNumber()
Get maximal detector layer global number.
void layerNumberToElementNumbers(int layerGlobal, int *section, int *layer) const
Get element numbers by detector layer global number.

◆ makeStatus()

DQMHistAnalysisModule::EStatus makeStatus ( bool  enough,
bool  warn_flag,
bool  error_flag 
)
inherited

Helper function to judge the status for coloring and EPICS.

Parameters
enoughenough events for judging
warn_flagoutside of expected range
error_flagoutside of warning range
Returns
the status

Definition at line 638 of file DQMHistAnalysis.cc.

639{
640 // white color is the default, if no colorize
641 if (!enough) {
642 return (c_StatusTooFew);
643 } else {
644 if (error_flag) {
645 return (c_StatusError);
646 } else if (warn_flag) {
647 return (c_StatusWarning);
648 } else {
649 return (c_StatusGood);
650 }
651 }
652
653 return (c_StatusDefault); // default, but should not be reached
654}

◆ printPVStatus()

void printPVStatus ( chid  pv,
bool  onlyError = true 
)
inherited

check the status of a PVs and report if disconnected or not found

Parameters
pvthe chid of the PV to check
onlyErrorprint only if in error condition (default)

Definition at line 706 of file DQMHistAnalysis.cc.

707{
708 if (pv == nullptr) {
709 B2WARNING("PV chid was nullptr");
710 return;
711 }
712 auto state = ca_state(pv);
713 switch (state) {
714 case cs_never_conn: /* valid chid, server not found or unavailable */
715 B2WARNING("Channel never connected " << ca_name(pv));
716 break;
717 case cs_prev_conn: /* valid chid, previously connected to server */
718 B2WARNING("Channel was connected, but now is not " << ca_name(pv));
719 break;
720 case cs_closed: /* channel deleted by user */
721 B2WARNING("Channel deleted already " << ca_name(pv));
722 break;
723 case cs_conn: /* valid chid, connected to server */
724 if (!onlyError) B2INFO("Channel connected and OK " << ca_name(pv));
725 break;
726 default:
727 B2WARNING("Undefined status for channel " << ca_name(pv));
728 break;
729 }
730}

◆ process2DEffHistogram()

void process2DEffHistogram ( TH1 *  mainHist,
TH1 *  refHist,
TH2 *  planeHist,
TH2 *  errHist,
int  layers,
int  sectors,
bool  ratioPlot,
int *  pvcount,
double  layerLimit,
TCanvas *  eff2dCanv 
)
private

Process 2D efficiency histograms.

Definition at line 453 of file DQMHistAnalysisKLM2.cc.

456{
457
458 int i = 0;
459 float mainEff;
460 float refEff;
461 float mainErr;
462 float refErr;
463 float maxVal = m_max;
464 float minVal = m_min;
465 float alarmThr = m_alarmThr;
466 float warnThr = m_warnThr;
467 float stopThr = m_stopThr;
468 float eff2dVal;
469 bool setAlarm = false;
470 bool setWarn = false;
471 bool setFew = false;
472 int mainEntries;
473
474 errHist->Reset(); // Reset histogram
475
476 *pvcount = 0; //initialize to zero
477 mainEntries = mainHist->GetEntries();
478
479 for (int binx = 0; binx < sectors; binx++) {
480
481 for (int biny = 0; biny < layers; biny++) {
482
483 mainEff = mainHist->GetBinContent(i + 1);
484 mainErr = mainHist->GetBinError(i + 1);
485 if (refHist) {
486 refEff = refHist->GetBinContent(i + 1);
487 refErr = refHist->GetBinError(i + 1);
488 } else {
489 refEff = 0.;
490 refErr = 0.;
491 }
492
493 if ((mainEff == 0.) and (refEff == 0.)) {
494 // empty histograms, draw blank bin
495 eff2dHist->SetBinContent(binx + 1, biny + 1, 0.);
496 } else if ((refEff == 0.) and (ratioPlot)) {
497 // no reference, set maximum value
498 eff2dHist->SetBinContent(binx + 1, biny + 1, maxVal);
499 } else if (mainEff == 0.) {
500 // no data, set zero
501 eff2dHist->SetBinContent(binx + 1, biny + 1, 0.);
502 errHist->SetBinContent(binx + 1, biny + 1, 0.);
503 } else {
504
505 if (ratioPlot) {
506 eff2dVal = mainEff / refEff;
507 if (eff2dVal < alarmThr) {errHist->SetBinContent(binx + 1, biny + 1, eff2dVal);}
508 } else {
509 eff2dVal = (mainEff - refEff) / pow(pow(mainErr, 2) + pow(refErr, 2), 0.5);
510 }
511
512 // main histogram
513 if ((eff2dVal > minVal) and (eff2dVal < maxVal)) {
514 // value within display window
515 eff2dHist->SetBinContent(binx + 1, biny + 1, eff2dVal);
516 } else if (eff2dVal > maxVal) {
517 // value above display window
518 eff2dHist->SetBinContent(binx + 1, biny + 1, maxVal);
519 } else if (eff2dVal < minVal) {
520 // value below display window
521 eff2dHist->SetBinContent(binx + 1, biny + 1, minVal);
522 }
523
524 // set alarm
525 if (mainEntries < (int)m_minEntries) {
526 setFew = true;
527 } else {
528 if (eff2dVal < warnThr) {
529 *pvcount += 1;
530 if ((eff2dVal <= alarmThr) && (eff2dVal >= stopThr)) {
531 setWarn = true;
532 } else if (eff2dVal < stopThr) {
533 setAlarm = true;
534 }
535 }
536 }
537
538 }
539 i++;
540 }//end of bin y
541
542 }//end of bin x
543
544 if (*pvcount > (int) layerLimit) {
545 setAlarm = true;
546 }
547
548 eff2dHist->SetMinimum(minVal);
549 eff2dHist->SetMaximum(maxVal);
550
551 eff2dCanv->cd();
552 eff2dHist->Draw("COLZ");
553 errHist->Draw("TEXT SAME");
554 if (setFew) {
555 colorizeCanvas(eff2dCanv, c_StatusTooFew);
556 } else if (setAlarm) {
557 colorizeCanvas(eff2dCanv, c_StatusError);
558 } else if (setWarn) {
560 } else {
561 colorizeCanvas(eff2dCanv, c_StatusGood);
562 }
563 eff2dCanv->Modified();
564 eff2dCanv->Update();
565}

◆ processEfficiencyHistogram()

void processEfficiencyHistogram ( TH1 *  effHist,
TH1 *  denominator,
TH1 *  numerator,
TCanvas *  canvas 
)
private

Process histogram containing the efficiencies.

Parameters
[in]effHistHistogram itself.
[in]denominatorDenominator for efficiency hist.
[in]numeratorNumerator for efficiency hist.
[in]canvasCanvas of interest.

Definition at line 362 of file DQMHistAnalysisKLM2.cc.

363{
364 effHist->Reset();
365 std::unique_ptr<TH1> effClone(static_cast<TH1*>
366 (effHist->Clone())); // Clone effHist, will be useful for delta plots & Smart pointer will mange memory leak
367 canvas->cd();
368 if (denominator != nullptr && numerator != nullptr) {
369 effHist->Divide(numerator, denominator, 1, 1, "B");
370 effHist->Draw();
371 canvas->Modified();
372 canvas->Update();
373
374 /* delta component */
375 auto deltaDenom = getDelta("", denominator->GetName());
376 auto deltaNumer = getDelta("", numerator->GetName());
377
378 // both histograms should have the same update condition but checking both should be okay?
379 // if this condition is not satisfied, does it cause the above to not ever update?
380 // after test campaign, switch condition back to (deltaNumer != nullptr && deltaDenom != nullptr)
381 UpdateCanvas(canvas->GetName(), (effHist != nullptr));
382 if ((deltaNumer != nullptr) && (deltaDenom != nullptr)) {
383 B2INFO("DQMHistAnalysisKLM2: Eff Delta Num/Denom Entries is " << deltaNumer->GetEntries() << "/" << deltaDenom->GetEntries());
384 effClone->Divide(deltaNumer, deltaDenom, 1, 1, "B");
385 effClone->SetLineColor(kOrange);
386 effClone->DrawCopy("SAME"); // managed by ROOT, so it helpes in plotting even if obj deleted by smart pointer
387 canvas->Modified();
388 canvas->Update();
389 }
390 }
391}
void UpdateCanvas(std::string name, bool updated=true)
Mark canvas as updated (or not)

◆ processPlaneHistogram()

void processPlaneHistogram ( const std::string &  histName,
TH1 *  histogram 
)
private

Process histogram containing the number of hits in plane.

Parameters
[in]histNameHistogram name.
[in]histogramHistogram itself.

Definition at line 393 of file DQMHistAnalysisKLM2.cc.

395{
396 std::string name;
397 TCanvas* canvas = findCanvas(m_histogramDirectoryName + "/c_" + histName);
398 if (canvas == NULL) {
399 B2WARNING("KLMDQM2 histogram canvas " + m_histogramDirectoryName + "/c_" << histName << " is not found.");
400 return;
401 } else {
402 canvas->cd();
403 histogram->SetStats(false);
404 double histMin = gPad->GetUymin();
405 double histMax = gPad->GetUymax();
406 double histRange = histMax - histMin;
407 if (histName.find("bklm") != std::string::npos) {
408 /* First draw the vertical lines and the sector names. */
409 const int maximalLayer = BKLMElementNumbers::getMaximalLayerNumber();
410 for (int sector = 0; sector < BKLMElementNumbers::getMaximalSectorGlobalNumber(); ++sector) {
411 int bin = maximalLayer * sector + 1;
412 double xLine = histogram->GetXaxis()->GetBinLowEdge(bin);
413 double xText = histogram->GetXaxis()->GetBinLowEdge(bin + maximalLayer / 2);
414 double yText = histMin + 0.98 * histRange;
415 if (sector > 0)
416 m_PlaneLine.DrawLine(xLine, histMin, xLine, histMin + histRange);
417 name = "B";
419 name += "B";
420 else
421 name += "F";
422 name += std::to_string(sector % BKLMElementNumbers::getMaximalSectorNumber());
423 m_PlaneText.DrawText(xText, yText, name.c_str());
424 }
425
426 } else {
427 /* First draw the vertical lines and the sector names. */
428 const double maximalLayer = EKLMElementNumbers::getMaximalLayerGlobalNumber();
430 for (int layerGlobal = 1; layerGlobal <= maximalLayer; ++layerGlobal) {
431 int bin = maxPlane * layerGlobal + 1;
432 double xLine = histogram->GetXaxis()->GetBinLowEdge(bin);
433 double xText = histogram->GetXaxis()->GetBinLowEdge(bin - maxPlane / 2);
434 double yText = histMin + 0.98 * histRange;
435 if (layerGlobal < maximalLayer)
436 m_PlaneLine.DrawLine(xLine, histMin, xLine, histMin + histRange);
437 int section, layer;
439 layerGlobal, &section, &layer);
441 name = "B";
442 else
443 name = "F";
444 name += std::to_string(layer);
445 m_PlaneText.DrawText(xText, yText, name.c_str());
446 }
447 }
448 canvas->Modified();
449 canvas->Update();
450 }
451}
static constexpr int getMaximalPlaneNumber()
Get maximal plane number.

◆ registerEpicsPV()

int registerEpicsPV ( std::string  pvname,
std::string  keyname = "" 
)
inherited

EPICS related Functions.

Register a PV with its name and a key name

Parameters
pvnamefull PV name
keynamekey name for easier access
Returns
an index which can be used to access the PV instead of key name, -1 if failure

Definition at line 322 of file DQMHistAnalysis.cc.

323{
324 return registerEpicsPVwithPrefix(m_PVPrefix, pvname, keyname);
325}
int registerEpicsPVwithPrefix(std::string prefix, std::string pvname, std::string keyname="")
Register a PV with its name and a key name.

◆ registerEpicsPVwithPrefix()

int registerEpicsPVwithPrefix ( std::string  prefix,
std::string  pvname,
std::string  keyname = "" 
)
privateinherited

Register a PV with its name and a key name.

Parameters
prefixprefix to PV name
pvnamefull PV name without prefix
keynamekey name for easier access
Returns
an index which can be used to access the PV instead of key name, -1 if failure

Definition at line 332 of file DQMHistAnalysis.cc.

333{
334 if (!m_useEpics) return -1;
335#ifdef _BELLE2_EPICS
336 if (m_epicsNameToChID[pvname] != nullptr) {
337 B2ERROR("Epics PV " << pvname << " already registered!");
338 return -1;
339 }
340 if (keyname != "" && m_epicsNameToChID[keyname] != nullptr) {
341 B2ERROR("Epics PV with key " << keyname << " already registered!");
342 return -1;
343 }
344
345 m_epicsChID.emplace_back();
346 auto ptr = &m_epicsChID.back();
347 if (!ca_current_context()) SEVCHK(ca_context_create(ca_disable_preemptive_callback), "ca_context_create");
348 // the subscribed name includes the prefix, the map below does *not*
349 CheckEpicsError(ca_create_channel((prefix + pvname).data(), NULL, NULL, 10, ptr), "ca_create_channel failure", pvname);
350
351 m_epicsNameToChID[pvname] = *ptr;
352 if (keyname != "") m_epicsNameToChID[keyname] = *ptr;
353 return m_epicsChID.size() - 1; // return index to last added item
354#else
355 return -1;
356#endif
357}

◆ registerExternalEpicsPV()

int registerExternalEpicsPV ( std::string  pvname,
std::string  keyname = "" 
)
inherited

Register a PV with its name and a key name.

Parameters
pvnamefull PV name
keynamekey name for easier access
Returns
an index which can be used to access the PV instead of key name, -1 if failure

Definition at line 327 of file DQMHistAnalysis.cc.

328{
329 return registerEpicsPVwithPrefix(std::string(""), pvname, keyname);
330}

◆ requestLimitsFromEpicsPVs() [1/3]

bool requestLimitsFromEpicsPVs ( chid  id,
double &  lowerAlarm,
double &  lowerWarn,
double &  upperWarn,
double &  upperAlarm 
)
inherited

Get Alarm Limits from EPICS PV.

Parameters
idChannel ID
&lowerAlarmreturn low Alarm limit (lolo) if set, not changed otherwise
&lowerWarnreturn low Warning limit (low) if set, not changed otherwise
&upperWarnreturn upper Warning limit (high) if set, not changed otherwise
&upperAlarmreturn upper Alarm limit (hihi) if set, not changed otherwise
Returns
true if limits could be read (even if there are none set)

Definition at line 603 of file DQMHistAnalysis.cc.

605{
606 // get warn and error limit only if pv exists
607 // overwrite only if limit is defined (not NaN)
608 // user should initilize with NaN before calling, unless
609 // some "default" values should be set otherwise
610 if (pv != nullptr) {
611 struct dbr_ctrl_double tPvData;
612 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value cant be assumed to be stable
613 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
614 // outstanding get requests are not automatically reissued following reconnect.
615 auto r = ca_get(DBR_CTRL_DOUBLE, pv, &tPvData);
616 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
617 if (r == ECA_NORMAL) {
618 if (!std::isnan(tPvData.lower_alarm_limit)) {
619 lowerAlarm = tPvData.lower_alarm_limit;
620 }
621 if (!std::isnan(tPvData.lower_warning_limit)) {
622 lowerWarn = tPvData.lower_warning_limit;
623 }
624 if (!std::isnan(tPvData.upper_warning_limit)) {
625 upperWarn = tPvData.upper_warning_limit;
626 }
627 if (!std::isnan(tPvData.upper_alarm_limit)) {
628 upperAlarm = tPvData.upper_alarm_limit;
629 }
630 return true;
631 } else {
632 CheckEpicsError(r, "Reading PV Limits failed in ca_get or ca_pend_io failure", pv);
633 }
634 }
635 return false;
636}

◆ requestLimitsFromEpicsPVs() [2/3]

bool requestLimitsFromEpicsPVs ( int  index,
double &  lowerAlarm,
double &  lowerWarn,
double &  upperWarn,
double &  upperAlarm 
)
inherited

Get Alarm Limits from EPICS PV.

Parameters
indexindex of PV
&lowerAlarmreturn low Alarm limit (lolo) if set, not changed otherwise
&lowerWarnreturn low Warning limit (low) if set, not changed otherwise
&upperWarnreturn upper Warning limit (high) if set, not changed otherwise
&upperAlarmreturn upper Alarm limit (hihi) if set, not changed otherwise
Returns
true if limits could be read (even if there are none set)

Definition at line 597 of file DQMHistAnalysis.cc.

599{
600 return requestLimitsFromEpicsPVs(getEpicsPVChID(index), lowerAlarm, lowerWarn, upperWarn, upperAlarm);
601}
chid getEpicsPVChID(std::string keyname)
Get EPICS PV Channel Id.

◆ requestLimitsFromEpicsPVs() [3/3]

bool requestLimitsFromEpicsPVs ( std::string  keyname,
double &  lowerAlarm,
double &  lowerWarn,
double &  upperWarn,
double &  upperAlarm 
)
inherited

Get Alarm Limits from EPICS PV.

Parameters
keynamekey name (or full PV name) of PV
&lowerAlarmreturn low Alarm limit (lolo) if set, not changed otherwise
&lowerWarnreturn low Warning limit (low) if set, not changed otherwise
&upperWarnreturn upper Warning limit (high) if set, not changed otherwise
&upperAlarmreturn upper Alarm limit (hihi) if set, not changed otherwise
Returns
true if limits could be read (even if there are none set)

Definition at line 591 of file DQMHistAnalysis.cc.

593{
594 return requestLimitsFromEpicsPVs(getEpicsPVChID(name), lowerAlarm, lowerWarn, upperWarn, upperAlarm);
595}

◆ resetDeltaList()

void resetDeltaList ( void  )
inherited

Reset Delta.

Definition at line 281 of file DQMHistAnalysis.cc.

282{
283 for (auto& d : s_deltaList) {
284 d.second.reset();
285 }
286}

◆ setAbortLevel()

void setAbortLevel ( int  abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

68{
69 m_logConfig.setAbortLevel(static_cast<LogConfig::ELogLevel>(abortLevel));
70}
ELogLevel
Definition of the supported log levels.
Definition: LogConfig.h:26
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition: LogConfig.h:112

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

62{
63 m_logConfig.setDebugLevel(debugLevel);
64}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition: LogConfig.h:98

◆ setDescription()

void setDescription ( const std::string &  description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}

◆ setEpicsPV() [1/4]

void setEpicsPV ( int  index,
double  value 
)
inherited

Write value to a EPICS PV.

Parameters
indexindex of PV
valuevalue to write

Definition at line 401 of file DQMHistAnalysis.cc.

402{
403 if (!m_useEpics || m_epicsReadOnly) return;
404#ifdef _BELLE2_EPICS
405 if (index < 0 || index >= (int)m_epicsChID.size()) {
406 B2ERROR("Epics PV with " << index << " not registered!");
407 return;
408 }
409 CheckEpicsError(ca_put(DBR_DOUBLE, m_epicsChID[index], (void*)&value), "ca_set failure", m_epicsChID[index]);
410#endif
411}

◆ setEpicsPV() [2/4]

void setEpicsPV ( int  index,
int  value 
)
inherited

Write value to a EPICS PV.

Parameters
indexindex of PV
valuevalue to write

Definition at line 413 of file DQMHistAnalysis.cc.

414{
415 if (!m_useEpics || m_epicsReadOnly) return;
416#ifdef _BELLE2_EPICS
417 if (index < 0 || index >= (int)m_epicsChID.size()) {
418 B2ERROR("Epics PV with " << index << " not registered!");
419 return;
420 }
421 CheckEpicsError(ca_put(DBR_SHORT, m_epicsChID[index], (void*)&value), "ca_set failure", m_epicsChID[index]);
422#endif
423}

◆ setEpicsPV() [3/4]

void setEpicsPV ( std::string  keyname,
double  value 
)
inherited

Write value to a EPICS PV.

Parameters
keynamekey name (or full PV name) of PV
valuevalue to write

Definition at line 359 of file DQMHistAnalysis.cc.

360{
361 if (!m_useEpics || m_epicsReadOnly) return;
362#ifdef _BELLE2_EPICS
363 if (m_epicsNameToChID[keyname] == nullptr) {
364 B2ERROR("Epics PV " << keyname << " not registered!");
365 return;
366 }
367 CheckEpicsError(ca_put(DBR_DOUBLE, m_epicsNameToChID[keyname], (void*)&value), "ca_set failure", keyname);
368#endif
369}

◆ setEpicsPV() [4/4]

void setEpicsPV ( std::string  keyname,
int  value 
)
inherited

Write value to a EPICS PV.

Parameters
keynamekey name (or full PV name) of PV
valuevalue to write

Definition at line 371 of file DQMHistAnalysis.cc.

372{
373 if (!m_useEpics || m_epicsReadOnly) return;
374#ifdef _BELLE2_EPICS
375 if (m_epicsNameToChID[keyname] == nullptr) {
376 B2ERROR("Epics PV " << keyname << " not registered!");
377 return;
378 }
379 CheckEpicsError(ca_put(DBR_SHORT, m_epicsNameToChID[keyname], (void*)&value), "ca_set failure", keyname);
380#endif
381}

◆ setEpicsStringPV() [1/2]

void setEpicsStringPV ( int  index,
std::string  value 
)
inherited

Write string to a EPICS PV.

Parameters
indexindex of PV
valuestring to write

Definition at line 425 of file DQMHistAnalysis.cc.

426{
427 if (!m_useEpics || m_epicsReadOnly) return;
428#ifdef _BELLE2_EPICS
429 if (index < 0 || index >= (int)m_epicsChID.size()) {
430 B2ERROR("Epics PV with " << index << " not registered!");
431 return;
432 }
433 char text[41];
434 strncpy(text, value.c_str(), 40);
435 text[40] = 0;
436 CheckEpicsError(ca_put(DBR_STRING, m_epicsChID[index], text), "ca_set failure", m_epicsChID[index]);
437#endif
438}

◆ setEpicsStringPV() [2/2]

void setEpicsStringPV ( std::string  keyname,
std::string  value 
)
inherited

Write string to a EPICS PV.

Parameters
keynamekey name (or full PV name) of PV
valuestring to write

Definition at line 383 of file DQMHistAnalysis.cc.

384{
385 if (!m_useEpics || m_epicsReadOnly) return;
386#ifdef _BELLE2_EPICS
387 if (m_epicsNameToChID[keyname] == nullptr) {
388 B2ERROR("Epics PV " << keyname << " not registered!");
389 return;
390 }
391 if (value.length() > 40) {
392 B2ERROR("Epics string PV " << keyname << " too long (>40 characters)!");
393 return;
394 }
395 char text[40];
396 strcpy(text, value.c_str());
397 CheckEpicsError(ca_put(DBR_STRING, m_epicsNameToChID[keyname], text), "ca_set failure", keyname);
398#endif
399}

◆ setEventProcessed()

void setEventProcessed ( int  e)
inlineinherited

Set the number of processed events.

(Attention, asynch histogram updates!)

e Processed events.

Definition at line 205 of file DQMHistAnalysis.h.

205{s_eventProcessed = e;};

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

74{
75 m_logConfig.setLogInfo(static_cast<LogConfig::ELogLevel>(logLevel), logInfo);
76}
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition: LogConfig.h:127

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

56{
57 m_logConfig.setLogLevel(static_cast<LogConfig::ELogLevel>(logLevel));
58}
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition: LogConfig.cc:25

◆ setName()

void setName ( const std::string &  name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

void setParamPython ( const std::string &  name,
const boost::python::object &  pyObj 
)
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

235{
236 LogSystem& logSystem = LogSystem::Instance();
237 logSystem.updateModule(&(getLogConfig()), getName());
238 try {
240 } catch (std::runtime_error& e) {
241 throw std::runtime_error("Cannot set parameter '" + name + "' for module '"
242 + m_name + "': " + e.what());
243 }
244
245 logSystem.updateModule(nullptr);
246}
Class for logging debug, info and error messages.
Definition: LogSystem.h:46
void updateModule(const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
Sets the log configuration to the given module log configuration and sets the module name This method...
Definition: LogSystem.h:191
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:31
void setParamPython(const std::string &name, const PythonObject &pyObj)
Implements a method for setting boost::python objects.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict &  dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

250{
251
252 LogSystem& logSystem = LogSystem::Instance();
253 logSystem.updateModule(&(getLogConfig()), getName());
254
255 boost::python::list dictKeys = dictionary.keys();
256 int nKey = boost::python::len(dictKeys);
257
258 //Loop over all keys in the dictionary
259 for (int iKey = 0; iKey < nKey; ++iKey) {
260 boost::python::object currKey = dictKeys[iKey];
261 boost::python::extract<std::string> keyProxy(currKey);
262
263 if (keyProxy.check()) {
264 const boost::python::object& currValue = dictionary[currKey];
265 setParamPython(keyProxy, currValue);
266 } else {
267 B2ERROR("Setting the module parameters from a python dictionary: invalid key in dictionary!");
268 }
269 }
270
271 logSystem.updateModule(nullptr);
272}
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
Definition: Module.cc:234

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setPVPrefix()

void setPVPrefix ( std::string &  prefix)
inlineinherited

set global Prefix for EPICS PVs

Parameters
prefixPrefix to set

Definition at line 545 of file DQMHistAnalysis.h.

545{ m_PVPrefix = prefix;};

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

228{
229 m_hasReturnValue = true;
230 m_returnValue = value;
231}

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

221{
222 m_hasReturnValue = true;
223 m_returnValue = value;
224}

◆ setRunType()

void setRunType ( std::string &  t)
inlineinherited

Set the Run Type.

t Run type string.

Definition at line 199 of file DQMHistAnalysis.h.

199{s_runType = t;};

◆ setType()

void setType ( const std::string &  type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.

49{
50 if (!m_type.empty())
51 B2FATAL("Trying to change module type from " << m_type << " is not allowed, the value is assumed to be fixed.");
52 m_type = type;
53}

◆ setUseEpics()

void setUseEpics ( bool  flag)
inlineinherited

Setter for EPICS usage.

Parameters
flagset in use

Definition at line 510 of file DQMHistAnalysis.h.

510{m_useEpics = flag;};

◆ setUseEpicsReadOnly()

void setUseEpicsReadOnly ( bool  flag)
inlineinherited

Setter EPICS flag in read only mode.

Parameters
flagset read only

Definition at line 516 of file DQMHistAnalysis.h.

516{m_epicsReadOnly = flag;};

◆ StringSplit()

std::vector< std::string > StringSplit ( const std::string &  s,
const char  delim 
)
inherited

Helper function for string token split.

Parameters
sString to split
delimdelimiter
Returns
vector of strings

Definition at line 241 of file DQMHistAnalysis.cc.

242{
243 std::vector <std::string> out;
244 boost::split(out, in, [delim](char c) {return c == delim;});
245 return out;
246}

◆ terminate()

virtual void terminate ( void  )
inlinevirtualinherited

This method is called at the end of the event processing.

This method is called only once after the event processing finished. Use this method for cleaning up, closing files, etc.

This method can be implemented by subclasses.

Reimplemented in ARICHBackgroundModule, BeamabortModule, BgoModule, CaveModule, ClawModule, CLAWSModule, DosiModule, FANGSModule, He3tubeModule, MicrotpcModule, Ph1bpipeModule, Ph1sustrModule, PindiodeModule, PlumeModule, QcsmonitorModule, SrsensorModule, GetEventFromSocketModule, CalibrationCollectorModule, CosmicsAlignmentValidationModule, CurlTaggerModule, EventKinematicsModule, FlavorTaggerInfoFillerModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, ParticleKinematicFitterModule, ParticleLoaderModule, ParticleMassHypothesesUpdaterModule, ParticleMassUpdaterModule, ParticleMCDecayStringModule, ParticleMomentumUpdaterModule, ParticleStatsModule, ParticleWeightingLookUpCreatorModule, RemoveParticlesNotInListsModule, SkimFilterModule, TreeFitterModule, VariablesToEventBasedTreeModule, VariablesToHistogramModule, VariablesToNtupleModule, arichBtestModule, ARICHNtupleModule, arichToNtupleModule, B2BIIMCParticlesMonitorModule, B2BIIConvertMdstModule, B2BIIFixMdstModule, B2BIIMdstInputModule, BelleMCOutputModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BGOverlayInputModule, AnalysisPhase1StudyModule, NtuplePhase1_v6Module, ReprocessorModule, BeamabortStudyModule, BeamDigitizerModule, BgoDigitizerModule, BgoStudyModule, ClawDigitizerModule, ClawStudyModule, ClawsDigitizerModule, ClawsStudyModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DosiDigitizerModule, DosiStudyModule, FANGSDigitizerModule, FANGSStudyModule, He3DigitizerModule, He3tubeStudyModule, MicrotpcStudyModule, TpcDigitizerModule, PinDigitizerModule, PindiodeStudyModule, PlumeDigitizerModule, QcsmonitorDigitizerModule, QcsmonitorStudyModule, CDCCosmicAnalysisModule, CDCCrossTalkAdderModule, CDCCRTestModule, CDCDedxCorrectionModule, CDCDedxDQMModule, CDCDedxPIDModule, CDCDedxScanModule, CDCDedxSkimModule, CDCDedxSkimCDSTModule, CDCDedxValidationModule, CDCDigitizerModule, cdcDQM7Module, CDCDQMModule, ScanCDCGeoModule, CDCInitialT0DeterminationModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, HitLevelInfoWriterModule, DAQPerfModule, RxSocketModule, TxSocketModule, DqmHistoManagerModule, MonitorDataModule, TrackAnaModule, Ds2SampleModule, ReceiveEventModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, ElapsedTimeModule, DeSerializerModule, DeSerializerPXDModule, GenRawSendModule, Root2RawModule, SerializerModule, CertifyParallelModule, Ds2RawModule, Ds2RbufModule, EvReductionModule, FastRbuf2DsModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, Ds2RawFileModule, PartialSeqRootReaderModule, SeqRootMergerModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, DisplayModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, ECLBackgroundModule, ECLChargedPIDModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLClusterPSDModule, ECLCompressBGOverlayModule, ECLCovarianceMatrixModule, ECLCRFinderModule, EclCovMatrixNtupleModule, ECLDataAnalysisModule, ECLDigiStudyModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMModule, ECLDQMEXTENDEDModule, ECLFillCellIdMappingModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLOMModule, ECLMatchingPerformanceExpertModule, ECLPackerModule, ECLShowerCalibratorModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLTrackClusterMatchingModule, ECLTrackClusterMatchingParametrizationExpertModule, ECLTrackClusterMatchingPerformanceModule, ECLTRGInformationModule, ECLTrimShowersAndDigitsModule, ECLUnpackerModule, eclWaveformCalibCollectorModule, ECLWaveformFitModule, HistoModule, MergeDataStoreModule, SubEventModule, SwitchDataStoreModule, ProgressBarModule, RandomBarrierModule, HistoManagerModule, ProfileModule, RootInputModule, RootOutputModule, SeqRootInputModule, SeqRootOutputModule, AsyncWrapper, RxModule, TxModule, ZMQRxOutputModule, ZMQRxWorkerModule, ZMQTxInputModule, ZMQTxWorkerModule, AafhInputModule, BabayagaNLOInputModule, BBBremInputModule, BHWideInputModule, CRYInputModule, EvtGenDecayModule, FragmentationModule, HepMCInputModule, HepMCOutputModule, GeneratedVertexDisplacerModule, GeneratorPreselectionModule, HepevtOutputModule, OverrideGenerationFlagsModule, RemoveMCParticlesModule, KKGenInputModule, KoralWInputModule, PhokharaInputModule, TeeggInputModule, TrepsInputModule, GeometryModule, SoftwareTriggerModule, SoftwareTriggerResultPrinterModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, EKLMDataCheckerModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDQMModule, KLMDQM2Module, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMUnpackerModule, MasterClassModule, MVAExpertModule, MVAMultipleExpertsModule, AWESOMEBasicModule, PXDBackgroundModule, PXDClustersFromTracksModule, PXDPerformanceModule, PXDSpacePointCreatorModule, CheckErrorEventModule, Convert2RawDetModule, Root2BinaryModule, DataWriterModule, ECLExpertModule, KLMExpertModule, KlongValidationModule, KLMMuonIDDNNExpertModule, PIDNtupleModule, VXDDedxPIDModule, FullSimModule, FullSimTimingModule, SVDBackgroundModule, SVDChannelMappingModule, SVDHotStripFinderModule, SVDChargeSharingAnalysisModule, SVDClusterQualityEstimatorCalibrationModule, SVDClusterQualityEstimatorModule, SVDCrossTalkFinderModule, svdDumpModule, SVDPackerModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDEventT0PerformanceTTreeModule, SVDMaxStripTTreeModule, SVDPerformanceTTreeModule, SVDShaperDigitsFromTracksModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVD3SamplesEmulatorModule, SVDDigitizerModule, SVDTriggerQualityGeneratorModule, SVDSpacePointCreatorModule, SVDSpacePointQICalibrationModule, TOPAlignerModule, TOPBackgroundModule, TOPBunchFinderModule, TOPChannelT0CalibratorModule, TOPChannelT0MCModule, TOPCommonT0CalibratorModule, TOPCosmicT0FinderModule, TOPTriggerDigitizerModule, TOPDoublePulseGeneratorModule, TOPGainEfficiencyCalculatorModule, TOPLaserHitSelectorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPLLScannerModule, TOPMCTrackMakerModule, TOPModuleT0CalibratorModule, TOPNtupleModule, TOPPackerModule, TOPPDFCheckerModule, TOPRawDigitConverterModule, TOPRingPlotterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPXTalkChargeShareSetterModule, ExtModule, GenfitVisModule, BeamSpotMonitorModule, KinkFinderModule, Chi2MCTrackMatcherModule, MCV0MatcherModule, MCTrackCandClassifierModule, MuidModule, ROIReadTestModule, SVDROIFinderAnalysisDataModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, CurlingTrackCandSplitterModule, GFTC2SPTCConverterModule, PhaseSpaceAnalysisModule, RT2SPTCConverterModule, SpacePoint2TrueHitConnectorModule, SpacePointCreatorTestModule, SPTC2GFTCConverterModule, SPTCRefereeModule, TCConvertersTestModule, StandardTrackingPerformanceModule, TrackFilterModule, CollectorTestModule, StudyMaterialEffectsModule, EffPlotsModule, FillTrackFitNtupleModule, HitXPModule, TrackingPerformanceEvaluationModule, V0findingPerformanceEvaluationModule, TrackQETrainingDataCollectorModule, V0FinderModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, TrackFinderVXDAnalizerModule, VXDQETrainingDataCollectorModule, FastBDTClassifierAnalyzerModule, FastBDTClassifierTrainingModule, MLSegmentNetworkProducerModule, NoKickCutsEvalModule, SegmentNetworkAnalyzerModule, SPTC2RTConverterModule, VXDTFTrainingDataCollectorModule, FindletModule< AFindlet >, FindletModule< HitBasedT0Extractor >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFindlet >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< FacetCreator >, FindletModule< HitReclaimer >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinder >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerHoughETFModule, CDCTrigger2DFinderModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDataModule, CDCTriggerNeuroIDHistModule, CDCTriggerTSFFirmwareModule, CDCTriggerTSFModule, TRGCDCModule, TRGCDCETFUnpackerModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSFUnpackerModule, TRGCDCTSStreamModule, CDCTriggerUnpackerModule, MCMatcherTRGECLModule, TRGECLFAMModule, TRGECLModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLModule, TRGEFFDQMModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLSummaryModule, TRGGDLUnpackerModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLDQMModule, GRLNeuroModule, GRLNeuroTrainerModule, TRGGRLUnpackerModule, KLMTriggerModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TRGRAWDATAModule, VXDMisalignmentModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEventT0EfficiencyModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisHLTModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPeakModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTrackingAbortModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistAutoCanvasModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistReferenceModule, DQMHistSnapshotsModule, PyModule, PXDBgTupleProducerModule, PXDMCBgTupleProducerModule, PXDDQMEfficiencyNtupleModule, PXDDQMEfficiencyNtupleSelftrackModule, PXDDQMTrackRawNtupleModule, PXDPackerErrModule, PXDPackerModule, PXDReadRawBonnDAQModule, PXDReadRawBonnDAQMatchedModule, PXDReadRawONSENModule, PXDUnpackerModule, PXDUnpackerOldModule, PXDUnpackerOTModule, SVDDQMClustersOnTrackModule, SVDDQMExpressRecoModule, PXDROIFinderAnalysisModule, ROISenderModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisRunNrModule, DQMHistAnalysisTRGModule, DQMHistOutputToEPICSModule, and ROIDQMModule.

Definition at line 176 of file Module.h.

176{};

◆ UpdateCanvas() [1/2]

void UpdateCanvas ( std::string  name,
bool  updated = true 
)
inherited

Mark canvas as updated (or not)

Parameters
namename of Canvas
updatedwas updated

Definition at line 288 of file DQMHistAnalysis.cc.

289{
290 s_canvasUpdatedList[name] = updated;
291}

◆ UpdateCanvas() [2/2]

void UpdateCanvas ( TCanvas *  canvas,
bool  updated = true 
)
inherited

Mark canvas as updated (or not)

Parameters
canvasCanvas from which to take the name for update
updatedwas updated

Definition at line 293 of file DQMHistAnalysis.cc.

294{
295 if (c) UpdateCanvas(c->GetName(), updated);
296}

◆ updateEpicsPVs()

int updateEpicsPVs ( float  timeout)
inherited

Update all EPICS PV (flush to network)

Parameters
timeoutmaximum time until timeout in s
Returns
status of ca_pend_io

Definition at line 564 of file DQMHistAnalysis.cc.

565{
566 int state = ECA_NORMAL;
567 if (!m_useEpics) return state;
568#ifdef _BELLE2_EPICS
569 if (wait > 0.) {
570 state = ca_pend_io(wait);
571 SEVCHK(state, "ca_pend_io failure");
572 }
573#endif
574 return state;
575}

Member Data Documentation

◆ m_alarmThr

float m_alarmThr = 0
private

efficiency ratio alarm threshold

Definition at line 148 of file DQMHistAnalysisKLM2.h.

◆ m_BKLMLayerWarn

double m_BKLMLayerWarn
private

alarm limits from inefficient BKLM layers PV

Definition at line 202 of file DQMHistAnalysisKLM2.h.

◆ m_c_eff2d_bklm

TCanvas* m_c_eff2d_bklm = NULL
private

BKLM efficiencies ratio canvas.

Definition at line 172 of file DQMHistAnalysisKLM2.h.

◆ m_c_eff2d_eklm

TCanvas* m_c_eff2d_eklm = NULL
private

EKLM efficiencies ratio canvas.

Definition at line 184 of file DQMHistAnalysisKLM2.h.

◆ m_c_eff_bklm

TCanvas* m_c_eff_bklm = NULL
private

BKLM plane efficiency canvas.

Definition at line 110 of file DQMHistAnalysisKLM2.h.

◆ m_c_eff_bklm_sector

TCanvas* m_c_eff_bklm_sector = NULL
private

Histogram for BKLM sector efficiency.

Definition at line 122 of file DQMHistAnalysisKLM2.h.

◆ m_c_eff_eklm

TCanvas* m_c_eff_eklm = NULL
private

EKLM plane efficiency canvas.

Definition at line 116 of file DQMHistAnalysisKLM2.h.

◆ m_c_eff_eklm_sector

TCanvas* m_c_eff_eklm_sector = NULL
private

Histogram for EKLM sector efficiency.

Definition at line 128 of file DQMHistAnalysisKLM2.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_eff2d_bklm

TH2* m_eff2d_bklm = NULL
private

BKLM efficiencies 2dim histogram.

Definition at line 166 of file DQMHistAnalysisKLM2.h.

◆ m_eff2d_eklm

TH2* m_eff2d_eklm = NULL
private

EKLM efficiencies 2dim histogram.

Definition at line 178 of file DQMHistAnalysisKLM2.h.

◆ m_eff_bklm

TH1* m_eff_bklm = NULL
private

Histogram for BKLM plane efficiency.

Definition at line 107 of file DQMHistAnalysisKLM2.h.

◆ m_eff_bklm_sector

TH1* m_eff_bklm_sector = NULL
private

Histogram for BKLM sector efficiency.

Definition at line 119 of file DQMHistAnalysisKLM2.h.

◆ m_eff_eklm

TH1* m_eff_eklm = NULL
private

Histogram for EKLM plane efficiency.

Definition at line 113 of file DQMHistAnalysisKLM2.h.

◆ m_eff_eklm_sector

TH1* m_eff_eklm_sector = NULL
private

Histogram for EKLM sector efficiency.

Definition at line 125 of file DQMHistAnalysisKLM2.h.

◆ m_EklmElementNumbers

const EKLMElementNumbers* m_EklmElementNumbers
private

EKLM element numbers.

Definition at line 134 of file DQMHistAnalysisKLM2.h.

◆ m_EKLMLayerWarn

double m_EKLMLayerWarn
private

alarm limits from inefficient EKLM layers PV

Definition at line 205 of file DQMHistAnalysisKLM2.h.

◆ m_epicsReadOnly

bool m_epicsReadOnly
staticprivateinherited
Initial value:
=
false

Flag if to use EPICS in ReadOnly mode (for reading limits) do not set by yourself, use EpicsEnable module to set.

Definition at line 134 of file DQMHistAnalysis.h.

◆ m_err_bklm

TH2* m_err_bklm = NULL
private

BKLM efficiencies error histogram.

Definition at line 169 of file DQMHistAnalysisKLM2.h.

◆ m_err_eklm

TH2* m_err_eklm = NULL
private

EKLM efficiencies error histogram.

Definition at line 181 of file DQMHistAnalysisKLM2.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_histogramDirectoryName

std::string m_histogramDirectoryName
private

Name of histogram directory.

Definition at line 187 of file DQMHistAnalysisKLM2.h.

◆ m_IsNullRun

bool m_IsNullRun
private

Run type flag for null runs.

Definition at line 104 of file DQMHistAnalysisKLM2.h.

◆ m_IsPhysicsRun

bool m_IsPhysicsRun = false
private

Run type flag for null runs.

Definition at line 101 of file DQMHistAnalysisKLM2.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_max

float m_max = 2
private

efficiency ratio max z scale

Definition at line 157 of file DQMHistAnalysisKLM2.h.

◆ m_min

float m_min = 0
private

efficiency ratio min z scale

Definition at line 154 of file DQMHistAnalysisKLM2.h.

◆ m_minEntries

double m_minEntries
private

Minimal number of entries for delta histogram and PV update.

Definition at line 193 of file DQMHistAnalysisKLM2.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_monObj

MonitoringObject* m_monObj {}
private

Monitoring object.

Definition at line 131 of file DQMHistAnalysisKLM2.h.

◆ m_name

std::string m_name
privateinherited

The name of the module, saved as a string (user-modifiable)

Definition at line 508 of file Module.h.

◆ m_nEffBKLMLayers

int m_nEffBKLMLayers
private

Number of inefficient BKLM layers.

Definition at line 196 of file DQMHistAnalysisKLM2.h.

◆ m_nEffEKLMLayers

int m_nEffEKLMLayers
private

Number of inefficient EKLM Layers.

Definition at line 199 of file DQMHistAnalysisKLM2.h.

◆ m_package

std::string m_package
privateinherited

Package this module is found in (may be empty).

Definition at line 510 of file Module.h.

◆ m_PlaneLine

TLine m_PlaneLine
private

TLine for boundary in plane histograms.

Definition at line 95 of file DQMHistAnalysisKLM2.h.

◆ m_PlaneText

TText m_PlaneText
private

TText for names in plane histograms.

Definition at line 98 of file DQMHistAnalysisKLM2.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

The properties of the module as bitwise or (with |) of EModulePropFlags.

Definition at line 512 of file Module.h.

◆ m_PVPrefix

std::string m_PVPrefix = "TEST:"
staticprivateinherited

The Prefix for EPICS PVs.

Definition at line 139 of file DQMHistAnalysis.h.

◆ m_ratio

bool m_ratio = true
private

show efficiency ratio or difference

Definition at line 160 of file DQMHistAnalysisKLM2.h.

◆ m_ref_efficiencies_bklm

TH1* m_ref_efficiencies_bklm = NULL
private

BKLM efficiencies reference histogram.

Definition at line 163 of file DQMHistAnalysisKLM2.h.

◆ m_ref_efficiencies_eklm

TH1* m_ref_efficiencies_eklm = NULL
private

ELM efficiencies reference histogram.

Definition at line 175 of file DQMHistAnalysisKLM2.h.

◆ m_refFile

TFile* m_refFile = nullptr
private

reference histogram file

Definition at line 142 of file DQMHistAnalysisKLM2.h.

◆ m_refFileName

std::string m_refFileName
private

2D layer-sector efficiency differences

reference histogram file path

Definition at line 139 of file DQMHistAnalysisKLM2.h.

◆ m_refHistogramDirectoryName

std::string m_refHistogramDirectoryName
private

Name of histogram directory for reference file.

Definition at line 190 of file DQMHistAnalysisKLM2.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_stopThr

float m_stopThr = 0
private

efficiency ratio (run-)stop threshold

Definition at line 151 of file DQMHistAnalysisKLM2.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ m_useEpics

bool m_useEpics = false
staticprivateinherited

Flag if to use EPICS do not set by yourself, use EpicsEnable module to set.

Definition at line 128 of file DQMHistAnalysis.h.

◆ m_warnThr

float m_warnThr = 0
private

efficiency ratio warning threshold

Definition at line 145 of file DQMHistAnalysisKLM2.h.

◆ s_canvasUpdatedList

DQMHistAnalysisModule::CanvasUpdatedList s_canvasUpdatedList
staticprivateinherited

The list of canvas updated status.

Definition at line 108 of file DQMHistAnalysis.h.

◆ s_deltaList

DQMHistAnalysisModule::DeltaList s_deltaList
staticinherited

The list of Delta Histograms and settings.

Definition at line 102 of file DQMHistAnalysis.h.

◆ s_eventProcessed

int s_eventProcessed = 0
inlinestaticprivateinherited

Number of Events processed to fill histograms.

Attention: histograms are updates asynchronously Thus the number for a specific histogram may be lower or higher. If you need precise number, you must fill it in the histogram itself (e.g. underflow bin)

Definition at line 117 of file DQMHistAnalysis.h.

◆ s_histList

DQMHistAnalysisModule::HistList s_histList
staticprivateinherited

The list of Histograms.

Definition at line 92 of file DQMHistAnalysis.h.

◆ s_monObjList

DQMHistAnalysisModule::MonObjList s_monObjList
staticprivateinherited

The list of MonitoringObjects.

Definition at line 96 of file DQMHistAnalysis.h.

◆ s_runType

std::string s_runType = ""
inlinestaticprivateinherited

The Run type.

Definition at line 122 of file DQMHistAnalysis.h.


The documentation for this class was generated from the following files: