Belle II Software development
GFTC2SPTCConverterModule Class Reference

Module for converting genfit::TrackCands to SpacePointTrackCands. More...

#include <GFTC2SPTCConverterModule.h>

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

 GFTC2SPTCConverterModule ()
 Constructor.
 
void initialize () override
 initialize module (e.g.
 
void event () override
 event: convert genfit::TrackCands to SpacePointTrackCands
 
void terminate () override
 terminate: print some summary information on the processed events
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
virtual void beginRun ()
 Called when entering a new run.
 
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 Types

enum  conversionStatus {
  c_singleClusterSP = 1 ,
  c_noFail = 0 ,
  c_foundNoSpacePoint = -1 ,
  c_foundNoTrueHit = -2 ,
  c_unsuitableGFTC = -3 ,
  c_unusedHits = -4 ,
  c_nonSingleSP = -5 ,
  c_noValidSP = -6 ,
  c_lowNDF = -7
}
 enum for differentiating different reasons why a conversion failed negative values mean fail! More...
 
template<typename HitType >
using HitInfo = std::pair< double, const HitType * >
 container used for storing information, that is then put into the SpacePointTrackCand
 
template<typename T >
using flaggedPair = boost::tuple< bool, T, T >
 typdef, for avoiding having a vector<bool> and a vector<pair<T,T>>
 

Protected Member Functions

conversionStatus getFailEnum (int intToConvert)
 get the enum representation of an integer
 
void initializeCounters ()
 reset counters to 0 to avoid indeterministic behaviour
 
void increaseFailCounter (conversionStatus status)
 increase the counter that 'belongs' to the conversionStatus
 
template<typename ClusterType >
void increaseSkippedCounter (conversionStatus status, ClusterType *cluster)
 increase the appropriate counter variable if a Cluster is skipped (i.e.
 
void markHitAsUsed (std::vector< flaggedPair< int > > &flaggedHitIDs, int hitToMark)
 mark a hit as used, i.e.
 
std::pair< const Belle2::SpacePointTrackCand, conversionStatuscreateSpacePointTC (const genfit::TrackCand *genfitTC)
 create a SpacePointTrackCand from the genfit::TrackCand
 
std::pair< Belle2::SpacePoint *, conversionStatusprocessTrackCandHit (genfit::TrackCandHit *hit, std::vector< flaggedPair< int > > &flaggedHitIDs, int iHit)
 process a TrackCandHit (i.e.
 
template<typename ClusterType , typename TrueHitType >
std::pair< Belle2::SpacePoint *, conversionStatusgetSpacePoint (const ClusterType *cluster, std::vector< flaggedPair< int > > &flaggedHitIDs, int iHit, bool singleCluster, std::string arrayName="")
 templated version to get a SpacePoint from a Cluster
 
template<typename ClusterType >
std::pair< Belle2::SpacePoint *, conversionStatusfindAppropriateSpacePoint (const Belle2::RelationVector< Belle2::SpacePoint > &spacePoints, std::vector< flaggedPair< int > > &flaggedHitIDs)
 given a RelationVector with SpacePoints in it, it tries to get the appropriate one (see main documentation of module) NOTE: marks hits as used! NOTE: if no appropriate SpacePoint can be found, returns a nullptr pointer! templated for easier handling of other ClusterTypes later, at the moment only SVDCluster needed!
 
std::pair< int, int > checkExistAndValid (int clusterInd, int detID, std::vector< flaggedPair< int > > &flaggedHitIDs)
 check if the Cluster (of a SpacePoint) is valid and/or exists in a genfit::TrackCand
 
int getAppropriateSpacePointIndex (const std::vector< std::pair< bool, bool > > &existAndValidSPs, const std::vector< std::pair< int, int > > &clusterPositions)
 get the position of the appropriate SpacePoint inside the RelationVector NOTE: returns negative index if no SpacePoint fitting the criteria can be found!
 
template<typename ClusterType >
std::vector< int > getClusterIndices (const Belle2::SpacePoint *spacePoint, std::string storeArrayName)
 get the indices of the Clusters related to the SpacePoint.
 
int getNDF (Belle2::SpacePoint *spacePoint)
 get the NDF of a SpacePoint
 
bool checkUsedAllHits (std::vector< flaggedPair< int > > &flaggedHitIDs)
 check if all hits have been used (i.e.
 
template<typename TrueHitType >
bool foundRelatedTrueHit (const Belle2::SpacePoint *spacePoint, unsigned int allowedRelations=1)
 check if there is a related TrueHit for a given SpacePoint.
 
 BELLE2_DEFINE_EXCEPTION (UnusedHits, "Not all hits of the genfit::TrackCand have been marked as used. This indicates that not all hits have been used to create a SpacePointTrackCand.")
 Exception thrown, when not all hits of a genfit::TrackCand have been used for conversion.
 
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.
 

Protected Attributes

std::string m_PXDClusterName
 PXDCluster collection name.
 
std::string m_SVDClusterName
 SVDCluster collection name.
 
std::string m_SingleClusterSVDSPName
 Single Cluster SVD SpacePoints collection name.
 
std::string m_NoSingleClusterSVDSPName
 Non SingleCluster SVD SpacePoints collection name.
 
std::string m_PXDClusterSPName
 PXDCluster SpacePoints collection name.
 
std::string m_genfitTCName
 Name of collection of genfit::TrackCand StoreArray.
 
std::string m_SPTCName
 Name of collection under which SpacePointTrackCands will be stored in the StoreArray.
 
bool m_PARAMcheckTrueHits
 Parameter Indicating if the TrueHits related from the Clusters forming a SpacePoint should be checked for equality.
 
bool m_PARAMuseSingleClusterSP
 Parameter Indicating if SingleCluster SVD SpacePoints should be used if no double Cluster SVD SpacePoint can be found.
 
bool m_PARAMcheckNoSingleSVDSP
 Switch for checking the StoreArray of non-single cluster SVD SpacePoints in initialize.
 
bool m_PARAMskipCluster
 Switch for controlling the behavior of the converter, when for one or more Clusters no appropriate SpacePoint can be found.
 
int m_PARAMminNDF
 parameter for specifying a minimal number of degrees of freedom a SpacePointTrackCand has to have in order to be registered in the DataStore
 
unsigned int m_SpacePointTCCtr
 Counter for SpacePointTrackCands which were converted (if a curling track is split up, this counter will still be only increased by 1!)
 
unsigned int m_genfitTCCtr
 Counter for genfit::TrackCands which were presented to the module.
 
unsigned int m_abortedTrueHitCtr
 Counting discarded conversions due to check for TrueHits not good.
 
unsigned int m_abortedUnsuitableTCCtr
 Counter for aborted conversions due to unsuitable genfit::TrackCand.
 
unsigned int m_abortedNoSPCtr
 Counter for aborted conversions because no SpacePoint has been found.
 
unsigned int m_noTwoClusterSPCtr
 Counter for cases where no related two Cluster could be found for a Cluster.
 
unsigned int m_abortedLowNDFCtr
 Counter for SpacePointTrackCands that were not stored due to a too small number of degrees of freedom.
 
unsigned int m_skippedPXDnoSPCtr
 Counter for skipped PXD Clusters, due to no found SpacePoint.
 
unsigned int m_skippedPXDnoTHCtr
 Counter for skipped PXD Clusters, due to no related TrueHit to a SpacePoint.
 
unsigned int m_skippedSVDnoSPCtr
 Counter for skipped SVD Clusters, due to no found SpacePoint.
 
unsigned int m_skippedSVDnoTHCtr
 Counter for skipped SVD Clusters, due to no related TrueHit to a SpacePoint.
 
unsigned int m_singleClusterSPCtr
 Counter for single cluster SVD SpacePoints.
 
unsigned int m_abortedMiscCtr
 temporary counter used for counting all failed conversions for which the reason cannot be deduced at the moment
 
unsigned int m_skippedCluster
 Counter for skipped Cluster.
 
unsigned int m_skippedPXDunsuitableCtr
 Counter for skipped PXD Clusters due to unsuitable GFTC.
 
unsigned int m_skippedSVDunsuitableCtr
 Counter for skipped SVD Clusters due to unsuitable GFTC.
 
unsigned int m_skippedPXDnoValidSPCtr
 Counter for skipped PXD Clusters due to no found valid SpacePoint.
 
unsigned int m_skippedSVDnoValidSPCtr
 Counter for skipped SVD Clusters due to no found valid SpacePoint.
 
unsigned int m_nonSingleSPCtr
 Counter for cases where there is more than one single Cluster SpacePoint related to a Cluster.
 
unsigned int m_abortedNoValidSPCtr
 Counter for aborted conversions due to no found valid SpacePoint to any Cluster of the GFTC.
 
std::string svdMainArrayName
 Name of the Array of SVD SpacePoints that shall be searched first.
 
int m_NDF
 number of degrees of freedom.
 

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

StoreArray< PXDClusterm_PXDClusters
 PXDClusters StoreArray.
 
StoreArray< SVDClusterm_SVDClusters
 SVDClusters StoreArray.
 
StoreArray< SpacePointm_SingleClusterSpacePoints
 SVD SpacePoints StoreArray only consisting of one SVDCluster.
 
StoreArray< SpacePointm_NoSingleClusterSpacePoints
 SVD SpacePoints StoreArray consisting of two SVDClusters.
 
StoreArray< SpacePointm_PXDSpacePoints
 PXDSpacePoints StoreArray.
 
StoreArray< genfit::TrackCand > m_GenfitTrackCands
 Genfit::TrackCand StoreArray.
 
StoreArray< SpacePointTrackCandm_SpacePointTrackCands
 SpacePointTrackCands StoreArray.
 
StoreArray< PXDTrueHitm_PXDTrueHits
 PXDTrueHits StoreArray.
 
StoreArray< SVDTrueHitm_SVDTrueHits
 SVDTrueHits StoreArray.
 
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 for converting genfit::TrackCands to SpacePointTrackCands.

NOTE: requires:

Intended Behaviour: The Module takes a genfit::TrackCand and converts it to a SpacePointTrackCand by taking the TrackCandHits of the TrackCand and searching the DataStore for the according Clusters and then look for Relations of these Clusters to SpacePoints (without loosing any information of the genfit::TrackCand, such that every hit in the genfit::TrackCand can be found in a SpacePoint in the SpacePointTrackCand). Employing a somewhat sloppy notation below regarding Clusters and TrackCandHits, since they are essentially the same for this Module.

NOTE: There are cases where the conversion cannot be done properly, in this case the genfit::TrackCand is skipped and will not be converted (by default, there are parameters that can change this behavior to only skip problematic Clusters)! Problems only occur, when a Cluster is not unambiguously related to a SpacePoint (i.e. a Cluster is related to more than one SpacePoint), because:

  • the decision which SpacePoint to use is not trivial in most cases. If no well defined decision can be made, the TrackCand will be skipped (see below how this decision is made, and when it is considered 'well defined')
  • If no decision can be made and every SpacePoint would be added, problems would only be postponed to the conversion of SpacePointTrackCand to genfit::TrackCand, where it is even harder to decide what is right and what is wrong.
  • To have a handle later on SpacePointTrackCands now have some flags to check what problems occured during conversion

Some statements on how the module works for a given (SVD) Cluster (TrackCandHit) 1) Check if the Cluster (TrackCandHit) has already been used (i.e. it is already contained in the SpacePointTrackCand via a SpacePoint). If not used 2) Get all SpacePoints (double Cluster) related to this Cluster 2.a) If no SpacePoints (double Cluster) can be found, add this Cluster via a single Cluster SpacePoint (should always be present, if not an exception is thrown, and the genfit::TrackCand is not converted). Mark this Cluster (TrackCandHit) as used and go to next Cluster (TrackCandHit) 3) For every SpacePoint (double Cluster) related to the original Cluster, get all Clusters related from this SpacePoint 4) For every SpacePoint (from 3) check if its Cluster combination is valid (i.e. both Clusters are contained in the genfit::TrackCand and neither of these Clusters has been used by another SpacePoint) and also check if its Cluster combination is not valid, but existing (i.e. both Clusters are contained in the genfit::TrackCand but one has already been used by another SpacePoint) 5) If ONLY ONE SpacePoint has a valid Cluster Combination, check if its Clusters appear in consecutive order in the genfit::TrackCand, if they do -> take this SpacePoint, mark the Clusters (TrackCandHits) as used, proceed with next TrackCandHit. If they do not appear in consecutive order -> throw an exception (this SpacePointTrackCand cannot be converted back to a genfit::TrackCand properly) 6) If more than SpacePoint has a valid Cluster Combination -> check if there is a SpacePoint with consecutive Clusters in the genfit::TrackCand ('normally' there is a Cluster Combination, that is in consecutive order in the genfit::TrackCand) and mark its Clusters as used, proceed with next TrackCandHit, if all valid SpacePoints have Cluster Combinations that do not appear in consecutive order -> throw 7) If no valid SpacePoint can be found, but SpacePoints with existing (but used) Cluster Combinations can be found, an exception is thrown and the genfit::TrackCand will not be converted, since the conversion would get ambiguous then (this happens in roughly 1 - 2 % of all cases) 8) If no valid SpacePoint can be found and no SpacePoint with existing (but used) Cluster Combinations, this Cluster will be added via a single Cluster SpacePoint (and then be marked as used) if this feature is activated by parameter 'useSingleClusterSP'

