Belle II Software development
ECLSplitterN1PureCsIModule Class Reference

The very same module but for PureCsI. More...

#include <ECLSplitterN1Module.h>

Inheritance diagram for ECLSplitterN1PureCsIModule:
ECLSplitterN1Module 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

virtual const char * eclCalDigitArrayName () const override
 PureCsI name ECLCalDigitsPureCsI.
 
virtual const char * eclConnectedRegionArrayName () const override
 PureCsI name ECLConnectedRegionsPureCsI.
 
virtual const char * eclLocalMaximumArrayName () const override
 PureCsI name ECLLocalMaximumsPureCsI.
 
virtual const char * eclShowerArrayName () const override
 PureCsI name ECLShowersPureCsI.
 
virtual const char * eventLevelClusteringInfoName () const override
 Name to be used for PureCsI option: EventLevelClusteringInfoPureCsI.
 
virtual void initialize () override
 Initialize.
 
virtual void beginRun () override
 Begin run.
 
virtual void event () override
 Event.
 
virtual void terminate () override
 Terminate.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
virtual void endRun ()
 This method is called if the current run ends.
 
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

void splitConnectedRegion (ECLConnectedRegion &aCR)
 Split connected region into showers.
 
std::vector< int > getOptimalNumberOfDigits (const int cellid, const double energy)
 Get optimal number of digits (out of 21) based on first energy estimation and background level per event.
 
double estimateEnergy (const int centerid)
 Estimate energy using 3x3 around central crystal.
 
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.
 

Static Private Member Functions

static int getNeighbourMap (const double energy, const double background)
 Get number of neighbours based on first energy estimation and background level per event.
 
static double getEnergySum (std::vector< std::pair< double, double > > &weighteddigits, const unsigned int n)
 Get energy sum for weighted entries.
 

Private Attributes

double m_threshold
 Local maximum threshold after splitting.
 
double m_expConstant
 Constant a from exp(-a*dist/RM), 1.5 to 2.5.
 
int m_maxIterations
 Maximum number of iterations.
 
double m_shiftTolerance
 Tolerance level for centroid shifts.
 
double m_minimumSharedEnergy
 Minimum shared energy.
 
int m_maxSplits
 Maximum number of splits.
 
const double c_molierRadius
 Constant RM (Molier Radius) from exp(-a*dist/RM), http://pdg.lbl.gov/2009/AtomicNuclearProperties/HTML_PAGES/141.html.
 
double m_cutDigitEnergyForEnergy
 Minimum digit energy to be included in the shower energy calculation.
 
double m_cutDigitTimeResidualForEnergy
 Maximum time residual to be included in the shower energy calculation.
 
int m_useOptimalNumberOfDigitsForEnergy
 Optimize the number of neighbours for energy calculations.
 
int m_removeShiftedLMs
 Remove LMs if the splitter shifted the centroid position too much.
 
double m_sharingDistanceMolierMultiplier
 Maximum distance d to use when sharing energy d = m_sharingDistanceMolierMultiplier*c_molierRadius.
 
DBObjPtr< ECLnOptimalm_eclNOptimal
 nOptimal payload
 
TH2F m_nOptimal2D
 2D hist of nOptimal for Ebin vs groupID
 
std::vector< int > m_groupNumber
 group number for each crystal
 
const int m_nLeakReg = 3
 3 ECL regions: 0 = forward, 1 = barrel, 2 = backward
 
int m_nEnergyBins = 0
 number of energies bins in nOptimal payload
 
std::vector< std::vector< float > > m_eBoundaries
 energy boundaries each region
 
std::string m_positionMethod
 Position calculation: lilo or linear.
 
double m_liloParameterA
 lin-log parameter A
 
double m_liloParameterB
 lin-log parameter B
 
double m_liloParameterC
 lin-log parameter C
 
std::vector< double > m_liloParameters
 lin-log parameters A, B, and C
 
int m_fullBkgdCount
 Number of expected background digits at full background, FIXME: move to database.
 
std::vector< int > m_StoreArrPosition
 vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions
 
std::vector< int > m_StoreArrPositionLM
 vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions for LM
 
std::vector< int > m_cellIdInCR
 list with all cellid of this connected region
 
ECL::ECLNeighboursm_NeighbourMap9 {nullptr}
 Neighbour maps.
 
ECL::ECLNeighboursm_NeighbourMap21 {nullptr}
 5x5 neighbours excluding corners = 21
 
StoreArray< ECLCalDigitm_eclCalDigits
 Store array: ECLCalDigit.
 
StoreArray< ECLConnectedRegionm_eclConnectedRegions
 Store array: ECLConnectedRegion.
 
StoreArray< ECLShowerm_eclShowers
 Store array: ECLShower.
 
StoreArray< ECLLocalMaximumm_eclLocalMaximums
 Store array: ECLLocalMaximum.
 
StoreObjPtr< EventLevelClusteringInfom_eventLevelClusteringInfo
 Store object pointer: EventLevelClusteringInfo.
 
ECL::ECLGeometryParm_geom {nullptr}
 Geometry.
 
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

The very same module but for PureCsI.

Definition at line 171 of file ECLSplitterN1Module.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,
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

Member Function Documentation

◆ beginRun()

void beginRun ( void )
overridevirtualinherited

Begin run.

Reimplemented from Module.

Definition at line 135 of file ECLSplitterN1Module.cc.

136{
137 //..Read in nOptimal crystal payload from database
138 if (m_eclNOptimal.hasChanged()) {
139
140 //..Vectors of energy boundaries for each region
141 std::vector<float> eBoundariesFwd = m_eclNOptimal->getUpperBoundariesFwd();
142 std::vector<float> eBoundariesBrl = m_eclNOptimal->getUpperBoundariesBrl();
143 std::vector<float> eBoundariesBwd = m_eclNOptimal->getUpperBoundariesBwd();
144
145 //..Adjust the size of the vector of boundaries to match the number in the payload
146 m_nEnergyBins = eBoundariesBrl.size();
147 B2INFO("ECLSplitterN1 beginRun: number of nOptimal payload energies = " << m_nEnergyBins);
148 m_eBoundaries.resize(m_nLeakReg, std::vector<float>(m_nEnergyBins, 0.));
149
150 //..Copy values to m_eBoundaries
151 for (int ie = 0; ie < m_nEnergyBins; ie++) {
152 m_eBoundaries[0][ie] = eBoundariesFwd[ie];
153 m_eBoundaries[1][ie] = eBoundariesBrl[ie];
154 m_eBoundaries[2][ie] = eBoundariesBwd[ie];
155 B2INFO(" upper boundaries for energy point " << ie << " " << m_eBoundaries[0][ie] << " " << m_eBoundaries[1][ie] << " " <<
156 m_eBoundaries[2][ie]);
157 }
158
159 //..Group number of each crystal
160 m_groupNumber = m_eclNOptimal->getGroupNumber();
161
162 //..2D histogram of nOptimal for each group and energy point
163 m_nOptimal2D = m_eclNOptimal->getNOptimal();
164 }
165}
const int m_nLeakReg
3 ECL regions: 0 = forward, 1 = barrel, 2 = backward
DBObjPtr< ECLnOptimal > m_eclNOptimal
nOptimal payload
int m_nEnergyBins
number of energies bins in nOptimal payload
std::vector< std::vector< float > > m_eBoundaries
energy boundaries each region
TH2F m_nOptimal2D
2D hist of nOptimal for Ebin vs groupID
std::vector< int > m_groupNumber
group number for each crystal

◆ 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

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

◆ eclCalDigitArrayName()

virtual const char * eclCalDigitArrayName ( ) const
inlineoverridevirtual

PureCsI name ECLCalDigitsPureCsI.

Reimplemented from ECLSplitterN1Module.

Definition at line 174 of file ECLSplitterN1Module.h.

