Belle II Software development
DQMHistAnalysisKLMModule Class Referencefinal

Analysis of KLM DQM histograms. More...

#include <DQMHistAnalysisKLM.h>

Inheritance diagram for DQMHistAnalysisKLMModule:
DQMHistAnalysisModule Module PathElement

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...
 
enum  ERefScaling {
  c_RefScaleNone = 0 ,
  c_RefScaleEntries = 1 ,
  c_RefScaleMax = 2
}
 Reference plot scaling type. More...
 
typedef std::map< std::string, HistObject > HistList
 The type of list of histograms.
 
typedef std::map< std::string, MonitoringObject > MonObjList
 The type of list of MonitoringObjects.
 
typedef std::map< std::string, HistDelta > DeltaList
 The type of list of delta settings and histograms.
 
typedef std::map< std::string, bool > CanvasUpdatedList
 The type of list of canvas updated status.
 
typedef std::map< std::string, RefHistObject > RefList
 The type of list of references.
 
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

 DQMHistAnalysisKLMModule ()
 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 terminate () override final
 This method is called at the end of the event processing.
 
TH1 * findHistInCanvas (const std::string &hname, TCanvas **canvas=nullptr)
 Find histogram in corresponding canvas.
 
TH1 * getDelta (const std::string &dirname, const std::string &histname="", int n=0, bool onlyIfUpdated=true)
 Get Delta histogram.
 
int registerEpicsPV (const std::string &pvname, const std::string &keyname="")
 EPICS related Functions.
 
int registerExternalEpicsPV (const std::string &pvname, const std::string &keyname="")
 Register a PV with its name and a key name.
 
void setEpicsPV (const std::string &keyname, double value)
 Write value to a EPICS PV.
 
