10 #include <pxd/modules/pxdSpacePointCreator/PXDSpacePointCreatorModule.h>
12 #include <framework/logging/Logger.h>
28 setDescription(
"Imports Clusters of the PXD detector and converts them to spacePoints.");
29 setPropertyFlags(c_ParallelProcessingCertified);
32 addParam(
"PXDClusters", m_pxdClustersName,
33 "PXDCluster collection name",
string(
""));
34 addParam(
"SpacePoints", m_spacePointsName,
35 "SpacePoints collection name",
string(
"PXDSpacePoints"));
38 addParam(
"NameOfInstance", m_nameOfInstance,
39 "allows the user to set an identifier for this module. Usefull if one wants to use several instances of that module",
40 string(
"PXDSpacePoints"));
45 void PXDSpacePointCreatorModule::initialize()
48 m_spacePoints.registerInDataStore(m_spacePointsName, DataStore::c_DontWriteOut | DataStore::c_ErrorIfAlreadyRegistered);
49 m_pxdClusters.isRequired(m_pxdClustersName);
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()
70 for (
unsigned int i = 0; i < uint(m_pxdClusters.getEntries()); ++i) {
71 const PXDCluster* currentCluster = m_pxdClusters[i];
72 SpacePoint* newSP = m_spacePoints.appendNew((currentCluster));
76 B2DEBUG(1,
"PXDSpacePointCreatorModule(" << m_nameOfInstance <<
")::event: spacePoints created! Size of arrays:\n" <<
77 "pxdClusters: " << m_pxdClusters.getEntries() <<
78 ", spacePoints: " << m_spacePoints.getEntries());
81 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 10, PACKAGENAME()) ==
true) {
82 for (
int index = 0; index < m_spacePoints.getEntries(); index++) {
87 B2DEBUG(10,
"SpacePointCreatorModule(" << m_nameOfInstance <<
")::event: spacePoint " << index <<
88 " with type " << sp->
getType() <<
91 " and the related PXDCluster is in " << relatedCluster->
getArrayName() <<
96 m_TESTERPXDClusterCtr += m_pxdClusters.getEntries();
97 m_TESTERSpacePointCtr += m_spacePoints.getEntries();
102 void PXDSpacePointCreatorModule::terminate()
104 B2DEBUG(10,
"PXDSpacePointCreatorModule(" << m_nameOfInstance <<
")::terminate: total number of occured instances:\n" <<
105 "pxdClusters: " << m_TESTERPXDClusterCtr <<
106 ", spacePoints: " << m_TESTERSpacePointCtr);
110 void PXDSpacePointCreatorModule::InitializeCounters()
112 m_TESTERPXDClusterCtr = 0;
113 m_TESTERSpacePointCtr = 0;