If no SpacePoint can be found for any Cluster in the genfit::TrackCand, an exception is thrown, and the conversion is skipped.

If 'checkTrueHits' is enabled the module only checks the DataStore if there is an existing relation to a TrueHit. Depending on the parameters the conversion of the genfit::TrackCand is aborted or only the Cluster is skipped from Conversion. (The registering of the relation has to be done with the SpacePoint2TrueHitConnector)

TODO: clean-up and bring in line with coding conventions!

Definition at line 65 of file GFTC2SPTCConverterModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.h.

◆ flaggedPair

using flaggedPair = boost::tuple<bool, T, T>
protected

typdef, for avoiding having a vector<bool> and a vector<pair<T,T>>

Definition at line 278 of file GFTC2SPTCConverterModule.h.

◆ HitInfo

using HitInfo = std::pair<double, const HitType*>
protected

container used for storing information, that is then put into the SpacePointTrackCand

Definition at line 274 of file GFTC2SPTCConverterModule.h.

Member Enumeration Documentation

◆ conversionStatus

enum conversionStatus
protected

enum for differentiating different reasons why a conversion failed negative values mean fail!

Enumerator
c_singleClusterSP 

had to use a singleCluster SpacePoint (also returned if PXD is passed!

c_noFail 

conversion without any problems

c_foundNoSpacePoint 

conversion failed because no related SpacePoint was found to a Cluster/Hit of the GFTC

c_foundNoTrueHit 

conversion failed because there was no related SpacePoint to a TrueHit

c_unsuitableGFTC 

conversion failed because the GFTC is considered not suitable for conversion

c_unusedHits 

conversion failed because there were unused Hits

c_nonSingleSP 

conversion failed because there were more than one single Cluster SpacePoints related to a Cluster

c_noValidSP 

conversion failed because there was no valid SpacePoint (only possible for double Cluster SpacePoints) SpacePoints

c_lowNDF 

conversion failed because the created SpacePointTrackCand had not enough degrees of freedom

Definition at line 84 of file GFTC2SPTCConverterModule.h.

84 {
86 c_noFail = 0,
88 c_foundNoTrueHit = -2,
89 c_unsuitableGFTC = -3,
90 c_unusedHits = -4,
91 c_nonSingleSP = -5,
92 c_noValidSP = -6,
93 c_lowNDF = -7,
94 };
@ c_nonSingleSP
conversion failed because there were more than one single Cluster SpacePoints related to a Cluster
@ c_foundNoSpacePoint
conversion failed because no related SpacePoint was found to a Cluster/Hit of the GFTC
@ c_singleClusterSP
had to use a singleCluster SpacePoint (also returned if PXD is passed!
@ c_lowNDF
conversion failed because the created SpacePointTrackCand had not enough degrees of freedom
@ c_unusedHits
conversion failed because there were unused Hits
@ c_noValidSP
conversion failed because there was no valid SpacePoint (only possible for double Cluster SpacePoints...
@ c_foundNoTrueHit
conversion failed because there was no related SpacePoint to a TrueHit
@ c_unsuitableGFTC
conversion failed because the GFTC is considered not suitable for conversion
@ c_noFail
conversion without any problems

◆ 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

◆ GFTC2SPTCConverterModule()

Constructor.

Definition at line 24 of file GFTC2SPTCConverterModule.cc.

24 :
25 Module()
26{
27 setDescription("Module for converting genfit::TrackCands (e.g. from TrackFinderMCTruth) to SpacePointTrackCands.");
29
30 addParam("PXDClusters", m_PXDClusterName, "PXDCluster collection name", std::string(""));
31 addParam("SVDClusters", m_SVDClusterName, "SVDCluster collection name", std::string(""));
32 addParam("genfitTCName", m_genfitTCName, "Name of container of genfit::TrackCands", std::string(""));
33 addParam("SpacePointTCName", m_SPTCName,
34 "Name of the container under which SpacePointTrackCands will be stored in the DataStore (NOTE: These SpaceTrackCands are not checked for curling behaviour, but are simply converted and stored!)",
35 std::string(""));
36
37 addParam("SingleClusterSVDSP", m_SingleClusterSVDSPName,
38 "Single Cluster SVD SpacePoints collection name. NOTE: This StoreArray will be searched for SpacePoints only if 'useSingleClusterSP' is set to true!",
39 std::string("SVDSpacePoints"));
40 addParam("NoSingleClusterSVDSP", m_NoSingleClusterSVDSPName,
41 "Non Single Cluster SVD SpacePoints collection name. This StoreArray will be searched for SpacePoints",
42 std::string("SVDSpacePoints"));
43 addParam("PXDClusterSP", m_PXDClusterSPName, "PXD Cluster SpacePoints collection name.", std::string("PXDSpacePoints"));
44
45 addParam("minNDF", m_PARAMminNDF,
46 "Minimum number of degrees of freedom a SpacePointTrackCand has to contain in order to get registered in the DataStore. If set to 0, any number is accepted",
47 0);
48
49 addParam("checkTrueHits", m_PARAMcheckTrueHits,
50 "Set to true if you want TrueHits of Clusters forming a SpacePoint (e.g. SVD) to be checked for equality", false);
51 addParam("useSingleClusterSP", m_PARAMuseSingleClusterSP,
52 "Set to true if you want to use singleCluster SVD SpacePoints if no doubleCluster SVD SpacePoint can be found. NOTE: this gets overriden if 'skipCluster' is set to true!",
53 true);
54 addParam("checkNoSingleSVDSP", m_PARAMcheckNoSingleSVDSP,
55 "Set to false if you want to disable the initial check for the StoreArray of Non Single Cluster SVD SpacePoints. NOTE: The module will still search for these SpacePoints first, so you have to make sure you are not registering SpacePoints under the StoreArray with the NoSingleClusterSVDSP name! (Disable the module that registers these SpacePoints)",
56 true);
57 addParam("skipCluster", m_PARAMskipCluster,
58 "Set to true if you only want to skip the Clusters for which no appropriate SpacePoints can be found, instead of aborting the conversion of the whole GFTC when such a case occurs. NOTE: setting this to true automatically sets 'useSingleClusterSP' to false!",
59 false);
60
61 initializeCounters(); // NOTE: they get initialized in initialize again!!
62}
int m_PARAMminNDF
parameter for specifying a minimal number of degrees of freedom a SpacePointTrackCand has to have in ...
bool m_PARAMskipCluster
Switch for controlling the behavior of the converter, when for one or more Clusters no appropriate Sp...
std::string m_SingleClusterSVDSPName
Single Cluster SVD SpacePoints collection name.
std::string m_NoSingleClusterSVDSPName
Non SingleCluster SVD SpacePoints collection name.
std::string m_PXDClusterName
PXDCluster collection name.
std::string m_genfitTCName
Name of collection of genfit::TrackCand StoreArray.
bool m_PARAMcheckTrueHits
Parameter Indicating if the TrueHits related from the Clusters forming a SpacePoint should be checked...
bool m_PARAMuseSingleClusterSP
Parameter Indicating if SingleCluster SVD SpacePoints should be used if no double Cluster SVD SpacePo...
std::string m_SPTCName
Name of collection under which SpacePointTrackCands will be stored in the StoreArray.
std::string m_SVDClusterName
SVDCluster collection name.
std::string m_PXDClusterSPName
PXDCluster SpacePoints collection name.
bool m_PARAMcheckNoSingleSVDSP
Switch for checking the StoreArray of non-single cluster SVD SpacePoints in initialize.
void initializeCounters()
reset counters to 0 to avoid indeterministic behaviour
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
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

Member Function Documentation

◆ beginRun()

virtual void beginRun ( void  )
inlinevirtualinherited

Called when entering a new run.

Called at the beginning of each run, the method gives you the chance to change run dependent constants like alignment parameters, etc.

This method can be implemented by subclasses.

Reimplemented in ARICHBackgroundModule, BeamabortModule, BgoModule, CaveModule, ClawModule, CLAWSModule, DosiModule, FANGSModule, He3tubeModule, MicrotpcModule, Ph1bpipeModule, Ph1sustrModule, PindiodeModule, PlumeModule, QcsmonitorModule, SrsensorModule, GetEventFromSocketModule, CalibrationCollectorModule, EventsOfDoomBusterModule, CosmicsAlignmentValidationModule, EnergyBiasCorrectionModule, ChargedPidMVAModule, ChargedPidMVAMulticlassModule, CurlTaggerModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, ParticleVertexFitterModule, PhotonEfficiencySystematicsModule, TagVertexModule, TreeFitterModule, arichBtestModule, ARICHDigitizerModule, ARICHDQMModule, ARICHRateCalModule, ARICHReconstructorModule, B2BIIMCParticlesMonitorModule, B2BIIConvertBeamParamsModule, B2BIIConvertMdstModule, B2BIIFixMdstModule, B2BIIMdstInputModule, BelleMCOutputModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BGOverlayInputModule, AnalysisPhase1StudyModule, NtuplePhase1_v6Module, ReprocessorModule, BeamabortStudyModule, BeamDigitizerModule, BgoDigitizerModule, BgoStudyModule, ClawDigitizerModule, ClawStudyModule, ClawsDigitizerModule, ClawsStudyModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DosiDigitizerModule, DosiStudyModule, FANGSDigitizerModule, FANGSStudyModule, He3DigitizerModule, He3tubeStudyModule, MicrotpcStudyModule, TpcDigitizerModule, PinDigitizerModule, PindiodeStudyModule, PlumeDigitizerModule, QcsmonitorDigitizerModule, QcsmonitorStudyModule, CDCCosmicAnalysisModule, CDCCRTestModule, cdcDQM7Module, CDCDQMModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, DAQPerfModule, RxSocketModule, TxSocketModule, DqmHistoManagerModule, MonitorDataModule, TrackAnaModule, Ds2SampleModule, ReceiveEventModule, HLTDQM2ZMQModule, ElapsedTimeModule, DeSerializerPXDModule, GenRawSendModule, SerializerModule, CertifyParallelModule, Ds2RawModule, Ds2RbufModule, EvReductionModule, FastRbuf2DsModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, Ds2RawFileModule, PartialSeqRootReaderModule, SeqRootMergerModule, StorageDeserializerModule, StorageSerializerModule, IPDQMModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, ECLBackgroundModule, ECLChargedPIDModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDMVAModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMModule, ECLDQMConnectedRegionsModule, ECLDQMEXTENDEDModule, ECLDQMOutOfTimeDigitsModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLLOMModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, HistoModule, SubEventModule, SwitchDataStoreModule, EventInfoPrinterModule, EventLimiterModule, IoVDependentConditionModule, ProgressModule, RandomBarrierModule, GearboxModule, HistoManagerModule, StatisticsSummaryModule, SeqRootInputModule, SeqRootOutputModule, RxModule, TxModule, EvtGenDecayModule, EvtGenInputModule, OverrideGenerationFlagsModule, KKGenInputModule, CreateFieldMapModule, ExportGeometryModule, SoftwareTriggerModule, SoftwareTriggerHLTDQMModule, StatisticsTimingHLTDQMModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, EKLMDataCheckerModule, KLMClusterAnaModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDigitTimeShifterModule, KLMDQMModule, KLMDQM2Module, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMUnpackerModule, MVAExpertModule, MVAMultipleExpertsModule, MVAPrototypeModule, AWESOMEBasicModule, PXDBackgroundModule, PXDRawDQMChipsModule, PXDClustersFromTracksModule, PXDPerformanceModule, PXDClusterizerModule, Convert2RawDetModule, CDCDedxDQMModule, CDCDedxValidationModule, EventT0DQMModule, EventT0ValidationModule, DataWriterModule, ECLExpertModule, KLMExpertModule, KlongValidationModule, KLMMuonIDDNNExpertModule, FullSimModule, MaterialScanModule, SVDBackgroundModule, SVDClusterCalibrationsMonitorModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsCheckModule, SVDLocalCalibrationsMonitorModule, SVDPositionErrorScaleFactorImporterModule, SVDTimeCalibrationsMonitorModule, SVDDQMHitTimeModule, svdDumpModule, SVDPackerModule, SVDB4CommissioningPlotsModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDMaxStripTTreeModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDPerformanceTTreeModule, SVDShaperDigitsFromTracksModule, SVDClusterizerModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVDMissingAPVsClusterCreatorModule, SVDRecoDigitCreatorModule, SVD3SamplesEmulatorModule, SVDDigitizerModule, SVDEventInfoSetterModule, SVDTriggerQualityGeneratorModule, SVDSpacePointCreatorModule, SVDTimeGroupingModule, SVDUnpackerModule, TOPBackgroundModule, TOPBunchFinderModule, TOPChannelMaskerModule, TOPChannelT0MCModule, TOPDigitizerModule, TOPTriggerDigitizerModule, TOPDoublePulseGeneratorModule, TOPDQMModule, TOPGainEfficiencyCalculatorModule, TOPLaserHitSelectorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPMCTrackMakerModule, TOPModuleT0CalibratorModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPTimeRecalibratorModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPXTalkChargeShareSetterModule, DQMHistoModuleBase, SVDEventT0EstimatorModule, ExtModule, FlipQualityModule, BeamSpotMonitorModule, KinkFinderModule, MCV0MatcherModule, MCTrackCandClassifierModule, MuidModule, PXDROIFinderModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, TrackCreatorModule, TrackFinderMCTruthRecoTracksModule, EffPlotsModule, HitXPModule, TrackingPerformanceEvaluationModule, V0findingPerformanceEvaluationModule, TrackQETrainingDataCollectorModule, TrackQualityEstimatorMVAModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, TrackFinderVXDAnalizerModule, VXDSimpleClusterizerModule, QualityEstimatorVXDModule, VXDQETrainingDataCollectorModule, VXDQualityEstimatorMVAModule, SectorMapBootstrapModule, SegmentNetworkProducerModule, TrackFinderVXDBasicPathFinderModule, TrackFinderVXDCellOMatModule, VXDTFTrainingDataCollectorModule, FindletModule< AFindlet >, FindletModule< HitBasedT0Extractor >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< FacetCreator >, FindletModule< HitReclaimer >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinder >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerNDFinderModule, CDCTriggerTSFModule, TRGCDCModule, TRGCDCETFUnpackerModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSFUnpackerModule, TRGCDCTSStreamModule, CDCTriggerUnpackerModule, MCMatcherTRGECLModule, TRGECLFAMModule, TRGECLModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLEventTimingDQMModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLSummaryModule, TRGGDLUnpackerModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLDQMModule, TRGGRLUnpackerModule, KLMTriggerModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TRGRAWDATAModule, VXDMisalignmentModule, DQMHistAnalysisARICHModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisEventT0EfficiencyModule, DQMHistAnalysisEventT0TriggerJitterModule, DQMHistAnalysisExampleModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisHLTModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputRootFileModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPeakModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTrackingAbortModule, DQMHistAnalysisTrackingHLTModule, DQMHistAnalysisTRGECLModule, DQMHistAutoCanvasModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistReferenceModule, DQMHistSnapshotsModule, DAQMonitorModule, DelayDQMModule, V0ObjectsDQMModule, ECLDQMInjectionModule, PyModule, PXDBgTupleProducerModule, PXDMCBgTupleProducerModule, PXDDAQDQMModule, PXDDQMClustersModule, PXDDQMCorrModule, PXDDQMEfficiencyModule, PXDDQMEfficiencySelftrackModule, PXDDQMExpressRecoModule, PXDGatedDHCDQMModule, PXDGatedModeDQMModule, PXDInjectionDQMModule, PXDRawDQMCorrModule, PXDRawDQMModule, PXDROIDQMModule, PXDTrackClusterDQMModule, PXDDigitizerModule, PXDPackerModule, PXDUnpackerModule, TTDDQMModule, SVDDQMClustersOnTrackModule, SVDDQMDoseModule, SVDDQMExpressRecoModule, SVDDQMInjectionModule, SVDUnpackerDQMModule, PXDclusterFilterModule, PXDdigiFilterModule, PXDROIFinderAnalysisModule, TrackingAbortDQMModule, VXDDQMExpressRecoModule, vxdDigitMaskingModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisRunNrModule, DQMHistAnalysisTRGModule, DQMHistInjectionModule, and DQMHistOutputToEPICSModule.

Definition at line 147 of file Module.h.

147{};

◆ checkExistAndValid()

std::pair< int, int > checkExistAndValid ( int  clusterInd,
int  detID,
std::vector< flaggedPair< int > > &  flaggedHitIDs 
)
protected

check if the Cluster (of a SpacePoint) is valid and/or exists in a genfit::TrackCand

Parameters
clusterIndindex of Cluster to be checked in StoreArray
detIDdetector id
flaggedHitIDs(detId, hitId) of genfit::TrackCand with flag if hit has already been used
Returns
first is validPos, .second is existingPos, if one is not found a negative number is returned!

Definition at line 437 of file GFTC2SPTCConverterModule.cc.

439{
440 B2DEBUG(29, "Now checking if Cluster " << clusterInd << " is valid");
441 std::pair<int, int> positions = { -1, -1}; // return Vector
442
443 // flaggedPair for finding valid IDs: hit is in genfit::TrackCand and has not yet been used by another SpacePoint
444 flaggedPair<int> validID(false, detID, clusterInd);
445 flaggedPair<int> existingID(true, detID, clusterInd); // flaggedPair for finding existing but used fHitIDs
446
447 // find the positions of these two pairs in flaggedHitIDs
448 // position in "normal array indexing" (i.e. starting at 0, ending at vector.size() -1 )
449 unsigned int validPos = std::find(flaggedHitIDs.begin(), flaggedHitIDs.end(), validID) - flaggedHitIDs.begin();
450 unsigned int existingPos = std::find(flaggedHitIDs.begin(), flaggedHitIDs.end(), existingID) - flaggedHitIDs.begin();
451
452 B2DEBUG(22, "validID = (" << validID.get<1>() << "," << validID.get<2>() << "), found at position " << validPos <<
453 ", existingID found at position " << existingPos << " of " << flaggedHitIDs.size());
454
455 // check if these positions are still in the TrackCand
456 if (validPos < flaggedHitIDs.size()) { positions.first = validPos; }
457 if (existingPos < flaggedHitIDs.size()) { positions.second = existingPos; }
458
459 B2DEBUG(29, "Return values, .first: " << positions.first << ", .second: " << positions.second);
460 return positions;
461}

◆ checkUsedAllHits()

bool checkUsedAllHits ( std::vector< flaggedPair< int > > &  flaggedHitIDs)
protected

check if all hits have been used (i.e.

if all flags in the vector of flaggedPairs is set to true)

Definition at line 533 of file GFTC2SPTCConverterModule.cc.

534{
535 bool usedAll = true; // defining variable here so that all hits are checked (debug output)
536 for (unsigned int i = 0; i < flaggedHitIDs.size(); ++i) {
537 flaggedPair<int> fPair = flaggedHitIDs[i];
538 B2DEBUG(28, "Hit " << i << " with (detID,hitID): (" << fPair.get<1>() << "," << fPair.get<2>() << ") has been used: " <<
539 fPair.get<0>());
540 if (!fPair.get<0>()) {
541// return false;
542 usedAll = false;
543 }
544 }
545// return true;
546 return usedAll;
547}

◆ 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

◆ createSpacePointTC()

std::pair< const Belle2::SpacePointTrackCand, GFTC2SPTCConverterModule::conversionStatus > createSpacePointTC ( const genfit::TrackCand *  genfitTC)
protected

create a SpacePointTrackCand from the genfit::TrackCand

Returns
first is the SPTC, .second is the conversion status, if < 0, something went wrong

Definition at line 186 of file GFTC2SPTCConverterModule.cc.

187{
188 m_NDF = 0; // reset for every trackCand
189 std::vector<HitInfo<SpacePoint> > tcSpacePoints;
190 // cppcheck-suppress unreadVariable
191 conversionStatus convStatus = c_noFail; // part of return
192
193 int nHits = genfitTC->getNHits();
194 B2DEBUG(21, "genfit::TrackCand contains " << nHits << " hits");
195
196 // for easier handling fill a taggedPair (typedef) to distinguish whether a hit has already been used or if is still open for procession
197 std::vector<flaggedPair<int> > fHitIDs;
198 for (int i = 0; i < nHits; ++i) {
199 auto aHit = genfitTC->getHit(i);
200 flaggedPair<int> aPair(false, aHit->getDetId(), aHit->getHitId());
201 fHitIDs.push_back(aPair);
202 }
203
204 bool usedSingleCluster = false;
205 // now loop over all hits and add them appropriately
206 for (int iTCHit = 0; iTCHit < nHits; ++iTCHit) {
207 genfit::TrackCandHit* aTCHit = genfitTC->getHit(iTCHit);
208 double sortingParam = aTCHit->getSortingParameter();
209
210 B2DEBUG(20, "Processing TrackCandHit " << iTCHit << " of " << nHits);
211 if (fHitIDs[iTCHit].get<0>()) { // check if this hit has already been used, if not process
212 B2DEBUG(28, "This hit has already been added to the SpacePointTrackCand via a SpacePoint and will not be processed again");
213 } else {
214 std::pair<SpacePoint*, conversionStatus> aSpacePoint = processTrackCandHit(aTCHit, fHitIDs, iTCHit);
215
216 // if there is more than one single Cluster SpacePoint related to a Cluster, add one
217 if (aSpacePoint.first != nullptr && (aSpacePoint.second >= 0 || aSpacePoint.second == c_nonSingleSP)) {
218 if (aSpacePoint.second == c_singleClusterSP) usedSingleCluster = true;
219 tcSpacePoints.push_back({sortingParam, aSpacePoint.first});
220 B2DEBUG(28, "Added SpacePoint " << aSpacePoint.first->getArrayIndex() << " from Array " << aSpacePoint.first->getArrayName() <<
221 " to tcSpacePoints");
222 m_NDF += getNDF(aSpacePoint.first);
223 } else {
224 convStatus = aSpacePoint.second;
225 B2DEBUG(28, "There was an error during conversion: for Hit " << iTCHit << ": " << convStatus);
226 if (!m_PARAMskipCluster) {
227 B2DEBUG(21,
228 "There was an error during conversion for a GFTC. 'skipCluster' is set to false, hence this trackCand will not be converted!");
229
230 // return empty SPTC if there is a conversion error and splitCurlers is set to false
231 return std::make_pair(SpacePointTrackCand(), convStatus);
232 }
233 }
234 }
235 }
236
237 B2DEBUG(20, "NDF for this SpacePointTrackCand: " << m_NDF);
238 if (m_NDF < m_PARAMminNDF) {
239 B2DEBUG(21, "The created SpacePointTrackCand has not enough NDF: NDF is " << m_NDF << " but 'minNDF' is set to " << m_PARAMminNDF);
240 return std::make_pair(SpacePointTrackCand(), c_lowNDF);
241 }
242
243 // check if all hits have been used
244 bool usedAllHits = checkUsedAllHits(fHitIDs);
245 if (!usedAllHits && !m_PARAMskipCluster) {
246 B2WARNING("There is at least one TrackCandHit that has not been marked as used although 'skipCluster' is set to false"); // write warning here, because if this happens something has gone wrong
247 throw UnusedHits();
248 }
249
250 // create a vector of SpacePoint* and one with sorting Parameters to add to the SpacePointTrackCand
251 std::vector<const SpacePoint*> spacePoints;
252 std::vector<double> sortingParams;
253 for (const HitInfo<SpacePoint>& aSP : tcSpacePoints) {
254 spacePoints.push_back(aSP.second);
255 sortingParams.push_back(aSP.first);
256 }
257
258 SpacePointTrackCand spacePointTC = SpacePointTrackCand(spacePoints, genfitTC->getPdgCode(), genfitTC->getChargeSeed(),
259 genfitTC->getMcTrackId());
260 spacePointTC.set6DSeed(genfitTC->getStateSeed());
261 spacePointTC.setCovSeed(genfitTC->getCovSeed());
262 spacePointTC.setSortingParameters(sortingParams);
263
265 if (!usedAllHits) { spacePointTC.addRefereeStatus(SpacePointTrackCand::c_omittedClusters); }
266 if (usedSingleCluster) { spacePointTC.addRefereeStatus(SpacePointTrackCand::c_singleClustersSPs); }
267
268 return std::make_pair(spacePointTC, c_noFail);
269}
int getNDF(Belle2::SpacePoint *spacePoint)
get the NDF of a SpacePoint
conversionStatus
enum for differentiating different reasons why a conversion failed negative values mean fail!
std::pair< Belle2::SpacePoint *, conversionStatus > processTrackCandHit(genfit::TrackCandHit *hit, std::vector< flaggedPair< int > > &flaggedHitIDs, int iHit)
process a TrackCandHit (i.e.
bool checkUsedAllHits(std::vector< flaggedPair< int > > &flaggedHitIDs)
check if all hits have been used (i.e.
int m_NDF
number of degrees of freedom.
Storage for (VXD) SpacePoint-based track candidates.
void setSortingParameters(const std::vector< double > &sortParams)
set the sorting parameters
void set6DSeed(const TVectorD &state6D)
set the 6D state seed
void setCovSeed(const TMatrixDSym &cov)
set the covariance matrix seed
@ c_checkedTrueHits
bit 5: All SpacePoints of the SPTC have a relation to at least one TrueHit.
@ c_omittedClusters
bit 9: Not all Clusters of the genfit::TrackCand have been used to create this SPTC.
@ c_singleClustersSPs
bit 10: SPTC contains single Cluster SpacePoints.
void addRefereeStatus(unsigned short int bitmask)
add a referee status

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

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 BeamabortModule, BgoModule, CaveModule, ClawModule, CLAWSModule, DosiModule, FANGSModule, He3tubeModule, MicrotpcModule, Ph1bpipeModule, Ph1sustrModule, PindiodeModule, PlumeModule, QcsmonitorModule, SrsensorModule, GetEventFromSocketModule, CalibrationCollectorModule, AlignDQMModule, CosmicsAlignmentValidationModule, CurlTaggerModule, LowEnergyPi0IdentificationExpertModule, LowEnergyPi0VetoExpertModule, arichBtestModule, ARICHDQMModule, B2BIIMCParticlesMonitorModule, B2BIIConvertMdstModule, B2BIIMdstInputModule, BelleMCOutputModule, BeamBkgGeneratorModule, BeamBkgHitRateMonitorModule, BeamBkgMixerModule, BeamBkgTagSetterModule, BGOverlayInputModule, AnalysisPhase1StudyModule, NtuplePhase1_v6Module, ReprocessorModule, BeamabortStudyModule, BeamDigitizerModule, BgoDigitizerModule, BgoStudyModule, ClawDigitizerModule, ClawStudyModule, ClawsDigitizerModule, ClawsStudyModule, CsiDigitizer_v2Module, CsIDigitizerModule, CsiModule, CsiStudy_v2Module, CsIStudyModule, DosiDigitizerModule, DosiStudyModule, FANGSDigitizerModule, FANGSStudyModule, He3DigitizerModule, He3tubeStudyModule, MicrotpcStudyModule, TpcDigitizerModule, TPCStudyModule, PinDigitizerModule, PindiodeStudyModule, PlumeDigitizerModule, QcsmonitorDigitizerModule, QcsmonitorStudyModule, CDCCosmicAnalysisModule, CDCCRTestModule, cdcDQM7Module, CDCDQMModule, CDCPackerModule, CDCRecoTrackFilterModule, CDCUnpackerModule, DAQPerfModule, RxSocketModule, TxSocketModule, DqmHistoManagerModule, MonitorDataModule, TrackAnaModule, Ds2SampleModule, ReceiveEventModule, HLTDQM2ZMQModule, HLTDs2ZMQModule, ElapsedTimeModule, DeSerializerPXDModule, GenRawSendModule, Root2RawModule, SerializerModule, CertifyParallelModule, Ds2RawModule, Ds2RbufModule, EvReductionModule, FastRbuf2DsModule, Raw2DsModule, RawInputModule, Rbuf2DsModule, Rbuf2RbufModule, Ds2RawFileModule, PartialSeqRootReaderModule, SeqRootMergerModule, StorageDeserializerModule, StorageRootOutputModule, StorageSerializerModule, PhysicsObjectsDQMModule, PhysicsObjectsMiraBelleBhabhaModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleHadronModule, PhysicsObjectsMiraBelleModule, ECLBackgroundModule, ECLChargedPIDModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDDataAnalysisValidationModule, ECLClusterPSDModule, ECLCovarianceMatrixModule, ECLCRFinderModule, ECLDataAnalysisModule, ECLDigitCalibratorModule, ECLDigitizerModule, ECLDigitizerPureCsIModule, EclDisplayModule, ECLDQMModule, ECLDQMEXTENDEDModule, ECLDQMOutOfTimeDigitsModule, ECLFinalizerModule, ECLHitDebugModule, ECLLocalMaximumFinderModule, ECLLocalRunCalibratorModule, ECLLOMModule, ECLPackerModule, ECLShowerCorrectorModule, ECLShowerShapeModule, ECLSplitterN1Module, ECLSplitterN2Module, ECLUnpackerModule, ECLWaveformFitModule, HistoModule, SubEventModule, SwitchDataStoreModule, EventInfoPrinterModule, RandomBarrierModule, HistoManagerModule, StatisticsSummaryModule, SeqRootInputModule, SeqRootOutputModule, RxModule, TxModule, ZMQTxInputModule, ZMQTxWorkerModule, EvtGenDecayModule, OverrideGenerationFlagsModule, BKLMAnaModule, BKLMDigitAnalyzerModule, BKLMSimHistogrammerModule, BKLMTrackingModule, EKLMDataCheckerModule, KLMClusterEfficiencyModule, KLMClustersReconstructorModule, KLMDigitizerModule, KLMDQMModule, KLMDQM2Module, KLMPackerModule, KLMReconstructorModule, KLMScintillatorSimulatorModule, KLMUnpackerModule, AWESOMEBasicModule, PXDBackgroundModule, PXDClustersFromTracksModule, PXDPerformanceModule, Convert2RawDetModule, PrintDataModule, PrintEventRateModule, Root2BinaryModule, CDCDedxDQMModule, CDCDedxValidationModule, EventT0ValidationModule, DataWriterModule, KlongValidationModule, KLMMuonIDDNNExpertModule, FullSimModule, SVDBackgroundModule, SVDClusterCalibrationsMonitorModule, SVDHotStripFinderModule, SVDLatencyCalibrationModule, SVDLocalCalibrationsMonitorModule, SVDPositionErrorScaleFactorImporterModule, SVDTimeCalibrationsMonitorModule, svdDumpModule, SVDPackerModule, SVDB4CommissioningPlotsModule, SVDClusterEvaluationModule, SVDClusterEvaluationTrueInfoModule, SVDClusterFilterModule, SVDOccupancyAnalysisModule, SVDPerformanceModule, SVDShaperDigitsFromTracksModule, SVDClusterizerModule, SVDCoGTimeEstimatorModule, SVDDataFormatCheckModule, SVDRecoDigitCreatorModule, SVD3SamplesEmulatorModule, SVDTriggerQualityGeneratorModule, SVDUnpackerModule, TOPBackgroundModule, TOPChannelT0MCModule, TOPTriggerDigitizerModule, TOPDoublePulseGeneratorModule, TOPGainEfficiencyCalculatorModule, TOPLaserHitSelectorModule, TOPInterimFENtupleModule, TOPLaserCalibratorModule, TOPMCTrackMakerModule, TOPNtupleModule, TOPPackerModule, TOPRawDigitConverterModule, TOPTBCComparatorModule, TOPTimeBaseCalibratorModule, TOPUnpackerModule, TOPWaveformFeatureExtractorModule, TOPWaveformQualityPlotterModule, TOPXTalkChargeShareSetterModule, ExtModule, GenfitVisModule, MCV0MatcherModule, MCTrackCandClassifierModule, MuidModule, MCSlowPionPXDROICreatorModule, PXDROIFinderModule, SVDROIDQMModule, SVDROIFinderAnalysisModule, SVDROIFinderModule, RT2SPTCConverterModule, SPTCmomentumSeedRetrieverModule, SPTCvirtualIPRemoverModule, TrackFinderMCTruthRecoTracksModule, EffPlotsModule, HitXPModule, TrackingPerformanceEvaluationModule, V0findingPerformanceEvaluationModule, SecMapTrainerBaseModule, SecMapTrainerVXDTFModule, TrackFinderVXDAnalizerModule, VXDSimpleClusterizerModule, NoKickCutsEvalModule, SectorMapBootstrapModule, VXDTFTrainingDataCollectorModule, FindletModule< AFindlet >, FindletModule< HitBasedT0Extractor >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< CKFToSVDFindlet >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< DATCONFPGAFindlet >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< vxdHoughTracking::SVDHoughTracking >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< CKFToPXDFindlet >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet >, FindletModule< AxialSegmentPairCreator >, FindletModule< AxialStraightTrackFinder >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< AxialTrackFinderHough >, FindletModule< AxialTrackFinderLegendre >, FindletModule< ClusterBackgroundDetector >, FindletModule< ClusterPreparer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< FacetCreator >, FindletModule< HitReclaimer >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< MonopoleStereoHitFinder >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< SegmentCreatorMCTruth >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< SegmentFitter >, FindletModule< SegmentLinker >, FindletModule< SegmentOrienter >, FindletModule< SegmentPairCreator >, FindletModule< SegmentRejecter >, FindletModule< SegmentTrackCombiner >, FindletModule< SegmentTripleCreator >, FindletModule< StereoHitFinder >, FindletModule< SuperClusterCreator >, FindletModule< TrackCombiner >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSingleSegments >, FindletModule< TrackExporter >, FindletModule< TrackFinderAutomaton >, FindletModule< TrackFinderCosmics >, FindletModule< TrackFinder >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackLinker >, FindletModule< TrackOrienter >, FindletModule< TrackQualityAsserter >, FindletModule< TrackQualityEstimator >, FindletModule< TrackRejecter >, FindletModule< WireHitBackgroundDetector >, FindletModule< WireHitCreator >, FindletModule< WireHitPreparer >, CDCTriggerNeuroDQMModule, CDCTriggerNeuroDQMOnlineModule, CDCTriggerNDFinderModule, TRGCDCModule, TRGCDCETFUnpackerModule, TRGCDCT2DDQMModule, TRGCDCT3DConverterModule, TRGCDCT3DDQMModule, TRGCDCT3DUnpackerModule, TRGCDCTSFDQMModule, TRGCDCTSFUnpackerModule, TRGCDCTSStreamModule, MCMatcherTRGECLModule, TRGECLFAMModule, TRGECLModule, TRGECLBGTCHitModule, TRGECLDQMModule, TRGECLQAMModule, TRGECLRawdataAnalysisModule, TRGECLTimingCalModule, TRGECLUnpackerModule, TRGGDLModule, TRGGDLDQMModule, TRGGDLDSTModule, TRGGDLSummaryModule, TRGGDLUnpackerModule, TRGGRLMatchModule, TRGGRLModule, TRGGRLProjectsModule, TRGGRLDQMModule, TRGGRLUnpackerModule, KLMTriggerModule, TRGTOPDQMModule, TRGTOPTRD2TTSConverterModule, TRGTOPUnpackerModule, TRGTOPUnpackerWaveformModule, TRGTOPWaveformPlotterModule, TRGRAWDATAModule, DQMHistAnalysisARICHModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisCDCEpicsModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisDAQMonObjModule, DQMHistAnalysisECLModule, DQMHistAnalysisECLConnectedRegionsModule, DQMHistAnalysisECLOutOfTimeDigitsModule, DQMHistAnalysisECLShapersModule, DQMHistAnalysisECLSummaryModule, DQMHistAnalysisEpicsExampleModule, DQMHistAnalysisExampleModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisInput2Module, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputTestModule, DQMHistAnalysisKLMModule, DQMHistAnalysisKLM2Module, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisSVDClustersOnTrackModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDOccupancyModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDUnpackerModule, DQMHistAnalysisTOPModule, DQMHistAnalysisTRGECLModule, DQMHistAnalysisTRGGDLModule, DQMHistComparitorModule, DQMHistDeltaHistoModule, DQMHistReferenceModule, DQMHistSnapshotsModule, PyModule, SVDUnpackerDQMModule, TrackSetEvaluatorHopfieldNNDEVModule, vxdDigitMaskingModule, DQMHistAnalysisDeltaEpicsMonObjExampleModule, DQMHistAnalysisDeltaTestModule, DQMHistAnalysisEpicsOutputModule, DQMHistAnalysisPhysicsModule, DQMHistAnalysisPXDChargeModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisTRGModule, and DQMHistOutputToEPICSModule.

Definition at line 166 of file Module.h.

166{};

◆ evalCondition()

bool evalCondition ( ) const
inherited

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

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

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

Definition at line 96 of file Module.cc.

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

◆ event()

void event ( void  )
overridevirtual

event: convert genfit::TrackCands to SpacePointTrackCands

Reimplemented from Module.

Definition at line 104 of file GFTC2SPTCConverterModule.cc.

105{
106 StoreObjPtr<EventMetaData> eventMetaDataPtr("EventMetaData", DataStore::c_Event);
107 const int eventCounter = eventMetaDataPtr->getEvent();
108 B2DEBUG(21, "GFTC2SPTCConverter::event(). Processing event " << eventCounter << " --------");
109
110 int nTCs = m_GenfitTrackCands.getEntries();
111
112 B2DEBUG(21, "Found " << nTCs << " genfit::TrackCands in StoreArray " << m_GenfitTrackCands.getName());
113
114 for (int iTC = 0; iTC < nTCs; ++iTC) {
115 genfit::TrackCand* trackCand = m_GenfitTrackCands[iTC];
116 m_genfitTCCtr += 1;
117
118 B2DEBUG(21,
119 "================================================================================\nNow processing genfit::TrackCand "
120 << iTC << ".");
121 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 15, PACKAGENAME())) { trackCand->Print(); } // prints to stdout
122 try {
123 // get the converted SPTC
124 std::pair<const SpacePointTrackCand, conversionStatus> spacePointTC = createSpacePointTC(trackCand);
125 // check if the SPTC contains enough SpacePoints
126 if (spacePointTC.second == 0) {
127 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 50, PACKAGENAME())) spacePointTC.first.print(50);
128 SpacePointTrackCand* newSPTC = m_SpacePointTrackCands.appendNew(spacePointTC.first);
130 newSPTC->addRelationTo(trackCand);
131 B2DEBUG(21, "Added new SpacePointTrackCand to StoreArray " << m_SpacePointTrackCands.getName());
132 } else {
133 B2DEBUG(21, "The conversion failed due to: " << spacePointTC.second);
134 increaseFailCounter(spacePointTC.second);
135 }
136 } catch (std::runtime_error& anE) { // catch all Belle2 exceptions with this!
137 B2ERROR("Caught exception in creation of SpacePointTrackCand: " << anE.what());
138 } catch (...) { // catch the rest
139 B2ERROR("Caught undefined exception in creation of SpacePointTrackCand!"); // COULDDO: rethrow exception as something is fishy if this happens
140 }
141 }
142}
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
Definition: DataStore.h:59
StoreArray< SpacePointTrackCand > m_SpacePointTrackCands
SpacePointTrackCands StoreArray.
unsigned int m_genfitTCCtr
Counter for genfit::TrackCands which were presented to the module.
StoreArray< genfit::TrackCand > m_GenfitTrackCands
Genfit::TrackCand StoreArray.
void increaseFailCounter(conversionStatus status)
increase the counter that 'belongs' to the conversionStatus
unsigned int m_SpacePointTCCtr
Counter for SpacePointTrackCands which were converted (if a curling track is split up,...
std::pair< const Belle2::SpacePointTrackCand, conversionStatus > createSpacePointTC(const genfit::TrackCand *genfitTC)
create a SpacePointTrackCand from the genfit::TrackCand
@ c_Debug
Debug: for code development.
Definition: LogConfig.h:26
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:31
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
const std::string & getName() const
Return name under which the object is saved in the DataStore.
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

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

◆ findAppropriateSpacePoint()

std::pair< Belle2::SpacePoint *, GFTC2SPTCConverterModule::conversionStatus > findAppropriateSpacePoint ( const Belle2::RelationVector< Belle2::SpacePoint > &  spacePoints,
std::vector< flaggedPair< int > > &  flaggedHitIDs 
)
protected

given a RelationVector with SpacePoints in it, it tries to get the appropriate one (see main documentation of module) NOTE: marks hits as used! NOTE: if no appropriate SpacePoint can be found, returns a nullptr pointer! templated for easier handling of other ClusterTypes later, at the moment only SVDCluster needed!

Returns
first is a pointer to the appropriate SpacePoint, .second is the conversion status, if this is <0 .first is nullptr! (i.e. check .second first)

Definition at line 352 of file GFTC2SPTCConverterModule.cc.

354{
355 std::pair<SpacePoint*, conversionStatus> returnSP = { nullptr, c_noFail }; // default return, be optimistc and assume that there are no problems
356 B2DEBUG(22, "Trying to find an appropriate SpacePoint from RelationVector with " << spacePoints.size() << " entries!");
357 if (spacePoints.size() == 0) {
358 B2DEBUG(28, "There are no spacePoints to choose of!");
359 returnSP.second = c_foundNoSpacePoint;
360 return returnSP;
361 }
362
363 // WARNING: TEL cluster will do something wrong here!
364 int detID = spacePoints[0]->getType() == VXD::SensorInfoBase::SVD ? Const::SVD : Const::PXD;
365
366 // .first: Cluster Combination exists in the TrackCand, .second: Cluster Combination exists and has not yet been used
367 std::vector<std::pair<bool, bool> > existAndValidSP;
368 // .first: index of SpacePoint in RelationVector, .second: Index of Cluster in the genfit::TrackCand
369 std::vector<std::pair<int, int> > clusterPositions;
370
371 // loop over all SpacePoints to look if their Cluster combination is vali (or existing but used, etc...)
372 for (unsigned int iSP = 0; iSP < spacePoints.size(); ++iSP) {
373 const SpacePoint* aSP = spacePoints[iSP];
374 B2DEBUG(22, "Processing SpacePoint " << iSP + 1 << " of " << spacePoints.size() << " with Index " << aSP->getArrayIndex() <<
375 " in StoreArray " << aSP->getArrayName());
376
377 bool bothValid = true; // assume true, change to false if the second Cluster cannot be found in the genfit::TrackCand
378 bool foundBoth = true; // assume true, change to false if the second Cluster can be found, but is already used
379
380 std::vector<int> clusterInds = getClusterIndices<SVDCluster>(aSP, m_SVDClusterName);
381 for (int index : clusterInds) {
382 // get the valid and existing position for cluster. TODO: rename variable!
383 std::pair<int, int> existAndValidClPos = checkExistAndValid(index, detID, flaggedHitIDs);
384 if (existAndValidClPos.first < 0) { // check if cluster is valid and/or exists
385 bothValid = false;
386 if (existAndValidClPos.second < 0) foundBoth = false;
387 }
388
389 // push_back the index in the relationVector and the found valid position
390 clusterPositions.push_back({iSP, existAndValidClPos.first});
391 B2DEBUG(29, "clusterInd: " << index << " checkExistAndValid.first: " << existAndValidClPos.first << ", .second: " <<
392 existAndValidClPos.second << " bothValid/foundBoth: " << bothValid << "/" << foundBoth);
393 }
394 // push_back the determined values
395 existAndValidSP.push_back({foundBoth, bothValid});
396 B2DEBUG(22, "Cluster combination of SpacePoint " << aSP->getArrayIndex() << " is contained in genfit::TrackCand: " << foundBoth <<
397 ". SpacePoint is valid: " << bothValid);
398 }
399
400 int relVecPosition = getAppropriateSpacePointIndex(existAndValidSP, clusterPositions);
401 if (relVecPosition < 0) {
402 returnSP.second = getFailEnum(relVecPosition);
403 return returnSP;
404 }
405
406 B2DEBUG(22, "SpacePoint " << spacePoints[relVecPosition]->getArrayIndex() <<
407 " is the appropriate SpacePoint of all checked SpacePoints! The positions inside the GFTC are: " << clusterPositions.at(
408 relVecPosition * 2).second << " and " << clusterPositions.at(relVecPosition * 2 + 1).second);
409 markHitAsUsed(flaggedHitIDs, clusterPositions.at(relVecPosition * 2).second);
410 markHitAsUsed(flaggedHitIDs, clusterPositions.at(relVecPosition * 2 + 1).second);
411 returnSP.first = spacePoints[relVecPosition];
412
413 return returnSP;
414}
conversionStatus getFailEnum(int intToConvert)
get the enum representation of an integer
void markHitAsUsed(std::vector< flaggedPair< int > > &flaggedHitIDs, int hitToMark)
mark a hit as used, i.e.
std::pair< int, int > checkExistAndValid(int clusterInd, int detID, std::vector< flaggedPair< int > > &flaggedHitIDs)
check if the Cluster (of a SpacePoint) is valid and/or exists in a genfit::TrackCand
int getAppropriateSpacePointIndex(const std::vector< std::pair< bool, bool > > &existAndValidSPs, const std::vector< std::pair< int, int > > &clusterPositions)
get the position of the appropriate SpacePoint inside the RelationVector NOTE: returns negative index...
size_t size() const
Get number of relations.
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42

◆ foundRelatedTrueHit()

bool foundRelatedTrueHit ( const Belle2::SpacePoint spacePoint,
unsigned int  allowedRelations = 1 
)
protected

check if there is a related TrueHit for a given SpacePoint.

Possibility to pass an optional argument on the maximum number of allowed relations (defautls to 1)

Definition at line 551 of file GFTC2SPTCConverterModule.cc.

552{
553 RelationVector<TrueHitType> relTrueHits = spacePoint->getRelationsTo<TrueHitType>("ALL"); // WARNING: searching in all relations
554 if (relTrueHits.size() == 0) {
555 B2DEBUG(22, "Found no TrueHit to SpacePoint " << spacePoint->getArrayIndex() << " from Array " << spacePoint->getArrayName());
556 return false;
557 }
558 B2DEBUG(22, "Found " << relTrueHits.size() << " related TrueHits for SpacePoint " << spacePoint->getArrayIndex() << " from Array "
559 << spacePoint->getArrayName());
560 return (relTrueHits.size() <= allowedRelations);
561}
Class for type safe access to objects that are referred to in relations.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.

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

◆ getAppropriateSpacePointIndex()

int getAppropriateSpacePointIndex ( const std::vector< std::pair< bool, bool > > &  existAndValidSPs,
const std::vector< std::pair< int, int > > &  clusterPositions 
)
protected

get the position of the appropriate SpacePoint inside the RelationVector NOTE: returns negative index if no SpacePoint fitting the criteria can be found!

Definition at line 479 of file GFTC2SPTCConverterModule.cc.

481{
482 // get the number of existing but used and the number of valid SpacePoints
483 int nExistingButUsedSP = std::count(existAndValidSPs.begin(), existAndValidSPs.end(), std::make_pair(true, false));
484 int nValidSP = std::count(existAndValidSPs.begin(), existAndValidSPs.end(), std::make_pair(true, true));
485
486 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 999, PACKAGENAME())) { // some very verbose output
487 std::stringstream output;
488 output << "content of passed vector of pairs (comma separated): ";
489 for (auto entry : existAndValidSPs) { output << entry.first << "/" << entry.second << ", "; }
490 B2DEBUG(29, output.str() << "nValidSP: " << nValidSP << " nExistingButUsedSP: " << nExistingButUsedSP);
491 }
492
493 // if there is no valid SpacePoint, but a SpacePoint with an existing but used cluster, throw, because conversion cannot be done properly then
494 if (nValidSP < 1 && nExistingButUsedSP > 0) {
495 B2DEBUG(28,
496 "There are only Cluster Combinations where one of the Clusters is already used by another SpacePoint! This genfit::TrackCand cannot be converted properly to a SpacePointTrackCand!");
497 return c_unsuitableGFTC;
498 } else if (nValidSP < 1 && nExistingButUsedSP < 1) {
499 B2DEBUG(28, "Found no valid SpacePoint and no SpacePoint with existing but used Clusters/Hits!");
500 return c_noValidSP;
501 } // if there is at least one valid SpacePoint, check the position difference and then decide if the SP can be used!
502 else if (nValidSP > 0) {
503 // 1) index of SpacePoint in RelationVector, 2) squared position difference, 3) & 4) are positions inside genfit::TrackCand (valid positions)
504 std::vector<std::pair<int, int> > positionInfos;
505
506 for (unsigned int iSP = 0; iSP < existAndValidSPs.size(); ++iSP) {
507 if (!existAndValidSPs.at(iSP).second) continue; // if not valid continue with next SpacePoint
508 // sign doesnot matter, comparing squared values later only!
509 int posDiff = clusterPositions.at(iSP * 2).second - clusterPositions.at(iSP * 2 + 1).second;
510
511 B2DEBUG(28, "Difference of positions of Clusters for entry " << iSP << " is " << posDiff);
512 positionInfos.push_back(std::make_pair(iSP, posDiff * posDiff));
513 }
514
515 // sort to find the smallest difference
516 sort(positionInfos.begin(), positionInfos.end(), [](const std::pair<int, int>& lTuple, const std::pair<int, int>& rTuple) { return lTuple.second < rTuple.second; });
517
518 if (positionInfos.at(0).second != 1) {
519 B2DEBUG(28, "The shortest squared distance between two Clusters is " << positionInfos.at(0).second <<
520 "! This would lead to wrong ordered TrackCandHits.");
521 return c_unsuitableGFTC;
522 }
523
524 B2DEBUG(22, "SpacePoint with index " << positionInfos.at(0).first <<
525 " is the valid SpacePoint with two Clusters in consecutive order from all valid SpacePoints.");
526 return positionInfos.at(0).first;
527 }
528
529 return c_noValidSP; // default return is negative
530}

