Belle II Software development
ECLDQMEXTENDEDModule Class Reference

This module is created to monitor ECL electronics logic in frame of DQM system. More...

#include <eclDQMExtended.h>

Inheritance diagram for ECLDQMEXTENDEDModule:
HistoModule Module PathElement

Public Types

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

 ECLDQMEXTENDEDModule ()
 < derived from HistoModule class.
 
virtual ~ECLDQMEXTENDEDModule () override
 Destructor.
 
virtual void initialize () override
 Initialize the module.
 
virtual void beginRun () override
 Call when a run begins.
 
virtual void event () override
 Event processor.
 
virtual void endRun () override
 Call when a run ends.
 
virtual void terminate () override
 Terminate.
 
virtual void defineHisto () override
 Function to define histograms.
 
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.
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

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

int conversion (int)
 Convert a CellID number to the global Shaper number.
 
const short int * vectorsplit (const std::vector< short int > &, int)
 Select from vector of DSP coeffs a subvector corresponding to accurate channel number.
 
void callbackCalibration (DBObjPtr< ECLCrystalCalib > &, std::vector< short int > &)
 Read calibration values for thresholds from DBObject.
 
void callbackCalibration (const ECLDspData *, std::map< std::string, std::vector< short int > > &, std::map< std::string, short int > &)
 Read DSP coeffs and auxiliary constants from DBObject.
 
void initDspfromDB ()
 Get DSP coeffs and auxiliary constants from DB.
 
void initDspfromFile ()
 Get DSP coeffs and auxiliary constants from Files.
 
void emulator (int, int, std::vector< int >)
 Call for DSP emulator.
 
std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

std::string m_histogramDirectoryName
 Histogram directory in ROOT file.
 
std::string m_InitKey
 Key to initialize DSP coeffs.
 
std::string m_DSPDirectoryName
 Directory name consisting of DSP coeffs.
 
std::string m_RunName
 Run with valid DSP coeffs.
 
bool m_SaveDetailedFitData
 Save detailed fit data for failed fits.
 
bool m_adjusted_timing
 Use modified time determination algorithm in emulator, same as in ShaperDSP version >= 1.4.3.
 
std::vector< int > m_skipEvents = {}
 Skip events with specified type of timing source (see TRGSummary class, ETimingType enum)
 
DBArray< ECLDspDatam_ECLDspDataArray0
 DBArray for payload 'ECLDSPPars0'.
 
DBArray< ECLDspDatam_ECLDspDataArray1
 DBArray for payload 'ECLDSPPars1'.
 
DBArray< ECLDspDatam_ECLDspDataArray2
 DBArray for payload 'ECLDSPPars2'.
 
StoreArray< ECLDigitm_ECLDigits
 ECL digits.
 
StoreArray< ECLTrigm_ECLTrigs
 ECL trigger data.
 
StoreArray< ECLDspm_ECLDsps
 ECL DSP data.
 
StoreObjPtr< TRGSummarym_TRGSummary
 StoreObjPtr TRGSummary

 
DBObjPtr< ECLCrystalCalibm_calibrationThrA0
 Low amplitude threshold.
 
DBObjPtr< ECLCrystalCalibm_calibrationThrAhard
 Hit threshold.
 
DBObjPtr< ECLCrystalCalibm_calibrationThrAskip
 Skip amplitude threshold.
 
ECL::ECLChannelMapper mapper
 ECL channel mapper.
 
std::map< int, std::map< std::string, std::vector< short int > > > map_container_vec
 Map to store DSP coeffs.
 
std::map< int, std::map< std::string, short int > > map_container_coef
 Map to store auxiliary constants for all shapers.
 
std::vector< short int > v_totalthrA0 = {}
 Vector to store Low amplitude thresholds.
 
std::vector< short int > v_totalthrAhard = {}
 Vector to store hit thresholds.
 
std::vector< short int > v_totalthrAskip = {}
 Vector to store skip amplitude threshold.
 
int m_AmpFit {0}
 Signal amplitude obtaining from DSP emulator.
 
int m_TimeFit {0}
 Signal time obtaining from DSP emulator.
 
int m_QualityFit {0}
 Quality flag obtaining from DSP emulator.
 
int m_AmpData {0}
 Signal amplitude from ECL data.
 
int m_TimeData {0}
 Signal time from ECL data.
 
int m_QualityData {0}
 Quality flag from ECL data.
 
int m_CellId {0}
 Cell ID number.
 
int m_TrigTime {0}
 Trigger time value.
 
std::vector< TH1F * > h_amp_timefail = {}
 Histogram vector: Amplitude for time mismacthes (AmplitudeFit == AmplitudeData) w/ various QualityData values.
 
std::vector< TH1F * > h_time_ampfail = {}
 Histogram vector: Time for amplitude mismathces (TimeFit == TimeData) w/ various QualityData values.
 
std::vector< std::vector< TH1F * > > h_amp_qualityfail = {}
 Histogram vector: AmplitudeData for quality mismathes w/ various QualityFit (raw) and QualityData (column) values.
 
std::vector< std::vector< TH1F * > > h_time_qualityfail = {}
 Histogram vector: TimeData for quality mismacthes w/ various QualitFit (raw) and QualityData (column) values.
 
TH1F * h_ampfail_quality {nullptr}
 Histogram: Amp.
 
TH1F * h_timefail_quality {nullptr}
 Histogram: Time control flags in bins of QualityData.
 
TH1F * h_ampfail_cellid {nullptr}
 Histogram: CellIDs w/ failed amplitudes.
 
TH1F * h_timefail_cellid {nullptr}
 Histogram: CellIDs w/ failed times.
 
TH1F * h_amptimefail_cellid {nullptr}
 Histogram: CellIDs w/ failed amplitudes and times.
 
TH1F * h_qualityfail_cellid {nullptr}
 Histogram: CellIDs w/ failed qualities.
 
TH1F * h_ampfail_shaperid {nullptr}
 Histogram: ShaperIDs w/ failed amplitudes.
 
TH1F * h_timefail_shaperid {nullptr}
 Histogram: ShaperIDs w/ failed times.
 
TH1F * h_amptimefail_shaperid {nullptr}
 Histogram: ShaperIDs w/ failed amplitudes and times.
 
TH1F * h_qualityfail_shaperid {nullptr}
 Histogram: ShaperIDs w/ failed qualities.
 
TH1F * h_fail_shaperid {nullptr}
 Histogram: ShaperIDs w/ failed logic.
 
TH1F * h_ampfail_crateid {nullptr}
 Histogram: CrateIDs w/ failed amplitudes.
 
TH1F * h_timefail_crateid {nullptr}
 Histogram: CrateIDs w/ failed times.
 
TH1F * h_amptimefail_crateid {nullptr}
 Histogram: CrateIDs w/ failed amplitudes and times.
 
TH1F * h_qualityfail_crateid {nullptr}
 Histogram: CrateIDs w/ failed qualities.
 
TH1F * h_fail_crateid {nullptr}
 Histogram: CrateIDs w/ failed logic.
 
TH2F * h_ampdiff_cellid {nullptr}
 Histogram: Amplitude diff.
 
TH2F * h_timediff_cellid {nullptr}
 Histogram: Time diff.
 
TH2F * h_ampdiff_shaperid {nullptr}
 Histogram: Amp.
 
TH2F * h_timediff_shaperid {nullptr}
 Histogram: Time diff.
 
TH2F * h_ampdiff_quality {nullptr}
 Histogram: Amp.
 
TH2F * h_timediff_quality {nullptr}
 Histogram: Time diff.
 
