Belle II Software development
DataWriterModule Class Reference

Module to write Ntuples for KlId BKG classifier training. More...

#include <DataWriterModule.h>

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

 DataWriterModule ()
 Constructor.
 
virtual ~DataWriterModule ()
 Destructor.
 
virtual void initialize () override
 init
 
virtual void beginRun () override
 beginn run
 
virtual void event () override
 process event
 
virtual void endRun () override
 end run
 
virtual void terminate () override
 terminate
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module.
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter.
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

Static Public Member Functions

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

Protected Member Functions

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

Private Member Functions

std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

std::string m_outPath = "KlIdBKGClassifierTrainingTuples.root"
 Output path variable.
 
Float_t m_KLMnCluster
 varibales to write out.
 
Float_t m_KLMnLayer
 number of layers hit in KLM cluster
 
Float_t m_KLMnInnermostLayer
 number of innermost layers hit
 
Float_t m_KLMglobalZ
 global Z position in KLM

 
Float_t m_KLMtime
 timing of KLM Cluster
 
Float_t m_KLMavInterClusterDist
 average distance between all KLM clusters
 
Float_t m_KLMhitDepth
 hit depth in KLM, distance to IP
 
Float_t m_KLMenergy
 Energy deposit in KLM (0.2 GeV * nHitCells)
 
Float_t m_KLMinvM
 invariant mass calculated from root vector
 
Float_t m_KLMTruth
 target variable for KLM classification
 
Float_t m_KLMnextCluster
 distance to next KLM cluster
 
Float_t m_KLMTrackSepDist
 distance from track separation object

 
Float_t m_KLMTrackSepAngle
 angular distance from track separation object
 
Float_t m_KLMInitialTrackSepAngle
 angular distance from track to cluster at track starting point
 
Float_t m_KLMTrackRotationAngle
 angle between track at poca and trackbeginning
 
Float_t m_KLMTrackClusterSepAngle
 angle between trach momentum and cluster (measured from ip)
 
Float_t m_KLMAngleToMC
 angle between KLMcluster and Mcparticle
 
Float_t m_KLMECLDist
 distance associated ECL <-> KLM cluster
 
Float_t m_KLMECLE
 energy measured in associated ECL cluster
 
Float_t m_KLMECLdeltaL
 distance between track entry point and cluster center, might be removed
 
Float_t m_KLMECLminTrackDist
 track distance between associated ECL cluster and track extrapolated into ECL
 
Float_t m_KLMECLE9oE25
 E in surrounding 9 crystals divided by surrounding 25 crydtalls.
 
Float_t m_KLMECLTiming
 timing of associated ECL cluster
 
Float_t m_KLMECLTerror
 uncertainty on time in associated ECL cluster
 
Float_t m_KLMECLEerror
 uncertainty on E in associated ECL cluster
 
Float_t m_KLMtrackToECL
 primitive distance cluster <-> track for associated ECL cluster
 
Float_t m_KLMKLid
 KlId for that object.
 
Float_t m_KLMMCMom
 momentum of matched mc particle
 
Float_t m_KLMMCPhi
 phi of matched mc particle
 
Float_t m_KLMMCTheta
 theta of matched mc particle
 
Float_t m_KLMMom
 measured momentum
 
Float_t m_KLMPhi
 measured phi

 
Float_t m_KLMTheta
 measured theta
 
Float_t m_KLMMCStatus
 MC particles status.
 
Float_t m_KLMMCLifetime
 MC partilces life time.
 
Float_t m_KLMMCPDG
 pdg code of matched MCparticle
 
Float_t m_KLMMCPrimaryPDG
 pdg code of MCparticles mother, for example pi0 for some gammas
 
Float_t m_KLMECLHypo
 hypotheis id of closest ecl cluster 5: gamma, 6:hadron

 
Float_t m_KLMECLZMVA
 zernike mva output for closest ECL cluster (based on around 10 z-moments)
 
Float_t m_KLMECLZ40
 zernike moment 4,0 of closest ecl cluster
 
Float_t m_KLMECLZ51
 zernike moment 5,1 of closest ECL cluster
 
Float_t m_KLMECLUncertaintyPhi
 phi uncertainty oof closeest ecl cluster
 
Float_t m_KLMECLUncertaintyTheta
 theta uncertainty of closest ECL cluster
 
Float_t m_KLMMCWeight
 mc weight
 
Float_t m_KLMtrackFlag
 track flag for belle comparision
 
Float_t m_KLMeclFlag
 ecl flag for belle comparision
 
Float_t m_ECLE
 measured energy
 
Float_t m_ECLE9oE25
 energy of 9/25 chrystall rings (E dispersion shape)
 
Float_t m_ECLTiming
 timing of ECL
 
Float_t m_ECLR
 distance of cluster to IP
 
Float_t m_ECLEerror
 uncertainty on E measurement in ECL
 
Float_t m_ECLminTrkDistance
 more sophisticated distaqnce to track in ECL
 
Float_t m_ECLdeltaL
 distance between track entrace into cluster and cluster center
 
Float_t m_ECLZ51
 Zernike moment 5,1 see Belle2 note on that.
 
Float_t m_ECLZ40
 Zernike moment 4,0 see Belle2 note on that.
 
Float_t m_ECLE1oE9
 central crystal devided by 3x3 area with it in its center
 
Float_t m_ECL2ndMom
 second moment, shower shape
 
Float_t m_ECLnumChrystals
 number of crystals in the cluster
 
Float_t m_ECLLAT
 lateral shower shape
 
Float_t m_ECLZMVA
 output of a BDT that was fitted on some Zernike Moments on a connected region
 
Float_t m_ECLKLid
 classifier output
 
Float_t m_ECLMCStatus
 mc status, seen in detector etc.
 
Float_t m_ECLMCLifetime
 MC particles lifetime.
 
Float_t m_ECLMCPDG
 pdg code of the MCparticle directly related to the cluster
 
Float_t m_ECLMCPrimaryPDG
 pdg code of higher order MC particle, a cluster related to a photon that originates from a pi0 decay get the pi0 code
 
Float_t m_ECLDeltaTime
 KlId for that object.
 
Float_t m_ECLUncertaintyEnergy
 measured energy uncertainty
 
Float_t m_ECLUncertaintyTheta
 measured uncertainty on theta
 
Float_t m_ECLUncertaintyPhi
 measured uncertainty of phi
 
Float_t m_ECLMCMom
 MC particle momentum; -999 if not MCparticle.
 
Float_t m_ECLMCPhi
 MC particle phi; -999 if not MCparticle

 
Float_t m_ECLMCTheta
 MC particle momentum; -999 if not MCparticle.
 
Float_t m_ECLMom
 measured momentum
 
Float_t m_ECLPhi
 measured phi
 
Float_t m_ECLTheta
 measured theta
 
Float_t m_ECLZ
 measured Z-coordinate
 
Float_t m_ECLTruth
 ECL trarget variable.
 
Float_t m_isBeamBKG
 is beam bkg
 
Float_t m_ECLMCWeight
 mc weight
 
Float_t m_isSignal
 isSignal for the classifier
 
StoreArray< MCParticlem_mcParticles
 Store array

 
StoreArray< KLMClusterm_klmClusters
 Store array

 
StoreArray< ECLClusterm_eclClusters
 Store array

 
TFile * m_f = nullptr
 root file
 
TTree * m_treeKLM = nullptr
 tree for klm data
 
TTree * m_treeECLhadron = nullptr
 tree containing ntuples for ECL cluster with N2 (hadron hypothesis)
 
