9 #include <framework/logging/Logger.h>
10 #include <svd/reconstruction/SVDClusterTime.h>
11 #include <svd/reconstruction/SVDMaxSumAlgorithm.h>
12 #include <svd/dataobjects/SVDEventInfo.h>
25 void SVDClusterTime::applyCoG6Time(
const Belle2::SVD::RawCluster& rawCluster,
double& time,
double& timeError,
int& firstFrame)
40 float sumAmplitudes = 0;
42 for (
int i = 0; i < (int)strips.size(); i++) {
47 float stripSumAmplitudes = 0;
49 for (
int k = 0; k < 6; k ++) {
50 stripTime += k * strip.
samples[k];
51 stripSumAmplitudes += strip.
samples[k];
53 if (stripSumAmplitudes != 0) {
54 stripTime /= (stripSumAmplitudes);
55 stripTime *= m_apvClockPeriod;
58 B2WARNING(
"Trying to divide by 0 (ZERO)! Sum of amplitudes is nullptr! Skipping this SVDShaperDigit!");
64 if (isnan(m_triggerBin))
65 B2FATAL(
"OOPS, we can't continue, you have to set the trigger bin!");
67 if (! m_returnRawClusterTime)
69 stripTime = m_CoG6TimeCal.getCorrectedTime(rawCluster.
getSensorID(), rawCluster.
isUSide(), strip.
cellID, stripTime, m_triggerBin);
77 time = time / sumAmplitudes;
80 void SVDClusterTime::applyCoG3Time(
const Belle2::SVD::RawCluster& rawCluster,
double& time,
double& timeError,
int& firstFrame)
95 auto begin = selectedSamples.begin();
96 const auto end = selectedSamples.end();
98 auto retval = 0., norm = 0.;
99 for (
auto step = 0.; begin != end; ++begin, step += m_apvClockPeriod) {
100 norm +=
static_cast<double>(*begin);
101 retval +=
static_cast<double>(*begin) * step;
103 float rawtime = retval / norm;
105 if (isnan(m_triggerBin))
106 B2FATAL(
"OOPS, we can't continue, you have to set the trigger bin!");
108 if (m_returnRawClusterTime)
112 time = m_CoG3TimeCal.getCorrectedTime(rawCluster.
getSensorID(), rawCluster.
isUSide(), 10, rawtime, m_triggerBin);
117 void SVDClusterTime::applyELS3Time(
const Belle2::SVD::RawCluster& rawCluster,
double& time,
double& timeError,
int& firstFrame)
125 float m_ELS3tau = 55;
133 auto begin = selectedSamples.begin();
134 const double E = std::exp(- m_apvClockPeriod / m_ELS3tau);
135 const double E2 = E * E;
136 const double E4 = E2 * E2;
137 double a0 = (*begin);
138 double a1 = (*(begin + 1));
139 double a2 = (*(begin + 2));
142 const double w = (a0 - E2 * a2) / (2 * a0 + E * a1);
143 auto rawtime_num = 2 * E4 + w * E2;
144 auto rawtime_den = 1 - E4 - w * (2 + E2);
145 double rawtime = - m_apvClockPeriod * rawtime_num / rawtime_den;
147 if (isnan(m_triggerBin))
148 B2FATAL(
"OOPS, we can't continue, you have to set the trigger bin!");
150 if (m_returnRawClusterTime)
153 time = m_ELS3TimeCal.getCorrectedTime(rawCluster.
getSensorID(), rawCluster.
isUSide(), 10, rawtime, m_triggerBin);
Class representing a raw cluster candidate during clustering of the SVD.
Belle2::SVDShaperDigit::APVFloatSamples getClsSamples(bool inElectrons) const
VxdID getSensorID() const
const std::vector< StripInRawCluster > getStripsInRawCluster() const
Class implementing the MaxSum algorithm.
std::vector< float > getSelectedSamples()
Abstract base class for different kinds of events.
structure containing the relevant informations of each strip of the raw cluster
Belle2::SVDShaperDigit::APVFloatSamples samples
ADC of the acquired samples.
int maxSample
ADC max of the acquired samples.