TH2F * h_quality_fit_data {nullptr}
 Histogram: QualityFit vs QualityData for quality fails.
 
TH2F * h_ampflag_qualityfail {nullptr}
 Histogram: Amp flag (0/1) w/ failed qualities in bins of QualityData.
 
TH2F * h_timeflag_qualityfail {nullptr}
 Histogram: Time flag (0/1) w/ failed qualities in bins of Quality Data.
 
TH1F * h_missing_ecldigits {nullptr}
 Histogram: Quality flag (from emulator) for the waveforms where fit result (ECLDigit) should have been saved but for some reason was not saved by ShaperDSP module.
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

This module is created to monitor ECL electronics logic in frame of DQM system.

Definition at line 44 of file eclDQMExtended.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

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

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

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

c_HistogramManager 

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

c_InternalSerializer 

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

c_TerminateInAllProcesses 

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

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

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

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

Constructor & Destructor Documentation

◆ ECLDQMEXTENDEDModule()

< derived from HistoModule class.

Constructor.

Definition at line 52 of file eclDQMExtended.cc.

53 : HistoModule(),
54 m_ECLDspDataArray0("ECLDSPPars0"),
55 m_ECLDspDataArray1("ECLDSPPars1"),
56 m_ECLDspDataArray2("ECLDSPPars2"),
57 m_calibrationThrA0("ECL_FPGA_LowAmp"),
58 m_calibrationThrAhard("ECL_FPGA_HitThresh"),
59 m_calibrationThrAskip("ECL_FPGA_StoreDigit")
60
61{
62
63 //Set module properties
64 setDescription("ECL Data Quality Monitor. Logic Test");
65 setPropertyFlags(c_ParallelProcessingCertified); // specify this flag if you need parallel processing
66 addParam("histogramDirectoryName", m_histogramDirectoryName,
67 "histogram directory in ROOT file", std::string("ECL"));
68 addParam("InitKey", m_InitKey,
69 "How to initialize DSP coeffs: ''DB'' or ''File'' are acceptable ", std::string("DB"));
70 addParam("DSPDirectoryName", m_DSPDirectoryName,
71 "directory for DSP coeffs", std::string("/hsm/belle2/bdata/users/dmitry/dsp/"));
72 addParam("RunName", m_RunName,
73 "Name of run with DSP files", std::string("run0000/"));
74 addParam("SaveDetailedFitData", m_SaveDetailedFitData, "Save detailed data "
75 "(ampdiff_{cellid,shaper}, timediff_{cellid,shaper} histograms) for "
76 "failed fits.", false);
77 addParam("AdjustedTiming", m_adjusted_timing, "Use improved procedure for "
78 "time determination in ShaperDSP emulator", true);
79
80 std::vector<int> default_skip = {
81 // By default, skip delayed bhabha and random trigger events
85 };
86 addParam("skipEvents", m_skipEvents, "Skip events that have listed timing "
87 "source (from TRGSummary)", default_skip);
88}
bool m_SaveDetailedFitData
Save detailed fit data for failed fits.
bool m_adjusted_timing
Use modified time determination algorithm in emulator, same as in ShaperDSP version >= 1....
std::vector< int > m_skipEvents
Skip events with specified type of timing source (see TRGSummary class, ETimingType enum)
DBArray< ECLDspData > m_ECLDspDataArray2
DBArray for payload 'ECLDSPPars2'.
DBObjPtr< ECLCrystalCalib > m_calibrationThrAhard
Hit threshold.
std::string m_InitKey
Key to initialize DSP coeffs.
DBObjPtr< ECLCrystalCalib > m_calibrationThrAskip
Skip amplitude threshold.
std::string m_histogramDirectoryName
Histogram directory in ROOT file.
DBArray< ECLDspData > m_ECLDspDataArray1
DBArray for payload 'ECLDSPPars1'.
std::string m_RunName
Run with valid DSP coeffs.
DBArray< ECLDspData > m_ECLDspDataArray0
DBArray for payload 'ECLDSPPars0'.
DBObjPtr< ECLCrystalCalib > m_calibrationThrA0
Low amplitude threshold.
std::string m_DSPDirectoryName
Directory name consisting of DSP coeffs.
HistoModule()
Constructor.
Definition: HistoModule.h:32
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ TTYP_DPHY
delayed physics events for background
Definition: TRGSummary.h:65
@ TTYP_POIS
poisson random trigger
Definition: TRGSummary.h:73
@ TTYP_RAND
random trigger events
Definition: TRGSummary.h:67
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560

◆ ~ECLDQMEXTENDEDModule()

~ECLDQMEXTENDEDModule ( )
overridevirtual

Destructor.

Definition at line 90 of file eclDQMExtended.cc.

91{
92}

Member Function Documentation

◆ beginRun()

void beginRun ( void  )
overridevirtual

Call when a run begins.

Reimplemented from HistoModule.

Definition at line 417 of file eclDQMExtended.cc.