TTree * m_treeECLgamma = nullptr
 tree containing ntuples for ECL cluster with N1 (photon hypothesis)
 
bool m_useKLM
 write out KLM data
 
bool m_useECL
 write out KLM data
 
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

Module to write Ntuples for KlId BKG classifier training.

Writes tuples for both ECL and KLM. You have to specify an outputpath outPath.

Definition at line 29 of file DataWriterModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

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

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

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

c_HistogramManager 

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

c_InternalSerializer 

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

c_TerminateInAllProcesses 

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

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

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

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

Constructor & Destructor Documentation

◆ DataWriterModule()

Constructor.

Definition at line 37 of file DataWriterModule.cc.

37 : Module()
38{
39 setDescription("Used to write flat ntuple for KlId classifier trainings for both ECL and KLM KlID. Output is a root file.");
40
41 addParam("outPath", m_outPath, "Output path - where you want your root files to be placed.", m_outPath);
42 addParam("useKLM", m_useKLM, "Write KLM data.", m_useKLM);
43 addParam("useECL", m_useECL, "Write ECL data.", m_useECL);
44}
bool m_useKLM
write out KLM data
std::string m_outPath
Output path variable.
bool m_useECL
write out KLM data
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Module()
Constructor.
Definition: Module.cc:30
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560

◆ ~DataWriterModule()

~DataWriterModule ( )
virtual

Destructor.

Definition at line 48 of file DataWriterModule.cc.

49{
50}

Member Function Documentation

◆ beginRun()

void beginRun ( void  )
overridevirtual

beginn run

Reimplemented from Module.

Definition at line 200 of file DataWriterModule.cc.

201{
202}

◆ clone()

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

Create an independent copy of this module.

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

Implements PathElement.

Definition at line 179 of file Module.cc.

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

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

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

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

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

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

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

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

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

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

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

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

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

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

◆ endRun()

void endRun ( void  )
overridevirtual

end run

Reimplemented from Module.

Definition at line 204 of file DataWriterModule.cc.

205{
206}

◆ evalCondition()

bool evalCondition ( ) const
inherited

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

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

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

Definition at line 96 of file Module.cc.

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

◆ event()

void event ( void  )
overridevirtual

process event

Reimplemented from Module.

Definition at line 208 of file DataWriterModule.cc.

