9 #include <svd/modules/svdSpacePointCreator/SVDSpacePointCreatorModule.h>
10 #include <svd/modules/svdSpacePointCreator/SpacePointHelperFunctions.h>
12 #include <framework/logging/Logger.h>
13 #include <framework/utilities/FileSystem.h>
26 setDescription(
"Imports Clusters of the SVD detector and converts them to spacePoints.");
27 setPropertyFlags(c_ParallelProcessingCertified);
30 addParam(
"SVDClusters", m_svdClustersName,
31 "SVDCluster collection name",
string(
""));
32 addParam(
"SpacePoints", m_spacePointsName,
33 "SpacePoints collection name",
string(
"SVDSpacePoints"));
34 addParam(
"EventLevelTrackingInfoName", m_eventLevelTrackingInfoName,
35 "EventLevelTrackingInfo collection name",
string(
""));
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",
string(
""));
40 addParam(
"OnlySingleClusterSpacePoints", m_onlySingleClusterSpacePoints,
41 "standard is false. If activated, the module will not try to find combinations of U and V clusters for the SVD any more",
44 addParam(
"MinClusterTime", m_minClusterTime,
"clusters with time below this value are not considered to make spacePoints.",
46 addParam(
"inputPDF", m_inputPDF,
47 "Path containing pdf root file", std::string(
"/data/svd/spacePointQICalibration.root"));
48 addParam(
"useQualityEstimator", m_useQualityEstimator,
49 "Standard is true. If turned off spacepoints will not be assigned a quality in their pairing.",
bool(
false));
51 addParam(
"useLegacyNaming", m_useLegacyNaming,
52 "Use old PDF name convention?",
bool(
true));
54 addParam(
"numMaxSpacePoints", m_numMaxSpacePoints,
55 "Maximum number of SpacePoints allowed in an event, above this threshold no SpacePoint will be created",
56 unsigned(m_numMaxSpacePoints));
62 void SVDSpacePointCreatorModule::initialize()
65 m_spacePoints.registerInDataStore(m_spacePointsName, DataStore::c_DontWriteOut | DataStore::c_ErrorIfAlreadyRegistered);
66 m_svdClusters.isRequired(m_svdClustersName);
70 m_spacePoints.registerRelationTo(m_svdClusters, DataStore::c_Event, DataStore::c_DontWriteOut);
73 B2DEBUG(1,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
")::initialize: names set for containers:\n" <<
74 "\nsvdClusters: " << m_svdClusters.getName() <<
75 "\nspacePoints: " << m_spacePoints.getName());
77 if (m_useQualityEstimator ==
true) {
78 if (m_inputPDF.empty()) {
79 B2ERROR(
"Input PDF filename not set");
81 std::string fullPath = FileSystem::findFile(m_inputPDF);
82 if (fullPath.empty()) {
83 B2ERROR(
"PDF file:" << m_inputPDF <<
"not located! Check filename input matches name of PDF file!");
85 m_inputPDF = fullPath;
88 m_calibrationFile =
new TFile(m_inputPDF.c_str(),
"READ");
89 if (!m_calibrationFile->IsOpen())
90 B2FATAL(
"Couldn't open pdf file:" << m_inputPDF);
99 void SVDSpacePointCreatorModule::event()
104 if (m_onlySingleClusterSpacePoints ==
true) {
109 m_useLegacyNaming, m_numMaxSpacePoints, m_eventLevelTrackingInfoName);
113 B2DEBUG(1,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
114 ")::event: spacePoints for single SVDClusters created! Size of arrays:\n" <<
115 ", svdClusters: " << m_svdClusters.getEntries() <<
116 ", spacePoints: " << m_spacePoints.getEntries());
119 if (LogSystem::Instance().isLevelEnabled(LogConfig::c_Debug, 10, PACKAGENAME()) ==
true) {
120 for (
int index = 0; index < m_spacePoints.getEntries(); index++) {
123 B2DEBUG(10,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
")::event: spacePoint " << index <<
124 " with type " << sp->
getType() <<
130 m_TESTERSVDClusterCtr += m_svdClusters.getEntries();
131 m_TESTERSpacePointCtr += m_spacePoints.getEntries();
137 void SVDSpacePointCreatorModule::terminate()
139 B2DEBUG(1,
"SVDSpacePointCreatorModule(" << m_nameOfInstance <<
")::terminate: total number of occured instances:\n" <<
140 ", svdClusters: " << m_TESTERSVDClusterCtr <<
141 ", spacePoints: " << m_TESTERSpacePointCtr);
142 if (m_useQualityEstimator ==
true) {
143 m_calibrationFile->Delete();
148 void SVDSpacePointCreatorModule::InitializeCounters()
150 m_TESTERSVDClusterCtr = 0;
151 m_TESTERSpacePointCtr = 0;
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
Imports Clusters of the SVD detector and converts them to spacePoints.
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.
void provideSVDClusterSingles(const StoreArray< SVDCluster > &svdClusters, StoreArray< SpacePointType > &spacePoints)
simply store one spacePoint for each existing SVDCluster.
void provideSVDClusterCombinations(const StoreArray< SVDCluster > &svdClusters, StoreArray< SpacePointType > &spacePoints, SVDHitTimeSelection &hitTimeCut, bool useQualityEstimator, TFile *pdfFile, bool useLegacyNaming, unsigned int numMaxSpacePoints, std::string m_eventLevelTrackingInfoName)
finds all possible combinations of U and V Clusters for SVDClusters.
Abstract base class for different kinds of events.