418{
419 for (int i = 0; i < 4; i++) {
420 h_amp_timefail[i]->Reset();
421 h_time_ampfail[i]->Reset();
422 }
423 for (int i = 0; i < 4; i++) {
424 for (int j = 0; j < 3; j++) {
425 h_amp_qualityfail[i][j]->Reset();
426 h_time_qualityfail[i][j]->Reset();
427 }
428 }
429 h_ampfail_quality->Reset();
430 h_timefail_quality->Reset();
431 h_ampfail_cellid->Reset();
432 h_timefail_cellid->Reset();
433 h_amptimefail_cellid->Reset();
434 h_ampfail_shaperid->Reset();
435 h_timefail_shaperid->Reset();
436 h_amptimefail_shaperid->Reset();
437 h_ampfail_crateid->Reset();
438 h_timefail_crateid->Reset();
439 h_amptimefail_crateid->Reset();
440 h_qualityfail_cellid->Reset();
441 h_qualityfail_shaperid->Reset();
442 h_qualityfail_crateid->Reset();
444 h_ampdiff_cellid->Reset();
445 h_timediff_cellid->Reset();
446 h_ampdiff_shaperid->Reset();
447 h_timediff_shaperid->Reset();
448 }
449 h_ampdiff_quality->Reset();
450 h_timediff_quality->Reset();
451 h_quality_fit_data->Reset();
452 h_ampflag_qualityfail->Reset();
453 h_timeflag_qualityfail->Reset();
454 h_missing_ecldigits->Reset();
455}
TH2F * h_timediff_cellid
Histogram: Time diff.
TH1F * h_amptimefail_shaperid
Histogram: ShaperIDs w/ failed amplitudes and times.
TH2F * h_timediff_shaperid
Histogram: Time diff.
TH1F * h_ampfail_crateid
Histogram: CrateIDs w/ failed amplitudes.
TH1F * h_timefail_quality
Histogram: Time control flags in bins of QualityData.
TH1F * h_timefail_shaperid
Histogram: ShaperIDs w/ failed times.
TH1F * h_qualityfail_shaperid
Histogram: ShaperIDs w/ failed qualities.
TH2F * h_timediff_quality
Histogram: Time diff.
TH1F * h_qualityfail_crateid
Histogram: CrateIDs w/ failed qualities.
TH1F * h_amptimefail_crateid
Histogram: CrateIDs w/ failed amplitudes and times.
std::vector< TH1F * > h_amp_timefail
Histogram vector: Amplitude for time mismacthes (AmplitudeFit == AmplitudeData) w/ various QualityDat...
TH1F * h_amptimefail_cellid
Histogram: CellIDs w/ failed amplitudes and times.
TH2F * h_ampflag_qualityfail
Histogram: Amp flag (0/1) w/ failed qualities in bins of QualityData.
TH1F * h_timefail_crateid
Histogram: CrateIDs w/ failed times.
TH2F * h_quality_fit_data
Histogram: QualityFit vs QualityData for quality fails.
TH2F * h_ampdiff_quality
Histogram: Amp.
TH1F * h_ampfail_cellid
Histogram: CellIDs w/ failed amplitudes.
TH2F * h_ampdiff_shaperid
Histogram: Amp.
TH1F * h_ampfail_quality
Histogram: Amp.
TH2F * h_ampdiff_cellid
Histogram: Amplitude diff.
TH1F * h_ampfail_shaperid
Histogram: ShaperIDs w/ failed amplitudes.
TH1F * h_timefail_cellid
Histogram: CellIDs w/ failed times.
TH1F * h_qualityfail_cellid
Histogram: CellIDs w/ failed qualities.
std::vector< std::vector< TH1F * > > h_amp_qualityfail
Histogram vector: AmplitudeData for quality mismathes w/ various QualityFit (raw) and QualityData (co...
std::vector< TH1F * > h_time_ampfail
Histogram vector: Time for amplitude mismathces (TimeFit == TimeData) w/ various QualityData values.
TH2F * h_timeflag_qualityfail
Histogram: Time flag (0/1) w/ failed qualities in bins of Quality Data.
TH1F * h_missing_ecldigits
Histogram: Quality flag (from emulator) for the waveforms where fit result (ECLDigit) should have bee...
std::vector< std::vector< TH1F * > > h_time_qualityfail
Histogram vector: TimeData for quality mismacthes w/ various QualitFit (raw) and QualityData (column)...

◆ callbackCalibration() [1/2]

void callbackCalibration ( const ECLDspData dspdata,
std::map< std::string, std::vector< short int > > &  map1,
std::map< std::string, short int > &  map2 
)
private

Read DSP coeffs and auxiliary constants from DBObject.

Definition at line 281 of file eclDQMExtended.cc.

284{
285
286 dspdata->getF(map1["F"]);
287 dspdata->getF1(map1["F1"]);
288 dspdata->getF31(map1["F31"]);
289 dspdata->getF32(map1["F32"]);
290 dspdata->getF33(map1["F33"]);
291 dspdata->getF41(map1["F41"]);
292 dspdata->getF43(map1["F43"]);
293
294 map2["k_a"] = (short int)dspdata->getka();
295 map2["k_b"] = (short int)dspdata->getkb();
296 map2["k_c"] = (short int)dspdata->getkc();
297 map2["k_16"] = (short int)dspdata->gety0Startr();
298 map2["k_1"] = (short int)dspdata->getk1();
299 map2["k_2"] = (short int)dspdata->getk2();
300 map2["chi_thres"] = dspdata->getchiThresh();
301}
unsigned char getkb() const
Number of bits for FG32.
Definition: ECLDspData.h:200
short int getchiThresh() const
chi2 threshold for fit quality flag
Definition: ECLDspData.h:192
void getF43(std::vector< short int > &dst) const
Alternative for FG33 for signals with small amplitude.
Definition: ECLDspData.h:170
unsigned char gety0Startr() const
start point for pedestal calculation
Definition: ECLDspData.h:204
void getF(std::vector< short int > &dst) const
Array with tabulated signal waveform.
Definition: ECLDspData.h:140
void getF31(std::vector< short int > &dst) const
Array FG31, used to estimate signal amplitude.
Definition: ECLDspData.h:149
unsigned char getk2() const
multipliers power of 2 for chi2 calculation
Definition: ECLDspData.h:196
void getF33(std::vector< short int > &dst) const
Array FG33, used to estimate pedestal height in signal.
Definition: ECLDspData.h:162
unsigned char getka() const
Number of bits for FG31, FG41.
Definition: ECLDspData.h:198
unsigned char getk1() const
multipliers power of 2 for f, f1
Definition: ECLDspData.h:194
void getF32(std::vector< short int > &dst) const
Array FG32, used to estimate A * delta_t.
Definition: ECLDspData.h:156
void getF41(std::vector< short int > &dst) const
Alternative for FG31 for signals with small amplitude.
Definition: ECLDspData.h:166
void getF1(std::vector< short int > &dst) const
Array with tabulated derivative of signal waveform.
Definition: ECLDspData.h:144
unsigned char getkc() const
Number of bits for FG33, FG43.
Definition: ECLDspData.h:202

◆ callbackCalibration() [2/2]

void callbackCalibration ( DBObjPtr< ECLCrystalCalib > &  cal,
std::vector< short int > &  constants 
)
private

Read calibration values for thresholds from DBObject.

Definition at line 273 of file eclDQMExtended.cc.

274{
275 const std::vector<float> intermediate = cal->getCalibVector();
276 constants.resize(intermediate.size());
277 for (size_t i = 0; i < constants.size(); i++) constants[i] = (short int)intermediate[i];
278}

◆ clone()

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

Create an independent copy of this module.

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

Implements PathElement.

Definition at line 179 of file Module.cc.

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

◆ conversion()

int conversion ( int  cellID)
private

Convert a CellID number to the global Shaper number.

Definition at line 304 of file eclDQMExtended.cc.

305{
306 int iCrate = mapper.getCrateID(cellID);
307 int iShaperPosition = mapper.getShaperPosition(cellID);
308 return (iCrate - 1) * 12 + iShaperPosition;
309
310}
ECL::ECLChannelMapper mapper
ECL channel mapper.
int getShaperPosition(int cellID)
Get position of the shaper in the crate by given CellId.
int getCrateID(int iCOPPERNode, int iFINESSE, bool pcie40=false)
Get crate number by given COPPER node number and FINESSE number.

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

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

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

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

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

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

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

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

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

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

◆ defineHisto()

void defineHisto ( )
overridevirtual

Function to define histograms.

Reimplemented from HistoModule.

Definition at line 98 of file eclDQMExtended.cc.

99{
100 TDirectory* oldDir = gDirectory;
101
102 // Create a separate histogram directory and cd into it.
103
104 TDirectory* dirDAQ = dynamic_cast<TDirectory*>(oldDir->Get(m_histogramDirectoryName.c_str()));
105 if (!dirDAQ) dirDAQ = oldDir->mkdir(m_histogramDirectoryName.c_str());
106 dirDAQ->cd();
107
108 //1D histograms creation.
109
110 std::vector<TH1F*> h_amp_qualityfail_raw, h_time_qualityfail_raw;
111
112 for (int i = 0; i < 4; i++) {
113 std::string h_name_a, h_title_a, h_name_t, h_title_t;
114 h_name_a = str(boost::format("amp_timefail_q%1%") % i);
115 h_title_a = str(boost::format("Amp for time mismatches w/ FPGA fit qual=%1%") % i);
116 h_name_t = str(boost::format("time_ampfail_q%1%") % i);
117 h_title_t = str(boost::format("Time for amp mismatches w/ FPGA fit qual=%1%") % i);
118 TH1F* h_a = new TH1F(h_name_a.c_str(), h_title_a.c_str(), 1200, 0, 262144);
119 TH1F* h_t = new TH1F(h_name_t.c_str(), h_title_t.c_str(), 240, -2050, 2050);
120 h_amp_timefail.push_back(h_a);
121 h_time_ampfail.push_back(h_t);
122 }
123
124 for (int i = 0; i < 4; i++) {
125 for (int j = 0; j < 4; j++) {
126 if (j != i) {
127 std::string h_name_a, h_title_a, h_name_t, h_title_t;
128 h_name_a = str(boost::format("amp_qf%1%_qd%2%") % i % j);
129 h_title_a = str(boost::format("Amp for C++ fit qual=%1% and FPGA fit qual=%2%") % i % j);
130 h_name_t = str(boost::format("time_qf%1%_qd%2%") % i % j);
131 h_title_t = str(boost::format("Time for C++ fit qual=%1% and FPGA fit qual=%2%") % i % j);
132 TH1F* h_a = new TH1F(h_name_a.c_str(), h_title_a.c_str(), 1200, 0, 262144);
133 TH1F* h_t = new TH1F(h_name_t.c_str(), h_title_t.c_str(), 240, -2050, 2050);
134 h_amp_qualityfail_raw.push_back(h_a);
135 h_time_qualityfail_raw.push_back(h_t);
136 }
137 }
138 h_amp_qualityfail.push_back(h_amp_qualityfail_raw);
139 h_time_qualityfail.push_back(h_time_qualityfail_raw);
140 h_amp_qualityfail_raw.clear();
141 h_time_qualityfail_raw.clear();
142 }
143
144 h_ampfail_quality = new TH1F("ampfail_quality", "Number of FPGA <-> C++ fitter #bf{amp} inconsistencies vs fit qual", 5, -1, 4);
145 h_ampfail_quality->SetFillColor(kPink - 4);
146 h_ampfail_quality->GetXaxis()->SetTitle("FPGA fit qual. -1-all evts,0-good,1-int overflow,2-low amp,3-bad chi2");
147 h_ampfail_quality->SetDrawOption("hist");
148
149 h_timefail_quality = new TH1F("timefail_quality", "Number of FPGA <-> C++ fitter #bf{time} inconsistencies vs fit qual", 5, -1, 4);
150 h_timefail_quality->SetFillColor(kPink - 4);
151 h_timefail_quality->GetXaxis()->SetTitle("FPGA fit qual. -1-all evts,0-good,1-int overflow,2-low amp,3-bad chi2");
152
153 h_ampfail_cellid = new TH1F("ampfail_cellid", "Cell IDs w/ amp inconsistencies",
155 h_ampfail_cellid->GetXaxis()->SetTitle("Cell ID");
156
157 h_timefail_cellid = new TH1F("timefail_cellid", "Cell IDs w/ time inconsistencies",
159 h_timefail_cellid->GetXaxis()->SetTitle("Cell ID");
160
161 h_amptimefail_cellid = new TH1F("amptimefail_cellid", "Cell IDs w/ time and amp inconsistencies",
163 h_amptimefail_cellid->GetXaxis()->SetTitle("Cell ID");
164
165 h_ampfail_shaperid = new TH1F("ampfail_shaperid", "Shaper IDs w/ amp inconsistencies", 624, 1, 625);
166 h_ampfail_shaperid->GetXaxis()->SetTitle("Shaper ID");
167
168 h_timefail_shaperid = new TH1F("timefail_shaperid", "Shaper IDs w/ time inconsistencies", 624, 1, 625);
169 h_timefail_shaperid->GetXaxis()->SetTitle("Shaper ID");
170
171 h_amptimefail_shaperid = new TH1F("amptimefail_shaperid", "Shaper IDs w/ time and amp inconsistencies", 624, 1, 625);
172 h_amptimefail_shaperid->GetXaxis()->SetTitle("Shaper ID");
173
174 h_ampfail_crateid = new TH1F("ampfail_crateid", "Crate IDs w/ amp inconsistencies", 52, 1, 53);
175 h_ampfail_crateid->GetXaxis()->SetTitle("Crate ID (same as ECLCollector ID)");
176
177 h_timefail_crateid = new TH1F("timefail_crateid", "Crate IDs w/ time inconsistencies", 52, 1, 53);
178 h_timefail_crateid->GetXaxis()->SetTitle("Crate ID (same as ECLCollector ID)");
179
180 h_amptimefail_crateid = new TH1F("amptimefail_crateid", "Crate IDs w/ time and amp inconsistencies", 52, 1, 53);
181 h_amptimefail_crateid->GetXaxis()->SetTitle("Crate ID (same as ECLCollector ID)");
182
183 h_qualityfail_cellid = new TH1F("qualityfail_cellid", "Cell IDs w/ fit qual inconsistencies",
185 h_qualityfail_cellid->GetXaxis()->SetTitle("Cell ID");
186
187 h_qualityfail_shaperid = new TH1F("qualityfail_shaperid", "Shaper IDs w/ fit qual inconsistencies", 624, 1, 625);
188 h_qualityfail_shaperid->GetXaxis()->SetTitle("Shaper ID");
189
190 h_qualityfail_crateid = new TH1F("qualityfail_crateid", "Crate IDs w/ fit qual inconsistencies", 52, 1, 53);
191 h_qualityfail_crateid->GetXaxis()->SetTitle("Crate ID (same as ECLCollector ID)");
192
193 h_fail_shaperid = new TH1F("fail_shaperid", "Shaper IDs w/ inconsistencies", 624, 1, 625);
194 h_fail_shaperid->GetXaxis()->SetTitle("Shaper ID");
195
196 h_fail_crateid = new TH1F("fail_crateid", "Crate IDs w/ inconsistencies", 52, 1, 53);
197 h_fail_crateid->GetXaxis()->SetTitle("Crate ID (same as ECLCollector ID)");
198
199
200 //2D histograms creation.
201
203 h_ampdiff_cellid = new TH2F("ampdiff_cellid", "Amp. diff. (Emulator-Data) for amp inconsistencies",
205 h_ampdiff_cellid->GetXaxis()->SetTitle("Cell ID");
206 h_ampdiff_cellid->GetYaxis()->SetTitle("Amplitude difference");
207
208 h_timediff_cellid = new TH2F("timediff_cellid", "Time diff. (Emulator-Data) for time inconsistencies",
210 h_timediff_cellid->GetXaxis()->SetTitle("Cell ID");
211 h_timediff_cellid->GetYaxis()->SetTitle("Time difference");
212
213 h_ampdiff_shaperid = new TH2F("ampdiff_shaper", "Amp. diff. (Emulator-Data) "
214 "for amp inconsistencies vs Shaper Id",
215 624, 1, 625, 239, -262143, 262143);
216 h_ampdiff_shaperid->GetXaxis()->SetTitle("Shaper Id");
217 h_ampdiff_shaperid->GetYaxis()->SetTitle("Amplitude difference");
218
219 h_timediff_shaperid = new TH2F("timediff_shaper", "Time diff. (Emulator-Data) "
220 "for time inconsistencies vs Shaper Id",
221 624, 1, 625, 239, -4095, 4095);
222 h_timediff_shaperid->GetXaxis()->SetTitle("Shaper Id");
223 h_timediff_shaperid->GetYaxis()->SetTitle("Time difference");
224 }
225
226 h_ampdiff_quality = new TH2F("ampdiff_quality", "Amp. diff. (Emulator-Data) for amp. inconsistencies", 4, 0, 4, 239,
227 -262143, 262143);
228 h_ampdiff_quality->GetXaxis()->SetTitle("FPGA fit quality. 0-good, 1-int overflow, 2-low amp, 3-bad chi2");
229 h_ampdiff_quality->GetYaxis()->SetTitle("Amplitude difference");
230
231 h_timediff_quality = new TH2F("timediff_quality", "Time diff. (Emulator-Data) for time inconsistencies", 4, 0, 4, 239,
232 -4095, 4095);
233 h_timediff_quality->GetXaxis()->SetTitle("FPGA fit quality. 0-good, 1-int overflow, 2-low amp, 3-bad chi2");
234 h_timediff_quality->GetYaxis()->SetTitle("Time difference");
235
236 h_quality_fit_data = new TH2F("quality_fit_data", "C++ fitter vs FPGA, fit quality inconsistencies", 4, 0, 4, 4, 0, 4);
237 h_quality_fit_data->GetXaxis()->SetTitle("C++ fit qual. 0-good,1-int overflow,2-low amp,3-bad chi2");
238 h_quality_fit_data->GetYaxis()->SetTitle("FPGA fit qual. 0-good,1-int overflow,2-low amp,3-bad chi2");
239
240 h_ampflag_qualityfail = new TH2F("ampflag_qualityfail", "Amp flag (0/1) for fit qual inconsistencies", 4, 0, 4, 4, -1,
241 3);
242 h_ampflag_qualityfail->GetXaxis()->SetTitle("FPGA fit quality. 0-good,1-int overflow,2-low amp,3-bad chi2");
243 h_ampflag_qualityfail->GetYaxis()->SetTitle("Amp flag (0-amp consistent)");
244
245 h_timeflag_qualityfail = new TH2F("timeflag_qualityfail", "Time flag (0/1) for fit qual inconsistencies", 4, 0, 4, 4,
246 -1, 3);
247 h_timeflag_qualityfail->GetXaxis()->SetTitle("FPGA fit quality. 0-good,1-int overflow,2-low amp,3-bad chi2");
248 h_timeflag_qualityfail->GetYaxis()->SetTitle("Time flag (0-time consistent)");
249
250 h_missing_ecldigits = new TH1F("missing_ecldigits", "", 4, 0, 4);
251 h_missing_ecldigits->SetTitle("Fit quality flag for missing ECLDigits (missing fit results)");
252 h_missing_ecldigits->GetXaxis()->SetTitle("C++ fit quality. 0-good,1-int overflow,2-low amplitude,3-bad chi2");
253
254 oldDir->cd();
255}
TH1F * h_fail_crateid
Histogram: CrateIDs w/ failed logic.
TH1F * h_fail_shaperid
Histogram: ShaperIDs w/ failed logic.
const int c_NCrystals
Number of crystals.

◆ emulator()

void emulator ( int  cellID,
int  trigger_time,
std::vector< int >  adc_data 
)
private

Call for DSP emulator.

Definition at line 377 of file eclDQMExtended.cc.

378{
379 int iShaper = conversion(cellID);
380 int iChannelPosition = mapper.getShaperChannel(cellID);
381
382 const auto& map_vec = map_container_vec[iShaper];
383 const short int* f = vectorsplit(map_vec.at("F"), iChannelPosition);
384 const short int* f1 = vectorsplit(map_vec.at("F1"), iChannelPosition);
385 const short int* fg31 = vectorsplit(map_vec.at("F31"), iChannelPosition);
386 const short int* fg32 = vectorsplit(map_vec.at("F32"), iChannelPosition);
387 const short int* fg33 = vectorsplit(map_vec.at("F33"), iChannelPosition);
388 const short int* fg41 = vectorsplit(map_vec.at("F41"), iChannelPosition);
389 const short int* fg43 = vectorsplit(map_vec.at("F43"), iChannelPosition);
390
391 const auto& map_coef = map_container_coef[iShaper];
392 int k_a = map_coef.at("k_a");
393 int k_b = map_coef.at("k_b");
394 int k_c = map_coef.at("k_c");
395 int k_1 = map_coef.at("k_1");
396 int k_2 = map_coef.at("k_2");
397 int k_16 = map_coef.at("k_16");
398 int chi_thres = map_coef.at("chi_thres");
399
400 int A0 = (int)v_totalthrA0[cellID - 1];
401 int Ahard = (int)v_totalthrAhard[cellID - 1];
402 int Askip = (int)v_totalthrAskip[cellID - 1];
403
404 int* y = adc_data.data();
405 int ttrig2 = trigger_time - 2 * (trigger_time / 8);
406
407 auto result = lftda_(f, f1, fg41, fg43, fg31, fg32, fg33, y, ttrig2, A0,
408 Ahard, Askip, k_a, k_b, k_c, k_16, k_1, k_2, chi_thres,
410 m_AmpFit = result.amp;
411 m_TimeFit = result.time;
412 m_QualityFit = result.quality;
413
414 if (result.skip_thr || result.hit_thr) m_QualityFit += 4;
415}
std::vector< short int > v_totalthrA0
Vector to store Low amplitude thresholds.
int m_AmpFit
Signal amplitude obtaining from DSP emulator.
std::vector< short int > v_totalthrAhard
Vector to store hit thresholds.
std::vector< short int > v_totalthrAskip
Vector to store skip amplitude threshold.
std::map< int, std::map< std::string, std::vector< short int > > > map_container_vec
Map to store DSP coeffs.
const short int * vectorsplit(const std::vector< short int > &, int)
Select from vector of DSP coeffs a subvector corresponding to accurate channel number.
int conversion(int)
Convert a CellID number to the global Shaper number.
int m_QualityFit
Quality flag obtaining from DSP emulator.
std::map< int, std::map< std::string, short int > > map_container_coef
Map to store auxiliary constants for all shapers.
int m_TimeFit
Signal time obtaining from DSP emulator.
int getShaperChannel(int cellID)
Get number of DSP channel in the shaper by given number of CellId.

◆ endRun()

void endRun ( void  )
overridevirtual

Call when a run ends.

Reimplemented from HistoModule.

Definition at line 557 of file eclDQMExtended.cc.

558{
559}

◆ evalCondition()

bool evalCondition ( ) const
inherited

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

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

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

Definition at line 96 of file Module.cc.

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

◆ event()

void event ( void  )
overridevirtual

Event processor.

Reimplemented from HistoModule.

Definition at line 457 of file eclDQMExtended.cc.

458{
459 if (m_TRGSummary.isValid()) {
460 // Skip events for several types of timing sources
461 // to reduce CPU time usage on HLT (random trigger, delayed bhahba).
462 int timing_type = m_TRGSummary->getTimType();
463 for (auto& skipped_timing_type : m_skipEvents) {
464 if (timing_type == skipped_timing_type) return;
465 }
466 }
467
468 int iAmpflag_qualityfail = 0;
469 int iTimeflag_qualityfail = 0;
470
471 if (!m_ECLTrigs.isValid()) B2FATAL("ECL DQM logic test FATAL: Trigger time information is not available");
472
473 for (auto& aECLDsp : m_ECLDsps) {
474 m_CellId = aECLDsp.getCellId();
475 std::vector<int> DspArray = aECLDsp.getDspA();
477
478 emulator(m_CellId, m_TrigTime, DspArray);
480
481 if ((m_AmpFit >= (int)v_totalthrAskip[m_CellId - 1]) && m_QualityFit < 4 && !aECLDigit) {
482 if (h_missing_ecldigits->GetEntries() == 0) {
483 B2ERROR("ECL DQM logic test error: ECL Digit does not exist for A_emulator > Thr_skip"
484 << LogVar("Thr_skip", (int)v_totalthrAskip[m_CellId - 1])
485 << LogVar("A_emulator", m_AmpFit)
486 << LogVar("Quality_emulator", m_QualityFit));
487 }
489 }
490
491 if ((m_AmpFit >= (int)v_totalthrAskip[m_CellId - 1]) && aECLDigit) {
492
493 m_AmpData = aECLDigit->getAmp();
494 m_TimeData = aECLDigit->getTimeFit();
495 m_QualityData = aECLDigit->getQuality();
496
497 if (m_AmpFit != m_AmpData) {
498 for (int i = 0; i < 4; i++) if (m_QualityData == i && m_TimeFit == m_TimeData) h_time_ampfail[i]->Fill(m_TimeData);
506 }
508 }
509 if (m_TimeFit != m_TimeData) {
510 for (int i = 0; i < 4; i++) if (m_QualityData == i && m_AmpFit == m_AmpData) h_amp_timefail[i]->Fill(m_AmpData);
518 }
520 }
521 if (m_AmpFit != m_AmpData && m_TimeFit != m_TimeData) {
525 }
527 for (int i = 0; i < 4; i++) {
528 for (int j = 0; j < 3; j++) {
529 int k = 0;
530 if (i == 0) k = j + 1;
531 if (i == 1) { if (j == 0) k = j; else k = j + 1; }
532 if (i == 2) { if (j == 2) k = j + 1; else k = j; }
533 if (i == 3) k = j;
534 if (m_QualityFit == i && m_QualityData == k) { h_amp_qualityfail[i][j]->Fill(m_AmpData); h_time_qualityfail[i][j]->Fill(m_TimeData); }
535 }
536 }
537 if (m_AmpFit != m_AmpData) iAmpflag_qualityfail = 1;
538 if (m_TimeFit != m_TimeData) iTimeflag_qualityfail = 1;
542 h_ampflag_qualityfail->Fill(m_QualityData, iAmpflag_qualityfail);
543 h_timeflag_qualityfail->Fill(m_QualityData, iTimeflag_qualityfail);
545 }
549 }
550 h_ampfail_quality->Fill(-1);
551 h_timefail_quality->Fill(-1);
552 } //aECLDigit
553 } //aECLDsp
554} //event
int m_TimeData
Signal time from ECL data.
int m_TrigTime
Trigger time value.
int m_CellId
Cell ID number.
StoreArray< ECLDsp > m_ECLDsps
ECL DSP data.
int m_QualityData
Quality flag from ECL data.
void emulator(int, int, std::vector< int >)
Call for DSP emulator.
int m_AmpData
Signal amplitude from ECL data.
StoreArray< ECLTrig > m_ECLTrigs
ECL trigger data.
StoreObjPtr< TRGSummary > m_TRGSummary
StoreObjPtr TRGSummary
Class to store ECL digitized hits (output of ECLDigi) relation to ECLHit filled in ecl/modules/eclDig...
Definition: ECLDigit.h:24
int getAmp() const
Get Fitting Amplitude.
Definition: ECLDigit.h:70
int getQuality() const
Get Fitting Quality.
Definition: ECLDigit.h:80
static ECLDigit * getByCellID(int cid)
Find ECLDigit by Cell ID using linear search.
Definition: ECLDigit.cc:14
int getTimeFit() const
Get Fitting Time.
Definition: ECLDigit.h:75
double getTimeTrig() const
Get Trig Time.
Definition: ECLTrig.h:111
static ECLTrig * getByCellID(int cid)
Find ECLTrig by Cell ID using linear search.
Definition: ECLTrig.cc:15
Class to store variables with their name which were sent to the logging service.

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

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

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

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

◆ getAllConditionPaths()

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

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

Definition at line 150 of file Module.cc.

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

◆ getAllConditions()

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

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

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

Definition at line 314 of file Module.h.

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

◆ getConditionPath()

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

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


Definition at line 113 of file Module.cc.

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

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

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

◆ getFileNames()

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

Return a list of output filenames for this modules.

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

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

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

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

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

Reimplemented in RootInputModule, StorageRootOutputModule, and RootOutputModule.

Definition at line 134 of file Module.h.

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

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

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

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

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

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

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

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

Definition at line 187 of file Module.h.

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

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

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

Returns a python list of all parameters.

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

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

Definition at line 279 of file Module.cc.

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

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

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

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

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

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 311 of file Module.h.

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

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

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

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

Definition at line 160 of file Module.cc.

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

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

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

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

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

Definition at line 166 of file Module.cc.

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

◆ if_false()

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

A simplified version to add a condition to the module.

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

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

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

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

Definition at line 85 of file Module.cc.

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

◆ if_true()

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

A simplified version to set the condition of the module.

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

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

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

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

Definition at line 90 of file Module.cc.

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

◆ if_value()

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

Add a condition to the module.

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

See https://confluence.desy.de/display/BI/Software+ModCondTut 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}

◆ initDspfromDB()

void initDspfromDB ( )
private

Get DSP coeffs and auxiliary constants from DB.

Definition at line 319 of file eclDQMExtended.cc.

320{
321 size_t iShaper = 0;
322
326
327 for (const auto& dspdata : m_ECLDspDataArray0) { //iCrate = 1, ..., 18
328 iShaper++;
329 callbackCalibration(&dspdata, map_container_vec[iShaper],
330 map_container_coef[iShaper]);
331 }
332
333 for (const auto& dspdata : m_ECLDspDataArray1) { //iCrate = 19, ..., 36
334 iShaper++;
335 callbackCalibration(&dspdata, map_container_vec[iShaper],
336 map_container_coef[iShaper]);
337 }
338
339 for (const auto& dspdata : m_ECLDspDataArray2) { //iCrate = 37, ..., 52
340 iShaper++;
341 if (iShaper < 529) {
342 if (iShaper - (iShaper - 1) / 12 * 12 > 10) continue;
343 } else {
344 if (iShaper - (iShaper - 1) / 12 * 12 > 8) continue;
345 }
346 callbackCalibration(&dspdata, map_container_vec[iShaper],
347 map_container_coef[iShaper]);
348 }
349}
void callbackCalibration(DBObjPtr< ECLCrystalCalib > &, std::vector< short int > &)
Read calibration values for thresholds from DBObject.

◆ initDspfromFile()

void initDspfromFile ( )
private

Get DSP coeffs and auxiliary constants from Files.

Definition at line 351 of file eclDQMExtended.cc.

352{
353 const std::filesystem::path MainDir(m_DSPDirectoryName);
354 const std::filesystem::path RunSubDir(m_RunName);
355 const std::regex Filter(".*(crate)([0-9]{2})/.*(dsp)([0-9]{2})(.dat)");
356 if (!exists(MainDir / RunSubDir)) B2FATAL("ECL DQM logic test FATAL: Directory w/ DSP files don't exist" << LogVar("Directory",
357 MainDir / RunSubDir));
358 for (const std::filesystem::directory_entry& x : std::filesystem::recursive_directory_iterator(MainDir / RunSubDir)) {
359 if (!std::regex_match(x.path().string(), Filter) || !std::filesystem::is_regular_file(x.path())) continue;
360 int iCrate = atoi(std::regex_replace(x.path().string(), Filter, "$2").c_str());
361 int iShaperPosition = atoi(std::regex_replace(x.path().string(), Filter, "$4").c_str());
362 int iShaper = (iCrate - 1) * 12 + iShaperPosition;
363 if (iCrate > 36 && iCrate < 45) {
364 if (iShaperPosition > 10) continue;
365 } else if (iCrate > 44) {
366 if (iShaperPosition > 8) continue;
367 }
368 ECLDspData* dspdata = ECLDspUtilities::readEclDsp(x.path().string().c_str(), iShaperPosition - 1);
369 callbackCalibration(dspdata, map_container_vec[iShaper],
370 map_container_coef[iShaper]);
374 }
375}
This object contains ECL DSP coefs – electromagnetic calorimeter digital signal processing coefficien...
Definition: ECLDspData.h:34
static ECLDspData * readEclDsp(const char *raw_file, int boardNumber)
Convert ECLDspData from *.dat file to Root object.
This class is used to select pairs, triplets... of objects.
Definition: Filter.h:34

◆ initialize()

void initialize ( void  )
overridevirtual

Initialize the module.

Reimplemented from HistoModule.

Definition at line 258 of file eclDQMExtended.cc.

259{
260 REG_HISTOGRAM; // required to register histograms to HistoManager
261
262 m_ECLDigits.isRequired();
263 m_ECLTrigs.isOptional();
264 m_ECLDsps.isOptional();
265
266 if (!mapper.initFromDB()) B2FATAL("ECL DQM logic test FATAL:: Can't initialize eclChannelMapper");
267
268 if (m_InitKey == "DB") initDspfromDB();
269 else if (m_InitKey == "File") initDspfromFile();
270 else B2FATAL("ECL DQM logic test FATAL: No way to initialize DSP coeffs!!! Please choose InitKey = DB or InitKey = File");
271}
void initDspfromDB()
Get DSP coeffs and auxiliary constants from DB.
StoreArray< ECLDigit > m_ECLDigits
ECL digits.
void initDspfromFile()
Get DSP coeffs and auxiliary constants from Files.
bool initFromDB()
Initialize channel mapper from the conditions database.

◆ 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}

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

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

Definition at line 73 of file Module.cc.

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

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

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

◆ setName()

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

Set the name of the module.

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

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

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

Implements a method for setting boost::python objects.

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

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

Definition at line 234 of file Module.cc.

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

◆ setParamPythonDict()

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

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

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

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

Definition at line 249 of file Module.cc.

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

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ 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}

◆ 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}