void setEpicsPV (const 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 (const std::string &keyname, const std::string &value)
 Write string to a EPICS PV.
 
void setEpicsStringPV (int index, const std::string &value)
 Write string to a EPICS PV.
 
double getEpicsPV (const std::string &keyname)
 Read value from a EPICS PV.
 
double getEpicsPV (int index)
 Read value from a EPICS PV.
 
std::string getEpicsStringPV (const 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 (const 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 (const 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 cleanupEpicsPVs (void)
 Unsubscribe from EPICS PVs on terminate.
 
void CheckEpicsError (int state, const std::string &message, const std::string &name)
 check the return status and check PV in case of error
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
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.
 
LogConfig & getLogConfig ()
 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 ModuleCondition * getCondition () 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< Path > getConditionPath () 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 ModuleParamList & getParamList () 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< PathElement > clone () 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 void clearlist (void)
 Clear all static global lists.
 
static HistList & getHistList ()
 Get the list of the histograms.
 
static MonObjList & getMonObjList ()
 Get the list of MonitoringObjects.
 
static const DeltaList & getDeltaList ()
 Get the list of the delta histograms.
 
static const CanvasUpdatedList & getCanvasUpdatedList ()
 Get the list of the canvas update status.
 
static const std::string & getRunType (void)
 Get the list of the reference histograms.
 
static int getEventProcessed (void)
 Get the number of processed events.
 
static void setRunType (const std::string &t)
 Set the Run Type.
 
static void setEventProcessed (int e)
 Set the number of processed events.
 
static TCanvas * findCanvas (TString cname)
 Find canvas by name.
 
static TH1 * findHist (const std::string &dirname, const std::string &histname="", bool onlyIfUpdated=false)
 Find histogram.
 
static TH1 * findRefHist (const std::string &dirname, const std::string &histname="", ERefScaling scaling=ERefScaling::c_RefScaleNone, const TH1 *hist=nullptr)
 Find reference histogram.
 
static TH1 * scaleReference (ERefScaling scaling, const TH1 *hist, TH1 *ref)
 Using the original and reference, create scaled version.
 
static TH1 * findHistInFile (TFile *file, const std::string &histname)
 Find histogram in specific TFile (e.g.
 
static MonitoringObject * findMonitoringObject (const std::string &objName)
 Find MonitoringObject.
 
static double getSigma68 (TH1 *h)
 Helper function to compute half of the central interval covering 68% of a distribution.
 
static bool addHist (const std::string &dirname, const std::string &histname, TH1 *h)
 Add histogram.
 
static void addRefHist (const std::string &dirname, TH1 *hist)
 Add reference histogram.
 
static MonitoringObject * getMonitoringObject (const std::string &name)
 Get MonitoringObject with given name (new object is created if non-existing)
 
static void clearCanvases (void)
 Clear content of all Canvases.
 
static void initHistListBeforeEvent (void)
 Reset the list of histograms.
 
static void clearHistList (void)
 Clears the list of histograms.
 
static void clearRefList (void)
 Clears the list of ref histograms.
 
static void resetDeltaList (void)
 Reset Delta.
 
static void addDeltaPar (const std::string &dirname, const std::string &histname, HistDelta::EDeltaType t, int p, unsigned int a=1)
 Add Delta histogram parameters.
 
static bool hasDeltaPar (const std::string &dirname, const std::string &histname)
 Check if Delta histogram parameters exist for histogram.
 
static void UpdateCanvas (const std::string &name, bool updated=true)
 Mark canvas as updated (or not)
 
static void UpdateCanvas (TCanvas *canvas, bool updated=true)
 Mark canvas as updated (or not)
 
static void ExtractRunType (std::vector< TH1 * > &hs)
 Extract Run Type from histogram title, called from input module.
 
static void ExtractNEvent (std::vector< TH1 * > &hs)
 Extract event processed from daq histogram, called from input module.
 
static void setUseEpics (bool flag)
 Setter for EPICS usage.
 
static void setUseEpicsReadOnly (bool flag)
 Setter EPICS flag in read only mode.
 
static bool getUseEpics (void)
 Getter for EPICS usage.
 
static bool getUseEpicsReadOnly (void)
 Getter EPICS flag in read only mode.
 
static std::string & getPVPrefix (void)
 get global prefix for EPICS PVs
 
static void setPVPrefix (const std::string &prefix)
 set global prefix for EPICS PVs
 
static EStatus makeStatus (bool enough, bool warn_flag, bool error_flag)
 Helper function to judge the status for coloring and EPICS.
 
static void colorizeCanvas (TCanvas *canvas, EStatus status)
 Helper function for Canvas colorization.
 
static EStatusColor getStatusColor (EStatus status)
 Return color for canvas state.
 
static void checkPVStatus (void)
 Check the status of all PVs and report if disconnected or not found.
 
static void printPVStatus (chid pv, bool onlyError=true)
 check the status of a PVs and report if disconnected or not found
 
static void CheckEpicsError (int state, const std::string &message, chid id)
 check the return status and check PV in case of error
 
static std::vector< std::string > StringSplit (const std::string &s, const char delim)
 Helper function for string token split.
 
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

double getProcessedEvents ()
 Get number of processed events.
 
void analyseChannelHitHistogram (int subdetector, int section, int sector, int index, TH1 *histogram, TH1 *delta, TCanvas *canvas, TLatex &latex)
 Analyse channel hit histogram.
 
void processSpatial2DHitEndcapHistogram (uint16_t section, TH2F *histogram, TCanvas *canvas)
 Process spatial 2D hits histograms for endcap.
 
void processTimeHistogram (const std::string &histName)
 Process histogram containing the hit times.
 
void processPlaneHistogram (const std::string &histName, TLatex *latex, TH1 *histogram)
 Process histogram containing the number of hits in plane.
 
void processPlaneHistogram (const std::string &histName, TLatex &latex)
 Process histogram containing the number of hits in plane.
 
void updateCanvasStatus (TCanvas *canvas, const std::vector< KLMModuleNumber > &deadModules, TLatex *latex, int &message_counter, double xAlarm, double yAlarm)
 Helper function to update the canvas status based on dead modules.
 
void processFEHistogram (TH1 *feHist, const std::string &histName, TCanvas *canvas)
 Process histogram containing the efficiencies.
 
void fillMaskedChannelsHistogram (TH1 *histogram, TCanvas *canvas)
 Fill histogram containing masked channels per sector.
 
int registerEpicsPVwithPrefix (const std::string &prefix, const std::string &pvname, const std::string &keyname="")
 Register a PV with its name and a key name.
 
std::list< ModulePtr > getModules () 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.
 

Static Private Member Functions

static void deltaDrawer (TH1 *delta, TH1 *histogram, TCanvas *canvas)
 Scales and draws desired delta histogram for current canvas.
 

Private Attributes

double m_ProcessedEvents
 Number of processed events.
 
int m_ThresholdForMasked
 Threshold for masked channels.
 
int m_ThresholdForHot
 Threshold for hot channels.
 
int m_ThresholdForLog
 Threshold for log scale.
 
int m_MinHitsForFlagging
 Minimal number of hits for flagging.
 
int m_MessageThreshold
 Message Threshold for expert pots.
 
double m_MinProcessedEventsForMessagesInput
 Input parameter for minimal number of processed events for error messages.
 
double m_MinProcessedEventsForMessages
 Minimal number of processed events for error messages.
 
double m_minEntries
 Minimal number of entries for delta histogram update.
 
double m_minEvents
 Minimal number of processed events for delta histogram update.
 
std::string m_histogramDirectoryName
 Name of histogram directory.
 
std::vector< uint16_t > m_DeadBarrelModules
 Vector of dead barrel modules.
 
std::vector< uint16_t > m_DeadEndcapModules
 Vector of dead endcap modules.
 
std::vector< uint16_t > m_MaskedChannels
 Vector of masked channels.
 
TH1 * m_MaskedChannelsHist = nullptr
 Histogram for masked channels per sector.
 
TCanvas * m_c_masked_channels = nullptr
 Canvas for masked channels per sector summary.
 
TLine m_2DHitsLine
 TLine for background region in 2d hits histograms.
 
TLine m_PlaneLine
 TLine for boundary in plane histograms.
 
TText m_PlaneText
 TText for names in plane histograms.
 
TH1 * m_fe_bklm_ratio = nullptr
 Histogram for BKLM plane events fraction w/ FE.
 
TCanvas * m_c_fe_bklm_ratio = nullptr
 Canvas for BKLM plane events fraction w/ FE.
 
TH1 * m_fe_eklm_ratio = nullptr
 Histogram for EKLM plane events fraction w/ FE.
 
TCanvas * m_c_fe_eklm_ratio = nullptr
 Canvas for EKLM plane events fraction w/ FE.
 
bool m_IsNullRun
 Run type flag for null runs.
 
const KLMChannelArrayIndex * m_ChannelArrayIndex
 KLM channel array index.
 
const KLMSectorArrayIndex * m_SectorArrayIndex
 KLM sector array index.
 
const KLMElementNumbers * m_ElementNumbers
 KLM element numbers.
 
const EKLMElementNumbers * m_EklmElementNumbers
 EKLM element numbers.
 
DBObjPtr< KLMElectronicsMap > m_ElectronicsMap
 Electronics map.
 
MonitoringObject * m_monObj {}
 Monitoring object.
 
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< ModuleCondition > m_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 RefList s_refList
 The list of references.
 
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 43 of file DQMHistAnalysisKLM.h.

Member Typedef Documentation

◆ CanvasUpdatedList

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

The type of list of canvas updated status.

Definition at line 95 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 90 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 81 of file DQMHistAnalysis.h.

◆ MonObjList

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

The type of list of MonitoringObjects.

Definition at line 85 of file DQMHistAnalysis.h.

◆ RefList

typedef std::map<std::string, RefHistObject> RefList
inherited

The type of list of references.

Definition at line 100 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,
80 c_ParallelProcessingCertified = 4,
81 c_HistogramManager = 8,
82 c_InternalSerializer = 16,
83 c_TerminateInAllProcesses = 32,
84 c_DontCollectStatistics = 64,
85 };
@ c_Output
Output Process.
Definition ProcHelper.h:19
@ c_Input
Input Process.
Definition ProcHelper.h:17

◆ ERefScaling

enum ERefScaling
inherited

Reference plot scaling type.

Enumerator
c_RefScaleNone 

no scaling

c_RefScaleEntries 

to number of entries (integral)

c_RefScaleMax 

to maximum (bin entry)

Definition at line 72 of file DQMHistAnalysis.h.

72 {
73 c_RefScaleNone = 0,
74 c_RefScaleEntries = 1,
75 c_RefScaleMax = 2
76 };

◆ 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 50 of file DQMHistAnalysis.h.

50 {
51 c_StatusTooFew = 0,
52 c_StatusDefault = 1,
53 c_StatusGood = 2,
54 c_StatusWarning = 3,
55 c_StatusError = 4
56 };

◆ 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 61 of file DQMHistAnalysis.h.

61 {
62 c_ColorTooFew = kGray,
63 c_ColorDefault = kWhite,
64 c_ColorGood = kGreen,
65 c_ColorWarning = kYellow,
66 c_ColorError = kRed
67 };

Constructor & Destructor Documentation

◆ DQMHistAnalysisKLMModule()

Constructor.

Definition at line 27 of file DQMHistAnalysisKLM.cc.

30 m_IsNullRun{false},
35{
36 setDescription("Module used to analyze KLM DQM histograms.");
37 addParam("ThresholdForMasked", m_ThresholdForMasked,
38 "Threshold X for masked channels: if a channel has an occupancy X times larger than the average, it will be masked.", 100);
39 addParam("ThresholdForHot", m_ThresholdForHot,
40 "Threshold Y for hot channels: if a channel has an occupancy Y times larger than the average, it will be marked as hot (but not masked).",
41 10);
42 addParam("ThresholdForLog", m_ThresholdForLog,
43 "Threshold Z for log scale view: if a channel has an occupancy Z times larger than the average, canvas shifts to log scale.",
44 20);
45 addParam("MinHitsForFlagging", m_MinHitsForFlagging, "Minimal number of hits in a channel required to flag it as 'Masked' or 'Hot'",
46 50);
47 addParam("MinProcessedEventsForMessages", m_MinProcessedEventsForMessagesInput,
48 "Minimal number of processed events required to print error messages", 10000.);
49 addParam("MinEntries", m_minEntries,
50 "Minimal number of entries for delta histogram updates", 30000.);
51 addParam("MinEvents", m_minEvents,
52 "Minimal number of processed events for delta histogram updates", 30000.);
53 addParam("MessageThreshold", m_MessageThreshold,
54 "Max number of messages to show up in channel occupancy plots", 12);
55 addParam("HistogramDirectoryName", m_histogramDirectoryName, "Name of histogram directory", std::string("KLM"));
56
58 m_2DHitsLine.SetLineColor(kRed);
59 m_2DHitsLine.SetLineWidth(3);
60 m_2DHitsLine.SetLineStyle(2); // dashed
61 m_PlaneLine.SetLineColor(kMagenta);
62 m_PlaneLine.SetLineWidth(1);
63 m_PlaneLine.SetLineStyle(2); // dashed
64 m_PlaneText.SetTextAlign(22); // centered, middle
65 m_PlaneText.SetTextColor(kMagenta);
66 m_PlaneText.SetTextFont(42); // Helvetica regular
67 m_PlaneText.SetTextSize(0.02); // 2% of TPad's full height
68}
TLine m_PlaneLine
TLine for boundary in plane histograms.
double m_ProcessedEvents
Number of processed events.
int m_MessageThreshold
Message Threshold for expert pots.
int m_ThresholdForLog
Threshold for log scale.
double m_minEntries
Minimal number of entries for delta histogram update.
int m_MinHitsForFlagging
Minimal number of hits for flagging.
const KLMElementNumbers * m_ElementNumbers
KLM element numbers.
const EKLMElementNumbers * m_EklmElementNumbers
EKLM element numbers.
double m_minEvents
Minimal number of processed events for delta histogram update.
int m_ThresholdForHot
Threshold for hot channels.
std::string m_histogramDirectoryName
Name of histogram directory.
double m_MinProcessedEventsForMessagesInput
Input parameter for minimal number of processed events for error messages.
TText m_PlaneText
TText for names in plane histograms.
int m_ThresholdForMasked
Threshold for masked channels.
const KLMSectorArrayIndex * m_SectorArrayIndex
KLM sector array index.
double m_MinProcessedEventsForMessages
Minimal number of processed events for error messages.
TLine m_2DHitsLine
TLine for background region in 2d hits histograms.
const KLMChannelArrayIndex * m_ChannelArrayIndex
KLM channel array index.
bool m_IsNullRun
Run type flag for null runs.
DQMHistAnalysisModule()
Constructor / Destructor.
static const EKLMElementNumbers & Instance()
Instantiation.
static const KLMChannelArrayIndex & Instance()
Instantiation.
static const KLMElementNumbers & Instance()
Instantiation.
static const KLMSectorArrayIndex & 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:559

Member Function Documentation

◆ addDeltaPar()

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

Add Delta histogram parameters.

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

Definition at line 94 of file DQMHistAnalysis.cc.

96{
97 std::string fullname;
98 if (dirname.size() > 0) {
99 fullname = dirname + "/" + histname;
100 } else {
101 fullname = histname;
102 }
103 s_deltaList[fullname].set(t, p, a);
104}
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 59 of file DQMHistAnalysis.cc.

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

◆ addRefHist()

void addRefHist ( const std::string & dirname,
TH1 * hist )
staticinherited

Add reference histogram.

Parameters
dirnameThe name of the directory.
histThe TH1 pointer for the reference.

Definition at line 81 of file DQMHistAnalysis.cc.

82{
83 string histname = hist->GetName();
84 std::string name = dirname + "/" + histname;
85 auto& n = s_refList[name];
86 n.m_orghist_name = name;
87 n.m_refhist_name = "ref/" + name;
88 hist->SetName((n.m_refhist_name).c_str());
89 hist->SetDirectory(0);
90 n.setRefHist(hist); // transfer ownership!
91 n.setRefCopy(nullptr);
92}
static RefList s_refList
The list of references.

◆ analyseChannelHitHistogram()

void analyseChannelHitHistogram ( int subdetector,
int section,
int sector,
int index,
TH1 * histogram,
TH1 * delta,
TCanvas * canvas,
TLatex & latex )
private

Analyse channel hit histogram.

Parameters
[in]subdetectorSubdetector (E or B-KLM).
[in]sectionSection (Forward or Backward).
[in]sectorSector.
[in]indexHistogram Index (The j'th histogram of a given sector).
[in]histogramHistogram.
[in]deltaDelta Histogram.
[in]canvasCanvas.
[out]latexTLatex to draw messages.

Definition at line 219 of file DQMHistAnalysisKLM.cc.

222{
223 double x = 0.15;
224 double y = 0.85;
225 int i, n;
226 std::map<KLMModuleNumber, double> moduleHitMap;
227 std::map<KLMModuleNumber, double>::iterator it;
228 double average = 0;
229 int channelSubdetector, channelSection, channelSector;
230 int layer, plane, strip;
231 std::string str;
232 canvas->Clear();
233 canvas->cd();
234 histogram->SetStats(false);
235 canvas->SetLogy(0); //initialize to start without logscale
236 histogram->Draw();
237 deltaDrawer(delta, histogram, canvas); //draw normalized delta on top
238 n = histogram->GetXaxis()->GetNbins();
239
240 /* call reference histograms from base class*/
241 TH1* ref_histogram = findRefHist(histogram->GetName(), "", ERefScaling::c_RefScaleEntries, histogram);
242 if (ref_histogram) {ref_histogram->Draw("hist,same");}
243 float ref_average = 0;
244
245 if (ref_histogram != nullptr) {
246 for (i = 1; i <= n; i++) {
247 double nHitsPerModuleRef = ref_histogram->GetBinContent(i);
248 ref_average = ref_average + nHitsPerModuleRef;
249 }
250 }
251
252 for (i = 1; i <= n; i++) {
253 KLMChannelNumber channelIndex = std::round(histogram->GetBinCenter(i));
254 KLMChannelNumber channelNumber =
255 m_ChannelArrayIndex->getNumber(channelIndex);
256 double nHitsPerModule = histogram->GetBinContent(i);
257 average = average + nHitsPerModule;
258 m_ElementNumbers->channelNumberToElementNumbers(
259 channelNumber, &channelSubdetector, &channelSection, &channelSector,
260 &layer, &plane, &strip);
261 if ((channelSubdetector != subdetector) ||
262 (channelSection != section) ||
263 (channelSector != sector))
264 B2FATAL("Inconsistent element numbers.");
265 KLMModuleNumber module = m_ElementNumbers->moduleNumber(
266 subdetector, section, sector, layer);
267 it = moduleHitMap.find(module);
268 if (it == moduleHitMap.end()) {
269 moduleHitMap.insert(std::pair<KLMModuleNumber, double>(
270 module, nHitsPerModule));
271 } else {
272 it->second += nHitsPerModule;
273 }
274 }
275 unsigned int activeModuleChannels = 0;
276 int message_counter = 0;
277 for (it = moduleHitMap.begin(); it != moduleHitMap.end(); ++it) {
278 KLMModuleNumber moduleNumber = it->first;
279 if (it->second != 0) {
280 activeModuleChannels += m_ElementNumbers->getNChannelsModule(moduleNumber);
281 continue;
282 }
283 m_ElementNumbers->moduleNumberToElementNumbers(
284 moduleNumber, &channelSubdetector, &channelSection, &channelSector, &layer);
285 /* Channel with plane = 1, strip = 1 exists for any BKLM or EKLM module. */
286 KLMChannelNumber channel =
287 m_ElementNumbers->channelNumber(
288 channelSubdetector, channelSection, channelSector, layer, 1, 1);
289 const KLMElectronicsChannel* electronicsChannel =
290 m_ElectronicsMap->getElectronicsChannel(channel);
291 if (electronicsChannel == nullptr)
292 B2FATAL("Incomplete KLM electronics map.");
293 str = "No data from lane " + std::to_string(electronicsChannel->getLane());
294 latex.DrawLatexNDC(x, y, str.c_str());
295 y -= 0.05;
296 message_counter++;
297 /* Store the module number, used later in processPlaneHistogram
298 * to color the canvas with red and to raise up an alarm. */
299 if (channelSubdetector == KLMElementNumbers::c_BKLM) {
300 std::vector<KLMModuleNumber>::iterator ite =
301 std::find(m_DeadBarrelModules.begin(),
303 moduleNumber);
304 if (ite == m_DeadBarrelModules.end())
305 m_DeadBarrelModules.push_back(moduleNumber);
306 } else {
307 std::vector<KLMModuleNumber>::iterator ite = std::find(m_DeadEndcapModules.begin(),
309 moduleNumber);
310 if (ite == m_DeadEndcapModules.end())
311 m_DeadEndcapModules.push_back(moduleNumber);
312 }
313 }
314 if (activeModuleChannels == 0)
315 return;
316 average /= activeModuleChannels;
317 ref_average /= activeModuleChannels;
318
319 for (i = 1; i <= n; ++i) {
320 KLMChannelNumber channelIndex = std::round(histogram->GetBinCenter(i));
321 KLMChannelNumber channelNumber =
322 m_ChannelArrayIndex->getNumber(channelIndex);
323 double nHits = histogram->GetBinContent(i);
324 m_ElementNumbers->channelNumberToElementNumbers(
325 channelNumber, &channelSubdetector, &channelSection, &channelSector,
326 &layer, &plane, &strip);
327 std::string channelStatus = "Normal";
328 if ((nHits > average * m_ThresholdForMasked) && (nHits > m_MinHitsForFlagging)) {
329 channelStatus = "Masked";
330 std::vector<KLMModuleNumber>::iterator ite =
331 std::find(m_MaskedChannels.begin(),
332 m_MaskedChannels.end(),
333 channelNumber);
334 if (ite == m_MaskedChannels.end())
335 m_MaskedChannels.push_back(channelNumber);
336 B2DEBUG(20, "KLM@MaskMe " << channelNumber);
337 } else if ((nHits > average * m_ThresholdForHot) && (nHits > m_MinHitsForFlagging)) {
338 channelStatus = "Hot";
339 }
340 if (channelStatus != "Normal") {
341 const KLMElectronicsChannel* electronicsChannel =
342 m_ElectronicsMap->getElectronicsChannel(channelNumber);
343 if (electronicsChannel == nullptr)
344 B2FATAL("Incomplete BKLM electronics map.");
345 if (channelStatus == "Masked") {
346 histogram->SetBinContent(i, 0);
347 if (delta != nullptr)
348 delta->SetBinContent(i, 0);
349 }
350 str = channelStatus + " channel: ";
351 // lane, axis, channel
352 str += ("L" + std::to_string(electronicsChannel->getLane()) +
353 " A" + std::to_string(electronicsChannel->getAxis()) +
354 " Ch" + std::to_string(electronicsChannel->getChannel()));
355 message_counter++;
356 if (message_counter <= m_MessageThreshold) {
357 latex.DrawLatexNDC(x, y, str.c_str());
358 y -= 0.05;
359 }
360 }
361 }
362 if (message_counter > m_MessageThreshold) {
363 std::string verbose_message = " more messages";
364 verbose_message = std::to_string(message_counter - m_MessageThreshold) + verbose_message;
365 latex.DrawLatexNDC(x, y, verbose_message.c_str());
366 }
367
368
369 // for hot/masked channels, log scale plots (reference and main)
370 if (histogram->GetMaximum()*n > histogram->Integral()*m_ThresholdForLog && average * activeModuleChannels > m_MinHitsForFlagging) {
371 histogram->SetMinimum(1);
372 canvas->SetLogy();
373 } else if (ref_histogram != nullptr) {
374 if (ref_histogram->GetMaximum()*n > ref_histogram->Integral()*m_ThresholdForLog
375 && ref_average * activeModuleChannels > m_MinHitsForFlagging) {
376 histogram->SetMinimum(1);
377 canvas->SetLogy();
378 } else
379 canvas->SetLogy(0);
380 } else
381 canvas->SetLogy(0);
382
383 canvas->Modified();
384 canvas->Update();
385
386 /* Drawing dividing lines */
387 int divisions;
388 int bin = 1;
389 double xLine;
390 // drawing lines for BKLM sectors
391 if (subdetector == 1) {
392 int shift;
393 if (index == 0) {
394 divisions = 7;
395 shift = 1;
396 } else {
399 }
400 for (int k = 0; k < divisions; k++) {
401 xLine = (histogram->GetXaxis()->GetBinLowEdge(bin) - canvas->GetX1()) / (canvas->GetX2() - canvas->GetX1());
402 m_PlaneLine.DrawLineNDC(xLine, 0.1, xLine, 0.9);
403 bin += BKLMElementNumbers::getNStrips(section, sector, k + shift, 0)
404 + BKLMElementNumbers::getNStrips(section, sector, k + shift, 1);
405 }
406 } else { // drawing lines for EKLM sectors
407 if ((section == 2) && (index == 0 || index == 1))
408 divisions = 5;
409 else
410 divisions = 4;
411 for (int k = 0; k < divisions; k++) {
412 xLine = (histogram->GetXaxis()->GetBinLowEdge(bin) - canvas->GetX1()) / (canvas->GetX2() - canvas->GetX1());
413 m_PlaneLine.DrawLineNDC(xLine, 0.1, xLine, 0.9);
415 }
416 }
417 canvas->Modified();
418 canvas->Update();
419
420}
static constexpr int getMaximalSectorNumber()
Get maximal sector number (1-based).
static int getNStrips(int section, int sector, int layer, int plane)
Get number of strips.
static void deltaDrawer(TH1 *delta, TH1 *histogram, TCanvas *canvas)
Scales and draws desired delta histogram for current canvas.
std::vector< uint16_t > m_MaskedChannels
Vector of masked channels.
std::vector< uint16_t > m_DeadBarrelModules
Vector of dead barrel modules.
DBObjPtr< KLMElectronicsMap > m_ElectronicsMap
Electronics map.
std::vector< uint16_t > m_DeadEndcapModules
Vector of dead endcap modules.
@ c_RefScaleEntries
to number of entries (integral)
static TH1 * findRefHist(const std::string &dirname, const std::string &histname="", ERefScaling scaling=ERefScaling::c_RefScaleNone, const TH1 *hist=nullptr)
Find reference histogram.
static constexpr int getNStripsSector()
Get number of strips in a sector.
TH2 * moduleHitMap(TH1 *hitMap, int moduleID)
Make hit map in HAPD view (12*12 channels).
uint16_t KLMChannelNumber
Channel number.
uint16_t KLMModuleNumber
Module number.

◆ beginRun()

void beginRun ( void )
finaloverridevirtual

Called when entering a new run.

Reimplemented from Module.

Definition at line 157 of file DQMHistAnalysisKLM.cc.

158{
159 if (!m_ElectronicsMap.isValid())
160 B2FATAL("No KLM electronics map.");
163 m_DeadBarrelModules.clear();
164 m_DeadEndcapModules.clear();
165 m_MaskedChannels.clear();
166
167 m_IsNullRun = (getRunType() == "null");
168}
static const std::string & getRunType(void)
Get the list of the reference histograms.

◆ CheckEpicsError() [1/2]

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

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 792 of file DQMHistAnalysis.cc.

793{
794 if (state != ECA_NORMAL) {
795 std::string name;
796 if (id) name = ca_name(id);
797 B2WARNING(message << ": " << name);
798 printPVStatus(id, false);
799 }
800}
static 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 784 of file DQMHistAnalysis.cc.

785{
786 if (state != ECA_NORMAL) {
787 B2WARNING(message << ": " << name);
788 printPVStatus(m_epicsNameToChID[name], false);
789 }
790}

◆ checkPVStatus()

void checkPVStatus ( void )
staticinherited

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

Definition at line 748 of file DQMHistAnalysis.cc.

749{
750 B2INFO("Check PV Connections");
751
752 for (const auto& it : m_epicsChID) {
753 printPVStatus(it);
754 }
755 B2INFO("Check PVs done");
756}

◆ cleanupEpicsPVs()

void cleanupEpicsPVs ( void )
inherited

Unsubscribe from EPICS PVs on terminate.

Definition at line 629 of file DQMHistAnalysis.cc.

630{
631 // this should be called in terminate function of analysis modules
632#ifdef _BELLE2_EPICS
633 if (getUseEpics()) {
634 for (auto& it : m_epicsChID) CheckEpicsError(ca_clear_channel(it), "ca_clear_channel failure", it);
635 updateEpicsPVs(5.0);
636 // Make sure we clean up both afterwards!
637 m_epicsChID.clear();
638 m_epicsNameToChID.clear();
639 }
640#endif
641}
static 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 )
staticinherited

Clear content of all Canvases.

Definition at line 294 of file DQMHistAnalysis.cc.

295{
296 TIter nextckey(gROOT->GetListOfCanvases());
297 TObject* cobj = nullptr;
298
299 while ((cobj = dynamic_cast<TObject*>(nextckey()))) {
300 if (cobj->IsA()->InheritsFrom("TCanvas")) {
301 TCanvas* cnv = dynamic_cast<TCanvas*>(cobj);
302 cnv->Clear();
304 }
305 }
306}
static void colorizeCanvas(TCanvas *canvas, EStatus status)
Helper function for Canvas colorization.
@ c_StatusDefault
default for non-coloring

◆ clearHistList()

void clearHistList ( void )
staticinherited

Clears the list of histograms.

Definition at line 322 of file DQMHistAnalysis.cc.

323{
324 s_histList.clear();
325}

◆ clearlist()

void clearlist ( void )
staticinherited

Clear all static global lists.

Definition at line 50 of file DQMHistAnalysis.cc.

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

◆ clearRefList()

void clearRefList ( void )
staticinherited

Clears the list of ref histograms.

Definition at line 327 of file DQMHistAnalysis.cc.

328{
329 s_refList.clear();
330}

◆ 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{
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.
void setParameters(const ModuleParamList &params)
Set values for parameters from other parameter list.
const ModuleParamList & getParamList() const
Return module param list.
Definition Module.h:362
const std::string & getName() const
Returns the name of the module.
Definition Module.h:186
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:511
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition Module.h:515
void setName(const std::string &name)
Set the name of the module.
Definition Module.h:213
LogConfig m_logConfig
The log system configuration of the module.
Definition Module.h:513
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition Module.h:520
std::string m_package
Package this module is found in (may be empty).
Definition Module.h:509
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 )
staticinherited

Helper function for Canvas colorization.

Parameters
canvasCanvas to change
statusstatus to color

Definition at line 735 of file DQMHistAnalysis.cc.

736{
737 if (!canvas) return;
738 auto color = DQMHistAnalysisModule::getStatusColor(stat);
739
740 canvas->Pad()->SetFillColor(color);
741
742 canvas->Pad()->SetFrameFillColor(10); // White (kWhite is not used since it results in transparent!)
743 canvas->Pad()->SetFrameFillStyle(1001);// White
744 canvas->Pad()->Modified();
745 canvas->Pad()->Update();
746}
static 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 425 of file Module.h.

425{ beginRun(); }

◆ 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 438 of file Module.h.

438{ endRun(); }

◆ 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 431 of file Module.h.

431{ event(); }

◆ 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 419 of file Module.h.

419{ initialize(); }

◆ 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 444 of file Module.h.

444{ terminate(); }

◆ deltaDrawer()

void deltaDrawer ( TH1 * delta,
TH1 * histogram,
TCanvas * canvas )
staticprivate

Scales and draws desired delta histogram for current canvas.

Parameters
[in]deltaDelta histogram.
[in]histogramBase histogram (for normalization).
[in]canvasCanvas with delta histogram.

Definition at line 205 of file DQMHistAnalysisKLM.cc.

206{
207 if (delta != nullptr) {
208 Double_t scale = (Double_t) histogram->Integral(); //want delta and histo to have same norm
209
210 // delta != nullptr should take care of whether update condition is met.
211 delta->SetLineColor(kBlackBody); //random choice of not green or blue
212 delta->SetLineStyle(4);
213 delta->DrawNormalized("SAME", scale); //normalize delta to histo
214 canvas->Modified();
215 canvas->Update();
216 }
217}

◆ endRun()

void endRun ( void )
finaloverridevirtual

This method is called if the current run ends.

Reimplemented from Module.

Definition at line 170 of file DQMHistAnalysisKLM.cc.

171{
172 int hist_max_bin; double max_position;
173 TH1* time_rpc = findHist(m_histogramDirectoryName + "/time_rpc");
174 if (time_rpc) {
175 hist_max_bin = time_rpc->GetMaximumBin();
176 max_position = time_rpc->GetXaxis()->GetBinCenter(hist_max_bin);
177 m_monObj->setVariable("RPC_Time_Peak", max_position);
178 }
179
180 TH1* time_scint_bklm = findHist(m_histogramDirectoryName + "/time_scintillator_bklm");
181 if (time_scint_bklm) {
182 hist_max_bin = time_scint_bklm->GetMaximumBin();
183 max_position = time_scint_bklm->GetXaxis()->GetBinCenter(hist_max_bin);
184 m_monObj->setVariable("BKLM_Scint_Time_Peak", max_position);
185 }
186
187 TH1* time_scint_eklm = findHist(m_histogramDirectoryName + "/time_scintillator_eklm");
188 if (time_scint_eklm) {
189 hist_max_bin = time_scint_eklm->GetMaximumBin();
190 max_position = time_scint_eklm->GetXaxis()->GetBinCenter(hist_max_bin);
191 m_monObj->setVariable("EKLM_Scint_Time_Peak", max_position);
192 }
193}
MonitoringObject * m_monObj
Monitoring object.
static TH1 * findHist(const std::string &dirname, const std::string &histname="", bool onlyIfUpdated=false)
Find histogram.

◆ 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:518
bool m_hasReturnValue
True, if the return value is set.
Definition Module.h:517

◆ event()

void event ( void )
finaloverridevirtual

This method is called for each event.

Reimplemented from Module.

Definition at line 714 of file DQMHistAnalysisKLM.cc.

715{
716 /* If KLM is not included, stop here and return. */
717 TH1* daqInclusion = findHist(m_histogramDirectoryName + "/daq_inclusion");
718 if (not(daqInclusion == nullptr)) {
719 int isKlmIncluded = daqInclusion->GetBinContent(daqInclusion->GetXaxis()->FindBin("Yes"));
720 if (isKlmIncluded == 0)
721 return;
722 }
723 /* Make sure that the vectors are cleared at each DQM refresh. */
724 m_DeadBarrelModules.clear();
725 m_DeadEndcapModules.clear();
726 m_MaskedChannels.clear();
728 std::string str, histogramName, canvasName;
729 TLatex latex;
730 latex.SetTextColor(kRed);
731 latex.SetTextAlign(11);
732 KLMChannelIndex klmIndex(KLMChannelIndex::c_IndexLevelSector);
733 // gathering relevant info for analyseChannelHitHistogram
734 for (const KLMChannelIndex& klmSector : klmIndex) {
735 int nHistograms;
736 if (klmSector.getSubdetector() == KLMElementNumbers::c_BKLM)
737 nHistograms = 2;
738 else
739 nHistograms = 3;
740 for (int j = 0; j < nHistograms; j++) {
741 str = "strip_hits_subdetector_" +
742 std::to_string(klmSector.getSubdetector()) +
743 "_section_" + std::to_string(klmSector.getSection()) +
744 "_sector_" + std::to_string(klmSector.getSector()) +
745 "_" + std::to_string(j);
746 histogramName = m_histogramDirectoryName + "/" + str;
747 canvasName = m_histogramDirectoryName + "/c_" + str;
748 TH1* histogram = findHist(histogramName);
749 //get delta histogram (should we work with a clone instead?)
750 auto delta = getDelta("", histogramName);
751
752 if (histogram == nullptr) {
753 B2WARNING("KLM DQM histogram " << histogramName << " is not found.");
754 continue;
755 }
756 TCanvas* canvas = findCanvas(canvasName);
757 if (canvas == nullptr) {
758 B2WARNING("KLM DQM histogram canvas " << canvasName << " is not found.");
759 continue;
760 }
761 // Add this canvas that it is time to update
762 // not sure if this is interfering with the generation of some features
763 // after testing, switch condition back to delta != nullptr || histogram != nullptr
764 UpdateCanvas(canvas->GetName(), true);
766 klmSector.getSubdetector(), klmSector.getSection(),
767 klmSector.getSector(), j, histogram, delta, canvas, latex);
768
769 }
770 }
771 /* Temporary change the color palette. */
772 gStyle->SetPalette(kLightTemperature);
773 klmIndex.setIndexLevel(KLMChannelIndex::c_IndexLevelSection);
774 for (const KLMChannelIndex& klmSection : klmIndex) {
775 KLMSubdetectorNumber subdetector = klmSection.getSubdetector();
776 if (subdetector == KLMElementNumbers::c_EKLM) {
777 KLMSubdetectorNumber section = klmSection.getSection();
778 int maximalLayerNumber = m_EklmElementNumbers->getMaximalDetectorLayerNumber(section);
779 for (int j = 1; j <= maximalLayerNumber; ++j) {
780 str = "spatial_2d_hits_subdetector_" + std::to_string(subdetector) +
781 "_section_" + std::to_string(section) +
782 "_layer_" + std::to_string(j);
783 histogramName = m_histogramDirectoryName + "/" + str;
784 canvasName = m_histogramDirectoryName + "/c_" + str;
785 TH2F* histogram = static_cast<TH2F*>(findHist(histogramName));
786 if (histogram == nullptr) {
787 B2ERROR("KLM DQM histogram " << histogramName << " is not found.");
788 continue;
789 }
790 TCanvas* canvas = findCanvas(canvasName);
791 if (canvas == nullptr) {
792 B2ERROR("KLM DQM histogram canvas " << canvasName << " is not found.");
793 continue;
794 }
795 processSpatial2DHitEndcapHistogram(section, histogram, canvas);
796 }
797 }
798 }
799
800 /* Reset the color palette to the default one. */
801 gStyle->SetPalette(kBird);
803 latex.SetTextColor(kBlue);
804 processPlaneHistogram("plane_bklm_phi", latex);
805 processPlaneHistogram("plane_bklm_z", latex);
806 processPlaneHistogram("plane_eklm", latex);
807
808 processFEHistogram(m_fe_bklm_ratio, "feStatus_bklm_scintillator_layers", m_c_fe_bklm_ratio);
810 processPlaneHistogram("fe_bklm_ratio", nullptr, m_fe_bklm_ratio);
811 processPlaneHistogram("fe_eklm_ratio", nullptr, m_fe_eklm_ratio);
812
813
814 processTimeHistogram("time_rpc");
815 processTimeHistogram("time_scintillator_bklm");
816 processTimeHistogram("time_scintillator_eklm");
817
818 B2DEBUG(20, "Updating EPICS PVs for DQMHistAnalysisKLM");
819 // only update PVs if there's enough statistics and datasize != 0
820 // Check if it's a null run, if so, don't update EPICS PVs
821 if (m_IsNullRun) {
822 B2INFO("DQMHistAnalysisKLM: Null run detected. No PV Update.");
823 return;
824 }
825 auto* daqDataSize = findHist("DAQ/KLMDataSize");
826 double meanDAQDataSize = 0.;
827 if (daqDataSize != nullptr) {
828 meanDAQDataSize = daqDataSize->GetMean();
829 } else
830 B2WARNING("DQMHistAnalysisKLM: Cannot find KLMDataSize");
831 if ((daqDataSize != nullptr) and (meanDAQDataSize != 0.)) {
833 setEpicsPV("MaskedChannels", (double)m_MaskedChannels.size());
834 setEpicsPV("DeadBarrelModules", (double)m_DeadBarrelModules.size());
835 setEpicsPV("DeadEndcapModules", (double)m_DeadEndcapModules.size());
836 B2DEBUG(20, "DQMHistAnalysisKLM: MaskedChannels " << m_MaskedChannels.size());
837 B2DEBUG(20, "DQMHistAnalysisKLM: DeadBarrelModules " << m_DeadBarrelModules.size());
838 B2DEBUG(20, "DQMHistAnalysisKLM: DeadEndcapModules " << m_DeadEndcapModules.size());
839 }
840 } else
841 B2INFO("DQMHistAnalysisKLM: KLM Not included. No PV Update. ");
842
843
844}
void processFEHistogram(TH1 *feHist, const std::string &histName, TCanvas *canvas)
Process histogram containing the efficiencies.
void processPlaneHistogram(const std::string &histName, TLatex *latex, TH1 *histogram)
Process histogram containing the number of hits in plane.
TH1 * m_fe_eklm_ratio
Histogram for EKLM plane events fraction w/ FE.
TCanvas * m_c_fe_eklm_ratio
Canvas for EKLM plane events fraction w/ FE.
void fillMaskedChannelsHistogram(TH1 *histogram, TCanvas *canvas)
Fill histogram containing masked channels per sector.
void processSpatial2DHitEndcapHistogram(uint16_t section, TH2F *histogram, TCanvas *canvas)
Process spatial 2D hits histograms for endcap.
void processTimeHistogram(const std::string &histName)
Process histogram containing the hit times.
TCanvas * m_c_fe_bklm_ratio
Canvas for BKLM plane events fraction w/ FE.
TH1 * m_fe_bklm_ratio
Histogram for BKLM plane events fraction w/ FE.
TH1 * m_MaskedChannelsHist
Histogram for masked channels per sector.
double getProcessedEvents()
Get number of processed events.
void analyseChannelHitHistogram(int subdetector, int section, int sector, int index, TH1 *histogram, TH1 *delta, TCanvas *canvas, TLatex &latex)
Analyse channel hit histogram.
TCanvas * m_c_masked_channels
Canvas for masked channels per sector summary.
static TCanvas * findCanvas(TString cname)
Find canvas by name.
static void UpdateCanvas(const std::string &name, bool updated=true)
Mark canvas as updated (or not)
TH1 * getDelta(const std::string &dirname, const std::string &histname="", int n=0, bool onlyIfUpdated=true)
Get Delta histogram.
void setEpicsPV(const std::string &keyname, double value)
Write value to a EPICS PV.
uint16_t KLMSubdetectorNumber
Subdetector 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 paths */
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>()),
491 &Module::setLogConfig)
@ 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: "<".
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 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
Module()
Constructor.
Definition Module.cc:30
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition Module.cc:220
@ 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_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
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
ModuleCondition::EAfterConditionPath EAfterConditionPath
Forward the EAfterConditionPath definition from the ModuleCondition.
Definition Module.h:88

