17 #include "DetectorInfo/ClockConstants.h" 18 #include "DetectorInfo/DetectorClocksException.h" 35 double frequency = 1e9)
62 { fTime =
Time(sample, frame); }
66 {
SetTime(
int(sample),
int(frame)); }
69 { fTime =
Time(ticks,0); }
80 double Time(
int sample,
int frame)
const {
return (sample * 1.e3 / fFrequency + frame * fFramePeriod); }
int Frame(double time) const
Given time [ns] w.r.t. electronics clock T0, return frame number.
double Time(int sample, int frame) const
Given sample & frame number in this clock, returns double precision time [ns].
int Sample(int tick) const
Given ticks w.r.t. electronics clock T0, return sample number.
int Ticks(double time) const
Given time [ns] w.r.t. electronics clock T0, return # of ticks.
unsigned int FrameTicks() const
Number ticks in a frame.
~ElecClock()
Default destructor.
void SetTime(unsigned int sample, unsigned int frame)
int Frame() const
Frame number.
int Sample() const
Sample number.
tick ticks
Alias for common language habits.
double fTime
Time in nano-second.
double TickPeriod() const
A single tick period in nano-second, frequency is in MHz.
void SetTime(unsigned int ticks)
double FramePeriod() const
A single frame period in micro-second.
double fFramePeriod
Frame period in micro-second.
bool operator<=(const ElecClock &rhs) const
int Frame(int tick) const
Given ticks w.r.t. electronics clock T0, return frame number.
double Time(double time) const
Given time [ns] w.r.t. electronics clock counting, return discretized time in double precision...
ElecClock operator-(const ElecClock &rhs)
bool operator>=(const ElecClock &rhs) const
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
ElecClock operator+(const ElecClock &rhs)
General LArSoft Utilities.
double Time(int ticks) const
Given time in ticks w.r.t. electronics clock counting, return discretized time in double precision...
double fFrequency
Clock speed in MHz.
General GArSoft Utilities.
int Ticks(int sample, int frame) const
Given sample & frame returns # ticks.
int Sample(double time) const
Given time [ns] w.r.t. electronics clock T0, return sample number.
bool operator<(const ElecClock &rhs) const
int Ticks() const
of Ticks
const double kTIME_MAX
Maximum time in nano-second.
double Frequency() const
Frequency in MHz.
ElecClock(double time=0, double frame_period=kTIME_MAX, double frequency=1e9)
Default constructor.
void SetTime(double time)
bool operator>(const ElecClock &rhs) const
void SetTime(int sample, int frame)
double Time() const
Time (stored) in nano-second.