◆ getClusterIndices()

std::vector< int > getClusterIndices ( const Belle2::SpacePoint spacePoint,
std::string  storeArrayName 
)
protected

get the indices of the Clusters related to the SpacePoint.

size of returned vector is <= 2! NOTE: only the StoreArray of Clusters with name storeArrayName will be searched!

Definition at line 418 of file GFTC2SPTCConverterModule.cc.

419{
420 std::vector<int> clusterInds;
421 RelationVector<ClusterType> relClusters = spacePoint->getRelationsTo<ClusterType>(storeArrayName);
422 B2ASSERT("Too many clusters. There are " << relClusters.size() << " clusters.", relClusters.size() < 3);
423
424 std::stringstream clusterStream;
425 for (const ClusterType& aCluster : relClusters) {
426 clusterInds.push_back(aCluster.getArrayIndex());
427 clusterStream << aCluster.getArrayIndex() << " ";
428 }
429
430 B2DEBUG(29, "getClusterIndices(SpacePoint " << spacePoint->getArrayIndex() << "," << spacePoint->getArrayName() <<
431 "): clusters are: " << clusterStream.str());
432
433 return clusterInds;
434}

◆ 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

◆ getFailEnum()

conversionStatus getFailEnum ( int  intToConvert)
inlineprotected

