9 #include <pxd/modules/pxdSpacePointCreator/PXDSpacePointCreatorModule.h>
11 #include <framework/logging/Logger.h>
27 setDescription(
"Imports Clusters of the PXD detector and converts them to spacePoints.");
28 setPropertyFlags(c_ParallelProcessingCertified);
31 addParam(
"PXDClusters", m_pxdClustersName,
32 "PXDCluster collection name",
string(
""));
33 addParam(
"SpacePoints", m_spacePointsName,
34 "SpacePoints collection name",
string(
"PXDSpacePoints"));
37 addParam(
"NameOfInstance", m_nameOfInstance,
38 "allows the user to set an identifier for this module. Usefull if one wants to use several instances of that module",
39 string(
"PXDSpacePoints"));
44 void PXDSpacePointCreatorModule::initialize()
47 m_spacePoints.registerInDataStore(m_spacePointsName, DataStore::c_DontWriteOut | DataStore::c_ErrorIfAlreadyRegistered);
48 m_pxdClusters.isRequired(m_pxdClustersName);
49 m_eventLevelTrackingInfo.isOptional();
53 m_spacePoints.registerRelationTo(m_pxdClusters, DataStore::c_Event, DataStore::c_DontWriteOut);
56 B2DEBUG(10,
"SpacePointCreatorModule(" << m_nameOfInstance <<
")::initialize: names set for containers:\n" <<
57 "pxdClusters: " << m_pxdClusters.getName() <<
58 "\nspacePoints: " << m_spacePoints.getName());
67 void PXDSpacePointCreatorModule::event()
71 if (m_eventLevelTrackingInfo.isValid()) {
72 if (m_eventLevelTrackingInfo->hasSVDSpacePointCreatorAbortionFlag()) {
77 for (
unsigned int i = 0; i < uint(m_pxdClusters.getEntries()); ++i) {
78 const PXDCluster* currentCluster = m_pxdClusters[i];
79 SpacePoint* newSP = m_spacePoints.appendNew((currentCluster));
83 B2DEBUG(1,
"PXDSpacePointCreatorModule(" << m_nameOfInstance <<
")::event: spacePoints created! Size of arrays:\n" <<
84 "pxdClusters: " << m_pxdClusters.getEntries() <<
85 ", spacePoints: " << m_spacePoints.getEntries());
88 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 10, PACKAGENAME()) ==
true) {
89 for (
int index = 0; index < m_spacePoints.getEntries(); index++) {
94 B2DEBUG(10,
"SpacePointCreatorModule(" << m_nameOfInstance <<
")::event: spacePoint " << index <<
95 " with type " << sp->
getType() <<
98 " and the related PXDCluster is in " << relatedCluster->
getArrayName() <<
103 m_TESTERPXDClusterCtr += m_pxdClusters.getEntries();
104 m_TESTERSpacePointCtr += m_spacePoints.getEntries();
109 void PXDSpacePointCreatorModule::terminate()
111 B2DEBUG(10,
"PXDSpacePointCreatorModule(" << m_nameOfInstance <<
")::terminate: total number of occured instances:\n" <<
112 "pxdClusters: " << m_TESTERPXDClusterCtr <<
113 ", spacePoints: " << m_TESTERSpacePointCtr);
117 void PXDSpacePointCreatorModule::InitializeCounters()
119 m_TESTERPXDClusterCtr = 0;
120 m_TESTERSpacePointCtr = 0;
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Imports Clusters of the pxd detector and converts them to spacePoints.
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).
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.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
Class to uniquely identify a any structure of the PXD and SVD.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.