◆ ExtractNEvent()

void ExtractNEvent ( std::vector< TH1 * > & hs)
staticinherited

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

Definition at line 361 of file DQMHistAnalysis.cc.

362{
364 for (size_t i = 0; i < hs.size(); i++) {
365 if (hs[i]->GetName() == std::string("DAQ/Nevent")) {
366 s_eventProcessed = hs[i]->GetEntries();
367 return;
368 }
369 }
370 B2ERROR("ExtractEvent: Histogram \"DAQ/Nevent\" missing");
371}
static int s_eventProcessed
Number of Events processed to fill histograms.

◆ ExtractRunType()

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

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

Definition at line 349 of file DQMHistAnalysis.cc.

350{
351 s_runType = "";
352 for (size_t i = 0; i < hs.size(); i++) {
353 if (hs[i]->GetName() == std::string("DQMInfo/rtype")) {
354 s_runType = hs[i]->GetTitle();
355 return;
356 }
357 }
358 B2ERROR("ExtractRunType: Histogram \"DQMInfo/rtype\" missing");
359}
static std::string s_runType
The Run type.

◆ fillMaskedChannelsHistogram()

void fillMaskedChannelsHistogram ( TH1 * histogram,
TCanvas * canvas )
private

Fill histogram containing masked channels per sector.