get the enum representation of an integer

Definition at line 97 of file GFTC2SPTCConverterModule.h.

98 {
99 switch (intToConvert) {
100 case 1: return c_singleClusterSP;
101 case 0: return c_noFail;
102 case -1: return c_foundNoSpacePoint;
103 case -2: return c_foundNoTrueHit;
104 case -3: return c_unsuitableGFTC;
105 case -4: return c_unusedHits;
106 case -5: return c_nonSingleSP;
107 case -6: return c_noValidSP;
108 case -7: return c_lowNDF;
109 default: return c_foundNoSpacePoint;
110 }
111 }

◆ 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

◆ getNDF()

int getNDF ( Belle2::SpacePoint spacePoint)
protected

get the NDF of a SpacePoint

Definition at line 464 of file GFTC2SPTCConverterModule.cc.

465{
466 if (spacePoint == nullptr) {
467 B2ERROR("Got nullptr pointer to determine the NDF of!");
468 return 0;
469 }
470 std::pair<bool, bool> assignedHits = spacePoint->getIfClustersAssigned();
471 // if both are assigned -> NDF of SpacePoint is 2
472 if (assignedHits.first && assignedHits.second) return 2;
473 // if ONLY one is assigned -> NDF of SpacePoint is 1 (note the use of the bitwise XOR operator)
474 if (assignedHits.first ^ assignedHits.second) return 1;
475 return 0;
476}
std::pair< bool, bool > getIfClustersAssigned() const
Returns, if u(v)-coordinate is based on cluster information.
Definition: SpacePoint.h:162

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