175 { return "ECLCalDigitsPureCsI" ; }

◆ eclConnectedRegionArrayName()

virtual const char * eclConnectedRegionArrayName ( ) const
inlineoverridevirtual

PureCsI name ECLConnectedRegionsPureCsI.

Reimplemented from ECLSplitterN1Module.

Definition at line 178 of file ECLSplitterN1Module.h.

179 { return "ECLConnectedRegionsPureCsI" ; }

◆ eclLocalMaximumArrayName()

virtual const char * eclLocalMaximumArrayName ( ) const
inlineoverridevirtual

PureCsI name ECLLocalMaximumsPureCsI.

Reimplemented from ECLSplitterN1Module.

Definition at line 182 of file ECLSplitterN1Module.h.

183 { return "ECLLocalMaximumsPureCsI" ; }

◆ eclShowerArrayName()

virtual const char * eclShowerArrayName ( ) const
inlineoverridevirtual

PureCsI name ECLShowersPureCsI.

Reimplemented from ECLSplitterN1Module.

Definition at line 186 of file ECLSplitterN1Module.h.

187 { return "ECLShowersPureCsI" ; }

◆ endRun()

virtual void endRun ( void )
inlinevirtualinherited

This method is called if the current run ends.

Use this method to store information, which should be aggregated over one run.

This method can be implemented by subclasses.

Reimplemented in AlignDQMModule, AnalysisPhase1StudyModule, arichBtestModule, ARICHDQMModule, AWESOMEBasicModule, B2BIIConvertMdstModule, B2BIIMCParticlesMonitorModule, B2BIIMdstInputModule, BeamabortModule, BeamabortStudyModule, BeamDigitizerModule, BeamBkgHitRateMonitorModule, BelleMCOutputModule, BgoDigitizerModule, BgoModule, BgoStudyModule, BKLMDigitAnalyzerModule, BKLMTrackingModule, CalibrationCollectorModule, CaveModule, CDCPackerModule, CDCUnpackerModule, CDCDedxDQMModule, CDCDedxValidationModule, CDCDQMModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CertifyParallelModule, ClawDigitizerModule, ClawModule, ClawStudyModule, ClawsDigitizerModule, CLAWSModule, ClawsStudyModule, Convert2RawDetModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DAQPerfModule, DeSerializerPXDModule, DosiDigitizerModule, DosiModule, DosiStudyModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEcmsMonObjModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisExampleModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisKLMModule, DQMHistAnalysisKLMMonObjModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGEFFModule, DQMHistAnalysisTRGGDLModule, DQMHistAnalysisTRGModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DqmHistoManagerModule, DQMHistOutputToEPICSModule, DQMHistReferenceModule, DQMHistSnapshotsModule, Ds2RawFileModule, Ds2RawModule, Ds2RbufModule, Ds2SampleModule, ECLBackgroundModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLShowerCorrectorModule, ECLSplitterN2Module, EffPlotsModule, ElapsedTimeModule, EventInfoPrinterModule, EventT0ValidationModule, EvReductionModule, EvtGenDecayModule, ExtModule, FANGSDigitizerModule, FANGSModule, FANGSStudyModule, FastRbuf2DsModule, TRGGDLUnpackerModule, GenfitVisModule, GenRawSendModule, GetEventFromSocketModule, He3DigitizerModule, He3tubeModule, He3tubeStudyModule, HistoManagerModule, HitXPModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, KLMDigitizerModule, KLMTrackingModule, KLMTriggerModule, MCMatcherTRGECLModule, MCTrackCandClassifierModule, MicrotpcModule, MicrotpcStudyModule, TpcDigitizerModule, TPCStudyModule, MonitorDataModule, MuidModule, NoKickCutsEvalModule, NtuplePhase1_v6Module, OverrideGenerationFlagsModule, PartialSeqRootReaderModule, Ph1bpipeModule, Ph1sustrModule, PhysicsObjectsDQMModule, PinDigitizerModule, PindiodeModule, PindiodeStudyModule, PlumeDigitizerModule, PlumeModule, PrintDataModule, PrintEventRateModule, PXDROIFinderModule, PyModule, QcsmonitorDigitizerModule, QcsmonitorModule, QcsmonitorStudyModule, RandomBarrierModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, ReceiveEventModule, ReprocessorModule, Root2BinaryModule, Root2RawModule, RT2SPTCConverterModule, RxSocketModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, SectorMapBootstrapModule, SeqRootInputModule, SeqRootMergerModule, SeqRootOutputModule, SerializerModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, SrsensorModule, StatisticsSummaryModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, SubEventModule, SVDClusterizerModule, SVDRecoDigitCreatorModule, SVDUnpackerModule, SVDB4CommissioningPlotsModule, SVDClusterCalibrationsMonitorModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDDataFormatCheckModule, svdDumpModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsMonitorModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPositionErrorScaleFactorImporterModule, SVDROIDQMModule, SVDROIFinderModule, SVDTimeCalibrationsMonitorModule, SVDUnpackerDQMModule, SwitchDataStoreModule, TOPBackgroundModule, TOPTBCComparatorModule, TOPUnpackerModule, TOPWaveformQualityPlotterModule, TrackAnaModule, TrackFinderMCTruthRecoTracksModule, TrackFinderVXDAnalizerModule, TrackingPerformanceEvaluationModule, FindletModule< AFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackFinderLegendre >, FindletModule< CDCHitsRemover >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< FacetCreator >, FindletModule< FacetCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< HitBasedT0Extractor >, FindletModule< HitReclaimer >, FindletModule< HitReclaimer >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackExporter >, FindletModule< TrackFinder >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackingUtilities::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackingUtilities::FindletStoreArrayInput< BaseEventTimeExtractorModuleFindlet< AFindlet > > >, FindletModule< TrackLinker >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< TrackRejecter >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, FindletModule< WireHitPreparer >, TrackSetEvaluatorHopfieldNNDEVModule, TRGCDCETFUnpackerModule, TRGCDCModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSStreamModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLFAMModule, TRGECLModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLModule, TRGGDLSummaryModule, TRGGRLDQMModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLUnpackerModule, TRGRAWDATAModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TxModule, TxSocketModule, V0findingPerformanceEvaluationModule, vxdDigitMaskingModule, VXDSimpleClusterizerModule, ZMQTxInputModule, and ZMQTxWorkerModule.

Definition at line 165 of file Module.h.

165{};

◆ estimateEnergy()

double estimateEnergy ( const int centerid)
privateinherited

Estimate energy using 3x3 around central crystal.

Definition at line 877 of file ECLSplitterN1Module.cc.

878{
879
880 double energyEstimation = 0.0;
881
882 for (auto& neighbourId : m_NeighbourMap9->getNeighbours(centerid)) {
883
884 // Check if this neighbour is in this CR
885 const auto it = std::find(m_cellIdInCR.begin(), m_cellIdInCR.end(),
886 neighbourId); // check if the neighbour is in the list for this CR
887 if (it == m_cellIdInCR.end()) continue; // not in this CR
888
889 const int pos = m_StoreArrPosition[neighbourId];
890 const double energyNeighbour = m_eclCalDigits[pos]->getEnergy();
891
892 energyEstimation += energyNeighbour;
893 }
894
895 return energyEstimation;
896}
ECL::ECLNeighbours * m_NeighbourMap9
Neighbour maps.
std::vector< int > m_cellIdInCR
list with all cellid of this connected region
std::vector< int > m_StoreArrPosition
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions
StoreArray< ECLCalDigit > m_eclCalDigits
Store array: ECLCalDigit.

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

Event.

Reimplemented from Module.

Definition at line 167 of file ECLSplitterN1Module.cc.