◆ terminate()

void terminate ( void  )
overridevirtual

Terminate.

Reimplemented from HistoModule.

Definition at line 563 of file eclDQMExtended.cc.

564{
565}

◆ vectorsplit()

const short int * vectorsplit ( const std::vector< short int > &  vectorFrom,
int  iChannel 
)
private

Select from vector of DSP coeffs a subvector corresponding to accurate channel number.

Definition at line 311 of file eclDQMExtended.cc.

312{
313 size_t size = vectorFrom.size();
314 if (size % 16) B2ERROR("ECL DQM logic test error: Split is impossible!" << LogVar("Vector size", size));
315 return (vectorFrom.data() + (size / 16) * (iChannel - 1));
316}

Member Data Documentation

◆ h_amp_qualityfail

std::vector<std::vector<TH1F*> > h_amp_qualityfail = {}
private

Histogram vector: AmplitudeData for quality mismathes w/ various QualityFit (raw) and QualityData (column) values.

Definition at line 153 of file eclDQMExtended.h.

◆ h_amp_timefail

std::vector<TH1F*> h_amp_timefail = {}
private

Histogram vector: Amplitude for time mismacthes (AmplitudeFit == AmplitudeData) w/ various QualityData values.

Definition at line 149 of file eclDQMExtended.h.