◆ getSpacePoint()

std::pair< Belle2::SpacePoint *, GFTC2SPTCConverterModule::conversionStatus > getSpacePoint ( const ClusterType *  cluster,
std::vector< flaggedPair< int > > &  flaggedHitIDs,
int  iHit,
bool  singleCluster,
std::string  arrayName = "" 
)
protected

templated version to get a SpacePoint from a Cluster

Parameters
clustertype of cluster
flaggedHitIDs(detId, hitId) of genfit::TrackCand with flag if hit has already been used
iHitindex of hit
arrayNamename of the StoreArray to be searched, defaults to empty string
singleClustersingleCluster SpacePoint? (Can probably be done in another way as well) NOTE: returns nullptr if no (appropriate) SpacePoint can be found!
Returns
first is a pointer to the SpacePoint, .second is the status, if this is < 0, .first is nullptr! (i.e. check .second first!) get the SpacePoint related to a Cluster

Definition at line 300 of file GFTC2SPTCConverterModule.cc.

302{
303 std::pair<SpacePoint*, conversionStatus> spacePoint = {nullptr, c_noFail}; // default return. be optimistic and assume that there are no problems!
304
305 B2DEBUG(28, "Trying to find a related SpacePoint in StoreArray " << arrayName << " for Cluster " << cluster->getArrayIndex() <<
306 " from Array " << cluster->getArrayName());
307 RelationVector<SpacePoint> spacePoints = cluster->template getRelationsFrom<SpacePoint>(arrayName);
308 B2DEBUG(28, "Found " << spacePoints.size() << " related SpacePoints for Cluster " << cluster->getArrayIndex() << " from Array " <<
309 cluster->getArrayName()); // NOTE: .size == 0 handled later!
310
311 if (singleCluster) { // if it is a singleCluster SpacePoint process different, then if it is a double Cluster SpacePoint
312 if (spacePoints.size() == 0) {
313 B2DEBUG(28, "Found no related (single Cluster) SpacePoint!");
314 spacePoint.second = c_foundNoSpacePoint;
315 return spacePoint;
316 }
317 if (spacePoints.size() > 1) {
318 B2ERROR("More than one single Cluster SpacePoint related to a Cluster! Returning only the first in RelationVector!");
319 spacePoint.second = c_nonSingleSP; // WARNING: returning first SpacePoint in RelationVector this way
321 }
322 spacePoint.first = spacePoints[0];
323 // cppcheck-suppress redundantAssignment
324 spacePoint.second = c_singleClusterSP;
325 markHitAsUsed(flaggedHitIDs, iHit); // mark hit as used
326 } else {
327 // try to get the appropriate double Cluster SVD SpacePoint
328 spacePoint = findAppropriateSpacePoint<ClusterType>(spacePoints, flaggedHitIDs);
329 if (spacePoint.first == nullptr) {
330 B2DEBUG(28, "Did not find an appropriate double Cluster SpacePoint for Cluster " << cluster->getArrayIndex() << " from Array " <<
331 cluster->getArrayName() << ". Reason for failure: " << spacePoint.second);
334 B2DEBUG(28, "Trying to get a single Cluster SpacePoint now!");
336 // get single Cluster SVD PacePoint if desired. WARNING: hardcoded to SVD here at the moment!
337 return getSpacePoint<ClusterType, TrueHitType>(cluster, flaggedHitIDs, iHit, true, m_SingleClusterSVDSPName);
338 }
339 }
340 }
341
342 if (m_PARAMcheckTrueHits && spacePoint.first != nullptr) { // only do the TrueHit check if there is actually something to check
343 if (!foundRelatedTrueHit<TrueHitType>(spacePoint.first)) { spacePoint.second = c_foundNoTrueHit; }
344 }
345
346 return spacePoint;
347}
unsigned int m_nonSingleSPCtr
Counter for cases where there is more than one single Cluster SpacePoint related to a Cluster.
unsigned int m_noTwoClusterSPCtr
Counter for cases where no related two Cluster could be found for a Cluster.
unsigned int m_singleClusterSPCtr
Counter for single cluster SVD SpacePoints.

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

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

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 311 of file Module.h.

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

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

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

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