168{
169 B2DEBUG(175, "ECLCRSplitterModule::event()");
170
171 // Fill a vector that can be used to map cellid -> store array position for eclCalDigits.
172 memset(&m_StoreArrPosition[0], -1, m_StoreArrPosition.size() * sizeof m_StoreArrPosition[0]);
173 for (int i = 0; i < m_eclCalDigits.getEntries(); i++) {
174 m_StoreArrPosition[m_eclCalDigits[i]->getCellId()] = i;
175 }
176
177 // Fill a vector that can be used to map cellid -> store array position for eclLocalMaximums.
178 memset(&m_StoreArrPositionLM[0], -1, m_StoreArrPositionLM.size() * sizeof m_StoreArrPositionLM[0]);
179 for (int i = 0; i < m_eclLocalMaximums.getEntries(); i++) {
180 m_StoreArrPositionLM[m_eclLocalMaximums[i]->getCellId()] = i;
181 }
182
183 // Loop over all connected regions
184 for (auto& aCR : m_eclConnectedRegions) {
185 // list theat will hold all cellids in this connected region
186 m_cellIdInCR.clear();
187
188 const unsigned int entries = (aCR.getRelationsWith<ECLCalDigit>(eclCalDigitArrayName())).size();
189
190 m_cellIdInCR.resize(entries);
191
192 // Fill all calDigits ids in this CR into a vector to make them 'find'-able.
193 int i = 0;
194 for (const auto& caldigit : aCR.getRelationsWith<ECLCalDigit>(eclCalDigitArrayName())) {
195 m_cellIdInCR[i] = caldigit.getCellId();
196 ++i;
197 }
198
199 // Split and reconstruct the showers in this connected regions.
201
202 } // end auto& aCR
203
204}
StoreArray< ECLConnectedRegion > m_eclConnectedRegions
Store array: ECLConnectedRegion.
void splitConnectedRegion(ECLConnectedRegion &aCR)
Split connected region into showers.
StoreArray< ECLLocalMaximum > m_eclLocalMaximums
Store array: ECLLocalMaximum.
virtual const char * eclCalDigitArrayName() const
Default name ECLCalDigits.
std::vector< int > m_StoreArrPositionLM
vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions for LM

◆ eventLevelClusteringInfoName()

virtual const char * eventLevelClusteringInfoName ( ) const
inlineoverridevirtual

Name to be used for PureCsI option: EventLevelClusteringInfoPureCsI.

Reimplemented from ECLSplitterN1Module.

Definition at line 190 of file ECLSplitterN1Module.h.

191 { return "EventLevelClusteringInfoPureCsI" ; }

◆ 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

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

◆ 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

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

◆ getEnergySum()

double getEnergySum ( std::vector< std::pair< double, double > > & weighteddigits,
const unsigned int n )
staticprivateinherited

Get energy sum for weighted entries.

Definition at line 854 of file ECLSplitterN1Module.cc.

855{
856
857 double energysum = 0.;
858
859 std::sort(weighteddigits.begin(), weighteddigits.end(), [](const auto & left, const auto & right) {
860 return left.first * left.second > right.first * right.second;
861 });
862
863
864 unsigned int min = n;
865 if (weighteddigits.size() < n) min = weighteddigits.size();
866
867 for (unsigned int i = 0; i < min; ++i) {
868 B2DEBUG(175, "getEnergySum: " << weighteddigits.at(i).first << " " << weighteddigits.at(i).second);
869 energysum += (weighteddigits.at(i).first * weighteddigits.at(i).second);
870 }
871 B2DEBUG(175, "getEnergySum: energysum=" << energysum);
872
873 return energysum;
874}

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

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

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

◆ getNeighbourMap()

int getNeighbourMap ( const double energy,
const double background )
staticprivateinherited

Get number of neighbours based on first energy estimation and background level per event.

Definition at line 814 of file ECLSplitterN1Module.cc.

815{
816 if (background <= 0.1) return 21;
817 else {
818 if (energy > 0.06 + 0.4 * background) return 21; // based on preliminary study TF, valid in barrel only (TF).
819 else return 9;
820 }
821}

◆ getOptimalNumberOfDigits()

std::vector< int > getOptimalNumberOfDigits ( const int cellid,
const double energy )
privateinherited

Get optimal number of digits (out of 21) based on first energy estimation and background level per event.

Definition at line 823 of file ECLSplitterN1Module.cc.

824{
825
826 //..nOptimal depends on the energy bin, which in turn depends on ECL region
827 int iRegion = 1; // barrel
828 if (ECLElementNumbers::isForward(cellid)) {iRegion = 0;}
829 if (ECLElementNumbers::isBackward(cellid)) {iRegion = 2;}
830
831 //..Find the energy bin
832 int iEnergy = 0;
833 while (energy > m_eBoundaries[iRegion][iEnergy] and iEnergy < m_nEnergyBins - 1) {iEnergy++;}
834
835 //..Group number just depends on the cellID
836 int iGroup = m_groupNumber[cellid - 1];
837
838 //..Optimal number of crystals from energy and group numbers
839 int nOptimalNeighbours = (int)(0.5 + m_nOptimal2D.GetBinContent(iGroup + 1, iEnergy + 1));
840
841 //..Store these in a vector to return
842 std::vector<int> nOptimalVector;
843 nOptimalVector.push_back(nOptimalNeighbours);
844 nOptimalVector.push_back(iGroup);
845 nOptimalVector.push_back(iEnergy);
846
847 B2DEBUG(175, "ECLSplitterN1Module::getOptimalNumberOfDigits: cellID: " << cellid << " energy: " << energy << " iG: " << iGroup <<
848 " iE: " << iEnergy << " nOpt: " << nOptimalNeighbours);
849
850 return nOptimalVector;
851
852}
bool isForward(int cellId)
Check whether the crystal is in forward ECL.
bool isBackward(int cellId)
Check whether the crystal is in backward ECL.

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

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

◆ 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

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

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

◆ initialize()

void initialize ( void )
overridevirtualinherited

Initialize.

Reimplemented from Module.

Definition at line 96 of file ECLSplitterN1Module.cc.

97{
98
99 // Geometry instance.
101
102 // Check and format user input.
103 m_liloParameters.resize(3);
107
108 // ECL dataobjects.
112 m_eclShowers.registerInDataStore(eclShowerArrayName());
113
114 // mDST dataobjects.
116
117 // Register relations (we probably dont need all, but keep them for now for debugging).
118 m_eclShowers.registerRelationTo(m_eclConnectedRegions);
119 m_eclShowers.registerRelationTo(m_eclCalDigits);
120 m_eclShowers.registerRelationTo(m_eclLocalMaximums);
121 m_eclLocalMaximums.registerRelationTo(m_eclCalDigits);
122 m_eclConnectedRegions.requireRelationTo(m_eclLocalMaximums);
123 m_eclConnectedRegions.requireRelationTo(m_eclCalDigits);
124
125 // Initialize neighbour maps (we will optimize the endcaps later, there is more than just a certain energy containment to be considered)
126 m_NeighbourMap9 = new ECLNeighbours("N", 1); // N: 3x3 = 9
127 m_NeighbourMap21 = new ECLNeighbours("NC", 2); // NC: 5x5 excluding corners = 21
128
129 // initialize the vector that gives the relation between cellid and store array position
132
133}
virtual const char * eclShowerArrayName() const
Default name ECLShowers.
virtual const char * eventLevelClusteringInfoName() const
Name to be used for default option: EventLevelClusteringInfo.
double m_liloParameterB
lin-log parameter B
StoreArray< ECLShower > m_eclShowers
Store array: ECLShower.
ECL::ECLNeighbours * m_NeighbourMap21
5x5 neighbours excluding corners = 21
virtual const char * eclLocalMaximumArrayName() const
Default name ECLLocalMaximums.
ECL::ECLGeometryPar * m_geom
Geometry.
virtual const char * eclConnectedRegionArrayName() const
Default name ECLConnectedRegions.
std::vector< double > m_liloParameters
lin-log parameters A, B, and C
double m_liloParameterA
lin-log parameter A
StoreObjPtr< EventLevelClusteringInfo > m_eventLevelClusteringInfo
Store object pointer: EventLevelClusteringInfo.
double m_liloParameterC
lin-log parameter C
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
const int c_NCrystals
Number of crystals.

