10 #include <svd/modules/svdSpacePointCreator/SVDSpacePointCreatorModule.h>
11 #include <svd/modules/svdSpacePointCreator/SpacePointHelperFunctions.h>
13 #include <framework/logging/Logger.h>
14 #include <framework/utilities/FileSystem.h>
27 setDescription(
"Imports Clusters of the SVD detector and converts them to spacePoints.");
28 setPropertyFlags(c_ParallelProcessingCertified);
31 addParam(
"SVDClusters", m_svdClustersName,
32 "SVDCluster collection name",
string(
""));
33 addParam(
"SpacePoints", m_spacePointsName,
34 "SpacePoints collection name",
string(
"SVDSpacePoints"));
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",
string(
""));
39 addParam(
"OnlySingleClusterSpacePoints", m_onlySingleClusterSpacePoints,
40 "standard is false. If activated, the module will not try to find combinations of U and V clusters for the SVD any more",
43 addParam(
"MinClusterTime", m_minClusterTime,
"clusters with time below this value are not considered to make spacePoints.",
45 addParam(
"inputPDF", m_inputPDF,
46 "Path containing pdf root file", std::string(
"/data/svd/spacePointQICalibration.root"));
47 addParam(
"useQualityEstimator", m_useQualityEstimator,
48 "Standard is true. If turned off spacepoints will not be assigned a quality in their pairing.",
bool(
false));
50 addParam(
"useLegacyNaming", m_useLegacyNaming,
51 "Use old PDF name convention?",
bool(
true));
57 void SVDSpacePointCreatorModule::initialize()
60 m_spacePoints.registerInDataStore(m_spacePointsName, DataStore::c_DontWriteOut | DataStore::c_ErrorIfAlreadyRegistered);
61 m_svdClusters.isRequired(m_svdClustersName);
65 m_spacePoints.registerRelationTo(m_svdClusters, DataStore::c_Event, DataStore::c_DontWriteOut);
68 B2DEBUG(1,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
")::initialize: names set for containers:\n" <<
69 "\nsvdClusters: " << m_svdClusters.getName() <<
70 "\nspacePoints: " << m_spacePoints.getName());
72 if (m_useQualityEstimator ==
true) {
73 if (m_inputPDF.empty()) {
74 B2ERROR(
"Input PDF filename not set");
76 std::string fullPath = FileSystem::findFile(m_inputPDF);
77 if (fullPath.empty()) {
78 B2ERROR(
"PDF file:" << m_inputPDF <<
"not located! Check filename input matches name of PDF file!");
80 m_inputPDF = fullPath;
83 m_calibrationFile =
new TFile(m_inputPDF.c_str(),
"READ");
84 if (!m_calibrationFile->IsOpen())
85 B2FATAL(
"Couldn't open pdf file:" << m_inputPDF);
94 void SVDSpacePointCreatorModule::event()
99 if (m_onlySingleClusterSpacePoints ==
true) {
108 B2DEBUG(1,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
109 ")::event: spacePoints for single SVDClusters created! Size of arrays:\n" <<
110 ", svdClusters: " << m_svdClusters.getEntries() <<
111 ", spacePoints: " << m_spacePoints.getEntries());
114 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 10, PACKAGENAME()) ==
true) {
115 for (
int index = 0; index < m_spacePoints.getEntries(); index++) {
118 B2DEBUG(10,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
")::event: spacePoint " << index <<
119 " with type " << sp->
getType() <<
125 m_TESTERSVDClusterCtr += m_svdClusters.getEntries();
126 m_TESTERSpacePointCtr += m_spacePoints.getEntries();
132 void SVDSpacePointCreatorModule::terminate()
134 B2DEBUG(1,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
")::terminate: total number of occured instances:\n" <<
135 ", svdClusters: " << m_TESTERSVDClusterCtr <<
136 ", spacePoints: " << m_TESTERSpacePointCtr);
137 if (m_useQualityEstimator ==
true) {
138 m_calibrationFile->Delete();
143 void SVDSpacePointCreatorModule::InitializeCounters()
145 m_TESTERSVDClusterCtr = 0;
146 m_TESTERSpacePointCtr = 0;