Definition at line 160 of file Module.cc.

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

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

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

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

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

Definition at line 166 of file Module.cc.

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

◆ if_false()

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

A simplified version to add a condition to the module.

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

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

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

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

Definition at line 85 of file Module.cc.

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

◆ if_true()

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

A simplified version to set the condition of the module.

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

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

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

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

Definition at line 90 of file Module.cc.

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

◆ if_value()

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

Add a condition to the module.

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

See https://confluence.desy.de/display/BI/Software+ModCondTut or ModuleCondition for a description of the syntax.

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

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

Definition at line 79 of file Module.cc.

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

◆ increaseFailCounter()

void increaseFailCounter ( conversionStatus  status)
inlineprotected

increase the counter that 'belongs' to the conversionStatus

Definition at line 218 of file GFTC2SPTCConverterModule.h.

219 {
220 switch (status) {
224 case c_lowNDF: m_abortedLowNDFCtr++; break;
225 case c_noValidSP: m_abortedNoValidSPCtr++; break;
226 default: m_abortedMiscCtr++; break;
227 }
228 return;
229 }
unsigned int m_abortedNoSPCtr
Counter for aborted conversions because no SpacePoint has been found.
unsigned int m_abortedUnsuitableTCCtr
Counter for aborted conversions due to unsuitable genfit::TrackCand.
unsigned int m_abortedNoValidSPCtr
Counter for aborted conversions due to no found valid SpacePoint to any Cluster of the GFTC.
unsigned int m_abortedLowNDFCtr
Counter for SpacePointTrackCands that were not stored due to a too small number of degrees of freedom...
unsigned int m_abortedMiscCtr
temporary counter used for counting all failed conversions for which the reason cannot be deduced at ...
unsigned int m_abortedTrueHitCtr
Counting discarded conversions due to check for TrueHits not good.