Parameters
[in]histogramHistogram.
[in]canvasCanvas.

Definition at line 472 of file DQMHistAnalysisKLM.cc.

474{
475 histogram->Clear();
476 canvas->Clear();
477 canvas->cd();
478 if (m_MaskedChannels.size() > 0) {
479 int channelSubdetector, channelSection, channelSector;
480 int layer, plane, strip;
481 for (KLMChannelNumber channel : m_MaskedChannels) {
482 m_ElementNumbers->channelNumberToElementNumbers(
483 channel, &channelSubdetector, &channelSection, &channelSector,
484 &layer, &plane, &strip);
485 KLMSectorNumber sectorNumber;
486 if (channelSubdetector == KLMElementNumbers::c_BKLM)
487 sectorNumber = m_ElementNumbers->sectorNumberBKLM(channelSection, channelSector);
488 else
489 sectorNumber = m_ElementNumbers->sectorNumberEKLM(channelSection, channelSector);
490 KLMSectorNumber sectorIndex = m_SectorArrayIndex->getIndex(sectorNumber);
491 histogram->Fill(sectorIndex);
492 }
493 }
494 histogram->SetStats(false);
495 histogram->SetTitle("Number of masked channels per sector");
496 histogram->Draw();
497 canvas->Modified();
498 canvas->Update();
499}
uint16_t KLMSectorNumber
Sector number.

◆ findCanvas()

TCanvas * findCanvas ( TString cname)
staticinherited

Find canvas by name.

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

Definition at line 138 of file DQMHistAnalysis.cc.

139{
140 TIter nextkey(gROOT->GetListOfCanvases());
141 TObject* obj{};
142
143 while ((obj = dynamic_cast<TObject*>(nextkey()))) {
144 if (obj->IsA()->InheritsFrom("TCanvas")) {
145 if (obj->GetName() == canvas_name)
146 return dynamic_cast<TCanvas*>(obj);
147 }
148 }
149 return nullptr;
150}

◆ findHist()

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 153 of file DQMHistAnalysis.cc.

154{
155 std::string fullname = dirname + "/" + histname;
156 if (dirname.size() == 0) fullname = histname; // assume contains dirname
157 if (histname.size() == 0) fullname = dirname; // assume contains histname
158
159 if (s_histList.find(fullname) != s_histList.end()) {
160 if (was_updated && !s_histList[fullname].isUpdated()) return nullptr;
161 if (s_histList[fullname].getHist()) {
162 return s_histList[fullname].getHist();
163 } else {
164 B2ERROR("Histogram " << fullname << " in histogram list but nullptr.");
165 }
166 }
167 B2INFO("Histogram " << fullname << " not in list.");
168 return nullptr;
169}

◆ 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 213 of file DQMHistAnalysis.cc.

214{
215 TCanvas* cnv = nullptr;
216 // try to get canvas from outside
217 if (cobj) cnv = *cobj;
218 // if no canvas search for it
219 if (cnv == nullptr) {
220 // parse the dir+histo name and create the corresponding canvas name
221 auto s = StringSplit(histo_name, '/');
222 if (s.size() != 2) {
223 B2ERROR("findHistInCanvas: histoname not valid (missing dir?), should be 'dirname/histname': " << histo_name);
224 return nullptr;
225 }
226 auto dirname = s.at(0);
227 auto hname = s.at(1);
228 std::string canvas_name = dirname + "/c_" + hname;
229 cnv = findCanvas(canvas_name);
230 // set canvas pointer for outside
231 if (cnv && cobj) *cobj = cnv;
232 }
233
234 // get histogram pointer
235 if (cnv != nullptr) {
236 TIter nextkey(cnv->GetListOfPrimitives());
237 TObject* obj{};
238 while ((obj = dynamic_cast<TObject*>(nextkey()))) {
239 if (obj->IsA()->InheritsFrom("TH1")) {
240 if (obj->GetName() == histo_name)
241 return dynamic_cast<TH1*>(obj);
242 }
243 }
244 }
245 return nullptr;
246}
static 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 248 of file DQMHistAnalysis.cc.

249{
250 // find histogram by name in file, histname CAN contain directory!
251 // will return nullptr if file is zeroptr, not found or not correct type
252 if (file && file->IsOpen()) {
253 auto obj = file->Get(histname.data());
254 if (obj != nullptr) {
255 // check class type
256 if (obj->IsA()->InheritsFrom("TH1")) {
257 B2DEBUG(20, "Histogram " << histname << " found in file");
258 return dynamic_cast<TH1*>(obj);
259 } else {
260 B2INFO("Found Object " << histname << " in file is not a histogram");
261 }
262 } else {
263 B2INFO("Histogram " << histname << " not found in file");
264 }
265 }
266 return nullptr;
267}

◆ 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 269 of file DQMHistAnalysis.cc.

270{
271 if (s_monObjList.find(objName) != s_monObjList.end()) {
272 return &s_monObjList[objName];
273 }
274 B2INFO("MonitoringObject " << objName << " not in memfile.");
275 return nullptr;
276}
static MonObjList s_monObjList
The list of MonitoringObjects.

◆ findRefHist()

TH1 * findRefHist ( const std::string & dirname,
const std::string & histname = "",
ERefScaling scaling = ERefScaling::c_RefScaleNone,
const TH1 * hist = nullptr )
staticinherited

Find reference histogram.

Parameters
dirnameThe name of the directory.
histnameThe name of the histogram.
scalingenum what scaling to use
histhistogram to scale to
Returns
The found histogram, or nullptr if not found.

Definition at line 197 of file DQMHistAnalysis.cc.

199{
200 std::string fullname = dirname + "/" + histname;
201 if (dirname.size() == 0) fullname = histname; // assume contains dirname
202 if (histname.size() == 0) fullname = dirname; // assume contains histname
203
204 if (s_refList.find(fullname) != s_refList.end()) {
205 // get a copy of the reference which we can modify
206 // (it is still owned and managed by the framework)
207 // then do the scaling
208 return scaleReference(scaling, hist, s_refList[fullname].getReference());
209 }
210 return nullptr;
211}
static TH1 * scaleReference(ERefScaling scaling, const TH1 *hist, TH1 *ref)
Using the original and reference, create scaled version.