◆ h_ampdiff_cellid

TH2F* h_ampdiff_cellid {nullptr}
private

Histogram: Amplitude diff.

(Emulator - Data) for amp. fails.

Definition at line 192 of file eclDQMExtended.h.

◆ h_ampdiff_quality

TH2F* h_ampdiff_quality {nullptr}
private

Histogram: Amp.

diff. (Emulator-Data) for amp. fails in bins of QualityData.

Definition at line 200 of file eclDQMExtended.h.

◆ h_ampdiff_shaperid

TH2F* h_ampdiff_shaperid {nullptr}
private

Histogram: Amp.

diff. (Emulator-Data) for amp. fails in bins of Shaper Id.

Definition at line 196 of file eclDQMExtended.h.

◆ h_ampfail_cellid

TH1F* h_ampfail_cellid {nullptr}
private

Histogram: CellIDs w/ failed amplitudes.

Definition at line 163 of file eclDQMExtended.h.

◆ h_ampfail_crateid

TH1F* h_ampfail_crateid {nullptr}
private

Histogram: CrateIDs w/ failed amplitudes.

Definition at line 181 of file eclDQMExtended.h.

◆ h_ampfail_quality

TH1F* h_ampfail_quality {nullptr}
private

Histogram: Amp.

Control flags in bins of QualityData.