◆ increaseSkippedCounter()

void increaseSkippedCounter ( conversionStatus  status,
ClusterType *  cluster 
)
inlineprotected

increase the appropriate counter variable if a Cluster is skipped (i.e.

only called if 'skipClusters' is set to true!) WARNING: decides which counter to increase (i.e. which ClusterType) via the layerNumber (hardcoded values!)

Definition at line 236 of file GFTC2SPTCConverterModule.h.

237 {
238 short unsigned int layerNumber = cluster->getSensorID().getLayerNumber();
239 if (layerNumber > 6) throw SpacePointTrackCand::UnsupportedDetType();
240 switch (status) {
241 case c_noFail:
242 break;
244 break;
246 if (layerNumber < 3) m_skippedPXDnoSPCtr++;
247 else m_skippedSVDnoSPCtr++;
248 break;
249 case c_foundNoTrueHit:
250 if (layerNumber < 3) m_skippedPXDnoTHCtr++;
251 else m_skippedSVDnoTHCtr++;
252 break;
253 case c_unsuitableGFTC:
254 if (layerNumber < 3) m_skippedPXDunsuitableCtr++;
256 break;
257 case c_noValidSP:
258 if (layerNumber < 3) m_skippedPXDnoValidSPCtr++;
260 break;
261 default:
262 m_skippedCluster++; break;
263 }
264 return;
265 }
unsigned int m_skippedPXDunsuitableCtr
Counter for skipped PXD Clusters due to unsuitable GFTC.
unsigned int m_skippedSVDnoValidSPCtr
Counter for skipped SVD Clusters due to no found valid SpacePoint.
unsigned int m_skippedSVDunsuitableCtr
Counter for skipped SVD Clusters due to unsuitable GFTC.
unsigned int m_skippedSVDnoSPCtr
Counter for skipped SVD Clusters, due to no found SpacePoint.
unsigned int m_skippedSVDnoTHCtr
Counter for skipped SVD Clusters, due to no related TrueHit to a SpacePoint.
unsigned int m_skippedPXDnoSPCtr
Counter for skipped PXD Clusters, due to no found SpacePoint.
unsigned int m_skippedPXDnoValidSPCtr
Counter for skipped PXD Clusters due to no found valid SpacePoint.
unsigned int m_skippedPXDnoTHCtr
Counter for skipped PXD Clusters, due to no related TrueHit to a SpacePoint.
unsigned int m_skippedCluster
Counter for skipped Cluster.

◆ initialize()

void initialize ( void  )
overridevirtual

initialize module (e.g.

check if all required StoreArrays are present or registering new StoreArrays)

Reimplemented from Module.

Definition at line 65 of file GFTC2SPTCConverterModule.cc.

66{
67 B2INFO("GFTC2SPTCConverter -------------- initialize() ---------------------");
68 // initialize Counters
70
71 // check if all required StoreArrays are here
76 }
79 }
81
83
84 // registering StoreArray for SpacePointTrackCand
86
87 // m_SpacePointTrackCands Relation to genfit::TrackCand
89
90 // CAUTION: if the StoreArray of the TrueHits is named, this check fails!!!
92 m_PXDTrueHits.isRequired();
93 m_SVDTrueHits.isRequired();
94 }
95
96 if (m_PARAMminNDF < 0) {
97 B2WARNING("'minNDF' is set to a value below 0. Resetting to 0!");
98 m_PARAMminNDF = 0;
99 }
100
101}
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:72
StoreArray< SpacePoint > m_SingleClusterSpacePoints
SVD SpacePoints StoreArray only consisting of one SVDCluster.
StoreArray< SVDCluster > m_SVDClusters
SVDClusters StoreArray.
StoreArray< PXDTrueHit > m_PXDTrueHits
PXDTrueHits StoreArray.
StoreArray< PXDCluster > m_PXDClusters
PXDClusters StoreArray.
StoreArray< SpacePoint > m_PXDSpacePoints
PXDSpacePoints StoreArray.
StoreArray< SpacePoint > m_NoSingleClusterSpacePoints
SVD SpacePoints StoreArray consisting of two SVDClusters.
StoreArray< SVDTrueHit > m_SVDTrueHits
SVDTrueHits StoreArray.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition: StoreArray.h:140

◆ initializeCounters()

void initializeCounters ( )
inlineprotected

reset counters to 0 to avoid indeterministic behaviour

Definition at line 187 of file GFTC2SPTCConverterModule.h.

188 {
190 m_genfitTCCtr = 0;
197
200
206
210
213
214 m_NDF = 0; // (cppcheck complaining about not being initialized in constructor)
215 }

◆ markHitAsUsed()

void markHitAsUsed ( std::vector< flaggedPair< int > > &  flaggedHitIDs,
int  hitToMark 
)
protected

mark a hit as used, i.e.

change its boolean value to true. Code readability reasons mainly, Output hardcoded to debug level 150

Definition at line 565 of file GFTC2SPTCConverterModule.cc.

566{
567 flaggedHitIDs[hitToMark].get<0>() = true;
568 flaggedPair<int> fPair = flaggedHitIDs[hitToMark];
569 B2DEBUG(22, "Marked Hit " << hitToMark << " as used. (detID,hitID) of this hit is (" << fPair.get<1>() << "," << fPair.get<2>() <<
570 ")");
571}

◆ processTrackCandHit()

std::pair< Belle2::SpacePoint *, GFTC2SPTCConverterModule::conversionStatus > processTrackCandHit ( genfit::TrackCandHit *  hit,
std::vector< flaggedPair< int > > &  flaggedHitIDs,
int  iHit 
)
protected

process a TrackCandHit (i.e.

do the handling of the different ClusterTypes), this is essentially nothing more than a wrapper, that directly returns whats returned from getSpacePoint(args) that is called within!

Definition at line 273 of file GFTC2SPTCConverterModule.cc.

274{
275 int detID = hit->getDetId();
276 int hitID = hit->getHitId();
277 int planeID = hit->getPlaneId(); // not used at the moment (except for debug output)
278 B2DEBUG(28, "Processing TrackCandHit " << iHit << " with detID: " << detID << ", hitID: " << hitID << ", planeID: " << planeID);
279
280 std::pair<SpacePoint*, conversionStatus> returnSP = { nullptr, c_noFail }; // default return, optimistically assuming no fail
281
282 if (detID == Const::PXD) {
283 const PXDCluster* aCluster = m_PXDClusters[hitID];
284 returnSP = getSpacePoint<PXDCluster, PXDTrueHit>(aCluster, flaggedHitIDs, iHit, true, m_PXDClusterSPName);
285 if (m_PARAMskipCluster) { increaseSkippedCounter(returnSP.second, aCluster); } // have to do this here at the moment -> COULDDO; change increaseSkippedCounter, such that it can be used without a Cluster
286 if (returnSP.second == c_singleClusterSP) returnSP.second = c_noFail; // getSpacePoint returns singleClusterSP for PXDs!
287 } else if (detID == Const::SVD) {
288 const SVDCluster* aCluster = m_SVDClusters[hitID];
289 returnSP = getSpacePoint<SVDCluster, SVDTrueHit>(aCluster, flaggedHitIDs, iHit, false, m_NoSingleClusterSVDSPName);
290 if (m_PARAMskipCluster) { increaseSkippedCounter(returnSP.second, aCluster); }
291 } else {
292 throw SpacePointTrackCand::UnsupportedDetType();
293 }
294 return returnSP;
295}
void increaseSkippedCounter(conversionStatus status, ClusterType *cluster)
increase the appropriate counter variable if a Cluster is skipped (i.e.
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:30
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29

◆ 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
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: print some summary information on the processed events

Reimplemented from Module.

Definition at line 145 of file GFTC2SPTCConverterModule.cc.

146{
147 std::stringstream generalOutput;
148 generalOutput << "GFTC2SPTCConverter::terminate(): got " << m_genfitTCCtr << " GFTCs and created " << m_SpacePointTCCtr <<
149 " SPTCs. ";
150 if (m_abortedLowNDFCtr) generalOutput << "For " << m_abortedLowNDFCtr << " SPTCs the NDF was below " << m_PARAMminNDF << "\n";
151 // NEW output
152 B2INFO(generalOutput.str());
153 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 1, PACKAGENAME())) {
154 std::stringstream verboseOutput;
155 verboseOutput << "counter variables: ";
156 verboseOutput << "abortedNoSP: " << m_abortedNoSPCtr << ", abortedUnsuitableGFTC: " << m_abortedUnsuitableTCCtr <<
157 ", abortedNoValidSP: " << m_abortedNoValidSPCtr;
158 if (m_PARAMcheckTrueHits) verboseOutput << ", abortedTrueHit: " << m_abortedTrueHitCtr;
159 if (m_PARAMskipCluster) {
160 verboseOutput << ", skippedCluster: " << m_skippedCluster << ", skippedPXDnoSP: " << m_skippedPXDnoSPCtr;
161 verboseOutput << ", skippedSVDnoSP: " << m_skippedSVDnoSPCtr << ", skippedPXDnoTH: " << m_skippedPXDnoTHCtr << ", skippedSVDnoTH: "
163 verboseOutput << ", skippedPXDunsuitable: " << m_skippedPXDunsuitableCtr << ", skippedSVDunsuitable: " << m_skippedSVDunsuitableCtr;
164 verboseOutput << ", skippedPXDnoValidSP " << m_skippedPXDnoValidSPCtr << ", skippedSVDnoValidSP " << m_skippedSVDnoValidSPCtr;
165 }
166 if (m_nonSingleSPCtr) verboseOutput << ", nonSingleSP " << m_nonSingleSPCtr;
167 verboseOutput << ", noTwoClusterSP: " << m_noTwoClusterSPCtr << ", singleClusterSVDSP: " << m_singleClusterSPCtr;
168 B2DEBUG(21, verboseOutput.str());
169 }
170 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 2, PACKAGENAME())) {
171 std::stringstream explanation;
172 explanation << "explanation of counter variables (key words only):\n";
173 explanation << "NoSP -> Found no related SpacePoint to a Cluster\n";
174 explanation << "Unsuitable -> Cluster combination of SpacePoint was not in consecutive order in GFTC\n";
175 explanation << "NoValidSP -> Cluster combination of SpacePoint was not contained in GFTC\n";
176 if (m_PARAMcheckTrueHits) explanation << "TrueHit/noTH -> found no related TrueHit to a SpacePoint\n";
177 if (m_nonSingleSPCtr) explanation << "nonSingleSP -> more than one singleCluster SpacePoint related to a Cluster\n";
178 explanation << "noTwoClusterSP -> found no two Cluster SpacePoint\n";
179 explanation << "singleClusterSVDSP -> number of tries to add a singleCluster SpacePoint for latter cases\n";
180 B2DEBUG(22, explanation.str());
181 }
182}

