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>
16#include <svd/dataobjects/SVDEventInfo.h>
29 setDescription(
"Imports Clusters of the SVD detector and converts them to spacePoints.");
34 "SVDCluster collection name",
string(
""));
36 "SpacePoints collection name",
string(
"SVDSpacePoints"));
38 "EventLevelTrackingInfo collection name",
string(
""));
40 "SVDEventInfo collection name.",
string(
"SVDEventInfo"));
44 "allows the user to set an identifier for this module. Usefull if one wants to use several instances of that module",
string(
""));
46 "standard is false. If activated, the module will not try to find combinations of U and V clusters for the SVD any more",
49 addParam(
"MinClusterTime",
m_minClusterTime,
"clusters with time below this value are not considered to make spacePoints.",
52 "Path containing pdf root file", std::string(
"/data/svd/spacePointQICalibration.root"));
54 "Standard is true. If turned off spacepoints will not be assigned a quality in their pairing.",
bool(
false));
57 "Use old PDF name convention?",
bool(
true));
60 "Maximum number of SpacePoints allowed in an event, above this threshold no SpacePoint will be created",
64 "Use SVD group info to reject combinations from clusters belonging to different groups in 6-sample DAQ mode",
bool(
false));
66 "Use SVD group info to reject combinations from clusters belonging to different groups in 3-sample DAQ mode",
bool(
false));
68 "Number of groups expected to contain the signal clusters.",
71 "Form a single super-group.",
78 "Use SVDSpacePointSNRFractionSelector to apply a selection on combinations of clusters in 6-sample DAQ mode",
bool(
false));
80 "Use SVDSpacePointSNRFractionSelector to apply a selection on combinations of clusters in 3-sample DAQ mode",
bool(
false));
83 "if False, use configuration module parameters for SVDSPacePointSNRFractionSelector",
97 B2FATAL(
"no valid configuration found for SVD reconstruction");
99 B2DEBUG(20,
"SVDRecoConfiguration: from now on we are using " <<
m_recoConfig->get_uniqueID());
113 B2INFO(
"SVDSpacePointCreator : SVDCluster groupId is used for 6-sample DAQ mode.");
115 B2INFO(
"SVDSpacePointCreator : SVDCluster groupId is not used for 6-sample DAQ mode.");
118 B2INFO(
"SVDSpacePointCreator : SVDCluster groupId is used for 3-sample DAQ mode.");
120 B2INFO(
"SVDSpacePointCreator : SVDCluster groupId is not used for 3-sample DAQ mode.");
123 B2INFO(
"SVDSpacePointCreator : cut on sample SNR fraction is used for 6-sample DAQ mode.");
126 B2INFO(
"SVDSpacePointCreator : cut on sample SNR fraction is used for 3-sample DAQ mode.");
130 B2FATAL(
"No valid SVDSpacePointSNRFractionSelector");
137 B2FATAL(
"no valid configuration found for SVD reconstruction");
139 B2DEBUG(20,
"SVDRecoConfiguration: from now on we are using " <<
m_recoConfig->get_uniqueID());
141 TString timeRecoWith6SamplesAlgorithm =
m_recoConfig->getTimeRecoWith6Samples();
142 TString timeRecoWith3SamplesAlgorithm =
m_recoConfig->getTimeRecoWith3Samples();
145 B2FATAL(
"no valid configuration found for SVDTimeGrouping");
147 B2DEBUG(20,
"SVDTimeGroupingConfiguration: from now on we are using " <<
m_groupingConfig->get_uniqueID());
165 B2DEBUG(20,
"SVDSpacePointCreatorModule(" <<
m_nameOfInstance <<
")::initialize: names set for containers:\n" <<
171 B2ERROR(
"Input PDF filename not set");
174 if (fullPath.empty()) {
175 B2ERROR(
"PDF file:" <<
m_inputPDF <<
"not located! Check filename input matches name of PDF file!");
182 B2FATAL(
"Couldn't open pdf file:" <<
m_inputPDF);
197 int numberOfSignalGroups;
198 bool formSingleSignalGroup;
199 if (useSVDGroupInfo || useSVDSpacePointSNRFraction) {
205 if (!eventinfo) B2ERROR(
"No SVDEventInfo!");
206 int numberOfAcquiredSamples = eventinfo->getNSamples();
208 if (numberOfAcquiredSamples == 6) {
213 }
else if (numberOfAcquiredSamples == 3) {
232 ")::event: spacePoints for single SVDClusters created! Size of arrays:\n" <<
241 B2DEBUG(29,
"SVDSpacePointCreatorModule(" <<
m_nameOfInstance <<
")::event: spacePoint " << index <<
242 " with type " << sp->
getType() <<
257 B2DEBUG(20,
"SVDSpacePointCreatorModule(" <<
m_nameOfInstance <<
")::terminate: total number of occured instances:\n" <<
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
@ c_Debug
Debug: for code development.
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
std::string m_eventLevelTrackingInfoName
Name of the EventLevelTrackingInfo.
bool m_useParamFromDB
use the configuration from SVDTimeGroupingConfiguration DB.
std::string m_svdClustersName
SVDCluster collection name.
float m_minClusterTime
clusters with time below this value are not considered to make spacePoints
std::string m_nameOfInstance
allows the user to set an identifier for this module.
SVDTimeGroupingParameters m_usedParsIn3Samples
module parameter values for 3-sample DAQ taken from SVDTimeGroupingConfiguration dbobject.
virtual void initialize() override
Init the module.
SVDHitTimeSelection m_HitTimeCut
selection based on clustr time db object
unsigned int m_numMaxSpacePoints
do not crete SPs if their number exceeds m_numMaxSpacePoints, tuned with BG19
StoreArray< SVDCluster > m_svdClusters
the storeArray for svdClusters as member, is faster than recreating link for each event
std::string m_inputPDF
File path of root file containing pdf histograms.
virtual void event() override
eventWise jobs (e.g.
void InitializeCounters()
initialize variables in constructor to avoid nondeterministic behavior
unsigned int m_TESTERSpacePointCtr
counts total number of SpacePoints occured
SVDTimeGroupingParameters m_usedParsIn6Samples
module parameter values for 6-sample DAQ taken from SVDTimeGroupingConfiguration dbobject.
SVDNoiseCalibrations m_NoiseCal
SVDNoise calibrations db object.
bool m_useSVDSpacePointSNRFractionFor6Samples
Use SVDSpacePointSNRFractionSelector to reject combinations in 6-sample DAQ mode.
bool m_useQualityEstimator
Standard is true.
virtual void terminate() override
final output with mini-feedback
StoreArray< SpacePoint > m_spacePoints
the storeArray for spacePoints as member, is faster than recreating link for each event
bool m_forceGroupingFromDB
use the configuration from SVDRecConfiguration DB.
bool m_onlySingleClusterSpacePoints
standard is false.
bool m_useSVDGroupInfoIn6Sample
Use SVD group info to reject combinations in 6-sample DAQ mode.
bool m_useDBForSNRFraction
if true takes the configuration from the DB objects for SVDSpacePointSNRFractionSelector.
void beginRun() override
configure
bool m_useLegacyNaming
Choice between PDF naming conventions.
TFile * m_calibrationFile
Pointer to root TFile containing PDF histograms.
bool m_useSVDGroupInfoIn3Sample
Use SVD group info to reject combinations in 3-sample DAQ mode.
std::string m_svdEventInfoName
Name of the collection to use for the SVDEventInfo.
SVDSpacePointCreatorModule()
Constructor.
std::string m_spacePointsName
SpacePoints collection name.
DBObjPtr< SVDSpacePointSNRFractionSelector > m_svdSpacePointSNRFractionSelector
Payload of selection functions and thresholds applied on SVDSpacePoint.
unsigned int m_TESTERSVDClusterCtr
counts total number of SVDCluster occured
DBObjPtr< SVDRecoConfiguration > m_recoConfig
SVD Reconstruction Configuration payload.
bool m_useSVDSpacePointSNRFractionFor3Samples
Use SVDSpacePointSNRFractionSelector to reject combinations in 3-sample DAQ mode.
DBObjPtr< SVDTimeGroupingConfiguration > m_groupingConfig
SVDTimeGrouping Configuration payload.
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.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
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.
int getEntries() const
Get the number of objects in the array.
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.
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
Class to uniquely identify a any structure of the PXD and SVD.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#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, const bool &useSVDGroupInfo, const int &numberOfSignalGroups, const bool &formSingleSignalGroup, const SVDNoiseCalibrations &noiseCal, const DBObjPtr< SVDSpacePointSNRFractionSelector > &svdSpacePointSelectionFunction, bool useSVDSpacePointSNRFractionSelector)
finds all possible combinations of U and V Clusters for SVDClusters.
Abstract base class for different kinds of events.
Bool_t formSingleSignalGroup
Assign groupID = 0 to all clusters belonging to the signal groups.
Int_t numberOfSignalGroups
Number of groups expected to contain the signal clusters.