◆ 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

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

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

◆ splitConnectedRegion()

void splitConnectedRegion ( ECLConnectedRegion & aCR)
privateinherited

Split connected region into showers.

Definition at line 213 of file ECLSplitterN1Module.cc.

214{
215
216 //calculate the maximum distance for later weighting
218 if (maxDistance < 0.0) {
219 maxDistance = 9999999.;
220 }
221
222
223 // Get the event background level
224 const int bkgdcount = m_eventLevelClusteringInfo->getNECLCalDigitsOutOfTime();
225 double backgroundLevel = 0.0; // from out of time digit counting
226 if (m_fullBkgdCount > 0) {
227 backgroundLevel = static_cast<double>(bkgdcount) / static_cast<double>(m_fullBkgdCount);
228 }
229
230 // Get the number of LMs in this CR
231 const int nLocalMaximums = aCR.getRelationsWith<ECLLocalMaximum>(eclLocalMaximumArrayName()).size();
232
233 B2DEBUG(170, "ECLCRSplitterModule::splitConnectedRegion: nLocalMaximums = " << nLocalMaximums);
234
235 // Three cases:
236 // 1) There is no local maximum (can only happen if the CR seed is not a LM itself).
237 // 2) There is exactly one local maximum.
238 // 3) There are more than one, typically two or three, local maxima and we have to share energy between them.
239 // If there are more than m_maxSplits local maxima, the m_maxSplits highest energy local maxima will be used.
240
241 // ---------------------------------------------------------------------
242 if (nLocalMaximums == 1) {
243
244 // Create a shower.
245 const auto aECLShower = m_eclShowers.appendNew();
246
247 // Add relation to the CR.
248 aECLShower->addRelationTo(&aCR);
249
250 // Find the highest energetic crystal in this CR or use the LM.
251 double weightSum = 0.0;
252
253 // Add relation to the LM.
254 RelationVector<ECLLocalMaximum> locmaxvector = aCR.getRelationsWith<ECLLocalMaximum>(eclLocalMaximumArrayName());
255 aECLShower->addRelationTo(locmaxvector[0]);
256
257 const int locmaxcellid = locmaxvector[0]->getCellId();
258 const int pos = m_StoreArrPosition[locmaxcellid];
259 double highestEnergyID = (m_eclCalDigits[pos])->getCellId();
260 double highestEnergy = (m_eclCalDigits[pos])->getEnergy();
261 double highestEnergyTime = (m_eclCalDigits[pos])->getTime();
262 double highestEnergyTimeResolution = (m_eclCalDigits[pos])->getTimeResolution();
263
264 // Get a first estimation of the energy using 3x3 neighbours.
265 const double energyEstimation = estimateEnergy(highestEnergyID);
266
267 // Check if 21 would be better in the present background conditions:
268 const ECLNeighbours* neighbourMap; // FIXME pointer needed?
269 int nNeighbours = getNeighbourMap(energyEstimation, backgroundLevel);
270 if (nNeighbours == 9 and !m_useOptimalNumberOfDigitsForEnergy) neighbourMap = m_NeighbourMap9;
271 else neighbourMap = m_NeighbourMap21;
272
273 // Add neighbours and weights for the shower.
274 std::vector<ECLCalDigit> digits;
275 std::vector<double> weights;
276 for (auto& neighbourId : neighbourMap->getNeighbours(highestEnergyID)) {
277 const auto it = std::find(m_cellIdInCR.begin(), m_cellIdInCR.end(),
278 neighbourId); // check if the neighbour is in the list for this CR
279 if (it == m_cellIdInCR.end()) continue; // not in this CR
280
281 const int neighbourpos = m_StoreArrPosition[neighbourId];
282 digits.push_back(*m_eclCalDigits[neighbourpos]); // list of digits for position reconstruction
283 weights.push_back(1.0); // list of weights (all 1 in this case for now)
284 weightSum += 1.0;
285
286 aECLShower->addRelationTo(m_eclCalDigits[neighbourpos], 1.0); // add digits to this shower, weight = 1
287 }
288
289 // Get position.
290 const B2Vector3D& showerposition = Belle2::ECL::computePositionLiLo(digits, weights, m_liloParameters);
291 aECLShower->setTheta(showerposition.Theta());
292 aECLShower->setPhi(showerposition.Phi());
293 aECLShower->setR(showerposition.Mag());
294
295 // Get Energy, if requested, set some weights to zero for energy calculation.
296 double showerEnergy = 0.0;
298
299 // Get the optimal number of neighbours for this crystal and energy
300 std::vector<int> nOptimalVec = getOptimalNumberOfDigits(highestEnergyID, energyEstimation);
301 const unsigned int nOptimal = static_cast<unsigned int>(nOptimalVec[0]);
302 aECLShower->setNominalNumberOfCrystalsForEnergy(static_cast<double>(nOptimal));
303
304 // Store the indices used; will be needed later for energy corrections.
305 // Also store energy, used along with cellID to find leakage corrections.
306 aECLShower->setNOptimalGroupIndex(nOptimalVec[1]);
307 aECLShower->setNOptimalEnergyBin(nOptimalVec[2]);
308 aECLShower->setNOptimalEnergy(energyEstimation);
309
310 // Get the list of crystals used for the energy calculation
311 std::vector< std::pair<unsigned int, double>> listCrystalPairs; // cell id and weighted reconstructed energy
312 listCrystalPairs.resize(digits.size()); //resize to number of all crystals in cluster
313
314 std::vector < std::pair<double, double> > weighteddigits;
315 weighteddigits.resize(digits.size());
316 for (unsigned int i = 0; i < digits.size(); ++i) {
317 weighteddigits.at(i) = std::make_pair((digits.at(i)).getEnergy(), weights.at(i));
318 listCrystalPairs.at(i) = std::make_pair((digits.at(i)).getCellId(), weights.at(i) * (digits.at(i)).getEnergy());
319 }
320
321 // sort the listCrystals and keep the n highest in descending order
322 std::sort(listCrystalPairs.begin(), listCrystalPairs.end(), [](const auto & left, const auto & right) {
323 return left.second > right.second;
324 });
325 std::vector< unsigned int> listCrystals; //cell id
326
327 for (unsigned int i = 0; i < digits.size(); ++i) {
328 if (i < nOptimal) {
329 listCrystals.push_back(listCrystalPairs[i].first);
330 }
331 }
332
333 aECLShower->setNumberOfCrystalsForEnergy(static_cast<double>(listCrystals.size()));
334 aECLShower->setListOfCrystalsForEnergy(listCrystals);
335
336 showerEnergy = getEnergySum(weighteddigits, nOptimal);
337 B2DEBUG(175, "Shower Energy (1): " << showerEnergy);
338
339 } else {
340 showerEnergy = Belle2::ECL::computeEnergySum(digits, weights);
341 }
342
343 aECLShower->setEnergy(showerEnergy);
344 aECLShower->setEnergyRaw(showerEnergy);
345 aECLShower->setEnergyHighestCrystal(highestEnergy);
346 aECLShower->setTime(highestEnergyTime);
347 aECLShower->setDeltaTime99(highestEnergyTimeResolution);
348 aECLShower->setNumberOfCrystals(weightSum);
349 aECLShower->setCentralCellId(highestEnergyID);
350
351 B2DEBUG(175, "theta = " << showerposition.Theta());
352 B2DEBUG(175, "phi = " << showerposition.Phi());
353 B2DEBUG(175, "R = " << showerposition.Mag());
354 B2DEBUG(175, "energy = " << showerEnergy);
355 B2DEBUG(175, "time = " << highestEnergyTime);
356 B2DEBUG(175, "time resolution = " << highestEnergyTimeResolution);
357 B2DEBUG(175, "neighbours = " << nNeighbours);
358 B2DEBUG(175, "backgroundLevel = " << backgroundLevel);
359
360 // Fill shower Ids
361 aECLShower->setShowerId(1); // always one (only this single shower in the CR)
362 aECLShower->setHypothesisId(Belle2::ECLShower::c_nPhotons);
363 aECLShower->setConnectedRegionId(aCR.getCRId());
364
365 // Add relations of all CalDigits of the CR to the local maximum (here: all weights = 1).
366 const int posLM = m_StoreArrPositionLM[locmaxcellid];
367 for (const auto& aDigit : aCR.getRelationsWith<ECLCalDigit>()) {
368 const int posDigit = m_StoreArrPosition[aDigit.getCellId()];
369 m_eclLocalMaximums[posLM]->addRelationTo(m_eclCalDigits[posDigit], 1.0);
370 }
371
372 } // end case with one LM
373 else { // More than one LM, energy must be split. This algorithm is inspired by BaBar code.
374
375 // check if we have too many local maximums. if yes: limit to user set maximum
376 // create a vector with all local maximums and its crystal energies
377 std::vector<std::pair<ECLLocalMaximum, double>> lm_energy_vector;
378 for (auto& aLocalMaximum : aCR.getRelationsWith<ECLLocalMaximum>(eclLocalMaximumArrayName())) {
379 const int cellid = aLocalMaximum.getCellId();
380 const int pos = m_StoreArrPosition[cellid];
381 const double digitenergy = m_eclCalDigits[pos]->getEnergy();
382 lm_energy_vector.push_back(std::pair<ECLLocalMaximum, double>(aLocalMaximum, digitenergy));
383 };
384
385 // sort this vector in descending order and keep only up to m_maxSplits entries
386 if (lm_energy_vector.size() >= static_cast<size_t>(m_maxSplits)) {
387 std::sort(lm_energy_vector.begin(), lm_energy_vector.end(), [](const std::pair<ECLLocalMaximum, double>& x,
388 const std::pair<ECLLocalMaximum, double>& y) {
389 return x.second > y.second;
390 });
391
392 lm_energy_vector.resize(m_maxSplits);
393 }
394
395 std::vector<ECLCalDigit> digits;
396 std::vector<double> weights;
397 std::map<int, B2Vector3D> centroidList; // key = cellid, value = centroid position
398 std::map<int, double> centroidEnergyList; // key = cellid, value = centroid position
399 std::map<int, B2Vector3D> allPoints; // key = cellid, value = digit position
400 std::map<int, std::vector < double > > weightMap; // key = locmaxid, value = vector of weights
401 std::vector < ECLCalDigit > digitVector; // the order of weights in weightMap must be the same
402
403 // Fill the maxima positions in a map
404 std::map<int, B2Vector3D> localMaximumsPoints; // key = locmaxid, value = maximum position
405 std::map<int, B2Vector3D> centroidPoints; // key = locmaxid (as index), value = centroid position
406
407 for (auto& aLocalMaximum : lm_energy_vector) {
408
409 int cellid = aLocalMaximum.first.getCellId();
410
411 // Get the position of this crystal and fill it in two maps.
412 B2Vector3D vectorPosition = m_geom->GetCrystalPos(cellid - 1);
413 localMaximumsPoints.insert(std::map<int, B2Vector3D>::value_type(cellid, vectorPosition));
414 centroidPoints.insert(std::map<int, B2Vector3D>::value_type(cellid, vectorPosition));
415 }
416
417 // The following will be done iteratively. Empty clusters after splitting will be removed, and the procedure will be repeated.
418 bool iterateclusters = true;
419 do {
420 digits.clear();
421 weights.clear();
422 centroidList.clear();
423 centroidEnergyList.clear();
424 allPoints.clear();
425 weightMap.clear();
426 digitVector.clear();
427
428 // Fill all digits from this CR in a map
429 for (auto& aCalDigit : aCR.getRelationsWith<ECLCalDigit>(eclCalDigitArrayName())) {
430 const int cellid = aCalDigit.getCellId();
431 // get the position of this crystal and fill them in a map
432 B2Vector3D vectorPosition = m_geom->GetCrystalPos(cellid - 1);
433 allPoints.insert(std::map<int, B2Vector3D>::value_type(cellid, vectorPosition));
434 digits.push_back(aCalDigit);
435 }
436
437 for (const auto& digitpoint : allPoints) {
438 const int cellid = digitpoint.first;
439 const int pos = m_StoreArrPosition[cellid];
440 digitVector.push_back(*m_eclCalDigits[pos]);
441 }
442
443
444 // -----------------------------------------------------------------------------------------
445 // The 'heart' of the splitter
446 // Start with each local maximum and set it to the first centroid position. Then iterate over all ECLCalDigits
447 // in this CR and calculate the weighted distances to the local maximum
448 int nIterations = 0;
449 double centroidShiftAverage = 0.0;
450 // double lastcentroidShiftAverage = 0.0;
451
452 do {
453 B2DEBUG(175, "Iteration: #" << nIterations << " (of max. " << m_maxIterations << ")");
454
455 centroidShiftAverage = 0.0;
456 if (nIterations == 0) {
457 centroidList.clear();
458 centroidEnergyList.clear();
459 weightMap.clear();
460 }
461
462 // Loop over all local maximums points, each one will become a shower!
463 for (const auto& locmaxpoint : localMaximumsPoints) {
464
465 // cell id of this local maximum
466 const int locmaxcellid = locmaxpoint.first;
467
468 // clear weights vector
469 weights.clear();
470
471 // if this is the first iteration the shower energy is not know, take the local maximum energy * 1.5.
472 if (nIterations == 0) {
473 const int pos = m_StoreArrPosition[locmaxcellid];
474 const double locmaxenergy = m_eclCalDigits[pos]->getEnergy();
475 centroidEnergyList[locmaxcellid] = 1.5 * locmaxenergy;
476 }
477
478 B2DEBUG(175, "local maximum cellid: " << locmaxcellid);
479
480 //-------------------------------------------------------------------
481 // Loop over all digits. They get a weight using the distance to the respective centroid.
482 for (const auto& digitpoint : allPoints) {
483
484 // cellid and position of this digit
485 const int digitcellid = digitpoint.first;
486 B2Vector3D digitpos = digitpoint.second;
487
488 const int pos = m_StoreArrPosition[digitcellid];
489 const double digitenergy = m_eclCalDigits[pos]->getEnergy();
490
491 double weight = 0.0;
492 double energy = 0.0;
493 double distance = 0.0;
494 double distanceEnergySum = 0.0;
495
496 // Loop over all centroids to get the normalization for the weight
497 for (const auto& centroidpoint : centroidPoints) {
498
499 // cell id and position of this centroid
500 const int centroidcellid = centroidpoint.first;
501 B2Vector3D centroidpos = centroidpoint.second;
502
503 double thisdistance = 0.;
504
505 // in the first iteration, this distance is really zero, avoid floating point problems
506 if (nIterations == 0 and digitcellid == centroidcellid) {
507 thisdistance = 0.0;
508 } else {
509 B2Vector3D vectorDistance = ((centroidpos) - (digitpos));
510 thisdistance = vectorDistance.Mag();
511 }
512
513 // energy of the centroid aka locmax
514 const int thispos = m_StoreArrPosition[centroidcellid];
515 const double thisenergy = m_eclCalDigits[thispos]->getEnergy();
516
517 // get distance of the current local maximum (its centroid position) to this caldigit
518 // Not the most efficienct way to get this information, but not worth the thinking yet:
519 if ((locmaxcellid == centroidcellid) and (thisdistance < maxDistance)) {
520 distance = thisdistance;
521 energy = thisenergy;
522 }
523
524 // Get the product of distance and energy
525 if (thisdistance < maxDistance) {
526 const double expfactor = exp(-m_expConstant * thisdistance / c_molierRadius);
527 distanceEnergySum += (thisenergy * expfactor);
528 }
529
530 } // end centroidPoints
531
532 // Calculate the weight for this digit for this local maximum.
533 if (distanceEnergySum > 0.0) {
534 const double expfactor = exp(-m_expConstant * distance / c_molierRadius);
535 weight = energy * expfactor / distanceEnergySum;
536 } else {
537 weight = 0.0;
538 }
539
540 // Check if the weighted energy is above threshold
541 if ((digitenergy * weight) < m_minimumSharedEnergy) {
542 weight = 0.0;
543 }
544
545 // Check for rounding problems larger than unity
546 if (weight > 1.0) {
547 B2WARNING("ECLCRSplitterModule::splitConnectedRegion: Floating point glitch, weight for this digit " << weight <<
548 ", resetting it to 1.0.");
549 weight = 1.0;
550 }
551
552 // Fill the weight for this digits and this local maximum.
553 B2DEBUG(175, " cellid: " << digitcellid << ", energy: " << digitenergy << ", weight: " << weight << ", distance: " << distance);
554 weights.push_back(weight);
555
556 } // end allPoints
557
558 // Get the old centroid position.
559 B2Vector3D oldCentroidPos = (centroidPoints.find(locmaxcellid))->second;
560
561 // Calculate the new centroid position.
562 B2Vector3D newCentroidPos = Belle2::ECL::computePositionLiLo(digits, weights, m_liloParameters);
563
564 // Calculate new energy
565 const double newEnergy = Belle2::ECL::computeEnergySum(digits, weights);
566
567 // Calculate the shift of the centroid position for this local maximum.
568 const B2Vector3D centroidShift = (oldCentroidPos - newCentroidPos);
569
570 // Save the new centroid position (but dont update yet!), also save the weights and energy.
571 centroidList[locmaxcellid] = newCentroidPos;
572 weightMap[locmaxcellid] = weights;
573
574 B2DEBUG(175, "--> inserting new energy: " << newEnergy << " for local maximum " << locmaxcellid);
575 centroidEnergyList[locmaxcellid] = newEnergy;
576 double showerenergy = (*centroidEnergyList.find(locmaxcellid)).second / Belle2::Unit::MeV;
577 B2DEBUG(175, "--> new energy = " << showerenergy << " MeV");
578
579 // Add this to the average centroid shift.
580 centroidShiftAverage += centroidShift.Mag();
581
582 // Debugging output
583 B2DEBUG(175, " old centroid: " << oldCentroidPos.X() << " cm, " << oldCentroidPos.Y() << " cm, " << oldCentroidPos.Z() <<
584 "cm");
585 B2DEBUG(175, " new centroid: " << newCentroidPos.X() << " cm, " << newCentroidPos.Y() << " cm, " << newCentroidPos.Z() <<
586 "cm");
587 B2DEBUG(175, " centroid shift: " << centroidShift.Mag() << " cm");
588
589 } // end localMaximumsPoints
590
591 // Get the average centroid shift.
592 centroidShiftAverage /= static_cast<double>(nLocalMaximums);
593 // lastcentroidShiftAverage = centroidShiftAverage;
594 B2DEBUG(175, "--> average centroid shift: " << centroidShiftAverage << " cm (tolerance is " << m_shiftTolerance << " cm)");
595
596 // Update centroid positions for the next round
597 for (const auto& locmaxpoint : localMaximumsPoints) {
598 centroidPoints[locmaxpoint.first] = (centroidList.find(locmaxpoint.first))->second;
599 }
600
601 ++nIterations;
602
603 } while (nIterations < m_maxIterations and centroidShiftAverage > m_shiftTolerance);
604 // DONE!
605
606 // check that local maxima are still local maxima
607 std::vector<int> markfordeletion;
608 iterateclusters = false;
609 for (const auto& locmaxpoint : localMaximumsPoints) {
610
611 // Get locmax cellid
612 const int locmaxcellid = locmaxpoint.first;
613 const int pos = m_StoreArrPosition[locmaxcellid];
614
615 B2DEBUG(175, "locmaxcellid: " << locmaxcellid);
616 const double LMEnergy = m_eclCalDigits[pos]->getEnergy();
617 B2DEBUG(175, "ok: ");
618
619 // Get the weight vector.
620 std::vector < double > myWeights = (*weightMap.find(locmaxcellid)).second;
621
622 for (unsigned int i = 0; i < digitVector.size(); ++i) {
623
624 const ECLCalDigit dig = digitVector[i];
625 const double weightInShower = myWeights[i];
626 const int cellid = dig.getCellId();
627 const double energy = dig.getEnergy();
628
629 // two ways to fail:
630 // 1) another cell in this shower has more energy: energy*weight > LMEnergy and cellid != locmaxcellid
631 // 2) local maximum has cell has less than threshold energy left: energy*weight < m_threshold and cellid == locmaxcellid
632 if ((energy * weightInShower > LMEnergy and cellid != locmaxcellid and m_removeShiftedLMs > 0) or
633 (energy * weightInShower < m_threshold and cellid == locmaxcellid)) {
634 markfordeletion.push_back(locmaxcellid);
635 iterateclusters = true;
636 continue;
637 } // end check deletion for this digit
638 }// end digit loop
639 }
640
641 // delete LMs
642 for (const auto lmid : markfordeletion) {
643 localMaximumsPoints.erase(lmid);
644 centroidPoints.erase(lmid);
645 }
646
647 } while (iterateclusters);
648
649 // Create the ECLShower objects, one per LocalMaximumPoints
650 unsigned int iShower = 1;
651 for (const auto& locmaxpoint : localMaximumsPoints) {
652
653 const int locmaxcellid = locmaxpoint.first;
654 const int posLM = m_StoreArrPositionLM[locmaxcellid];
655
656 // Create a shower
657 const auto aECLShower = m_eclShowers.appendNew();
658
659 // Use the same method for the estimate (3x3).
660 const double energyEstimation = estimateEnergy(locmaxcellid);
661
662 // Get the neighbour list.
663 const ECLNeighbours* neighbourMap; // FIXME need pointer?
664 int nNeighbours = getNeighbourMap(energyEstimation, backgroundLevel);
665 if (nNeighbours == 9 and !m_useOptimalNumberOfDigitsForEnergy) neighbourMap = m_NeighbourMap9;
666 else neighbourMap = m_NeighbourMap21;
667
668 // Get the neighbour list.
669 std::vector<short int> neighbourlist = neighbourMap->getNeighbours(locmaxcellid);
670
671 // Get the weight vector.
672 std::vector < double > myWeights = (*weightMap.find(locmaxcellid)).second;
673
674 // Loop over all digits.
675 std::vector<ECLCalDigit> newdigits;
676 std::vector<double> newweights;
677 double highestEnergy = 0.;
678 double highestEnergyTime = 0.;
679 double highestEnergyTimeResolution = 0.;
680 double weightSum = 0.0;
681
682 for (unsigned int i = 0; i < digitVector.size(); ++i) {
683
684 const ECLCalDigit dig = digitVector[i];
685 const double weight = myWeights[i];
686
687 const int cellid = dig.getCellId();
688 const int pos = m_StoreArrPosition[cellid];
689
690 // Add weighted relations of all CalDigits to the local maximum.
691 m_eclLocalMaximums[posLM]->addRelationTo(m_eclCalDigits[pos], weight);
692
693 // Positive weight and in allowed neighbour list?
694 if (weight > 0.0) {
695 if (std::find(neighbourlist.begin(), neighbourlist.end(), cellid) != neighbourlist.end()) {
696
697 aECLShower->addRelationTo(m_eclCalDigits[pos], weight);
698
699 newdigits.push_back(dig);
700 newweights.push_back(weight);
701
702 weightSum += weight;
703
704 const double energy = dig.getEnergy();
705
706 if (energy * weight > highestEnergy) {
707 highestEnergy = energy * weight;
708 highestEnergyTime = dig.getTime();
709 highestEnergyTimeResolution = dig.getTimeResolution();
710 }
711 }
712 }
713 }
714
715 // Old position:
716 B2Vector3D* oldshowerposition = new B2Vector3D((centroidList.find(locmaxcellid))->second);
717
718 B2DEBUG(175, "old theta: " << oldshowerposition->Theta());
719 B2DEBUG(175, "old phi: " << oldshowerposition->Phi());
720 B2DEBUG(175, "old R: " << oldshowerposition->Mag());
721 B2DEBUG(175, "old energy: " << energyEstimation);
722 delete oldshowerposition;
723
724 // New position (with reduced number of neighbours)
725 // There are some cases where high backgrounds fake local maxima and the split centroid position is far
726 // away from the original LM cell... this will throw a (non fatal) error, and create a cluster with zero energy now).
727#ifndef __clang_analyzer__
728 B2Vector3D* showerposition = new B2Vector3D(Belle2::ECL::computePositionLiLo(newdigits, newweights, m_liloParameters));
729 aECLShower->setTheta(showerposition->Theta());
730 aECLShower->setPhi(showerposition->Phi());
731 aECLShower->setR(showerposition->Mag());
732
733 B2DEBUG(175, "new theta: " << showerposition->Theta());
734 B2DEBUG(175, "new phi: " << showerposition->Phi());
735 B2DEBUG(175, "new R: " << showerposition->Mag());
736 delete showerposition;
737#endif
738
739 // Get Energy, if requested, set weights to zero for energy calculation.
740 double showerEnergy = 0.0;
742
743
744 // Get the optimal number of neighbours for this crystal and energy
745 std::vector<int> nOptimalVec = getOptimalNumberOfDigits(locmaxcellid, energyEstimation);
746 const unsigned int nOptimal = static_cast<unsigned int>(nOptimalVec[0]);
747 aECLShower->setNominalNumberOfCrystalsForEnergy(static_cast<double>(nOptimal));
748
749 // Store the indices used; will be needed later for energy corrections.
750 // Also store energy, used along with cellID to find leakage corrections.
751 aECLShower->setNOptimalGroupIndex(nOptimalVec[1]);
752 aECLShower->setNOptimalEnergyBin(nOptimalVec[2]);
753 aECLShower->setNOptimalEnergy(energyEstimation);
754
755 // Get the list of crystals used for the energy calculation
756 std::vector< std::pair<unsigned int, double>> listCrystalPairs; // cell id and weighted reconstructed energy
757 listCrystalPairs.resize(newdigits.size()); //resize to number of all crystals in cluster
758
759 std::vector < std::pair<double, double> > weighteddigits;
760 weighteddigits.resize(newdigits.size());
761 for (unsigned int i = 0; i < newdigits.size(); ++i) {
762 weighteddigits.at(i) = std::make_pair((newdigits.at(i)).getEnergy(), newweights.at(i));
763 listCrystalPairs.at(i) = std::make_pair((newdigits.at(i)).getCellId(), newweights.at(i) * (newdigits.at(i)).getEnergy());
764 }
765
766 // sort the listCrystals and keep the n highest in descending order
767 std::sort(listCrystalPairs.begin(), listCrystalPairs.end(), [](const auto & left, const auto & right) {
768 return left.second > right.second;
769 });
770
771 std::vector< unsigned int> listCrystals; //cell id
772
773 for (unsigned int i = 0; i < newdigits.size(); ++i) {
774 if (i < nOptimal) {
775 listCrystals.push_back(listCrystalPairs[i].first);
776 }
777 }
778
779 aECLShower->setNumberOfCrystalsForEnergy(static_cast<double>(listCrystals.size()));
780 aECLShower->setListOfCrystalsForEnergy(listCrystals);
781
782 showerEnergy = getEnergySum(weighteddigits, nOptimal);
783 B2DEBUG(175, "Shower Energy (2): " << showerEnergy);
784
785 } else {
786 showerEnergy = Belle2::ECL::computeEnergySum(newdigits, newweights);
787 }
788
789 aECLShower->setEnergy(showerEnergy);
790 aECLShower->setEnergyRaw(showerEnergy);
791 aECLShower->setEnergyHighestCrystal(highestEnergy);
792 aECLShower->setTime(highestEnergyTime);
793 aECLShower->setDeltaTime99(highestEnergyTimeResolution);
794 aECLShower->setNumberOfCrystals(weightSum);
795 aECLShower->setCentralCellId(locmaxcellid);
796
797 B2DEBUG(175, "new energy: " << showerEnergy);
798
799 // Get unique ID
800 aECLShower->setShowerId(iShower);
801 ++iShower;
802 aECLShower->setHypothesisId(Belle2::ECLShower::c_nPhotons);
803 aECLShower->setConnectedRegionId(aCR.getCRId());
804
805 // Add relation to the CR.
806 aECLShower->addRelationTo(&aCR);
807
808 // Add relation to the LM.
809 aECLShower->addRelationTo(m_eclLocalMaximums[posLM]);
810 }
811 }
812}
DataType Phi() const
The azimuth angle.
Definition B2Vector3.h:153
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition B2Vector3.h:439
DataType Theta() const
The polar angle.
Definition B2Vector3.h:155
DataType X() const
access variable X (= .at(0) without boundary check)
Definition B2Vector3.h:435
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition B2Vector3.h:437
DataType Mag() const
The magnitude (rho in spherical coordinate system).
Definition B2Vector3.h:161
int getCellId() const
Get Cell ID.
double getEnergy() const
Get Calibrated Energy.
double getTimeResolution() const
Get Calibrated Time Resolution.
double getTime() const
Get Calibrated Time.
int getCRId() const
Get CR identifier.
@ c_nPhotons
CR is split into n photons (N1)
Definition ECLShower.h:42
int m_maxIterations
Maximum number of iterations.
double m_sharingDistanceMolierMultiplier
Maximum distance d to use when sharing energy d = m_sharingDistanceMolierMultiplier*c_molierRadius.
int m_removeShiftedLMs
Remove LMs if the splitter shifted the centroid position too much.
double m_minimumSharedEnergy
Minimum shared energy.
double m_threshold
Local maximum threshold after splitting.
double estimateEnergy(const int centerid)
Estimate energy using 3x3 around central crystal.
std::vector< int > getOptimalNumberOfDigits(const int cellid, const double energy)
Get optimal number of digits (out of 21) based on first energy estimation and background level per ev...
double m_shiftTolerance
Tolerance level for centroid shifts.
int m_fullBkgdCount
Number of expected background digits at full background, FIXME: move to database.
const double c_molierRadius
Constant RM (Molier Radius) from exp(-a*dist/RM), http://pdg.lbl.gov/2009/AtomicNuclearProperties/HTM...
int m_maxSplits
Maximum number of splits.
int m_useOptimalNumberOfDigitsForEnergy
Optimize the number of neighbours for energy calculations.
static int getNeighbourMap(const double energy, const double background)
Get number of neighbours based on first energy estimation and background level per event.
static double getEnergySum(std::vector< std::pair< double, double > > &weighteddigits, const unsigned int n)
Get energy sum for weighted entries.
double m_expConstant
Constant a from exp(-a*dist/RM), 1.5 to 2.5.
const std::vector< short int > & getNeighbours(short int cid) const
Return the neighbours for a given cell ID.
RelationVector< T > getRelationsWith(const std::string &name="", const std::string &namedRelation="") const
Get the relations between this object and another store array.
static const double MeV
[megaelectronvolt]
Definition Unit.h:114
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:522