Definition at line 158 of file eclDQMExtended.h.

◆ h_ampfail_shaperid

TH1F* h_ampfail_shaperid {nullptr}
private

Histogram: ShaperIDs w/ failed amplitudes.

Definition at line 171 of file eclDQMExtended.h.

◆ h_ampflag_qualityfail

TH2F* h_ampflag_qualityfail {nullptr}
private

Histogram: Amp flag (0/1) w/ failed qualities in bins of QualityData.

Definition at line 206 of file eclDQMExtended.h.

◆ h_amptimefail_cellid

TH1F* h_amptimefail_cellid {nullptr}
private

Histogram: CellIDs w/ failed amplitudes and times.

Definition at line 167 of file eclDQMExtended.h.

◆ h_amptimefail_crateid

TH1F* h_amptimefail_crateid {nullptr}
private

Histogram: CrateIDs w/ failed amplitudes and times.

Definition at line 185 of file eclDQMExtended.h.

◆ h_amptimefail_shaperid

TH1F* h_amptimefail_shaperid {nullptr}
private

Histogram: ShaperIDs w/ failed amplitudes and times.

Definition at line 175 of file eclDQMExtended.h.

◆ h_fail_crateid

TH1F* h_fail_crateid {nullptr}
private

Histogram: CrateIDs w/ failed logic.