209{
210 // Use the neutralHadron hypothesis for the ECL
212
213 for (const KLMCluster& cluster : m_klmClusters) {
214
215 if (!m_useKLM) {continue;}
216
217 const ROOT::Math::XYZVector& clusterPos = cluster.getClusterPosition();
218
219 m_KLMPhi = clusterPos.Phi();
220 m_KLMTheta = clusterPos.Theta();
221
222 m_KLMglobalZ = clusterPos.Z();
223 m_KLMnCluster = m_klmClusters.getEntries();
224 m_KLMnLayer = cluster.getLayers();
225 m_KLMnInnermostLayer = cluster.getInnermostLayer();
226 m_KLMtime = cluster.getTime();
227 m_KLMinvM = cluster.getMomentum().M2();
228 m_KLMenergy = cluster.getEnergy();
229 m_KLMhitDepth = cluster.getClusterPosition().R();
230 m_KLMtrackFlag = cluster.getAssociatedTrackFlag();
231 m_KLMeclFlag = cluster.getAssociatedEclClusterFlag();
232
233 m_KLMTrackSepDist = -999;
234 m_KLMTrackSepAngle = -999;
238 auto trackSeperations = cluster.getRelationsTo<TrackClusterSeparation>();
239 TrackClusterSeparation* trackSep;
240 float best_dist = 100000000;
241 for (auto trackSeperation : trackSeperations) {
242 float dist = trackSeperation.getDistance();
243 if (dist < best_dist) {
244 best_dist = dist;
245 trackSep = &trackSeperation;
246 m_KLMTrackSepDist = trackSep->getDistance();
247 m_KLMTrackSepAngle = trackSep->getTrackClusterAngle();
248 m_KLMInitialTrackSepAngle = trackSep->getTrackClusterInitialSeparationAngle();
249 m_KLMTrackRotationAngle = trackSep->getTrackRotationAngle();
250 m_KLMTrackClusterSepAngle = trackSep->getTrackClusterSeparationAngle();
251 }
252 }
253
254
255 if (isnan(m_KLMglobalZ)) { m_KLMglobalZ = -999;}
256 if (isnan(m_KLMnCluster)) { m_KLMnCluster = -999;}
257 if (isnan(m_KLMnLayer)) { m_KLMnLayer = -999;}
258 if (isnan(m_KLMnInnermostLayer)) { m_KLMnInnermostLayer = -999;}
259 if (isnan(m_KLMtime)) { m_KLMtime = -999;}
260 if (isnan(m_KLMinvM)) { m_KLMinvM = -999;}
261 if (isnan(m_KLMenergy)) { m_KLMenergy = -999;}
262 if (isnan(m_KLMhitDepth)) { m_KLMhitDepth = -999;}
263 if (isnan(m_KLMTrackSepDist)) { m_KLMTrackSepDist = -999;}
264 if (isnan(m_KLMTrackSepAngle)) { m_KLMTrackSepAngle = -999;}
268
269 // findClosestECLCluster with the c_neutralHadron hypothesis
270 pair<ECLCluster*, double> closestECLAndDist = findClosestECLCluster(clusterPos, eclHypothesis);
271 ECLCluster* closestECLCluster = get<0>(closestECLAndDist);
272 m_KLMECLDist = get<1>(closestECLAndDist);
273
274 if (!(closestECLCluster == nullptr)) {
275 m_KLMECLE = closestECLCluster->getEnergy(eclHypothesis);
276 m_KLMECLE9oE25 = closestECLCluster->getE9oE21();
277 m_KLMECLEerror = closestECLCluster->getUncertaintyEnergy();
278 m_KLMECLTerror = closestECLCluster->getDeltaTime99();
279 m_KLMECLdeltaL = closestECLCluster->getDeltaL();;
280 m_KLMECLminTrackDist = closestECLCluster->getMinTrkDistance();
281 m_KLMECLTiming = closestECLCluster->getTime();
282 m_KLMECLZMVA = closestECLCluster->getZernikeMVA();
283 m_KLMECLZ40 = closestECLCluster->getAbsZernike40();
284 m_KLMECLZ51 = closestECLCluster->getAbsZernike51();
285 m_KLMECLUncertaintyPhi = closestECLCluster->getUncertaintyPhi();
286 m_KLMECLUncertaintyTheta = closestECLCluster->getUncertaintyTheta();
287 m_KLMECLHypo = closestECLCluster->getHypotheses();
288 } else {
289 m_KLMECLdeltaL = -999;
291 m_KLMECLE = -999;
292 m_KLMECLE9oE25 = -999;
293 m_KLMECLTiming = -999;
294 m_KLMECLTerror = -999;
295 m_KLMECLEerror = -999;
296
297 m_KLMECLHypo = -999;
298 m_KLMECLZMVA = -999;
299 m_KLMECLZ40 = -999;
300 m_KLMECLZ51 = -999;
303 }
304
305 tuple<const KLMCluster*, double, double> closestKLMAndDist = findClosestKLMCluster(clusterPos);
306 m_KLMnextCluster = get<1>(closestKLMAndDist);
307 m_KLMavInterClusterDist = get<2>(closestKLMAndDist);
308
309 const auto mcParticleWeightPair = cluster.getRelatedToWithWeight<MCParticle>();
310 MCParticle* part = mcParticleWeightPair.first;
311
314
315 if (part) {
316 m_KLMMCWeight = mcParticleWeightPair.second;
317 m_KLMAngleToMC = ROOT::Math::VectorUtil::Angle(clusterPos, part->getMomentum());
318 m_KLMMCStatus = part->getStatus();
319 m_KLMMCLifetime = part->getLifetime();
320 m_KLMMCPDG = std::abs(part->getPDG());
322 m_KLMMCMom = part->getMomentum().R();
323 m_KLMMCPhi = part->getMomentum().Phi();
324 m_KLMMCTheta = part->getMomentum().Theta();
325 } else {
326 m_KLMMCWeight = -999;
327 m_KLMAngleToMC = -999;
328 m_KLMMCStatus = -999;
329 m_KLMMCLifetime = -999;
330 m_KLMMCPDG = -999;
331 m_KLMMCPrimaryPDG = -999;
332 m_KLMMCMom = -999;
333 m_KLMMCPhi = -999;
334 m_KLMMCTheta = -999;
335 }
336
337 KlId* klid = cluster.getRelatedTo<KlId>();
338 if (klid) {
339 m_KLMKLid = klid->getKlId();
340 } else {
341 m_KLMKLid = -999;
342 }
343 m_isSignal = isKLMClusterSignal(cluster, 0);
344
345
346 m_treeKLM -> Fill();
347 }// for klmcluster in klmclusters
348
349// --------------- ECL CLUSTERS
350 for (const ECLCluster& cluster : m_eclClusters) {
351
352 if (!m_useECL or !cluster.hasHypothesis(eclHypothesis)) {continue;}
353
354 m_ECLminTrkDistance = cluster.getMinTrkDistance();
355 m_ECLdeltaL = cluster.getDeltaL();
356 m_ECLE = cluster.getEnergy(eclHypothesis);
357 m_ECLE9oE25 = cluster.getE9oE21();
358 m_ECLTiming = cluster.getTime();
359 m_ECLR = cluster.getR();
360 m_ECLEerror = cluster.getUncertaintyEnergy();
361 m_ECLZ51 = cluster.getAbsZernike51();
362 m_ECLZ40 = cluster.getAbsZernike40();
363 m_ECLE1oE9 = cluster.getE1oE9();
364 m_ECL2ndMom = cluster.getSecondMoment();
365 m_ECLnumChrystals = cluster.getNumberOfCrystals();
366 m_ECLLAT = cluster.getLAT();
367 m_ECLZMVA = cluster.getZernikeMVA();
368
369 if (isnan(m_ECLminTrkDistance)) { m_ECLminTrkDistance = -999;}
370 if (isnan(m_ECLdeltaL)) { m_ECLdeltaL = -999;}
371 if (isnan(m_ECLE)) { m_ECLE = -999;}
372 if (isnan(m_ECLE9oE25)) { m_ECLE9oE25 = -999;}
373 if (isnan(m_ECLTiming)) { m_ECLTiming = -999;}
374 if (isnan(m_ECLR)) { m_ECLR = -999;}
375 if (isnan(m_ECLEerror)) { m_ECLEerror = -999;}
376 if (isnan(m_ECLZ40)) { m_ECLZ40 = -999;}
377 if (isnan(m_ECLZ51)) { m_ECLZ51 = -999;}
378 if (isnan(m_ECLE1oE9)) { m_ECLE1oE9 = -999;}
379 if (isnan(m_ECL2ndMom)) { m_ECL2ndMom = -999;}
380 if (isnan(m_ECLnumChrystals)) { m_ECLnumChrystals = -999;}
381 if (isnan(m_ECLLAT)) { m_ECLLAT = -999;}
382 if (isnan(m_ECLZMVA)) { m_ECLZMVA = -999;}
383
384 KlId* klid = cluster.getRelatedTo<KlId>();
385 if (klid) {
386 m_ECLKLid = klid->getKlId();
387 } else {
388 m_ECLKLid = -999;
389 }
390
391 const ROOT::Math::XYZVector& clusterPos = cluster.getClusterPosition();
392
393 m_ECLPhi = clusterPos.Phi();
394 m_ECLTheta = clusterPos.Theta();
395 m_ECLZ = clusterPos.Z();
396
397 ClusterUtils C;
398 m_ECLMom = C.Get4MomentumFromCluster(&cluster, eclHypothesis).Vect().Mag2();
399 m_ECLDeltaTime = cluster.getDeltaTime99();
400
401 m_ECLUncertaintyEnergy = cluster.getUncertaintyEnergy();
402 m_ECLUncertaintyTheta = cluster.getUncertaintyTheta();
403 m_ECLUncertaintyPhi = cluster.getUncertaintyPhi();
404
405// MCParticle* part = cluster.getRelatedTo<MCParticle>();
406 const auto mcParticleWeightPair = cluster.getRelatedToWithWeight<MCParticle>();
407 MCParticle* part = mcParticleWeightPair.first;
408
411 if (part) {
412 m_ECLMCWeight = mcParticleWeightPair.second;
413 m_ECLMCStatus = part->getStatus();
414 m_ECLMCLifetime = part->getLifetime();
415 m_ECLMCPDG = std::abs(part->getPDG());
416
418
419 m_ECLMCMom = part->getMomentum().Mag2();
420 m_ECLMCPhi = part->getMomentum().Phi();
421 m_ECLMCTheta = part->getMomentum().Theta();
422 } else {
423 m_ECLMCWeight = -999;
424 m_ECLMCStatus = -999;
425 m_ECLMCLifetime = -999;
426 m_ECLMCPrimaryPDG = -999;
427 m_ECLMCPDG = -999;
428 m_ECLMCMom = -999;
429 m_ECLMCPhi = -999;
430 m_ECLMCTheta = -999;
431 }
432
434
435 if (cluster.hasHypothesis(ECLCluster::EHypothesisBit::c_neutralHadron)) { m_treeECLhadron -> Fill();}
436 if (cluster.hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons)) { m_treeECLgamma -> Fill();}
437 }// for ecl cluster in clusters
438} // event
Class to provide momentum-related information from ECLClusters.
Definition: ClusterUtils.h:36
const ROOT::Math::PxPyPzEVector Get4MomentumFromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns four momentum vector.
Definition: ClusterUtils.cc:25
Float_t m_KLMnLayer
number of layers hit in KLM cluster
Float_t m_ECLnumChrystals
number of crystals in the cluster
Float_t m_KLMInitialTrackSepAngle
angular distance from track to cluster at track starting point
Float_t m_KLMTrackSepDist
distance from track separation object
Float_t m_KLMnCluster
varibales to write out.
Float_t m_KLMMCPhi
phi of matched mc particle
Float_t m_ECLMCLifetime
MC particles lifetime.
Float_t m_ECLE1oE9
central crystal devided by 3x3 area with it in its center
Float_t m_KLMTheta
measured theta
Float_t m_KLMECLdeltaL
distance between track entry point and cluster center, might be removed
Float_t m_KLMTrackSepAngle
angular distance from track separation object
Float_t m_ECLMCPrimaryPDG
pdg code of higher order MC particle, a cluster related to a photon that originates from a pi0 decay ...
StoreArray< KLMCluster > m_klmClusters
Store array
Float_t m_KLMECLminTrackDist
track distance between associated ECL cluster and track extrapolated into ECL
Float_t m_ECLE9oE25
energy of 9/25 chrystall rings (E dispersion shape)
Float_t m_KLMMCLifetime
MC partilces life time.
Float_t m_ECLLAT
lateral shower shape
Float_t m_KLMECLZ51
zernike moment 5,1 of closest ECL cluster
Float_t m_ECLdeltaL
distance between track entrace into cluster and cluster center
Float_t m_KLMMCPDG
pdg code of matched MCparticle
Float_t m_ECLminTrkDistance
more sophisticated distaqnce to track in ECL
Float_t m_ECLMCPDG
pdg code of the MCparticle directly related to the cluster
Float_t m_ECLMCWeight
mc weight
Float_t m_ECLKLid
classifier output
Float_t m_KLMTrackRotationAngle
angle between track at poca and trackbeginning
Float_t m_ECLEerror
uncertainty on E measurement in ECL
Float_t m_ECLR
distance of cluster to IP
Float_t m_ECLMom
measured momentum
Float_t m_ECLMCPhi
MC particle phi; -999 if not MCparticle
Float_t m_KLMTruth
target variable for KLM classification
Float_t m_KLMAngleToMC
angle between KLMcluster and Mcparticle
Float_t m_KLMECLE9oE25
E in surrounding 9 crystals divided by surrounding 25 crydtalls.
Float_t m_ECLMCStatus
mc status, seen in detector etc.
Float_t m_ECLE
measured energy
Float_t m_KLMECLZMVA
zernike mva output for closest ECL cluster (based on around 10 z-moments)
TTree * m_treeECLhadron
tree containing ntuples for ECL cluster with N2 (hadron hypothesis)
Float_t m_ECLZ40
Zernike moment 4,0 see Belle2 note on that.
Float_t m_ECLZ
measured Z-coordinate
Float_t m_ECLUncertaintyPhi
measured uncertainty of phi
Float_t m_ECL2ndMom
second moment, shower shape
Float_t m_KLMECLUncertaintyTheta
theta uncertainty of closest ECL cluster
Float_t m_ECLZMVA
output of a BDT that was fitted on some Zernike Moments on a connected region
TTree * m_treeECLgamma
tree containing ntuples for ECL cluster with N1 (photon hypothesis)
Float_t m_KLMMCStatus
MC particles status.
Float_t m_isBeamBKG
is beam bkg
Float_t m_KLMMCTheta
theta of matched mc particle
Float_t m_ECLTiming
timing of ECL
Float_t m_KLMMCWeight
mc weight
Float_t m_KLMECLTiming
timing of associated ECL cluster
Float_t m_KLMECLDist
distance associated ECL <-> KLM cluster
Float_t m_KLMglobalZ
global Z position in KLM
StoreArray< ECLCluster > m_eclClusters
Store array
Float_t m_isSignal
isSignal for the classifier
Float_t m_KLMnInnermostLayer
number of innermost layers hit
Float_t m_ECLTruth
ECL trarget variable.
Float_t m_KLMtime
timing of KLM Cluster
Float_t m_KLMECLTerror
uncertainty on time in associated ECL cluster
Float_t m_KLMinvM
invariant mass calculated from root vector
Float_t m_KLMnextCluster
distance to next KLM cluster
Float_t m_ECLUncertaintyEnergy
measured energy uncertainty
Float_t m_ECLTheta
measured theta
Float_t m_ECLUncertaintyTheta
measured uncertainty on theta
Float_t m_KLMECLHypo
hypotheis id of closest ecl cluster 5: gamma, 6:hadron
TTree * m_treeKLM
tree for klm data
Float_t m_ECLDeltaTime
KlId for that object.
Float_t m_ECLPhi
measured phi
Float_t m_KLMhitDepth
hit depth in KLM, distance to IP
Float_t m_ECLZ51
Zernike moment 5,1 see Belle2 note on that.
Float_t m_KLMTrackClusterSepAngle
angle between trach momentum and cluster (measured from ip)
Float_t m_KLMPhi
measured phi
Float_t m_ECLMCMom
MC particle momentum; -999 if not MCparticle.
Float_t m_KLMavInterClusterDist
average distance between all KLM clusters
Float_t m_KLMECLEerror
uncertainty on E in associated ECL cluster
Float_t m_KLMMCMom
momentum of matched mc particle
Float_t m_KLMKLid
KlId for that object.
Float_t m_KLMenergy
Energy deposit in KLM (0.2 GeV * nHitCells)
Float_t m_KLMMCPrimaryPDG
pdg code of MCparticles mother, for example pi0 for some gammas
Float_t m_KLMECLZ40
zernike moment 4,0 of closest ecl cluster
Float_t m_KLMeclFlag
ecl flag for belle comparision
Float_t m_KLMECLUncertaintyPhi
phi uncertainty oof closeest ecl cluster
Float_t m_KLMECLE
energy measured in associated ECL cluster
Float_t m_ECLMCTheta
MC particle momentum; -999 if not MCparticle.
Float_t m_KLMtrackFlag
track flag for belle comparision
ECL cluster data.
Definition: ECLCluster.h:27
double getDeltaL() const
Return deltaL.
Definition: ECLCluster.h:265
double getUncertaintyTheta() const
Return Uncertainty on Theta of Shower.
Definition: ECLCluster.h:325
double getE9oE21() const
Return E9/E21 (shower shape variable).
Definition: ECLCluster.h:280
double getEnergy(EHypothesisBit hypothesis) const
Return Energy (GeV).
Definition: ECLCluster.cc:23
double getUncertaintyEnergy() const
Return Uncertainty on Energy of Shower.
Definition: ECLCluster.h:322
double getMinTrkDistance() const
Get distance between cluster COG and track extrapolation to ECL.
Definition: ECLCluster.h:259
double getZernikeMVA() const
Return MVA based hadron/photon value based on Zernike moments (shower shape variable).
Definition: ECLCluster.h:274
double getUncertaintyPhi() const
Return Uncertainty on Phi of Shower.
Definition: ECLCluster.h:328
double getAbsZernike40() const
Return Zernike moment 40 (shower shape variable).
Definition: ECLCluster.h:268
unsigned short getHypotheses() const
Return hypothesis (expert only, this returns a bti pattern).
Definition: ECLCluster.h:244
double getDeltaTime99() const
Return cluster delta time 99.
Definition: ECLCluster.h:301
double getTime() const
Return cluster time.
Definition: ECLCluster.h:298
EHypothesisBit
The hypothesis bits for this ECLCluster (Connected region (CR) is split using this hypothesis.
Definition: ECLCluster.h:31
@ c_nPhotons
CR is split into n photons (N1)
@ c_neutralHadron
CR is reconstructed as a neutral hadron (N2)
double getAbsZernike51() const
Return Zernike moment 51 (shower shape variable).
Definition: ECLCluster.h:271
KLM cluster data.
Definition: KLMCluster.h:28
Klong identifcation (KlId) datastore object to store results from KlId calculations.
Definition: KlId.h:23
double getKlId() const
get the klong classifier output
Definition: KlId.cc:29
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Store one Track-KLMCluster separation as a ROOT object.
bool isKLMClusterSignal(const Belle2::KLMCluster &cluster, float mcWeigthCut=0.66)
checks if a cluster is signal under the mcWeightcondition (mcWeight = energy deposition)
Definition: KlId.h:100
int mcParticleIsBeamBKG(const Belle2::MCParticle *part)
return if MCparticle is beambkg
Definition: KlId.h:68
std::tuple< const Belle2::KLMCluster *, double, double > findClosestKLMCluster(const ROOT::Math::XYZVector &klmClusterPosition)
find nearest KLMCluster, tis distance and the av intercluster distance
Definition: KlId.h:236
bool isECLClusterSignal(const Belle2::ECLCluster &cluster, float mcWeigthCut=0.66)
checks if a cluster is signal under the mcWeightcondition (mcWeight = energy deposition)
Definition: KlId.h:114
std::pair< Belle2::ECLCluster *, double > findClosestECLCluster(const ROOT::Math::XYZVector &klmClusterPosition, const Belle2::ECLCluster::EHypothesisBit eclhypothesis=Belle2::ECLCluster::EHypothesisBit::c_neutralHadron)
Find the closest ECLCluster with a neutral hadron hypothesis, and return it with its distance.
Definition: KlId.h:203
int getPrimaryPDG(Belle2::MCParticle *part)
return if mc particles primary pdg.
Definition: KlId.h:151
int mcParticleIsKlong(Belle2::MCParticle *part)
return the mc hirachy of the klong 0:not a klong 1:final particle, 2: klong is mother etc
Definition: KlId.h:78

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

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

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

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

◆ getAllConditionPaths()

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

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

Definition at line 150 of file Module.cc.

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

◆ getAllConditions()

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

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

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

Definition at line 314 of file Module.h.

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

◆ getConditionPath()

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

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


Definition at line 113 of file Module.cc.

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

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

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

◆ getFileNames()

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

Return a list of output filenames for this modules.

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

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

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

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

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

Reimplemented in RootInputModule, StorageRootOutputModule, and RootOutputModule.

Definition at line 134 of file Module.h.

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

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

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

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

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

◆ getName()

const std::string & getName ( ) const
inlineinherited

Returns the name of the module.

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

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

Definition at line 187 of file Module.h.

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

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ getParamInfoListPython()

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

Returns a python list of all parameters.

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

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

Definition at line 279 of file Module.cc.

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

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

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

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

381{ return m_returnValue; }

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

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

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 311 of file Module.h.

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

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

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

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

Definition at line 160 of file Module.cc.

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

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

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

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

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

Definition at line 166 of file Module.cc.

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

◆ if_false()

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

A simplified version to add a condition to the module.

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

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

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

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

Definition at line 85 of file Module.cc.

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

◆ if_true()

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

A simplified version to set the condition of the module.

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

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

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

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

Definition at line 90 of file Module.cc.

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

◆ if_value()

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

Add a condition to the module.

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

See https://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  )
overridevirtual

init

Reimplemented from Module.

Definition at line 53 of file DataWriterModule.cc.

54{
55 // require existence of necessary datastore obj
56
57 m_eclClusters.isRequired();
58 m_klmClusters.isRequired();
60
61 m_klmClusters.requireRelationTo(m_mcParticles);
62 m_klmClusters.registerRelationTo(m_eclClusters);
63
64 m_f = new TFile(m_outPath.c_str(), "recreate");
65
66 m_treeECLhadron = new TTree("ECLdataHadron", "ECLdataHadron");
67 m_treeECLgamma = new TTree("ECLdataGamma", "ECLdataGamma");
68
69 // KLM
70 if (m_useKLM) {
71 m_treeKLM = new TTree("KLMdata", "KLMdata");
72 m_treeKLM -> Branch("KLMMCMom", & m_KLMMCMom);
73 m_treeKLM -> Branch("KLMMCPhi", & m_KLMMCPhi);
74 m_treeKLM -> Branch("KLMMCTheta", & m_KLMMCTheta);
75 m_treeKLM -> Branch("KLMMom", & m_KLMMom);
76 m_treeKLM -> Branch("KLMPhi", & m_KLMPhi);
77 m_treeKLM -> Branch("KLMTheta", & m_KLMTheta);
78 m_treeKLM -> Branch("KLMMCLifetime", & m_KLMMCLifetime);
79 m_treeKLM -> Branch("KLMMCPDG", & m_KLMMCPDG);
80 m_treeKLM -> Branch("KLMMCPrimaryPDG", & m_KLMMCPrimaryPDG);
81 m_treeKLM -> Branch("KLMMCStatus", & m_KLMMCStatus);
82 m_treeKLM -> Branch("KLMnCluster", & m_KLMnCluster);
83 m_treeKLM -> Branch("KLMnLayer", & m_KLMnLayer);
84 m_treeKLM -> Branch("KLMnInnermostlayer", & m_KLMnInnermostLayer);
85 m_treeKLM -> Branch("KLMglobalZ", & m_KLMglobalZ);
86 m_treeKLM -> Branch("KLMtime", & m_KLMtime);
87 m_treeKLM -> Branch("KLMinvM", & m_KLMinvM);
88 m_treeKLM -> Branch("KLMTruth", & m_KLMTruth);
89 m_treeKLM -> Branch("KLMdistToNextCl", & m_KLMnextCluster);
90 m_treeKLM -> Branch("KLMenergy", & m_KLMenergy);
91 m_treeKLM -> Branch("KLMaverageInterClusterDist", & m_KLMavInterClusterDist);
92 m_treeKLM -> Branch("KLMhitDepth", & m_KLMhitDepth);
93
94 m_treeKLM -> Branch("KLMECLHypo", & m_KLMECLHypo);
95 m_treeKLM -> Branch("KLMECLZMVA", & m_KLMECLZMVA);
96 m_treeKLM -> Branch("KLMECLZ40", & m_KLMECLZ40);
97 m_treeKLM -> Branch("KLMECLZ51", & m_KLMECLZ51);
98 m_treeKLM -> Branch("KLMECLUncertaintyPhi", & m_KLMECLUncertaintyPhi);
99 m_treeKLM -> Branch("KLMECLUncertaintyTheta", & m_KLMECLUncertaintyTheta);
100 m_treeKLM -> Branch("KLMdistToNextECL", & m_KLMECLDist);
101 m_treeKLM -> Branch("KLMtrackToECL", & m_KLMtrackToECL);
102 m_treeKLM -> Branch("KLMECLEerror", & m_KLMECLEerror);
103 m_treeKLM -> Branch("KLMECLenergy", & m_KLMECLE);
104 m_treeKLM -> Branch("KLMECLE9oE25", & m_KLMECLE9oE25);
105 m_treeKLM -> Branch("KLMECLtiming", & m_KLMECLTiming);
106 m_treeKLM -> Branch("KLMECLTerror", & m_KLMECLTerror);
107 m_treeKLM -> Branch("KLMECLdeltaL", & m_KLMECLdeltaL);
108 m_treeKLM -> Branch("KLMECLmintrackDist", & m_KLMECLminTrackDist);
109 m_treeKLM -> Branch("KLMTrackSepDist", & m_KLMTrackSepDist);
110 m_treeKLM -> Branch("KLMTrackSepAngle", & m_KLMTrackSepAngle);
111 m_treeKLM -> Branch("KLMInitialtrackSepAngle", & m_KLMInitialTrackSepAngle);
112 m_treeKLM -> Branch("KLMTrackRotationAngle", & m_KLMTrackRotationAngle);
113 m_treeKLM -> Branch("KLMTrackClusterSepAngle", & m_KLMTrackClusterSepAngle);
114 m_treeKLM -> Branch("isBeamBKG", & m_isBeamBKG);
115 m_treeKLM -> Branch("KLMKlId", & m_KLMKLid);
116 m_treeKLM -> Branch("KLMAngleToMC", & m_KLMAngleToMC);
117 m_treeKLM -> Branch("KLMMCWeight", & m_KLMMCWeight);
118 m_treeKLM -> Branch("KLMtrackFlag", & m_KLMtrackFlag);
119 m_treeKLM -> Branch("KLMeclFlag", & m_KLMeclFlag);
120 m_treeKLM -> Branch("isSignal", & m_isSignal);
121 }//useKLM
122
123 //ECL
124 if (m_useECL) {
125 m_treeECLhadron = new TTree("ECLdataHadron", "ECLdataHadron");
126 m_treeECLgamma = new TTree("ECLdataGamma", "ECLdataGamma");
127
128 m_treeECLhadron -> Branch("ECLMCMom", & m_ECLMCMom);
129 m_treeECLhadron -> Branch("ECLMCPhi", & m_ECLMCPhi);
130 m_treeECLhadron -> Branch("ECLMCLifetime", & m_ECLMCLifetime);
131 m_treeECLhadron -> Branch("ECLMCPDG", & m_ECLMCPDG);
132 m_treeECLhadron -> Branch("ECLMCTheta", & m_ECLMCTheta);
133 m_treeECLhadron -> Branch("ECLMCLifetime", & m_ECLMCLifetime);
134 m_treeECLhadron -> Branch("ECLMCPDG", & m_ECLMCPDG);
135 m_treeECLhadron -> Branch("ECLMCStatus", & m_ECLMCStatus);
136 m_treeECLhadron -> Branch("ECLMCPrimaryPDG", & m_ECLMCPrimaryPDG);
137 m_treeECLhadron -> Branch("ECLUncertaintyEnergy", & m_ECLUncertaintyEnergy);
138 m_treeECLhadron -> Branch("ECLUncertaintyTheta", & m_ECLUncertaintyTheta);
139 m_treeECLhadron -> Branch("ECLUncertaintyPhi", & m_ECLUncertaintyPhi);
140 m_treeECLhadron -> Branch("ECLMom", & m_ECLMom);
141 m_treeECLhadron -> Branch("ECLPhi", & m_ECLPhi);
142 m_treeECLhadron -> Branch("ECLTheta", & m_ECLTheta);
143 m_treeECLhadron -> Branch("ECLZ", & m_ECLZ);
144 m_treeECLhadron -> Branch("ECLenergy", & m_ECLE);
145 m_treeECLhadron -> Branch("ECLE9oE25", & m_ECLE9oE25);
146 m_treeECLhadron -> Branch("ECLtiming", & m_ECLTiming);
147 m_treeECLhadron -> Branch("ECLR", & m_ECLR);
148 m_treeECLhadron -> Branch("ECLTruth", & m_ECLTruth);
149 m_treeECLhadron -> Branch("ECLZ51", & m_ECLZ51);
150 m_treeECLhadron -> Branch("ECLZ40", & m_ECLZ40);
151 m_treeECLhadron -> Branch("ECLE1oE9", & m_ECLE1oE9);
152 m_treeECLhadron -> Branch("ECL2ndMom", & m_ECL2ndMom);
153 m_treeECLhadron -> Branch("ECLnumChrystals", & m_ECLnumChrystals);
154 m_treeECLhadron -> Branch("ECLLAT", & m_ECLLAT);
155 m_treeECLhadron -> Branch("ECLZMVA", & m_ECLZMVA);
156 m_treeECLhadron -> Branch("ECLKlId", & m_ECLKLid);
157 m_treeECLhadron -> Branch("ECLdeltaL", & m_ECLdeltaL);
158 m_treeECLhadron -> Branch("ECLmintrackDist", & m_ECLminTrkDistance);
159 m_treeECLhadron -> Branch("isBeamBKG", & m_isBeamBKG);
160 m_treeECLhadron -> Branch("ECLMCWeight", & m_ECLMCWeight);
161 m_treeECLhadron -> Branch("isSignal", & m_isSignal);
162
163
164 m_treeECLgamma -> Branch("ECLMCMom", & m_ECLMCMom);
165 m_treeECLgamma -> Branch("ECLMCPhi", & m_ECLMCPhi);
166 m_treeECLgamma -> Branch("ECLMCTheta", & m_ECLMCTheta);
167 m_treeECLgamma -> Branch("ECLMCLifetime", & m_ECLMCLifetime);
168 m_treeECLgamma -> Branch("ECLMCPDG", & m_ECLMCPDG);
169 m_treeECLgamma -> Branch("ECLMCStatus", & m_ECLMCStatus);
170 m_treeECLgamma -> Branch("ECLMCPrimaryPDG", & m_ECLMCPrimaryPDG);
171 m_treeECLgamma -> Branch("ECLUncertaintyEnergy", & m_ECLUncertaintyEnergy);
172 m_treeECLgamma -> Branch("ECLUncertaintyTheta", & m_ECLUncertaintyTheta);
173 m_treeECLgamma -> Branch("ECLUncertaintyPhi", & m_ECLUncertaintyPhi);
174 m_treeECLgamma -> Branch("ECLMom", & m_ECLMom);
175 m_treeECLgamma -> Branch("ECLPhi", & m_ECLPhi);
176 m_treeECLgamma -> Branch("ECLTheta", & m_ECLTheta);
177 m_treeECLgamma -> Branch("ECLZ", & m_ECLZ);
178 m_treeECLgamma -> Branch("ECLenergy", & m_ECLE);
179 m_treeECLgamma -> Branch("ECLE9oE25", & m_ECLE9oE25);
180 m_treeECLgamma -> Branch("ECLtiming", & m_ECLTiming);
181 m_treeECLgamma -> Branch("ECLR", & m_ECLR);
182 m_treeECLgamma -> Branch("ECLTruth", & m_ECLTruth);
183 m_treeECLgamma -> Branch("ECLZ51", & m_ECLZ51);
184 m_treeECLgamma -> Branch("ECLZ40", & m_ECLZ40);
185 m_treeECLgamma -> Branch("ECLE1oE9", & m_ECLE1oE9);
186 m_treeECLgamma -> Branch("ECL2ndMom", & m_ECL2ndMom);
187 m_treeECLgamma -> Branch("ECLnumChrystals", & m_ECLnumChrystals);
188 m_treeECLgamma -> Branch("ECLLAT", & m_ECLLAT);
189 m_treeECLgamma -> Branch("ECLZMVA", & m_ECLZMVA);
190 m_treeECLgamma -> Branch("ECLKlId", & m_ECLKLid);
191 m_treeECLgamma -> Branch("ECLdeltaL", & m_ECLdeltaL);
192 m_treeECLgamma -> Branch("ECLmintrackDist", & m_ECLminTrkDistance);
193 m_treeECLgamma -> Branch("isBeamBKG", & m_isBeamBKG);
194 m_treeECLgamma -> Branch("ECLMCWeight", & m_ECLMCWeight);
195 m_treeECLgamma -> Branch("isSignal", & m_isSignal);
196 }//useECL
197}//init
Float_t m_KLMMom
measured momentum
Float_t m_KLMtrackToECL
primitive distance cluster <-> track for associated ECL cluster
StoreArray< MCParticle > m_mcParticles
Store array
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.

◆ setAbortLevel()

void setAbortLevel ( int  abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

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

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

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

◆ setDescription()

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

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

215{
216 m_description = description;
217}

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

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

Definition at line 73 of file Module.cc.

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

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

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

◆ setName()

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

Set the name of the module.

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

Definition at line 214 of file Module.h.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ setParamPython()

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

Implements a method for setting boost::python objects.

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

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

Definition at line 234 of file Module.cc.

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

◆ setParamPythonDict()

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

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

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

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

Definition at line 249 of file Module.cc.

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

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

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

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

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

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

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

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

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

◆ setType()

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

Set the module type.

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

Definition at line 48 of file Module.cc.

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

◆ terminate()

void terminate ( void  )
overridevirtual

terminate

Reimplemented from Module.

Definition at line 441 of file DataWriterModule.cc.

442{
443 // close root files
444 m_f -> cd();
445 if (m_useKLM) { m_treeKLM -> Write();}
446 if (m_useECL) {
447 m_treeECLhadron -> Write();
448 m_treeECLgamma -> Write();
449 }
450 m_f -> Close();
451}

Member Data Documentation

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_ECL2ndMom

Float_t m_ECL2ndMom
private

second moment, shower shape

Definition at line 186 of file DataWriterModule.h.

◆ m_eclClusters

StoreArray<ECLCluster> m_eclClusters
private

Store array

Definition at line 242 of file DataWriterModule.h.

◆ m_ECLdeltaL

Float_t m_ECLdeltaL
private

distance between track entrace into cluster and cluster center

Definition at line 176 of file DataWriterModule.h.

◆ m_ECLDeltaTime

Float_t m_ECLDeltaTime
private

KlId for that object.

Definition at line 205 of file DataWriterModule.h.

◆ m_ECLE

Float_t m_ECLE
private

measured energy

Definition at line 164 of file DataWriterModule.h.

◆ m_ECLE1oE9

Float_t m_ECLE1oE9
private

central crystal devided by 3x3 area with it in its center

Definition at line 184 of file DataWriterModule.h.

◆ m_ECLE9oE25

Float_t m_ECLE9oE25
private

energy of 9/25 chrystall rings (E dispersion shape)

Definition at line 166 of file DataWriterModule.h.

◆ m_ECLEerror

Float_t m_ECLEerror
private

uncertainty on E measurement in ECL

Definition at line 172 of file DataWriterModule.h.

◆ m_ECLKLid

Float_t m_ECLKLid
private

classifier output

Definition at line 194 of file DataWriterModule.h.

◆ m_ECLLAT

Float_t m_ECLLAT
private

lateral shower shape

Definition at line 190 of file DataWriterModule.h.

◆ m_ECLMCLifetime

Float_t m_ECLMCLifetime
private

MC particles lifetime.

Definition at line 198 of file DataWriterModule.h.

◆ m_ECLMCMom

Float_t m_ECLMCMom
private

MC particle momentum; -999 if not MCparticle.

Definition at line 213 of file DataWriterModule.h.

◆ m_ECLMCPDG

Float_t m_ECLMCPDG
private

pdg code of the MCparticle directly related to the cluster

Definition at line 200 of file DataWriterModule.h.

◆ m_ECLMCPhi

Float_t m_ECLMCPhi
private

MC particle phi; -999 if not MCparticle

Definition at line 215 of file DataWriterModule.h.

◆ m_ECLMCPrimaryPDG

Float_t m_ECLMCPrimaryPDG
private

pdg code of higher order MC particle, a cluster related to a photon that originates from a pi0 decay get the pi0 code

Definition at line 203 of file DataWriterModule.h.

◆ m_ECLMCStatus

Float_t m_ECLMCStatus
private

mc status, seen in detector etc.

...

Definition at line 196 of file DataWriterModule.h.

◆ m_ECLMCTheta

Float_t m_ECLMCTheta
private

MC particle momentum; -999 if not MCparticle.

Definition at line 217 of file DataWriterModule.h.

◆ m_ECLMCWeight

Float_t m_ECLMCWeight
private

mc weight

Definition at line 231 of file DataWriterModule.h.

◆ m_ECLminTrkDistance

Float_t m_ECLminTrkDistance
private

more sophisticated distaqnce to track in ECL

Definition at line 174 of file DataWriterModule.h.

◆ m_ECLMom

Float_t m_ECLMom
private

measured momentum

Definition at line 219 of file DataWriterModule.h.

◆ m_ECLnumChrystals

Float_t m_ECLnumChrystals
private

number of crystals in the cluster

Definition at line 188 of file DataWriterModule.h.

◆ m_ECLPhi

Float_t m_ECLPhi
private

measured phi

Definition at line 221 of file DataWriterModule.h.

◆ m_ECLR

Float_t m_ECLR
private

distance of cluster to IP

Definition at line 170 of file DataWriterModule.h.

◆ m_ECLTheta

Float_t m_ECLTheta
private

measured theta

Definition at line 223 of file DataWriterModule.h.

◆ m_ECLTiming

Float_t m_ECLTiming
private

timing of ECL

Definition at line 168 of file DataWriterModule.h.

◆ m_ECLTruth

Float_t m_ECLTruth
private

ECL trarget variable.

Definition at line 227 of file DataWriterModule.h.

◆ m_ECLUncertaintyEnergy

Float_t m_ECLUncertaintyEnergy
private

measured energy uncertainty

Definition at line 207 of file DataWriterModule.h.

◆ m_ECLUncertaintyPhi

Float_t m_ECLUncertaintyPhi
private

measured uncertainty of phi

Definition at line 211 of file DataWriterModule.h.

◆ m_ECLUncertaintyTheta

Float_t m_ECLUncertaintyTheta
private

measured uncertainty on theta

Definition at line 209 of file DataWriterModule.h.

◆ m_ECLZ

Float_t m_ECLZ
private

measured Z-coordinate

Definition at line 225 of file DataWriterModule.h.

◆ m_ECLZ40

Float_t m_ECLZ40
private

Zernike moment 4,0 see Belle2 note on that.

Definition at line 182 of file DataWriterModule.h.

◆ m_ECLZ51

Float_t m_ECLZ51
private

Zernike moment 5,1 see Belle2 note on that.

Definition at line 180 of file DataWriterModule.h.

◆ m_ECLZMVA

Float_t m_ECLZMVA
private

output of a BDT that was fitted on some Zernike Moments on a connected region

Definition at line 192 of file DataWriterModule.h.

◆ m_f

TFile* m_f = nullptr
private

root file

Definition at line 245 of file DataWriterModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_isBeamBKG

Float_t m_isBeamBKG
private

is beam bkg

Definition at line 229 of file DataWriterModule.h.

◆ m_isSignal

Float_t m_isSignal
private

isSignal for the classifier

Definition at line 234 of file DataWriterModule.h.

◆ m_KLMAngleToMC

Float_t m_KLMAngleToMC
private

angle between KLMcluster and Mcparticle

Definition at line 97 of file DataWriterModule.h.

◆ m_KLMavInterClusterDist

Float_t m_KLMavInterClusterDist
private

average distance between all KLM clusters

Definition at line 74 of file DataWriterModule.h.

◆ m_klmClusters

StoreArray<KLMCluster> m_klmClusters
private

Store array

Definition at line 240 of file DataWriterModule.h.

◆ m_KLMECLdeltaL

Float_t m_KLMECLdeltaL
private

distance between track entry point and cluster center, might be removed

Definition at line 106 of file DataWriterModule.h.

◆ m_KLMECLDist

Float_t m_KLMECLDist
private

distance associated ECL <-> KLM cluster

Definition at line 102 of file DataWriterModule.h.

◆ m_KLMECLE

Float_t m_KLMECLE
private

energy measured in associated ECL cluster

Definition at line 104 of file DataWriterModule.h.

◆ m_KLMECLE9oE25

Float_t m_KLMECLE9oE25
private

E in surrounding 9 crystals divided by surrounding 25 crydtalls.

Definition at line 110 of file DataWriterModule.h.

◆ m_KLMECLEerror

Float_t m_KLMECLEerror
private

uncertainty on E in associated ECL cluster

Definition at line 116 of file DataWriterModule.h.

◆ m_KLMeclFlag

Float_t m_KLMeclFlag
private

ecl flag for belle comparision

Definition at line 159 of file DataWriterModule.h.

◆ m_KLMECLHypo

Float_t m_KLMECLHypo
private

hypotheis id of closest ecl cluster 5: gamma, 6:hadron

Definition at line 143 of file DataWriterModule.h.

◆ m_KLMECLminTrackDist

Float_t m_KLMECLminTrackDist
private

track distance between associated ECL cluster and track extrapolated into ECL

Definition at line 108 of file DataWriterModule.h.

◆ m_KLMECLTerror

Float_t m_KLMECLTerror
private

uncertainty on time in associated ECL cluster

Definition at line 114 of file DataWriterModule.h.

◆ m_KLMECLTiming

Float_t m_KLMECLTiming
private

timing of associated ECL cluster

Definition at line 112 of file DataWriterModule.h.

◆ m_KLMECLUncertaintyPhi

Float_t m_KLMECLUncertaintyPhi
private

phi uncertainty oof closeest ecl cluster

Definition at line 151 of file DataWriterModule.h.

◆ m_KLMECLUncertaintyTheta

Float_t m_KLMECLUncertaintyTheta
private

theta uncertainty of closest ECL cluster

Definition at line 153 of file DataWriterModule.h.

◆ m_KLMECLZ40

Float_t m_KLMECLZ40
private

zernike moment 4,0 of closest ecl cluster

Definition at line 147 of file DataWriterModule.h.

◆ m_KLMECLZ51

Float_t m_KLMECLZ51
private

zernike moment 5,1 of closest ECL cluster

Definition at line 149 of file DataWriterModule.h.

◆ m_KLMECLZMVA

Float_t m_KLMECLZMVA
private

zernike mva output for closest ECL cluster (based on around 10 z-moments)

Definition at line 145 of file DataWriterModule.h.

◆ m_KLMenergy

Float_t m_KLMenergy
private

Energy deposit in KLM (0.2 GeV * nHitCells)

Definition at line 78 of file DataWriterModule.h.

◆ m_KLMglobalZ

Float_t m_KLMglobalZ
private

global Z position in KLM

Definition at line 70 of file DataWriterModule.h.

◆ m_KLMhitDepth

Float_t m_KLMhitDepth
private

hit depth in KLM, distance to IP

Definition at line 76 of file DataWriterModule.h.

◆ m_KLMInitialTrackSepAngle

Float_t m_KLMInitialTrackSepAngle
private

angular distance from track to cluster at track starting point

Definition at line 91 of file DataWriterModule.h.

◆ m_KLMinvM

Float_t m_KLMinvM
private

invariant mass calculated from root vector

Definition at line 80 of file DataWriterModule.h.

◆ m_KLMKLid

Float_t m_KLMKLid
private

KlId for that object.

Definition at line 120 of file DataWriterModule.h.

◆ m_KLMMCLifetime

Float_t m_KLMMCLifetime
private

MC partilces life time.

Definition at line 137 of file DataWriterModule.h.

◆ m_KLMMCMom

Float_t m_KLMMCMom
private

momentum of matched mc particle

Definition at line 122 of file DataWriterModule.h.

◆ m_KLMMCPDG

Float_t m_KLMMCPDG
private

pdg code of matched MCparticle

Definition at line 139 of file DataWriterModule.h.

◆ m_KLMMCPhi

Float_t m_KLMMCPhi
private

phi of matched mc particle

Definition at line 124 of file DataWriterModule.h.

◆ m_KLMMCPrimaryPDG

Float_t m_KLMMCPrimaryPDG
private

pdg code of MCparticles mother, for example pi0 for some gammas

Definition at line 141 of file DataWriterModule.h.

◆ m_KLMMCStatus

Float_t m_KLMMCStatus
private

MC particles status.

Definition at line 135 of file DataWriterModule.h.

◆ m_KLMMCTheta

Float_t m_KLMMCTheta
private

theta of matched mc particle

Definition at line 126 of file DataWriterModule.h.

◆ m_KLMMCWeight

Float_t m_KLMMCWeight
private

mc weight

Definition at line 155 of file DataWriterModule.h.

◆ m_KLMMom

Float_t m_KLMMom
private

measured momentum

Definition at line 128 of file DataWriterModule.h.

◆ m_KLMnCluster

Float_t m_KLMnCluster
private

varibales to write out.

used for classification of clusters
number of clusters

Definition at line 64 of file DataWriterModule.h.

◆ m_KLMnextCluster

Float_t m_KLMnextCluster
private

distance to next KLM cluster

Definition at line 84 of file DataWriterModule.h.

◆ m_KLMnInnermostLayer

Float_t m_KLMnInnermostLayer
private

number of innermost layers hit

Definition at line 68 of file DataWriterModule.h.

◆ m_KLMnLayer

Float_t m_KLMnLayer
private

number of layers hit in KLM cluster

Definition at line 66 of file DataWriterModule.h.

◆ m_KLMPhi

Float_t m_KLMPhi
private

measured phi

Definition at line 130 of file DataWriterModule.h.

◆ m_KLMTheta

Float_t m_KLMTheta
private

measured theta

Definition at line 132 of file DataWriterModule.h.

◆ m_KLMtime

Float_t m_KLMtime
private

timing of KLM Cluster

Definition at line 72 of file DataWriterModule.h.

◆ m_KLMTrackClusterSepAngle

Float_t m_KLMTrackClusterSepAngle
private

angle between trach momentum and cluster (measured from ip)

Definition at line 95 of file DataWriterModule.h.

◆ m_KLMtrackFlag

Float_t m_KLMtrackFlag
private

track flag for belle comparision

Definition at line 157 of file DataWriterModule.h.

◆ m_KLMTrackRotationAngle

Float_t m_KLMTrackRotationAngle
private

angle between track at poca and trackbeginning

Definition at line 93 of file DataWriterModule.h.

◆ m_KLMTrackSepAngle

Float_t m_KLMTrackSepAngle
private

angular distance from track separation object

Definition at line 88 of file DataWriterModule.h.

◆ m_KLMTrackSepDist

Float_t m_KLMTrackSepDist
private

distance from track separation object

Definition at line 86 of file DataWriterModule.h.

◆ m_KLMtrackToECL

Float_t m_KLMtrackToECL
private

primitive distance cluster <-> track for associated ECL cluster

Definition at line 118 of file DataWriterModule.h.

◆ m_KLMTruth

Float_t m_KLMTruth
private

target variable for KLM classification

Definition at line 82 of file DataWriterModule.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_mcParticles

StoreArray<MCParticle> m_mcParticles
private

Store array

Definition at line 238 of file DataWriterModule.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

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

Definition at line 508 of file Module.h.

◆ m_outPath

std::string m_outPath = "KlIdBKGClassifierTrainingTuples.root"
private

Output path variable.

Definition at line 59 of file DataWriterModule.h.

◆ m_package

std::string m_package
privateinherited

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

Definition at line 510 of file Module.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

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

Definition at line 512 of file Module.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_treeECLgamma

TTree* m_treeECLgamma = nullptr
private

tree containing ntuples for ECL cluster with N1 (photon hypothesis)

Definition at line 251 of file DataWriterModule.h.

◆ m_treeECLhadron

TTree* m_treeECLhadron = nullptr
private

tree containing ntuples for ECL cluster with N2 (hadron hypothesis)

Definition at line 249 of file DataWriterModule.h.

◆ m_treeKLM

TTree* m_treeKLM = nullptr
private

tree for klm data

Definition at line 247 of file DataWriterModule.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ m_useECL

bool m_useECL
private

write out KLM data

Definition at line 257 of file DataWriterModule.h.

◆ m_useKLM

bool m_useKLM
private

write out KLM data

Definition at line 254 of file DataWriterModule.h.


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