◆ terminate()

void terminate ( void )
overridevirtualinherited

Terminate.

Reimplemented from Module.

Definition at line 207 of file ECLSplitterN1Module.cc.

208{
211}

Member Data Documentation

◆ c_molierRadius

const double c_molierRadius
privateinherited
Initial value:
= 3.581 *
static const double cm
Standard units with the value = 1.
Definition Unit.h:47

Constant RM (Molier Radius) from exp(-a*dist/RM), http://pdg.lbl.gov/2009/AtomicNuclearProperties/HTML_PAGES/141.html.

Definition at line 73 of file ECLSplitterN1Module.h.

◆ m_cellIdInCR

std::vector< int > m_cellIdInCR
privateinherited

list with all cellid of this connected region

Definition at line 108 of file ECLSplitterN1Module.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_cutDigitEnergyForEnergy

double m_cutDigitEnergyForEnergy
privateinherited

Minimum digit energy to be included in the shower energy calculation.

Definition at line 76 of file ECLSplitterN1Module.h.

◆ m_cutDigitTimeResidualForEnergy

double m_cutDigitTimeResidualForEnergy
privateinherited

Maximum time residual to be included in the shower energy calculation.

Definition at line 77 of file ECLSplitterN1Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 510 of file Module.h.

◆ m_eBoundaries