Definition at line 189 of file eclDQMExtended.h.

◆ h_fail_shaperid

TH1F* h_fail_shaperid {nullptr}
private

Histogram: ShaperIDs w/ failed logic.

Definition at line 179 of file eclDQMExtended.h.

◆ h_missing_ecldigits

TH1F* h_missing_ecldigits {nullptr}
private

Histogram: Quality flag (from emulator) for the waveforms where fit result (ECLDigit) should have been saved but for some reason was not saved by ShaperDSP module.

Definition at line 210 of file eclDQMExtended.h.

◆ h_quality_fit_data

TH2F* h_quality_fit_data {nullptr}
private

Histogram: QualityFit vs QualityData for quality fails.

Definition at line 204 of file eclDQMExtended.h.

◆ h_qualityfail_cellid

TH1F* h_qualityfail_cellid {nullptr}
private

Histogram: CellIDs w/ failed qualities.

Definition at line 169 of file eclDQMExtended.h.

◆ h_qualityfail_crateid

TH1F* h_qualityfail_crateid {nullptr}
private

Histogram: CrateIDs w/ failed qualities.

Definition at line 187 of file eclDQMExtended.h.

◆ h_qualityfail_shaperid

TH1F* h_qualityfail_shaperid {nullptr}
private

Histogram: ShaperIDs w/ failed qualities.

Definition at line 177 of file eclDQMExtended.h.

◆ h_time_ampfail

std::vector<TH1F*> h_time_ampfail = {}
private

Histogram vector: Time for amplitude mismathces (TimeFit == TimeData) w/ various QualityData values.

Definition at line 151 of file eclDQMExtended.h.

◆ h_time_qualityfail