◆ 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 323 of file Module.h.

324 {
325 return m_conditions;
326 }

◆ getCanvasUpdatedList()

static const CanvasUpdatedList & getCanvasUpdatedList ( )
inlinestaticinherited

Get the list of the canvas update status.

Returns
The list of the canvases.

Definition at line 206 of file DQMHistAnalysis.h.

206{ 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 313 of file Module.h.

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

◆ 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()

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 117 of file DQMHistAnalysis.cc.

118{
119 std::string fullname = dirname + "/" + histname;
120 if (dirname.size() == 0) fullname = histname; // assume contains dirname
121 if (histname.size() == 0) fullname = dirname; // assume contains histname
122
123 auto it = s_deltaList.find(fullname);
124 if (it != s_deltaList.end()) {
125 return it->second.getDelta(n, onlyIfUpdated);
126 }
127 B2WARNING("Delta hist " << fullname << " not found");
128 return nullptr;
129}

◆ getDeltaList()

static const DeltaList & getDeltaList ( )
inlinestaticinherited

Get the list of the delta histograms.

Returns
The list of the delta histograms.

Definition at line 200 of file DQMHistAnalysis.h.

200{ return s_deltaList;};

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 201 of file Module.h.

201{return m_description;}

◆ getEpicsPV() [1/2]

double getEpicsPV ( const 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 492 of file DQMHistAnalysis.cc.

493{
494 double value{NAN};
495 if (!m_useEpics) return value;
496#ifdef _BELLE2_EPICS
497 if (m_epicsNameToChID[keyname] == nullptr) {
498 B2ERROR("Epics PV " << keyname << " not registered!");
499 return value;
500 }
501 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value can't be assumed to be stable
502 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
503 // outstanding get requests are not automatically reissued following reconnect.
504 auto r = ca_get(DBR_DOUBLE, m_epicsNameToChID[keyname], &value);
505 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
506 if (r == ECA_NORMAL) {
507 return value;
508 } else {
509 CheckEpicsError(r, "Read PV failed in ca_get or ca_pend_io failure", keyname);
510 }
511#endif
512 return NAN;
513}
static bool m_useEpics
Flag if to use EPICS do not set by yourself, use EpicsEnable module to set.

◆ getEpicsPV() [2/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 515 of file DQMHistAnalysis.cc.

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

◆ getEpicsPVChID() [1/2]

chid getEpicsPVChID ( const 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 588 of file DQMHistAnalysis.cc.

589{
590#ifdef _BELLE2_EPICS
591 if (m_useEpics) {
592 if (m_epicsNameToChID[keyname] != nullptr) {
593 return m_epicsNameToChID[keyname];
594 } else {
595 B2ERROR("Epics PV " << keyname << " not registered!");
596 }
597 }
598#endif
599 return nullptr;
600}

◆ getEpicsPVChID() [2/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 602 of file DQMHistAnalysis.cc.

603{
604#ifdef _BELLE2_EPICS
605 if (m_useEpics) {
606 if (index >= 0 && index < (int)m_epicsChID.size()) {
607 return m_epicsChID[index];
608 } else {
609 B2ERROR("Epics PV with " << index << " not registered!");
610 }
611 }
612#endif
613 return nullptr;
614}

◆ getEpicsStringPV() [1/2]

std::string getEpicsStringPV ( const 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 538 of file DQMHistAnalysis.cc.

539{
540 status = false;
541 char value[40] = "";
542 if (!m_useEpics) return std::string(value);
543#ifdef _BELLE2_EPICS
544 if (m_epicsNameToChID[keyname] == nullptr) {
545 B2ERROR("Epics PV " << keyname << " not registered!");
546 return std::string(value);
547 }
548 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value can't be assumed to be stable
549 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
550 // outstanding get requests are not automatically reissued following reconnect.
551 auto r = ca_get(DBR_STRING, m_epicsNameToChID[keyname], value);
552 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
553 if (r == ECA_NORMAL) {
554 status = true;
555 return std::string(value);
556 } else {
557 CheckEpicsError(r, "Read PV (string) failed in ca_get or ca_pend_io failure", keyname);
558 }
559#endif
560 return std::string(value);
561}

◆ getEpicsStringPV() [2/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 563 of file DQMHistAnalysis.cc.

564{
565 status = false;
566 char value[40] = "";
567 if (!m_useEpics) return std::string(value);
568#ifdef _BELLE2_EPICS
569 if (index < 0 || index >= (int)m_epicsChID.size()) {
570 B2ERROR("Epics PV with " << index << " not registered!");
571 return std::string(value);
572 }
573 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value can't be assumed to be stable
574 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
575 // outstanding get requests are not automatically reissued following reconnect.
576 auto r = ca_get(DBR_STRING, m_epicsChID[index], value);
577 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
578 if (r == ECA_NORMAL) {
579 status = true;
580 return std::string(value);
581 } else {
582 CheckEpicsError(r, "Read PV (string) failed in ca_get or ca_pend_io failure", m_epicsChID[index]);
583 }
584#endif
585 return std::string(value);
586}

◆ getEventProcessed()

static int getEventProcessed ( void )
inlinestaticinherited

Get the number of processed events.

(Attention, asynch histogram updates!)

Returns
Processed events.

Definition at line 225 of file DQMHistAnalysis.h.

225{ 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, RootOutputModule, and StorageRootOutputModule.

Definition at line 133 of file Module.h.

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

◆ getHistList()

static HistList & getHistList ( )
inlinestaticinherited

Get the list of the histograms.

Returns
The list of the histograms.

Definition at line 188 of file DQMHistAnalysis.h.

188{ return s_histList;};

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 224 of file Module.h.

224{return m_logConfig;}

◆ getModules()

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

no submodules, return empty list

Implements PathElement.

Definition at line 505 of file Module.h.

505{ 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 131 of file DQMHistAnalysis.cc.

132{
133 auto obj = &s_monObjList[objName];
134 obj->SetName(objName.c_str());
135 return obj;
136}

◆ getMonObjList()

static MonObjList & getMonObjList ( )
inlinestaticinherited

Get the list of MonitoringObjects.

Returns
The list of the MonitoringObjects.

Definition at line 194 of file DQMHistAnalysis.h.

194{ 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 186 of file Module.h.

186{return m_name;}

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 196 of file Module.h.

196{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.

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 362 of file Module.h.

362{ 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}

◆ getProcessedEvents()

double getProcessedEvents ( )
private

Get number of processed events.

Definition at line 195 of file DQMHistAnalysisKLM.cc.

196{
198 B2WARNING("Either DAQ/Nevent is not found or Nevent = 0.");
199 /* Set the minimal number of processed events to 0 if we can't determine the processed events. */
201 }
203}
static int getEventProcessed(void)
Get the number of processed events.

◆ getPVPrefix()

static std::string & getPVPrefix ( void )
inlinestaticinherited

get global prefix for EPICS PVs

Returns
prefix in use

Definition at line 588 of file DQMHistAnalysis.h.

588{return m_PVPrefix;};

◆ 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 380 of file Module.h.

380{ return m_returnValue; }

◆ getRunType()

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

Get the list of the reference histograms.

Returns
The list of the reference histograms. Get the Run Type.
Run type string.

Definition at line 219 of file DQMHistAnalysis.h.

219{ return s_runType;};

◆ getSigma68()

double getSigma68 ( TH1 * h)
staticinherited

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 278 of file DQMHistAnalysis.cc.

279{
280 double probs[2] = {0.16, 1 - 0.16};
281 double quant[2] = {0, 0};
282 h->GetQuantiles(2, quant, probs);
283 const double sigma68 = (-quant[0] + quant[1]) / 2;
284 return sigma68;
285}

◆ getStatusColor()

DQMHistAnalysisModule::EStatusColor getStatusColor ( EStatus status)
staticinherited

Return color for canvas state.

Parameters
statuscanvas status
Returns
alarm color

Definition at line 708 of file DQMHistAnalysis.cc.

709{
710 // white color is the default, if no colorize
712 switch (stat) {
713 case c_StatusTooFew:
714 color = c_ColorTooFew; // Magenta or Gray
715 break;
716 case c_StatusDefault:
717 color = c_ColorDefault; // default no colors
718 break;
719 case c_StatusGood:
720 color = c_ColorGood; // Good
721 break;
722 case c_StatusWarning:
723 color = c_ColorWarning; // Warning
724 break;
725 case c_StatusError:
726 color = c_ColorError; // Severe
727 break;
728 default:
729 color = c_ColorDefault; // default no colors
730 break;
731 }
732 return color;
733}
EStatusColor
Status colors of histogram/canvas (corresponding to status)
@ 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
@ 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.

◆ 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:508

◆ getUseEpics()

static bool getUseEpics ( void )
inlinestaticinherited

Getter for EPICS usage.

Returns
flag is in use

Definition at line 571 of file DQMHistAnalysis.h.

571{return m_useEpics;};

◆ getUseEpicsReadOnly()

static bool getUseEpicsReadOnly ( void )
inlinestaticinherited

Getter EPICS flag in read only mode.

Returns
flag if read only

Definition at line 577 of file DQMHistAnalysis.h.

577{return m_epicsReadOnly;};

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 310 of file Module.h.

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

◆ hasDeltaPar()

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

Check if Delta histogram parameters exist for histogram.

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

Definition at line 106 of file DQMHistAnalysis.cc.

107{
108 std::string fullname;
109 if (dirname.size() > 0) {
110 fullname = dirname + "/" + histname;
111 } else {
112 fullname = histname;
113 }
114 return s_deltaList.find(fullname) != s_deltaList.end(); // contains() if we switch to C++20
115}

◆ 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 377 of file Module.h.

377{ 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 308 of file DQMHistAnalysis.cc.

309{
310 for (auto& it : s_histList) {
311 // attention, we must use reference, otherwise we work on a copy
312 it.second.resetBeforeEvent();
313 }
314 for (auto& it : s_deltaList) {
315 // attention, we must use reference, otherwise we work on a copy
316 it.second.setNotUpdated();
317 }
318
319 s_canvasUpdatedList.clear();
320}

◆ initialize()

void initialize ( void )
finaloverridevirtual

Initializer.

Reimplemented from Module.

Definition at line 71 of file DQMHistAnalysisKLM.cc.

72{
74
76 B2FATAL("The threshold used for hot channels is larger than the one for masked channels."
77 << LogVar("Threshold for hot channels", m_ThresholdForHot)
78 << LogVar("Threshold for masked channels", m_ThresholdForMasked));
79
80 // register plots for delta histogramming
81 addDeltaPar(m_histogramDirectoryName, "time_rpc", HistDelta::c_Entries, m_minEntries, 1);
82 addDeltaPar(m_histogramDirectoryName, "time_scintillator_bklm", HistDelta::c_Entries, m_minEntries, 1);
83 addDeltaPar(m_histogramDirectoryName, "time_scintillator_eklm", HistDelta::c_Entries, m_minEntries, 1);
84
85 // The FE ratio via pair: in c_Entries one fills far more slowly than other,
86 // leaving the pair out of sync and now use c_Events to update over the same event window.
87 addDeltaPar(m_histogramDirectoryName, "feStatus_bklm_scintillator_layers_0", HistDelta::c_Events, m_minEvents, 1);
88 addDeltaPar(m_histogramDirectoryName, "feStatus_bklm_scintillator_layers_1", HistDelta::c_Events, m_minEvents, 1);
89 addDeltaPar(m_histogramDirectoryName, "feStatus_eklm_plane_0", HistDelta::c_Events, m_minEvents, 1);
90 addDeltaPar(m_histogramDirectoryName, "feStatus_eklm_plane_1", HistDelta::c_Events, m_minEvents, 1);
91
92 //register EPICS PVs
93 registerEpicsPV("KLM:MaskedChannels", "MaskedChannels");
94 registerEpicsPV("KLM:DeadBarrelModules", "DeadBarrelModules");
95 registerEpicsPV("KLM:DeadEndcapModules", "DeadEndcapModules");
96
97 gROOT->cd();
98 std::string c_masked_channels_name = m_histogramDirectoryName + "/c_masked_channels";
99 m_c_masked_channels = new TCanvas((c_masked_channels_name).c_str());
100 std::string c_fe_bklm_ratio_name = m_histogramDirectoryName + "/c_fe_bklm_ratio";
101 m_c_fe_bklm_ratio = new TCanvas((c_fe_bklm_ratio_name).c_str());
102 std::string c_fe_eklm_ratio_name = m_histogramDirectoryName + "/c_fe_eklm_ratio";
103 m_c_fe_eklm_ratio = new TCanvas((c_fe_eklm_ratio_name).c_str());
104 // Feature extraction status histogram for BKLM
105 int bklmSectors = BKLMElementNumbers::getMaximalSectorGlobalNumber(); // 16
106 int eklmPlanes = EKLMElementNumbers::getMaximalPlaneGlobalNumber(); // 208
107 //BKLM
108 std::string fe_bklm_ratio_name = m_histogramDirectoryName + "/fe_bklm_ratio";
109 m_fe_bklm_ratio = new TH1F((fe_bklm_ratio_name).c_str(),
110 "FE Ratio in BKLM",
111 bklmSectors * 2, 0.5, 0.5 + bklmSectors * 2);
112 m_fe_bklm_ratio->GetXaxis()->SetTitle("Scintillator Layer number");
113 m_fe_bklm_ratio->SetStats(false);
114 m_fe_bklm_ratio->SetOption("HIST");
115 //EKLM
116 std::string fe_eklm_ratio_name = m_histogramDirectoryName + "/fe_eklm_ratio";
117 m_fe_eklm_ratio = new TH1F((fe_eklm_ratio_name).c_str(),
118 "FE Ratio in EKLM",
119 eklmPlanes, 0.5, 0.5 + eklmPlanes);
120 m_fe_eklm_ratio->GetXaxis()->SetTitle("Plane number");
121 m_fe_eklm_ratio->SetStats(false);
122 m_fe_eklm_ratio->SetOption("HIST");
123 /* Masked channels per sector. */
124 KLMSectorNumber totalSectors = m_SectorArrayIndex->getNElements();
125 m_MaskedChannelsHist = new TH1F("masked_channels", "Number of masked channels per sector",
126 totalSectors, -0.5, totalSectors - 0.5);
127
128 std::string str;
129 KLMChannelIndex klmIndex(KLMChannelIndex::c_IndexLevelSector);
130 for (const KLMChannelIndex& klmSector : klmIndex) {
131 std::string label = m_ElementNumbers->getSectorDAQName(klmSector.getSubdetector(), klmSector.getSection(), klmSector.getSector());
132 KLMSectorNumber sector = klmSector.getKLMSectorNumber();
133 KLMSectorNumber sectorIndex = m_SectorArrayIndex->getIndex(sector);
134 m_MaskedChannelsHist->GetXaxis()->SetBinLabel(sectorIndex + 1, label.c_str());
135 int nHistograms;
136 if (klmSector.getSubdetector() == KLMElementNumbers::c_BKLM)
137 nHistograms = 2;
138 else
139 nHistograms = 3;
140 for (int j = 0; j < nHistograms; j++) {
141 str = "strip_hits_subdetector_" +
142 std::to_string(klmSector.getSubdetector()) +
143 "_section_" + std::to_string(klmSector.getSection()) +
144 "_sector_" + std::to_string(klmSector.getSector()) +
145 "_" + std::to_string(j);
146 addDeltaPar(m_histogramDirectoryName, str, HistDelta::c_Entries, m_minEntries, 1);
147
148 }
149 }
150
151}
static constexpr int getMaximalSectorGlobalNumber()
Get maximal sector global number.
int registerEpicsPV(const std::string &pvname, const std::string &keyname="")
EPICS related Functions.
static MonitoringObject * getMonitoringObject(const std::string &name)
Get MonitoringObject with given name (new object is created if non-existing)
static void addDeltaPar(const std::string &dirname, const std::string &histname, HistDelta::EDeltaType t, int p, unsigned int a=1)
Add Delta histogram parameters.
static constexpr int getMaximalPlaneGlobalNumber()
Get maximal plane global number.

◆ makeStatus()

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

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 690 of file DQMHistAnalysis.cc.

691{
692 // white color is the default, if no colorize
693 if (!enough) {
694 return (c_StatusTooFew);
695 } else {
696 if (error_flag) {
697 return (c_StatusError);
698 } else if (warn_flag) {
699 return (c_StatusWarning);
700 } else {
701 return (c_StatusGood);
702 }
703 }
704
705 return (c_StatusDefault); // default, but should not be reached
706}

◆ printPVStatus()

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

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 758 of file DQMHistAnalysis.cc.

759{
760 if (pv == nullptr) {
761 B2WARNING("PV chid was nullptr");
762 return;
763 }
764 auto state = ca_state(pv);
765 switch (state) {
766 case cs_never_conn: /* valid chid, server not found or unavailable */
767 B2WARNING("Channel never connected " << ca_name(pv));
768 break;
769 case cs_prev_conn: /* valid chid, previously connected to server */
770 B2WARNING("Channel was connected, but now is not " << ca_name(pv));
771 break;
772 case cs_closed: /* channel deleted by user */
773 B2WARNING("Channel deleted already " << ca_name(pv));
774 break;
775 case cs_conn: /* valid chid, connected to server */
776 if (!onlyError) B2INFO("Channel connected and OK " << ca_name(pv));
777 break;
778 default:
779 B2WARNING("Undefined status for channel " << ca_name(pv));
780 break;
781 }
782}

◆ processFEHistogram()

void processFEHistogram ( TH1 * feHist,
const std::string & histName,
TCanvas * canvas )
private

Process histogram containing the efficiencies.

Parameters
[in]feHistHistogram itself.
[in]histNameName of the histogram.
[in]canvasCanvas of interest.

Definition at line 636 of file DQMHistAnalysisKLM.cc.

637{
638 if (!feHist) {
639 B2WARNING("processFEHistogram: feHist is null, exiting function.");
640 return;
641 }
642 if (!canvas) {
643 B2WARNING("processFEHistogram: canvas is null, cannot draw histograms.");
644 return;
645 }
646
647 /* Obtain plots necessary for FE Ratio plots */
648 auto* numerator = findHist(m_histogramDirectoryName + "/" + histName + "_0");
649 auto* denominator = findHist(m_histogramDirectoryName + "/" + histName + "_1");
650
651 feHist->Reset();
652 std::unique_ptr<TH1> feClone(static_cast<TH1*>(feHist->Clone())); // Clone feHist
653
654 canvas->cd();
655
656 if (denominator != nullptr && numerator != nullptr) {
657 // Clone numerator and denominator into unique_ptrs to ensure they are deleted automatically
658 auto tempNumerator = std::unique_ptr<TH1>(static_cast<TH1*>(numerator->Clone()));
659 auto tempSum = std::unique_ptr<TH1>(static_cast<TH1*>(denominator->Clone()));
660
661 // Add numerator to denominator to get the sum (denominator + numerator)
662 tempSum->Add(numerator);
663
664 // Divide numerator by (denominator + numerator) and store result in feHist
665 feHist->Divide(tempNumerator.get(), tempSum.get(), 1.0, 1.0, "B");
666 feHist->Draw();
667
668 // Reference check
669 TH1* ref = findRefHist(feHist->GetName(), "", ERefScaling::c_RefScaleNone);
670 if (ref) {
671 ref->Draw("hist,same");
672 B2INFO("processFEHistogram: Found and drew reference histogram.");
673 } else {
674 B2WARNING("processFEHistogram: Reference histogram not found.");
675 }
676
677 canvas->Modified();
678 canvas->Update();
679 B2INFO("processFEHistogram: Updated canvas after first draw.");
680
681 /* Delta component */
682 // Use the latest available deltas, not only "updated in the same event".
683 auto deltaDenom = getDelta(m_histogramDirectoryName, histName + "_1", 0, false);
684 auto deltaNumer = getDelta(m_histogramDirectoryName, histName + "_0", 0, false);
685
686 UpdateCanvas(canvas->GetName(), (feHist != nullptr));
687 if (deltaNumer != nullptr && deltaDenom != nullptr) {
688 B2INFO("DQMHistAnalysisKLM: FE Ratio Delta Num/Denom Entries is "
689 << deltaNumer->GetEntries() << "/" << deltaDenom->GetEntries());
690
691 // Clone deltaNumer and deltaDenom into unique_ptrs to create the delta sum
692 auto deltaTempNumerator = std::unique_ptr<TH1>(static_cast<TH1*>(deltaNumer->Clone()));
693 auto deltaTempSum = std::unique_ptr<TH1>(static_cast<TH1*>(deltaDenom->Clone()));
694
695 // Add delta numerator and denominator
696 deltaTempSum->Add(deltaNumer);
697
698 // Divide deltaNumer by (deltaDenom + deltaNumer) and store in feClone
699 feClone->Divide(deltaTempNumerator.get(), deltaTempSum.get(), 1.0, 1.0, "B");
700 feClone->SetLineColor(kOrange);
701 feClone->DrawCopy("SAME");
702
703 canvas->Modified();
704 canvas->Update();
705 }
706 // If the deltas are not available yet (e.g. before the first MinEvents window
707 // has closed), silently skip drawing the delta overlay, consistent with the
708 // other histogram handlers (e.g. processTimeHistogram).
709 } else {
710 B2WARNING("processFEHistogram: Skipped histogram processing due to missing numerator/denominator.");
711 }
712}

◆ processPlaneHistogram() [1/2]

void processPlaneHistogram ( const std::string & histName,
TLatex & latex )
private

Process histogram containing the number of hits in plane.

Parameters
[in]histNameHistogram name.
[out]latexTLatex to draw messages.

Definition at line 629 of file DQMHistAnalysisKLM.cc.

631{
632 // Internally call the main function with a pointer to TLatex
633 processPlaneHistogram(histName, &latex, nullptr);
634}

◆ processPlaneHistogram() [2/2]

void processPlaneHistogram ( const std::string & histName,
TLatex * latex = nullptr,
TH1 * histogram = nullptr )
private

Process histogram containing the number of hits in plane.

Parameters
[in]histNameHistogram name.
[in]histogramHistogram.
[out]latexTLatex to draw messages.

Definition at line 501 of file DQMHistAnalysisKLM.cc.

503{
504 // If no histogram is provided, try to retrieve it by name
505 if (!histogram) {
506 histogram = findHist(m_histogramDirectoryName + "/" + histName);
507 if (!histogram) {
508 B2WARNING("KLM DQM histogram " + m_histogramDirectoryName + "/" << histName << " is not found.");
509 return;
510 }
511 }
512
513 TCanvas* canvas = findCanvas(m_histogramDirectoryName + "/c_" + histName);
514 if (!canvas) {
515 B2WARNING("KLM DQM histogram canvas " + m_histogramDirectoryName + "/c_" << histName << " is not found.");
516 return;
517 }
518 // Set up the canvas
519 canvas->Clear();
520 canvas->cd();
521 histogram->SetStats(false);
522 histogram->Draw();
523
524 // Overlay reference histogram if available
525 TH1* ref = findRefHist(histogram->GetName(), "", ERefScaling::c_RefScaleEntries, histogram);
526 if (ref) {
527 ref->Draw("hist,same");
528 }
529
530 // Define variables for text and alarm positioning
531 double xAlarm = 0.15, yAlarm = 0.8;
532 int message_counter = 0;
533 std::string name;
534
535 // Determine if histogram is BKLM or EKLM and process accordingly
536 bool isBKLM = histName.find("bklm") != std::string::npos;
537
538 // Check if "fe" is in histName to adjust maximalLayer
539 bool isFE = histName.find("fe") != std::string::npos;
540
541 if (isBKLM) {
542 // Use a different maximalLayer if "fe" is found in the name
543 const int maximalLayer = isFE ? BKLMElementNumbers::getMaximalSectorGlobalNumber() / 8 :
545
546 for (int sector = 0; sector < BKLMElementNumbers::getMaximalSectorGlobalNumber(); ++sector) {
547 int bin = maximalLayer * sector + 1;
548 double xLine = histogram->GetXaxis()->GetBinLowEdge(bin);
549 double xText = histogram->GetXaxis()->GetBinLowEdge(bin + maximalLayer / 2);
550 double yText = gPad->GetUymin() + 0.98 * (gPad->GetUymax() - gPad->GetUymin());
551
552 if (sector > 0) {
553 m_PlaneLine.DrawLine(xLine, gPad->GetUymin(), xLine, gPad->GetUymax());
554 }
555
556 name = (sector < BKLMElementNumbers::getMaximalSectorNumber() ? "BB" : "BF") +
557 std::to_string(sector % BKLMElementNumbers::getMaximalSectorNumber());
558 m_PlaneText.DrawText(xText, yText, name.c_str());
559 }
560 // Only update canvas status if latex is provided
561 if (latex) {
562 updateCanvasStatus(canvas, m_DeadBarrelModules, latex, message_counter, xAlarm, yAlarm);
563 }
564 } else {
565 const double maximalLayer = EKLMElementNumbers::getMaximalLayerGlobalNumber();
567
568 for (int layerGlobal = 1; layerGlobal <= maximalLayer; ++layerGlobal) {
569 int bin = maxPlane * layerGlobal + 1;
570 double xLine = histogram->GetXaxis()->GetBinLowEdge(bin);
571 double xText = histogram->GetXaxis()->GetBinLowEdge(bin - maxPlane / 2);
572 double yText = gPad->GetUymin() + 0.98 * (gPad->GetUymax() - gPad->GetUymin());
573
574 if (layerGlobal < maximalLayer) {
575 m_PlaneLine.DrawLine(xLine, gPad->GetUymin(), xLine, gPad->GetUymax());
576 }
577
578 int section, layer;
579 m_EklmElementNumbers->layerNumberToElementNumbers(layerGlobal, &section, &layer);
580 name = (section == EKLMElementNumbers::c_BackwardSection ? "B" : "F") + std::to_string(layer);
581 m_PlaneText.DrawText(xText, yText, name.c_str());
582 }
583
584 // Only update canvas status if latex is provided
585 if (latex) {
586 updateCanvasStatus(canvas, m_DeadEndcapModules, latex, message_counter, xAlarm, yAlarm);
587 }
588 }
589
590 // Display additional message if message threshold exceeded
591 if (latex && message_counter > m_MessageThreshold) {
592 std::string verbose_string = std::to_string(message_counter - m_MessageThreshold) + " more messages";
593 latex->DrawLatexNDC(xAlarm, yAlarm, verbose_string.c_str());
594 }
595
596 canvas->Modified();
597 canvas->Update();
598}
static constexpr int getMaximalLayerNumber()
Get maximal layer number (1-based).
void updateCanvasStatus(TCanvas *canvas, const std::vector< KLMModuleNumber > &deadModules, TLatex *latex, int &message_counter, double xAlarm, double yAlarm)
Helper function to update the canvas status based on dead modules.
static constexpr int getMaximalLayerGlobalNumber()
Get maximal detector layer global number.
static constexpr int getMaximalSectorNumber()
Get maximal sector number.
static constexpr int getMaximalPlaneNumber()
Get maximal plane number.

◆ processSpatial2DHitEndcapHistogram()

void processSpatial2DHitEndcapHistogram ( uint16_t section,
TH2F * histogram,
TCanvas * canvas )
private

Process spatial 2D hits histograms for endcap.

Parameters
[in]sectionSection.
[in]histogramHistogram.
[in]canvasCanvas.

Definition at line 422 of file DQMHistAnalysisKLM.cc.

424{
425 canvas->Clear();
426 canvas->cd();
427 histogram->SetStats(false);
428 histogram->Draw("COLZ");
429 /* Draw the lines only for the backward layers. */
431 m_2DHitsLine.DrawLine(-110, 80, -110, 190);
432 m_2DHitsLine.DrawLine(-110, 190, 110, 190);
433 m_2DHitsLine.DrawLine(110, 80, 110, 190);
434 m_2DHitsLine.DrawLine(-110, 80, 110, 80);
435 }
436 canvas->Modified();
437 canvas->Update();
438}

◆ processTimeHistogram()

void processTimeHistogram ( const std::string & histName)
private

Process histogram containing the hit times.

Parameters
[in]histNameHistogram name.

Definition at line 440 of file DQMHistAnalysisKLM.cc.

442{
443 TH1* histogram = findHist(m_histogramDirectoryName + "/" + histName);
444 if (histogram == nullptr) {
445 B2WARNING("KLM DQM histogram " + m_histogramDirectoryName + "/" << histName << " is not found.");
446 return;
447 }
448
449 TCanvas* canvas = findCanvas(m_histogramDirectoryName + "/c_" + histName);
450 if (canvas == nullptr) {
451 B2WARNING("KLM DQM histogram canvas " + m_histogramDirectoryName + "/c_" << histName << " is not found.");
452 return;
453 }
454
455 else {
456 canvas->Clear();
457 canvas->cd();
458 histogram->Draw();
459 /* calling on delta histogram*/
460 TH1* delta = getDelta(m_histogramDirectoryName, histName);
461 UpdateCanvas(canvas->GetName(), delta != nullptr); //keeping this for testing purposes
462 if (delta != nullptr) {
463 B2INFO("DQMHistAnalysisKLM: Time Delta Entries is " << delta->GetEntries());
464 deltaDrawer(delta, histogram, canvas);
465 }
466 //reference check
467 TH1* ref = findRefHist(histogram->GetName(), "", ERefScaling::c_RefScaleEntries, histogram);
468 if (ref) {ref->Draw("hist,same");}
469 }
470}

◆ registerEpicsPV()

int registerEpicsPV ( const std::string & pvname,
const 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 373 of file DQMHistAnalysis.cc.

374{
375 return registerEpicsPVwithPrefix(m_PVPrefix, pvname, keyname);
376}
static std::string m_PVPrefix
The Prefix for EPICS PVs.
int registerEpicsPVwithPrefix(const std::string &prefix, const std::string &pvname, const std::string &keyname="")
Register a PV with its name and a key name.

◆ registerEpicsPVwithPrefix()

int registerEpicsPVwithPrefix ( const std::string & prefix,
const std::string & pvname,
const 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 383 of file DQMHistAnalysis.cc.

385{
386 if (!m_useEpics) return -1;
387#ifdef _BELLE2_EPICS
388 if (m_epicsNameToChID[pvname] != nullptr) {
389 B2ERROR("Epics PV " << pvname << " already registered!");
390 return -1;
391 }
392 if (keyname != "" && m_epicsNameToChID[keyname] != nullptr) {
393 B2ERROR("Epics PV with key " << keyname << " already registered!");
394 return -1;
395 }
396
397 m_epicsChID.emplace_back();
398 auto ptr = &m_epicsChID.back();
399 if (!ca_current_context()) SEVCHK(ca_context_create(ca_disable_preemptive_callback), "ca_context_create");
400 // the subscribed name includes the prefix, the map below does *not*
401 CheckEpicsError(ca_create_channel((prefix + pvname).data(), NULL, NULL, 10, ptr), "ca_create_channel failure", pvname);
402
403 m_epicsNameToChID[pvname] = *ptr;
404 if (keyname != "") m_epicsNameToChID[keyname] = *ptr;
405 return m_epicsChID.size() - 1; // return index to last added item
406#else
407 return -1;
408#endif
409}

◆ registerExternalEpicsPV()

int registerExternalEpicsPV ( const std::string & pvname,
const 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 378 of file DQMHistAnalysis.cc.

379{
380 return registerEpicsPVwithPrefix(std::string(""), pvname, keyname);
381}

◆ 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 655 of file DQMHistAnalysis.cc.

657{
658 // get warn and error limit only if pv exists
659 // overwrite only if limit is defined (not NaN)
660 // user should initialize with NaN before calling, unless
661 // some "default" values should be set otherwise
662 if (pv != nullptr) {
663 struct dbr_ctrl_double tPvData;
664 // From EPICS doc. When ca_get or ca_array_get are invoked the returned channel value can't be assumed to be stable
665 // in the application supplied buffer until after ECA_NORMAL is returned from ca_pend_io. If a connection is lost
666 // outstanding get requests are not automatically reissued following reconnect.
667 auto r = ca_get(DBR_CTRL_DOUBLE, pv, &tPvData);
668 if (r == ECA_NORMAL) r = ca_pend_io(5.0); // this is needed!
669 if (r == ECA_NORMAL) {
670 if (!std::isnan(tPvData.lower_alarm_limit)) {
671 lowerAlarm = tPvData.lower_alarm_limit;
672 }
673 if (!std::isnan(tPvData.lower_warning_limit)) {
674 lowerWarn = tPvData.lower_warning_limit;
675 }
676 if (!std::isnan(tPvData.upper_warning_limit)) {
677 upperWarn = tPvData.upper_warning_limit;
678 }
679 if (!std::isnan(tPvData.upper_alarm_limit)) {
680 upperAlarm = tPvData.upper_alarm_limit;
681 }
682 return true;
683 } else {
684 CheckEpicsError(r, "Reading PV Limits failed in ca_get or ca_pend_io failure", pv);
685 }
686 }
687 return false;
688}

◆ requestLimitsFromEpicsPVs() [2/3]

bool requestLimitsFromEpicsPVs ( const 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 643 of file DQMHistAnalysis.cc.

645{
646 return requestLimitsFromEpicsPVs(getEpicsPVChID(name), lowerAlarm, lowerWarn, upperWarn, upperAlarm);
647}
chid getEpicsPVChID(const std::string &keyname)
Get EPICS PV Channel Id.
bool requestLimitsFromEpicsPVs(chid id, double &lowerAlarm, double &lowerWarn, double &upperWarn, double &upperAlarm)
Get Alarm Limits from EPICS PV.

◆ requestLimitsFromEpicsPVs() [3/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 649 of file DQMHistAnalysis.cc.

651{
652 return requestLimitsFromEpicsPVs(getEpicsPVChID(index), lowerAlarm, lowerWarn, upperWarn, upperAlarm);
653}

◆ resetDeltaList()

void resetDeltaList ( void )
staticinherited

Reset Delta.

Definition at line 332 of file DQMHistAnalysis.cc.

333{
334 for (auto& d : s_deltaList) {
335 d.second.reset();
336 }
337}

◆ scaleReference()

TH1 * scaleReference ( ERefScaling scaling,
const TH1 * hist,
TH1 * ref )
staticinherited

Using the original and reference, create scaled version.

Parameters
scalingscaling algorithm
histpointer to histogram
refpointer to reference
Returns
scaled reference

Definition at line 171 of file DQMHistAnalysis.cc.

172{
173 // if hist/ref is nullptr, nothing to do
174 if (!hist || !ref)
175 return ref;
176
177 switch (scaling) {
178 // default: do nothing
179 case ERefScaling::c_RefScaleNone: //do nothing
180 break;
181 case ERefScaling::c_RefScaleEntries: // Integral
182 // only if we have entries in reference
183 if (hist->Integral() != 0 and ref->Integral() != 0) {
184 ref->Scale(hist->Integral() / ref->Integral());
185 }
186 break;
187 case ERefScaling::c_RefScaleMax: // Maximum
188 // only if we have entries in reference
189 if (hist->GetMaximum() != 0 and ref->GetMaximum() != 0) {
190 ref->Scale(hist->GetMaximum() / ref->GetMaximum());
191 }
192 break;
193 }
194 return ref;
195}
@ c_RefScaleMax
to maximum (bin entry)

◆ 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}
std::string m_description
The description of the module.
Definition Module.h:510

◆ setEpicsPV() [1/4]

void setEpicsPV ( const 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 411 of file DQMHistAnalysis.cc.

412{
413 if (!m_useEpics || m_epicsReadOnly) return;
414#ifdef _BELLE2_EPICS
415 if (m_epicsNameToChID[keyname] == nullptr) {
416 B2ERROR("Epics PV " << keyname << " not registered!");
417 return;
418 }
419 CheckEpicsError(ca_put(DBR_DOUBLE, m_epicsNameToChID[keyname], &value), "ca_set failure", keyname);
420#endif
421}
static bool m_epicsReadOnly
Flag if to use EPICS in ReadOnly mode (for reading limits) do not set by yourself,...

◆ setEpicsPV() [2/4]

void setEpicsPV ( const 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 423 of file DQMHistAnalysis.cc.

424{
425 if (!m_useEpics || m_epicsReadOnly) return;
426#ifdef _BELLE2_EPICS
427 if (m_epicsNameToChID[keyname] == nullptr) {
428 B2ERROR("Epics PV " << keyname << " not registered!");
429 return;
430 }
431 CheckEpicsError(ca_put(DBR_SHORT, m_epicsNameToChID[keyname], &value), "ca_set failure", keyname);
432#endif
433}

◆ setEpicsPV() [3/4]

void setEpicsPV ( int index,
double value )
inherited

Write value to a EPICS PV.

Parameters
indexindex of PV
valuevalue to write

Definition at line 453 of file DQMHistAnalysis.cc.

454{
455 if (!m_useEpics || m_epicsReadOnly) return;
456#ifdef _BELLE2_EPICS
457 if (index < 0 || index >= (int)m_epicsChID.size()) {
458 B2ERROR("Epics PV with " << index << " not registered!");
459 return;
460 }
461 CheckEpicsError(ca_put(DBR_DOUBLE, m_epicsChID[index], &value), "ca_set failure", m_epicsChID[index]);
462#endif
463}

◆ setEpicsPV() [4/4]

void setEpicsPV ( int index,
int value )
inherited

Write value to a EPICS PV.

Parameters
indexindex of PV
valuevalue to write

Definition at line 465 of file DQMHistAnalysis.cc.

466{
467 if (!m_useEpics || m_epicsReadOnly) return;
468#ifdef _BELLE2_EPICS
469 if (index < 0 || index >= (int)m_epicsChID.size()) {
470 B2ERROR("Epics PV with " << index << " not registered!");
471 return;
472 }
473 CheckEpicsError(ca_put(DBR_SHORT, m_epicsChID[index], &value), "ca_set failure", m_epicsChID[index]);
474#endif
475}

◆ setEpicsStringPV() [1/2]

void setEpicsStringPV ( const std::string & keyname,
const 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 435 of file DQMHistAnalysis.cc.

436{
437 if (!m_useEpics || m_epicsReadOnly) return;
438#ifdef _BELLE2_EPICS
439 if (m_epicsNameToChID[keyname] == nullptr) {
440 B2ERROR("Epics PV " << keyname << " not registered!");
441 return;
442 }
443 if (value.length() > 40) {
444 B2ERROR("Epics string PV " << keyname << " too long (>40 characters)!");
445 return;
446 }
447 char text[40];
448 strcpy(text, value.c_str());
449 CheckEpicsError(ca_put(DBR_STRING, m_epicsNameToChID[keyname], text), "ca_set failure", keyname);
450#endif
451}

◆ setEpicsStringPV() [2/2]

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

Write string to a EPICS PV.

Parameters
indexindex of PV
valuestring to write

Definition at line 477 of file DQMHistAnalysis.cc.

478{
479 if (!m_useEpics || m_epicsReadOnly) return;
480#ifdef _BELLE2_EPICS
481 if (index < 0 || index >= (int)m_epicsChID.size()) {
482 B2ERROR("Epics PV with " << index << " not registered!");
483 return;
484 }
485 char text[41];
486 strncpy(text, value.c_str(), 40);
487 text[40] = 0;
488 CheckEpicsError(ca_put(DBR_STRING, m_epicsChID[index], text), "ca_set failure", m_epicsChID[index]);
489#endif
490}

◆ setEventProcessed()

static void setEventProcessed ( int e)
inlinestaticinherited

Set the number of processed events.

(Attention, asynch histogram updates!)

Parameters
eProcessed events.

Definition at line 237 of file DQMHistAnalysis.h.

237{s_eventProcessed = e;};

◆ setLogConfig()

void setLogConfig ( const LogConfig & logConfig)
inlineinherited

Set the log system configuration.

Definition at line 229 of file Module.h.

229{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 213 of file Module.h.

213{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList & params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 500 of file Module.h.

500{ 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}
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:200
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition LogSystem.cc:28
LogConfig & getLogConfig()
Returns the log system configuration.
Definition Module.h:224
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition Module.h:507
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()

static void setPVPrefix ( const std::string & prefix)
inlinestaticinherited

set global prefix for EPICS PVs

Parameters
prefixPrefix to set

Definition at line 594 of file DQMHistAnalysis.h.

594{ 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()

static void setRunType ( const std::string & t)
inlinestaticinherited

Set the Run Type.

Parameters
tRun type string.

Definition at line 231 of file DQMHistAnalysis.h.

231{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()

static void setUseEpics ( bool flag)
inlinestaticinherited

Setter for EPICS usage.

Parameters
flagset in use

Definition at line 559 of file DQMHistAnalysis.h.

559{m_useEpics = flag;};

◆ setUseEpicsReadOnly()

static void setUseEpicsReadOnly ( bool flag)
inlinestaticinherited

Setter EPICS flag in read only mode.

Parameters
flagset read only

Definition at line 565 of file DQMHistAnalysis.h.

565{m_epicsReadOnly = flag;};

◆ StringSplit()

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

Helper function for string token split.

Parameters
sString to split
delimdelimiter
Returns
vector of strings

Definition at line 287 of file DQMHistAnalysis.cc.

288{
289 std::vector <std::string> out;
290 boost::split(out, in, [delim](char c) {return c == delim;});
291 return out;
292}

◆ terminate()

void terminate ( void )
finaloverridevirtual

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

Reimplemented from Module.

Definition at line 153 of file DQMHistAnalysisKLM.cc.

154{
155}

◆ UpdateCanvas() [1/2]

void UpdateCanvas ( const std::string & name,
bool updated = true )
staticinherited

Mark canvas as updated (or not)

Parameters
namename of Canvas
updatedwas updated

Definition at line 339 of file DQMHistAnalysis.cc.

340{
341 s_canvasUpdatedList[name] = updated;
342}

◆ UpdateCanvas() [2/2]

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

Mark canvas as updated (or not)

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

Definition at line 344 of file DQMHistAnalysis.cc.

345{
346 if (c) UpdateCanvas(c->GetName(), updated);
347}

◆ updateCanvasStatus()

void updateCanvasStatus ( TCanvas * canvas,
const std::vector< KLMModuleNumber > & deadModules,
TLatex * latex,
int & message_counter,
double xAlarm,
double yAlarm )
private

Helper function to update the canvas status based on dead modules.

Parameters
[in]canvasCanvas of interest.
[in]deadModulesList of dead modules.
[in]latexLaTeX object to render text annotations.
[out]message_counterCounter for how many messages are drawn.
[out]xAlarmX-position for the alarm messages.
[out]yAlarmY-position for the alarm messages.

Definition at line 601 of file DQMHistAnalysisKLM.cc.

604{
605 if (deadModules.empty()) {
608 for (const KLMModuleNumber& module : deadModules) {
609 int moduleSubdetector, moduleSection, moduleSector, moduleLayer;
610 m_ElementNumbers->moduleNumberToElementNumbers(module, &moduleSubdetector, &moduleSection, &moduleSector, &moduleLayer);
611
612 std::string alarm = "No data from " + m_ElementNumbers->getSectorDAQName(moduleSubdetector, moduleSection, moduleSector)
613 + ", layer " + std::to_string(moduleLayer);
614 message_counter++;
615 if (message_counter <= m_MessageThreshold) {
616 latex->DrawLatexNDC(xAlarm, yAlarm, alarm.c_str());
617 yAlarm -= 0.05;
618 }
619 }
620 if (!m_IsNullRun) {
622 }
623 } else {
625 }
626}

◆ 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 616 of file DQMHistAnalysis.cc.

617{
618 int state = ECA_NORMAL;
619 if (!m_useEpics) return state;
620#ifdef _BELLE2_EPICS
621 if (wait > 0.) {
622 state = ca_pend_io(wait);
623 SEVCHK(state, "ca_pend_io failure");
624 }
625#endif
626 return state;
627}

Member Data Documentation

◆ m_2DHitsLine

TLine m_2DHitsLine
private

TLine for background region in 2d hits histograms.

Definition at line 217 of file DQMHistAnalysisKLM.h.

◆ m_c_fe_bklm_ratio

TCanvas* m_c_fe_bklm_ratio = nullptr
private

Canvas for BKLM plane events fraction w/ FE.

Definition at line 229 of file DQMHistAnalysisKLM.h.

◆ m_c_fe_eklm_ratio

TCanvas* m_c_fe_eklm_ratio = nullptr
private

Canvas for EKLM plane events fraction w/ FE.

Definition at line 235 of file DQMHistAnalysisKLM.h.

◆ m_c_masked_channels

TCanvas* m_c_masked_channels = nullptr
private

Canvas for masked channels per sector summary.

Definition at line 214 of file DQMHistAnalysisKLM.h.

◆ m_ChannelArrayIndex

const KLMChannelArrayIndex* m_ChannelArrayIndex
private

KLM channel array index.

Definition at line 241 of file DQMHistAnalysisKLM.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 520 of file Module.h.

◆ m_DeadBarrelModules

std::vector<uint16_t> m_DeadBarrelModules
private

Vector of dead barrel modules.

Definition at line 202 of file DQMHistAnalysisKLM.h.

◆ m_DeadEndcapModules

std::vector<uint16_t> m_DeadEndcapModules
private

Vector of dead endcap modules.

Definition at line 205 of file DQMHistAnalysisKLM.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 510 of file Module.h.

◆ m_EklmElementNumbers

const EKLMElementNumbers* m_EklmElementNumbers
private

EKLM element numbers.

Definition at line 250 of file DQMHistAnalysisKLM.h.

◆ m_ElectronicsMap

DBObjPtr<KLMElectronicsMap> m_ElectronicsMap
private

Electronics map.

Definition at line 253 of file DQMHistAnalysisKLM.h.

◆ m_ElementNumbers

const KLMElementNumbers* m_ElementNumbers
private

KLM element numbers.

Definition at line 247 of file DQMHistAnalysisKLM.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 159 of file DQMHistAnalysis.h.

◆ m_fe_bklm_ratio

TH1* m_fe_bklm_ratio = nullptr
private

Histogram for BKLM plane events fraction w/ FE.

Definition at line 226 of file DQMHistAnalysisKLM.h.

◆ m_fe_eklm_ratio

TH1* m_fe_eklm_ratio = nullptr
private

Histogram for EKLM plane events fraction w/ FE.

Definition at line 232 of file DQMHistAnalysisKLM.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 517 of file Module.h.

◆ m_histogramDirectoryName

std::string m_histogramDirectoryName
private

Name of histogram directory.

Definition at line 199 of file DQMHistAnalysisKLM.h.

◆ m_IsNullRun

bool m_IsNullRun
private

Run type flag for null runs.

Definition at line 238 of file DQMHistAnalysisKLM.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 513 of file Module.h.

◆ m_MaskedChannels

std::vector<uint16_t> m_MaskedChannels
private

Vector of masked channels.

Definition at line 208 of file DQMHistAnalysisKLM.h.

◆ m_MaskedChannelsHist

TH1* m_MaskedChannelsHist = nullptr
private

Histogram for masked channels per sector.

Definition at line 211 of file DQMHistAnalysisKLM.h.

◆ m_MessageThreshold

int m_MessageThreshold
private

Message Threshold for expert pots.

Definition at line 184 of file DQMHistAnalysisKLM.h.

◆ m_minEntries

double m_minEntries
private

Minimal number of entries for delta histogram update.

Definition at line 193 of file DQMHistAnalysisKLM.h.

◆ m_minEvents

double m_minEvents
private

Minimal number of processed events for delta histogram update.

Definition at line 196 of file DQMHistAnalysisKLM.h.

◆ m_MinHitsForFlagging

int m_MinHitsForFlagging
private

Minimal number of hits for flagging.

Definition at line 181 of file DQMHistAnalysisKLM.h.

◆ m_MinProcessedEventsForMessages

double m_MinProcessedEventsForMessages
private

Minimal number of processed events for error messages.

Definition at line 190 of file DQMHistAnalysisKLM.h.

◆ m_MinProcessedEventsForMessagesInput

double m_MinProcessedEventsForMessagesInput
private

Input parameter for minimal number of processed events for error messages.

Definition at line 187 of file DQMHistAnalysisKLM.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 515 of file Module.h.

◆ m_monObj

MonitoringObject* m_monObj {}
private

Monitoring object.

Definition at line 256 of file DQMHistAnalysisKLM.h.

256{};

◆ m_name

std::string m_name
privateinherited

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

Definition at line 507 of file Module.h.

◆ m_package

std::string m_package
privateinherited

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

Definition at line 509 of file Module.h.

◆ m_PlaneLine

TLine m_PlaneLine
private

TLine for boundary in plane histograms.

Definition at line 220 of file DQMHistAnalysisKLM.h.

◆ m_PlaneText

TText m_PlaneText
private

TText for names in plane histograms.

Definition at line 223 of file DQMHistAnalysisKLM.h.

◆ m_ProcessedEvents

double m_ProcessedEvents
private

Number of processed events.

Definition at line 169 of file DQMHistAnalysisKLM.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

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

Definition at line 511 of file Module.h.

◆ m_PVPrefix

std::string m_PVPrefix = "TEST:"
staticprivateinherited

The Prefix for EPICS PVs.

Definition at line 164 of file DQMHistAnalysis.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 518 of file Module.h.

◆ m_SectorArrayIndex

const KLMSectorArrayIndex* m_SectorArrayIndex
private

KLM sector array index.

Definition at line 244 of file DQMHistAnalysisKLM.h.

◆ m_ThresholdForHot

int m_ThresholdForHot
private

Threshold for hot channels.

Definition at line 175 of file DQMHistAnalysisKLM.h.

◆ m_ThresholdForLog

int m_ThresholdForLog
private

Threshold for log scale.

Definition at line 178 of file DQMHistAnalysisKLM.h.

◆ m_ThresholdForMasked

int m_ThresholdForMasked
private

Threshold for masked channels.

Definition at line 172 of file DQMHistAnalysisKLM.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 508 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 153 of file DQMHistAnalysis.h.

◆ s_canvasUpdatedList

DQMHistAnalysisModule::CanvasUpdatedList s_canvasUpdatedList
staticprivateinherited

The list of canvas updated status.

Definition at line 128 of file DQMHistAnalysis.h.

◆ s_deltaList

DQMHistAnalysisModule::DeltaList s_deltaList
staticinherited

The list of Delta Histograms and settings.

Definition at line 122 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 142 of file DQMHistAnalysis.h.

◆ s_histList

DQMHistAnalysisModule::HistList s_histList
staticprivateinherited

The list of Histograms.

Definition at line 112 of file DQMHistAnalysis.h.

◆ s_monObjList

DQMHistAnalysisModule::MonObjList s_monObjList
staticprivateinherited

The list of MonitoringObjects.

Definition at line 116 of file DQMHistAnalysis.h.

◆ s_refList

DQMHistAnalysisModule::RefList s_refList
staticprivateinherited

The list of references.

Definition at line 133 of file DQMHistAnalysis.h.

◆ s_runType

std::string s_runType = ""
inlinestaticprivateinherited

The Run type.

Definition at line 147 of file DQMHistAnalysis.h.


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