std::vector< std::vector<float> > m_eBoundaries
privateinherited

energy boundaries each region

Definition at line 89 of file ECLSplitterN1Module.h.

◆ m_eclCalDigits

StoreArray<ECLCalDigit> m_eclCalDigits
privateinherited

Store array: ECLCalDigit.

Definition at line 115 of file ECLSplitterN1Module.h.

◆ m_eclConnectedRegions

StoreArray<ECLConnectedRegion> m_eclConnectedRegions
privateinherited

Store array: ECLConnectedRegion.

Definition at line 118 of file ECLSplitterN1Module.h.

◆ m_eclLocalMaximums

StoreArray<ECLLocalMaximum> m_eclLocalMaximums
privateinherited

Store array: ECLLocalMaximum.

Definition at line 124 of file ECLSplitterN1Module.h.

◆ m_eclNOptimal

DBObjPtr<ECLnOptimal> m_eclNOptimal
privateinherited

nOptimal payload

DB object to store the optimal number of crystals which is stored with clusters for calibration

Definition at line 84 of file ECLSplitterN1Module.h.

◆ m_eclShowers

StoreArray<ECLShower> m_eclShowers
privateinherited

Store array: ECLShower.

Definition at line 121 of file ECLSplitterN1Module.h.

◆ m_eventLevelClusteringInfo