std::vector<std::vector<TH1F*> > h_time_qualityfail = {}
private

Histogram vector: TimeData for quality mismacthes w/ various QualitFit (raw) and QualityData (column) values.

Definition at line 155 of file eclDQMExtended.h.

◆ h_timediff_cellid

TH2F* h_timediff_cellid {nullptr}
private

Histogram: Time diff.

(Emulator-Data) for time fails.

Definition at line 194 of file eclDQMExtended.h.

◆ h_timediff_quality

TH2F* h_timediff_quality {nullptr}
private

Histogram: Time diff.

(Emulator-Data) for time fails in bins of QualityData.

Definition at line 202 of file eclDQMExtended.h.

◆ h_timediff_shaperid

TH2F* h_timediff_shaperid {nullptr}
private

Histogram: Time diff.

(Emulator-Data) for time fails in bins of Shaper Id.

Definition at line 198 of file eclDQMExtended.h.

◆ h_timefail_cellid

TH1F* h_timefail_cellid {nullptr}
private

Histogram: CellIDs w/ failed times.

Definition at line 165 of file eclDQMExtended.h.

◆ h_timefail_crateid

TH1F* h_timefail_crateid {nullptr}
private

Histogram: CrateIDs w/ failed times.

Definition at line 183 of file eclDQMExtended.h.

◆ h_timefail_quality

TH1F* h_timefail_quality {nullptr}
private

Histogram: Time control flags in bins of QualityData.

Definition at line 160 of file eclDQMExtended.h.

◆ h_timefail_shaperid

TH1F* h_timefail_shaperid {nullptr}
private

Histogram: ShaperIDs w/ failed times.

Definition at line 173 of file eclDQMExtended.h.

◆ h_timeflag_qualityfail

TH2F* h_timeflag_qualityfail {nullptr}
private

Histogram: Time flag (0/1) w/ failed qualities in bins of Quality Data.

Definition at line 208 of file eclDQMExtended.h.

◆ m_adjusted_timing

bool m_adjusted_timing
private

Use modified time determination algorithm in emulator, same as in ShaperDSP version >= 1.4.3.

Definition at line 80 of file eclDQMExtended.h.

◆ m_AmpData

int m_AmpData {0}
private

Signal amplitude from ECL data.

Definition at line 137 of file eclDQMExtended.h.

◆ m_AmpFit

int m_AmpFit {0}
private

Signal amplitude obtaining from DSP emulator.

Definition at line 130 of file eclDQMExtended.h.

◆ m_calibrationThrA0

DBObjPtr<ECLCrystalCalib> m_calibrationThrA0
private

Low amplitude threshold.

Definition at line 108 of file eclDQMExtended.h.

◆ m_calibrationThrAhard

DBObjPtr<ECLCrystalCalib> m_calibrationThrAhard
private

Hit threshold.

Definition at line 110 of file eclDQMExtended.h.

◆ m_calibrationThrAskip

DBObjPtr<ECLCrystalCalib> m_calibrationThrAskip
private

Skip amplitude threshold.

Definition at line 112 of file eclDQMExtended.h.

◆ m_CellId

int m_CellId {0}
private

Cell ID number.

Definition at line 144 of file eclDQMExtended.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_DSPDirectoryName

std::string m_DSPDirectoryName
private

Directory name consisting of DSP coeffs.

Definition at line 74 of file eclDQMExtended.h.

◆ m_ECLDigits

StoreArray<ECLDigit> m_ECLDigits
private

ECL digits.

Definition at line 96 of file eclDQMExtended.h.

◆ m_ECLDspDataArray0

DBArray<ECLDspData> m_ECLDspDataArray0
private

DBArray for payload 'ECLDSPPars0'.

Definition at line 89 of file eclDQMExtended.h.

◆ m_ECLDspDataArray1

DBArray<ECLDspData> m_ECLDspDataArray1
private

DBArray for payload 'ECLDSPPars1'.

Definition at line 91 of file eclDQMExtended.h.

◆ m_ECLDspDataArray2

DBArray<ECLDspData> m_ECLDspDataArray2
private

DBArray for payload 'ECLDSPPars2'.

Definition at line 93 of file eclDQMExtended.h.

◆ m_ECLDsps

StoreArray<ECLDsp> m_ECLDsps
private

ECL DSP data.

Definition at line 102 of file eclDQMExtended.h.

◆ m_ECLTrigs

StoreArray<ECLTrig> m_ECLTrigs
private

ECL trigger data.

Definition at line 99 of file eclDQMExtended.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_histogramDirectoryName

std::string m_histogramDirectoryName
private

Histogram directory in ROOT file.

Definition at line 70 of file eclDQMExtended.h.

◆ m_InitKey

std::string m_InitKey
private

Key to initialize DSP coeffs.

('File' or 'DB' are acceptable).

Definition at line 72 of file eclDQMExtended.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

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

Definition at line 508 of file Module.h.

◆ m_package

std::string m_package
privateinherited

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

Definition at line 510 of file Module.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

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

Definition at line 512 of file Module.h.

◆ m_QualityData

int m_QualityData {0}
private

Quality flag from ECL data.

Definition at line 141 of file eclDQMExtended.h.

◆ m_QualityFit

int m_QualityFit {0}
private

Quality flag obtaining from DSP emulator.

Definition at line 134 of file eclDQMExtended.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_RunName

std::string m_RunName
private

Run with valid DSP coeffs.

(only for 'm_InitKey == File').

Definition at line 76 of file eclDQMExtended.h.

◆ m_SaveDetailedFitData

bool m_SaveDetailedFitData
private

Save detailed fit data for failed fits.

Definition at line 78 of file eclDQMExtended.h.

◆ m_skipEvents

std::vector<int> m_skipEvents = {}
private

Skip events with specified type of timing source (see TRGSummary class, ETimingType enum)

Definition at line 86 of file eclDQMExtended.h.

◆ m_TimeData

int m_TimeData {0}
private

Signal time from ECL data.

Definition at line 139 of file eclDQMExtended.h.

◆ m_TimeFit

int m_TimeFit {0}
private

Signal time obtaining from DSP emulator.

Definition at line 132 of file eclDQMExtended.h.

◆ m_TRGSummary

StoreObjPtr<TRGSummary> m_TRGSummary
private

StoreObjPtr TRGSummary

Definition at line 105 of file eclDQMExtended.h.

◆ m_TrigTime

int m_TrigTime {0}
private

Trigger time value.

Definition at line 146 of file eclDQMExtended.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ map_container_coef

std::map<int, std::map<std::string, short int> > map_container_coef
private

Map to store auxiliary constants for all shapers.

Definition at line 120 of file eclDQMExtended.h.

◆ map_container_vec

std::map<int, std::map<std::string, std::vector<short int> > > map_container_vec
private

Map to store DSP coeffs.

for all shapers.

Definition at line 118 of file eclDQMExtended.h.

◆ mapper

ECL::ECLChannelMapper mapper
private

ECL channel mapper.

Definition at line 115 of file eclDQMExtended.h.

◆ v_totalthrA0

std::vector<short int> v_totalthrA0 = {}
private

Vector to store Low amplitude thresholds.

Definition at line 123 of file eclDQMExtended.h.

◆ v_totalthrAhard

std::vector<short int> v_totalthrAhard = {}
private

Vector to store hit thresholds.

Definition at line 125 of file eclDQMExtended.h.

◆ v_totalthrAskip

std::vector<short int> v_totalthrAskip = {}
private

Vector to store skip amplitude threshold.

Definition at line 127 of file eclDQMExtended.h.


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