9#include <svd/modules/svdReconstruction/SVDRecoDigitCreatorModule.h>
11#include <framework/core/Environment.h>
12#include <framework/datastore/DataStore.h>
13#include <framework/logging/LogConfig.h>
14#include <framework/logging/Logger.h>
16#include <svd/dataobjects/SVDEventInfo.h>
18#include <svd/reconstruction/SVDReconstructionBase.h>
20#include <svd/reconstruction/SVDRecoTimeFactory.h>
21#include <svd/reconstruction/SVDRecoChargeFactory.h>
41 setDescription(
"This module reconstructs SVDShaperDigit in SVDRecoDigit, i.e. calibrated strip with reconstructed charge and time.");
46 "SVDShaperDigits collection name.",
string(
""));
48 "SVDRecoDigits collection name.",
string(
""));
50 "SVDCluster collection name.",
string(
""));
54 "strip-time reconstruction algorithm for the 6-sample DAQ mode: CoG6 = 6-sample CoG (default), CoG3 = 3-sample CoG, ELS3 = 3-sample ELS",
55 std::string(
"inRecoDBObject"));
57 "strip-time reconstruction algorithm for the 3-sample DAQ mode: CoG6 = 6-sample CoG, CoG3 = 3-sample CoG (default), ELS3 = 3-sample ELS",
58 std::string(
"inRecoDBObject"));
60 " choose charge algorithm for 6-sample DAQ mode: MaxSample (default), SumSamples, ELS3 = 3-sample ELS",
61 std::string(
"inRecoDBObject"));
63 " choose charge algorithm for 3-sample DAQ mode: MaxSample (default), SumSamples, ELS3 = 3-sample ELS",
64 std::string(
"inRecoDBObject"));
67 "if false use clustering and reconstruction configuration module parameters",
m_useDB);
76 B2FATAL(
"no valid configuration found for SVD reconstruction");
78 B2DEBUG(20,
"SVDRecoConfiguration: from now on we are using " <<
m_recoConfig->get_uniqueID());
107 bool returnRawClusterTime =
false;
136 B2DEBUG(25,
"SVDRecoDigitCreator Parameters (in default system unit, *=cannot be set directly):");
138 B2DEBUG(25,
" 1. COLLECTIONS:");
141 B2DEBUG(25,
" --> SVDClusters: " << DataStore::arrayName<SVDCluster>(
m_storeClustersName));
148 std::string m_svdEventInfoName =
"SVDEventInfo";
150 m_svdEventInfoName =
"SVDEventInfoSim";
155 B2WARNING(
"No SVDEventInfo object in this event: SVD is excluded, so don't worry");
159 B2FATAL(
"No SVDEventInfo object in this event: something went wrong");
163 int numberOfAcquiredSamples = eventinfo->getNSamples();
168 for (
int i = 0; i < nShaperDigits; ++i) {
182 strip.
charge = std::numeric_limits<double>::quiet_NaN();;
183 strip.
time = std::numeric_limits<double>::quiet_NaN();;
185 if (rawCluster.
add(sensorID, rawCluster.
isUSide(), strip)) {
187 double time = std::numeric_limits<float>::quiet_NaN();
188 double timeError = std::numeric_limits<float>::quiet_NaN();
189 double charge = std::numeric_limits<float>::quiet_NaN();
190 float chargeError = std::numeric_limits<float>::quiet_NaN();
191 int firstFrame = std::numeric_limits<int>::quiet_NaN();
192 std::vector<float> probabilities = {0.5};
193 double chi2 = std::numeric_limits<double>::quiet_NaN();
196 double SNR = std::numeric_limits<double>::quiet_NaN();
197 double seedCharge = std::numeric_limits<double>::quiet_NaN();
199 if (numberOfAcquiredSamples == 6) {
205 }
else if (numberOfAcquiredSamples == 3) {
213 B2ERROR(
"SVD Reconstruction not available for this strip: not supported number of acquired APV samples!!");
216 time = eventinfo->getTimeInFTSWReference(time, firstFrame);
219 SVDRecoDigit* recoDigit =
m_storeReco.appendNew(sensorID, isU, cellID, charge, chargeError, time, timeError, probabilities, chi2);
225 cluster->addRelationTo(recoDigit, recoDigit->
getCharge());
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
static Environment & Instance()
Static method to get a reference to the Environment instance.
@ c_Online
Online data taking.
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...
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).
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
float getNoise(const VxdID &sensorID, const bool &isU, const unsigned short &strip) const
This is the method for getting the noise.
float getCharge() const
Get amplitude estimate, alternate getter name.
Class representing a raw cluster candidate during clustering of the SVD.
bool add(VxdID vxdID, bool isUside, struct StripInRawCluster &aStrip)
Add a Strip to the current cluster.
virtual void computeClusterCharge(Belle2::SVD::RawCluster &rawCluster, double &charge, double &SNR, double &seedCharge)=0
computes the cluster charge, SNR and seedCharge
virtual void computeClusterTime(Belle2::SVD::RawCluster &rawCluster, double &time, double &timeError, int &firstFrame)=0
computes the cluster time, timeError and FirstFrame
static SVDClusterCharge * NewCharge(const std::string &description)
static function that returns the class to compute the cluster charge
SVDRecoDigitCreatorModule()
Constructor defining the parameters.
std::string m_storeRecoDigitsName
Name of the collection to use for the SVDRecoDigits.
SVDClusterCharge * m_charge6SampleClass
strip charge class for the 6-sample acquisition mode
SVDClusterCharge * m_charge3SampleClass
strip charge class for the 3-sample acquisition mode
void initialize() override
Initialize the module.
std::string m_storeShaperDigitsName
Name of the collection to use for the SVDShaperDigits.
void event() override
does the actual strip reconstruction
SVDNoiseCalibrations m_NoiseCal
wrapper of the noise calibrations
void endRun() override
delete pointers
SVDClusterTime * m_time6SampleClass
strip time class for the 6-sample acquisition mode
StoreArray< SVDRecoDigit > m_storeReco
Collection of SVDRecoDigits.
std::string m_chargeRecoWith6SamplesAlgorithm
string storing the strip charge reconstruction algorithm in 6-sample DAQ mode
std::string m_chargeRecoWith3SamplesAlgorithm
string storing the strip charge reconstruction algorithm in 3-sample DAQ mode
void beginRun() override
configure strip reconstruction
StoreArray< SVDShaperDigit > m_storeShaper
Collection of SVDShaperDigits.
std::string m_storeClustersName
Name of the collection to use for the SVDClusters.
std::string m_timeRecoWith6SamplesAlgorithm
string storing the strip time reconstruction algorithm in 6-sample DAQ mode
DBObjPtr< SVDRecoConfiguration > m_recoConfig
SVD Reconstruction Configuration payload.
StoreArray< SVDCluster > m_storeClusters
Collection of SVDClusters.
std::string m_timeRecoWith3SamplesAlgorithm
string storing the strip time reconstruction algorithm in 3-sample DAQ mode
bool m_useDB
if true takes the strip reconstruction configuration from the DB objects
SVDClusterTime * m_time3SampleClass
strip time class for the 3-sample acquisition mode
static SVDClusterTime * NewTime(const std::string &description, const bool &returnRawClusterTime)
static function that returns the class to compute the cluster time
Class to check whether the reconstruction algorithms are available or not.
bool isChargeAlgorithmAvailable(TString chargeAlg)
bool isTimeAlgorithmAvailable(TString timeAlg)
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
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.
Namespace to encapsulate code needed for simulation and reconstrucion of the SVD.
Abstract base class for different kinds of events.
structure containing the relevant informations of each strip of the raw cluster
double charge
strip charge
Belle2::SVDShaperDigit::APVFloatSamples samples
ADC of the acquired samples.
int shaperDigitIndex
index of the shaper digit
int maxSample
ADC max of the acquired samples.