StoreObjPtr<EventLevelClusteringInfo> m_eventLevelClusteringInfo
privateinherited

Store object pointer: EventLevelClusteringInfo.

Definition at line 127 of file ECLSplitterN1Module.h.

◆ m_expConstant

double m_expConstant
privateinherited

Constant a from exp(-a*dist/RM), 1.5 to 2.5.

Definition at line 68 of file ECLSplitterN1Module.h.

◆ m_fullBkgdCount

int m_fullBkgdCount
privateinherited

Number of expected background digits at full background, FIXME: move to database.

Definition at line 99 of file ECLSplitterN1Module.h.

◆ m_geom

ECL::ECLGeometryPar* m_geom {nullptr}
privateinherited

Geometry.

Definition at line 150 of file ECLSplitterN1Module.h.

150{nullptr};

◆ m_groupNumber

std::vector<int> m_groupNumber
privateinherited

group number for each crystal

Definition at line 86 of file ECLSplitterN1Module.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 517 of file Module.h.

◆ m_liloParameterA

double m_liloParameterA
privateinherited

lin-log parameter A

Definition at line 93 of file ECLSplitterN1Module.h.

◆ m_liloParameterB

double m_liloParameterB
privateinherited

lin-log parameter B

Definition at line 94 of file ECLSplitterN1Module.h.

