9#include <top/dbobjects/TOPSampleTimes.h>
11#include <framework/logging/Logger.h>
25 double DTime = 2 * syncTimeBase;
26 double timeBin = DTime /
static_cast<double>(c_TimeAxisSize);
27 for (
unsigned i = 0; i < c_TimeAxisSize; i++)
m_timeAxis[i] = timeBin * i;
36 if (sampleTimes.size() < c_TimeAxisSize) {
37 B2FATAL(
"TOPSampleTimes::setTimeAxis: vector too short");
41 for (
unsigned i = 0; i < c_TimeAxisSize; i++)
m_timeAxis[i] = sampleTimes[i];
42 double DTime = 2 * syncTimeBase;
50 std::vector<double> timeAxis;
51 for (
unsigned i = 0; i < c_TimeAxisSize + 1; i++) {
61 int sampleNum = int(sample);
62 if (sample < 0) sampleNum--;
63 double frac = sample - sampleNum;
65 sampleNum += window * c_WindowSize;
66 int n = sampleNum / c_TimeAxisSize;
67 int k = sampleNum % c_TimeAxisSize;
88 int i2 = c_TimeAxisSize;
90 int i = (i1 + i2) / 2;
98 return (n * c_TimeAxisSize - window * c_WindowSize + i1 +
106 int i = (window * c_WindowSize + sampleNumber) % c_TimeAxisSize;
107 if (i < 0) i += c_TimeAxisSize;
float m_timeAxis[c_TimeAxisSize+1]
time axis + right border point
@ c_Calibrated
good calibrated value
@ c_Default
uncalibrated default value
double getTimeRange() const
Returns time axis range (time interval corresponding to 4 asic windows)
EStatus m_calibrated
calibration status
double getFullTime(int window, double sample) const
Returns time with respect to sample 0 of window 0.
double getTimeBin(int window, int sampleNumber) const
Returns time bin of a given sample number and window (e.g.
double getSample(int window, double time) const
Returns sample with respect to sample 0 of the specified ASIC window (inverse of getTime).
void setTimeAxis(double syncTimeBase)
Sets equidistant time axis (uncalibrated).
std::vector< double > getTimeAxis() const
Returns time axis (sample times)
Abstract base class for different kinds of events.