9#include <top/dbobjects/TOPSignalShape.h>
10#include <framework/logging/Logger.h>
22 double pole1,
double pole2):
23 m_shape(shape), m_tau(tau), m_pole1(pole1), m_pole2(pole2)
30 for (
unsigned i = 0; i < shape.size(); i++) {
31 if (shape[i] > shape[samplePeak]) samplePeak = i;
34 TSpline5 spline(
"spline",
m_tmin,
m_tmax, shape.data(), shape.size());
35 double t1 =
m_tmin + (samplePeak - 1) * timeBin;
36 double t2 =
m_tmin + (samplePeak + 1) * timeBin;
37 for (
int i = 0; i < 20; i++) {
38 double t = (t1 + t2) / 2;
39 if (spline.Derivative(t) > 0) {
45 double vPeak = spline.Eval((t1 + t2) / 2);
49 for (
auto& value :
m_shape) value /= vPeak;
53 auto sampleRise = samplePeak;
54 while (sampleRise >= 0 and
m_shape[sampleRise] > 0.5) sampleRise--;
55 t1 =
m_tmin + sampleRise * timeBin;
56 t2 =
m_tmin + (sampleRise + 1) * timeBin;
57 for (
int i = 0; i < 20; i++) {
58 double t = (t1 + t2) / 2;
59 if (spline.Eval(t) < vPeak / 2) {
65 double crossingTime = (t1 + t2) / 2;
78 B2ERROR(
"TOPSignalShape::getValue: object not initialized");
81 if (isnan(t))
return 0;
85 std::vector<double> shape(
m_shape);
87 shape.data(), shape.size());
99 for (
int i = 0; i < 20; i++) {
100 double t = (t1 + t2) / 2;
double m_peakTime
do not write out
std::vector< double > m_shape
waveform values
TSpline5 * m_interpolator
cache for the interpolator
double m_tau
time constant of the exponential tail [ns]
double m_tmin
time of the first waveform sample [ns]
double m_tmax
time of the last waveform sample [ns]
TOPSignalShape()
Default constructor.
double getPeakingTime() const
Returns peaking time of the signal.
double getValue(double t) const
Returns value at time t of the normalized waveform using interpolator.
Abstract base class for different kinds of events.