◆ m_liloParameterC

double m_liloParameterC
privateinherited

lin-log parameter C

Definition at line 95 of file ECLSplitterN1Module.h.

◆ m_liloParameters

std::vector<double> m_liloParameters
privateinherited

lin-log parameters A, B, and C

Definition at line 96 of file ECLSplitterN1Module.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 513 of file Module.h.

◆ m_maxIterations

int m_maxIterations
privateinherited

Maximum number of iterations.

Definition at line 69 of file ECLSplitterN1Module.h.

◆ m_maxSplits

int m_maxSplits
privateinherited

Maximum number of splits.

Definition at line 72 of file ECLSplitterN1Module.h.

◆ m_minimumSharedEnergy

double m_minimumSharedEnergy
privateinherited

Minimum shared energy.

Definition at line 71 of file ECLSplitterN1Module.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_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_NeighbourMap21

ECL::ECLNeighbours* m_NeighbourMap21 {nullptr}
privateinherited

5x5 neighbours excluding corners = 21

Definition at line 112 of file ECLSplitterN1Module.h.

112{nullptr};

◆ m_NeighbourMap9

ECL::ECLNeighbours* m_NeighbourMap9 {nullptr}
privateinherited

Neighbour maps.

3x3 = 9 neighbours

Definition at line 111 of file ECLSplitterN1Module.h.

111{nullptr};

◆ m_nEnergyBins

int m_nEnergyBins = 0
privateinherited

number of energies bins in nOptimal payload

Definition at line 88 of file ECLSplitterN1Module.h.

◆ m_nLeakReg

const int m_nLeakReg = 3
privateinherited

3 ECL regions: 0 = forward, 1 = barrel, 2 = backward

Definition at line 87 of file ECLSplitterN1Module.h.

◆ m_nOptimal2D

TH2F m_nOptimal2D
privateinherited

2D hist of nOptimal for Ebin vs groupID

Definition at line 85 of file ECLSplitterN1Module.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_positionMethod

std::string m_positionMethod
privateinherited

Position calculation: lilo or linear.

Definition at line 92 of file ECLSplitterN1Module.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_removeShiftedLMs

int m_removeShiftedLMs
privateinherited

Remove LMs if the splitter shifted the centroid position too much.

Definition at line 79 of file ECLSplitterN1Module.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 518 of file Module.h.

◆ m_sharingDistanceMolierMultiplier

double m_sharingDistanceMolierMultiplier
privateinherited

Maximum distance d to use when sharing energy d = m_sharingDistanceMolierMultiplier*c_molierRadius.

Definition at line 80 of file ECLSplitterN1Module.h.

◆ m_shiftTolerance

double m_shiftTolerance
privateinherited

Tolerance level for centroid shifts.

Definition at line 70 of file ECLSplitterN1Module.h.

◆ m_StoreArrPosition

std::vector< int > m_StoreArrPosition
privateinherited

vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions

Definition at line 102 of file ECLSplitterN1Module.h.

◆ m_StoreArrPositionLM

std::vector< int > m_StoreArrPositionLM
privateinherited

vector (ECLElementNumbers::c_NCrystals + 1 entries) with cell id to store array positions for LM

Definition at line 105 of file ECLSplitterN1Module.h.

◆ m_threshold

double m_threshold
privateinherited

Local maximum threshold after splitting.

Definition at line 67 of file ECLSplitterN1Module.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_useOptimalNumberOfDigitsForEnergy

int m_useOptimalNumberOfDigitsForEnergy
privateinherited

Optimize the number of neighbours for energy calculations.

Definition at line 78 of file ECLSplitterN1Module.h.


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