Member Data Documentation

◆ m_abortedLowNDFCtr

unsigned int m_abortedLowNDFCtr
protected

Counter for SpacePointTrackCands that were not stored due to a too small number of degrees of freedom.

Definition at line 154 of file GFTC2SPTCConverterModule.h.

◆ m_abortedMiscCtr

unsigned int m_abortedMiscCtr
protected

temporary counter used for counting all failed conversions for which the reason cannot be deduced at the moment

Definition at line 167 of file GFTC2SPTCConverterModule.h.

◆ m_abortedNoSPCtr

unsigned int m_abortedNoSPCtr
protected

Counter for aborted conversions because no SpacePoint has been found.

Definition at line 148 of file GFTC2SPTCConverterModule.h.

◆ m_abortedNoValidSPCtr

unsigned int m_abortedNoValidSPCtr
protected

Counter for aborted conversions due to no found valid SpacePoint to any Cluster of the GFTC.

Definition at line 184 of file GFTC2SPTCConverterModule.h.

◆ m_abortedTrueHitCtr

unsigned int m_abortedTrueHitCtr
protected

Counting discarded conversions due to check for TrueHits not good.

Definition at line 144 of file GFTC2SPTCConverterModule.h.

◆ m_abortedUnsuitableTCCtr

unsigned int m_abortedUnsuitableTCCtr
protected

Counter for aborted conversions due to unsuitable genfit::TrackCand.

Definition at line 146 of file GFTC2SPTCConverterModule.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_genfitTCCtr

unsigned int m_genfitTCCtr
protected

Counter for genfit::TrackCands which were presented to the module.

Definition at line 142 of file GFTC2SPTCConverterModule.h.

◆ m_genfitTCName

std::string m_genfitTCName
protected

Name of collection of genfit::TrackCand StoreArray.

Definition at line 124 of file GFTC2SPTCConverterModule.h.

◆ m_GenfitTrackCands

StoreArray<genfit::TrackCand> m_GenfitTrackCands
private

Genfit::TrackCand StoreArray.

Definition at line 375 of file GFTC2SPTCConverterModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

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

Definition at line 508 of file Module.h.

◆ m_NDF

int m_NDF
protected

number of degrees of freedom.

counted during creation of SpacePointTrackCand

Definition at line 269 of file GFTC2SPTCConverterModule.h.

◆ m_nonSingleSPCtr

unsigned int m_nonSingleSPCtr
protected

Counter for cases where there is more than one single Cluster SpacePoint related to a Cluster.

Definition at line 181 of file GFTC2SPTCConverterModule.h.

◆ m_NoSingleClusterSpacePoints

StoreArray<SpacePoint> m_NoSingleClusterSpacePoints
private

SVD SpacePoints StoreArray consisting of two SVDClusters.

Definition at line 373 of file GFTC2SPTCConverterModule.h.

◆ m_NoSingleClusterSVDSPName

std::string m_NoSingleClusterSVDSPName
protected

Non SingleCluster SVD SpacePoints collection name.

Definition at line 120 of file GFTC2SPTCConverterModule.h.

◆ m_noTwoClusterSPCtr

unsigned int m_noTwoClusterSPCtr
protected

Counter for cases where no related two Cluster could be found for a Cluster.

NOTE: Counter counts cases where there really was no SpacePoint for a Cluster but does not count the cases where a found two Cluster SP was rejected later on in the process!

Definition at line 151 of file GFTC2SPTCConverterModule.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_PARAMcheckNoSingleSVDSP

bool m_PARAMcheckNoSingleSVDSP
protected

Switch for checking the StoreArray of non-single cluster SVD SpacePoints in initialize.

Need this for cases, where only single Cluster SVD SpacePoints are presented to the module

Definition at line 132 of file GFTC2SPTCConverterModule.h.

◆ m_PARAMcheckTrueHits

bool m_PARAMcheckTrueHits
protected

Parameter Indicating if the TrueHits related from the Clusters forming a SpacePoint should be checked for equality.

Definition at line 128 of file GFTC2SPTCConverterModule.h.

◆ m_PARAMminNDF

int m_PARAMminNDF
protected

parameter for specifying a minimal number of degrees of freedom a SpacePointTrackCand has to have in order to be registered in the DataStore

Definition at line 136 of file GFTC2SPTCConverterModule.h.

◆ m_PARAMskipCluster

bool m_PARAMskipCluster
protected

Switch for controlling the behavior of the converter, when for one or more Clusters no appropriate SpacePoint can be found.

Definition at line 134 of file GFTC2SPTCConverterModule.h.

◆ m_PARAMuseSingleClusterSP

bool m_PARAMuseSingleClusterSP
protected

Parameter Indicating if SingleCluster SVD SpacePoints should be used if no double Cluster SVD SpacePoint can be found.

Definition at line 130 of file GFTC2SPTCConverterModule.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_PXDClusterName

std::string m_PXDClusterName
protected

PXDCluster collection name.

Definition at line 114 of file GFTC2SPTCConverterModule.h.

◆ m_PXDClusters

StoreArray<PXDCluster> m_PXDClusters
private

PXDClusters StoreArray.

Definition at line 370 of file GFTC2SPTCConverterModule.h.

◆ m_PXDClusterSPName

std::string m_PXDClusterSPName
protected

PXDCluster SpacePoints collection name.

Definition at line 122 of file GFTC2SPTCConverterModule.h.

◆ m_PXDSpacePoints

StoreArray<SpacePoint> m_PXDSpacePoints
private

PXDSpacePoints StoreArray.

Definition at line 374 of file GFTC2SPTCConverterModule.h.

◆ m_PXDTrueHits

StoreArray<PXDTrueHit> m_PXDTrueHits
private

PXDTrueHits StoreArray.

Definition at line 377 of file GFTC2SPTCConverterModule.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_SingleClusterSpacePoints

StoreArray<SpacePoint> m_SingleClusterSpacePoints
private

SVD SpacePoints StoreArray only consisting of one SVDCluster.

Definition at line 372 of file GFTC2SPTCConverterModule.h.

◆ m_singleClusterSPCtr

unsigned int m_singleClusterSPCtr
protected

Counter for single cluster SVD SpacePoints.

Definition at line 164 of file GFTC2SPTCConverterModule.h.

◆ m_SingleClusterSVDSPName

std::string m_SingleClusterSVDSPName
protected

Single Cluster SVD SpacePoints collection name.

Definition at line 118 of file GFTC2SPTCConverterModule.h.

◆ m_skippedCluster

unsigned int m_skippedCluster
protected

Counter for skipped Cluster.

Definition at line 169 of file GFTC2SPTCConverterModule.h.

◆ m_skippedPXDnoSPCtr

unsigned int m_skippedPXDnoSPCtr
protected

Counter for skipped PXD Clusters, due to no found SpacePoint.

Definition at line 156 of file GFTC2SPTCConverterModule.h.

◆ m_skippedPXDnoTHCtr

unsigned int m_skippedPXDnoTHCtr
protected

Counter for skipped PXD Clusters, due to no related TrueHit to a SpacePoint.

Definition at line 158 of file GFTC2SPTCConverterModule.h.

◆ m_skippedPXDnoValidSPCtr

unsigned int m_skippedPXDnoValidSPCtr
protected

Counter for skipped PXD Clusters due to no found valid SpacePoint.

NOTE: this can actually not happen

Definition at line 177 of file GFTC2SPTCConverterModule.h.

◆ m_skippedPXDunsuitableCtr

unsigned int m_skippedPXDunsuitableCtr
protected

Counter for skipped PXD Clusters due to unsuitable GFTC.

NOTE: this can actually not happen

Definition at line 172 of file GFTC2SPTCConverterModule.h.

◆ m_skippedSVDnoSPCtr

unsigned int m_skippedSVDnoSPCtr
protected

Counter for skipped SVD Clusters, due to no found SpacePoint.

Definition at line 160 of file GFTC2SPTCConverterModule.h.

◆ m_skippedSVDnoTHCtr

unsigned int m_skippedSVDnoTHCtr
protected

Counter for skipped SVD Clusters, due to no related TrueHit to a SpacePoint.

Definition at line 162 of file GFTC2SPTCConverterModule.h.

◆ m_skippedSVDnoValidSPCtr

unsigned int m_skippedSVDnoValidSPCtr
protected

Counter for skipped SVD Clusters due to no found valid SpacePoint.

Definition at line 179 of file GFTC2SPTCConverterModule.h.

◆ m_skippedSVDunsuitableCtr

unsigned int m_skippedSVDunsuitableCtr
protected

Counter for skipped SVD Clusters due to unsuitable GFTC.

Definition at line 174 of file GFTC2SPTCConverterModule.h.

◆ m_SpacePointTCCtr

unsigned int m_SpacePointTCCtr
protected

Counter for SpacePointTrackCands which were converted (if a curling track is split up, this counter will still be only increased by 1!)

Definition at line 140 of file GFTC2SPTCConverterModule.h.

◆ m_SpacePointTrackCands

StoreArray<SpacePointTrackCand> m_SpacePointTrackCands
private

SpacePointTrackCands StoreArray.

Definition at line 376 of file GFTC2SPTCConverterModule.h.

◆ m_SPTCName

std::string m_SPTCName
protected

Name of collection under which SpacePointTrackCands will be stored in the StoreArray.

Definition at line 126 of file GFTC2SPTCConverterModule.h.

◆ m_SVDClusterName

std::string m_SVDClusterName
protected

SVDCluster collection name.

Definition at line 116 of file GFTC2SPTCConverterModule.h.

◆ m_SVDClusters

StoreArray<SVDCluster> m_SVDClusters
private

SVDClusters StoreArray.

Definition at line 371 of file GFTC2SPTCConverterModule.h.

◆ m_SVDTrueHits

StoreArray<SVDTrueHit> m_SVDTrueHits
private

SVDTrueHits StoreArray.

Definition at line 378 of file GFTC2SPTCConverterModule.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.

◆ svdMainArrayName

std::string svdMainArrayName
protected

Name of the Array of SVD SpacePoints that shall be searched first.

Definition at line 267 of file GFTC2SPTCConverterModule.h.


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