A class exposing an upgraded interface of detinfo::DetectorClocksData
.
More...
#include <DetectorTimings.h>
Public Member Functions | |
electronics_time | TriggerTime () const |
electronics_time | BeamGateTime () const |
auto | OpticalClockPeriod () const |
Returns the duration of the optical clock period and tick. More... | |
megahertz | OpticalClockFrequency () const |
Returns the frequency of the optical clock tick. More... | |
template<typename Ticks = optical_time_ticks> | |
Ticks | toOpticalTicks (time_interval time) const |
Returns the optical ticks corresponding to a time interval. More... | |
template<typename TimePoint > | |
optical_tick | toOpticalTick (TimePoint time) const |
Returns the time point converted in units of optical time ticks. More... | |
template<typename TimePoint > | |
optical_tick_d | toOpticalTickD (TimePoint time) const |
Returns the time point converted in units of optical time ticks. More... | |
Access to underlying service providers. | |
detinfo::DetectorClocksWithUnits const & | detClocksUnits () const |
Returns a DetectorClocksWithUnits object. More... | |
detinfo::DetectorClocksData const & | clockData () const |
Returns the detector clocks data. More... | |
Conversions | |
template<typename TargetTime , typename FromTime > | |
TargetTime | toTimeScale (FromTime time) const |
Returns a time point in a different time scale. More... | |
template<typename TargetTick , typename FromTime > | |
TargetTick | toTick (FromTime time) const |
Returns a time point as a tick on a different time scale. More... | |
template<typename Ticks > | |
Ticks | toTicks (time_interval time) const |
Returns the number of ticks corresponding to a time interval. More... | |
template<typename FromTime > | |
electronics_time | toElectronicsTime (FromTime time) const |
Converts a time point into electronics time scale. More... | |
template<typename FromTime > | |
electronics_tick_d | toElectronicsTickD (FromTime time) const |
Converts a time point into electronics tick (real). More... | |
template<typename FromTime > | |
electronics_tick | toElectronicsTick (FromTime time) const |
Converts a time point into electronics tick (truncated). More... | |
template<typename FromTime > | |
trigger_time | toTriggerTime (FromTime time) const |
Converts a time point into trigger time scale. More... | |
template<typename FromTime > | |
simulation_time | toSimulationTime (FromTime time) const |
Converts a time point into simulation time scale. More... | |
Clocks | |
template<typename TimeScale > | |
detinfo::ElecClock const & | ClockFor () const |
Returns the electronics clock for the specified time scale. More... | |
template<typename TimeScale > | |
time_interval_for< TimeScale > | ClockPeriodFor () const |
Returns the period of the clock for the specified time scale. More... | |
template<typename TimeScale > | |
frequency_for< TimeScale > | ClockFrequencyFor () const |
Returns the frequency of the clock for the specified time scale. More... | |
Reference times | |
time_interval | fromStart (electronics_time time) const |
Converts a electronics time point into a duration from the start of electronics time. More... | |
template<typename TimePoint , typename TimeScale = electronics_time> | |
constexpr TimeScale | startTime () const |
Returns the start time of the specified time scale. More... | |
template<typename TickPoint , typename TimeTickScale = electronics_tick> | |
constexpr TimeTickScale | startTick () const |
Returns the start tick of the specified time tick scale. More... | |
Private Types | |
template<typename TimeScale > | |
using | traits_of = detinfo::timescales::timescale_traits< typename TimeScale::category_t > |
The traits of a specific TimeScale . More... | |
template<typename TimeScale > | |
using | time_interval_for = typename traits_of< TimeScale >::time_interval_t |
The time interval type of a specific TimeScale . More... | |
template<typename TimeScale > | |
using | frequency_for = typename traits_of< TimeScale >::frequency_t |
The frequency type of a specific TimeScale . More... | |
Private Types inherited from detinfo::DetectorClocksWithUnits | |
using | nanosecond = util::quantities::nanosecond |
using | microsecond = util::quantities::microsecond |
using | megahertz = util::quantities::megahertz |
using | ticks_d = util::quantities::ticks_d |
Friends | |
detinfo::DetectorTimings | makeDetectorTimings (detinfo::DetectorClocksWithUnits const &) |
A class exposing an upgraded interface of detinfo::DetectorClocksData
.
This object extends detinfo::DetectorClocksData
interface. For example, in art/LArSoft, one can be created as:
in a non-event context or, if a current event is available:
It can also wrap around an existing detinfo::DetectorClocksWithUnits
object:
The timing data is copied locally; see detinfo::DetectorClocksData
for considerations on the validity time span of the timing information.
Several data types are designed to resolve the ambiguity of which time, which time scale and which time unit are used. The class distinguish between time points, which identify events in absolute terms, and time intervals and durations, which identify the time lapsed between two events or time points.
The time duration is generally expressed by a single type, since it is common to all main time scales expressed in real time:
time_interval
is natively represented in microsecondsNote that while each data type has a native representation (usually microseconds), these objects can convert into other units to remain consistent. Still, they are not fool-proof...
Different time point types are defined to reflect the different time scales:
electronics_time
for times on the electronics time axis, starting at the electronics start time, natively expressed in microseconds. There is no clock specific to this time scale, but we identify the ticks with the TPC electronics clock. Tick types are nevertheless specific to this time scale and they are called electronics_tick
(integral tick number) and electronics_tick_d
(real tick number).TPCelectronics_time
for times on the TPC electronics time axis, starting at the TPC electronics start time, natively expressed in microseconds. Tick types are called TPCelectronics_tick
(integral tick number) and TPCelectronics_tick_d
(real tick number).optical_time
for times on theoptical_tick
(integral tick number) and optical_tick_d
(real tick number). trigger_time
for times on the trigger time axis, starting at the hardware trigger time, natively expressed in microseconds. Tick types are called trigger_tick
(integral tick number) and trigger_tick_d
(real tick number).simulation_time
for times on the simulation time axis, starting at the GEANT4 time start, natively expressed in nanoseconds.For each time scale, a "category" is defined (e.g. electronics_time::category_t
), and traits are available for each category as timescale_traits
objects (for example detinfo::timescales::timescale_traits<electronics_time::category_t>
). From the traits, it is possible to access the type of time point (time_point_t
, which is equivalent e.g. to electronics_time
, simulation_time
etc.) as well as the time interval type (time_interval_t
), the tick type in integral units (tick_t
) and real units (tick_d_t
), the name of the time scale itself (name()
) and little more.
Note that not all time scales support all features. For example, simulation time is not actually associated to any clock, so that for example an attempt to convert a time into simulation time ticks will result in a compilation failure.
Definition at line 249 of file DetectorTimings.h.
Definition at line 274 of file DetectorTimings.h.
Definition at line 279 of file DetectorTimings.h.
Definition at line 268 of file DetectorTimings.h.
using detinfo::DetectorTimings::electronics_time_ticks = detinfo::timescales::electronics_time_ticks |
Definition at line 286 of file DetectorTimings.h.
|
private |
The frequency type of a specific TimeScale
.
Definition at line 261 of file DetectorTimings.h.
Definition at line 276 of file DetectorTimings.h.
Definition at line 281 of file DetectorTimings.h.
Definition at line 270 of file DetectorTimings.h.
Definition at line 288 of file DetectorTimings.h.
Definition at line 272 of file DetectorTimings.h.
Definition at line 284 of file DetectorTimings.h.
|
private |
The time interval type of a specific TimeScale
.
Definition at line 257 of file DetectorTimings.h.
Definition at line 275 of file DetectorTimings.h.
Definition at line 280 of file DetectorTimings.h.
Definition at line 269 of file DetectorTimings.h.
using detinfo::DetectorTimings::TPCelectronics_time_ticks = detinfo::timescales::TPCelectronics_time_ticks |
Definition at line 287 of file DetectorTimings.h.
|
private |
The traits of a specific TimeScale
.
Definition at line 253 of file DetectorTimings.h.
Definition at line 277 of file DetectorTimings.h.
Definition at line 282 of file DetectorTimings.h.
Definition at line 271 of file DetectorTimings.h.
Definition at line 289 of file DetectorTimings.h.
|
inlineexplicit |
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 297 of file DetectorTimings.h.
|
inlineexplicit |
Definition at line 300 of file DetectorTimings.h.
|
inline |
Returns the beam gate time as a point in electronics time.
Definition at line 339 of file DetectorTimings.h.
|
inline |
Returns the detector clocks data.
Definition at line 318 of file DetectorTimings.h.
detinfo::ElecClock const & detinfo::DetectorTimings::ClockFor | ( | ) | const |
Returns the electronics clock for the specified time scale.
Definition at line 1077 of file DetectorTimings.h.
|
inline |
Returns the frequency of the clock for the specified time scale.
Definition at line 522 of file DetectorTimings.h.
|
inline |
Returns the period of the clock for the specified time scale.
Definition at line 514 of file DetectorTimings.h.
|
inline |
Returns a DetectorClocksWithUnits object.
Definition at line 311 of file DetectorTimings.h.
|
inline |
Converts a electronics time point into a duration from the start of electronics time.
time | electronics time point to be converted |
time
This is mostly a logic operation, since the value of the returned time duration is the same as the value of the time
point (i.e. the start time is 0).
Definition at line 1084 of file DetectorTimings.h.
|
inline |
Returns the frequency of the optical clock tick.
Definition at line 540 of file DetectorTimings.h.
|
inline |
Returns the duration of the optical clock period and tick.
Definition at line 533 of file DetectorTimings.h.
constexpr TimeTickScale detinfo::DetectorTimings::startTick | ( | ) | const |
Returns the start tick of the specified time tick scale.
TickPoint | the type of tick point on the requested scale |
TimeTickScale | the type of scale to get the result in, also a time tick point (default: electronics_tick ) |
This method returns the start tick of a time tick scale, in another time tick scale (or in the very same, in which case the result is trivially 0
). Example:
sets TPCstartTime
to the instant the TPC electronics time starts, in the electronics time tick scale. This example in particular is yielding the same value as calling detinfo::DetectorClocksData::TPCTick2TDC(0)
.
TickPoint
is the same as TimeScale
(trivially, 0
)TPCelectronics_time
to:electronics_time
Definition at line 1053 of file DetectorTimings.h.
constexpr TimeScale detinfo::DetectorTimings::startTime | ( | ) | const |
Returns the start time of the specified time scale.
TimePoint | the type of time point on the requested scale |
TimeScale | the type of scale to get the result in (default: electronics_time ) |
This method returns the start time of a time scale, in another time scale (or in the very same, in which case the result is trivially 0
). Example:
sets TPCstartTime
to the instant the TPC electronics time starts, in the electronics time scale. This example in particular is yielding the same value as calling detinfo::DetectorClocksData::TPCTime()
.
TimePoint
is the same as TimeScale
(trivially, 0
)TPCelectronics_time
to:electronics_time
Definition at line 1045 of file DetectorTimings.h.
|
inline |
Converts a time
point into electronics tick (truncated).
FromTime | the time scale the input time is measured in |
time | the time instant to be converted, in FromTime scale |
toTick()
, toElectronicsTime()
, toElectronicsTickD()
Example:
Definition at line 457 of file DetectorTimings.h.
|
inline |
Converts a time
point into electronics tick (real).
FromTime | the time scale the input time is measured in |
time | the time instant to be converted, in FromTime scale |
toTick()
, toElectronicsTime()
, toElectronicsTick()
Example:
Definition at line 437 of file DetectorTimings.h.
|
inline |
Converts a time
point into electronics time scale.
FromTime | the time scale the input time is measured in |
time | the time instant to be converted, in FromTime scale |
Example:
is equivalent to use detinfo::DetectorClocksData::G4ToElecTime(47.5)
.
Definition at line 417 of file DetectorTimings.h.
|
inline |
Returns the time
point converted in units of optical time ticks.
TimePoint | type of the time to be converted |
time | time point to be converted into an optical tick |
time
point expressed as integral number of ticks toTick()
, toOpticalTickD()
The specified time point is converted in ticks from the start of the optical time scale (i.e., from startTime<optical_time>()
). The ticks are from the optical detector clock (OpticalClockPeriod()
). The number of ticks is truncated.
Definition at line 578 of file DetectorTimings.h.
|
inline |
Returns the time
point converted in units of optical time ticks.
TimePoint | type of the time to be converted |
time | time point to be converted into an optical tick |
time
point expressed as real number of ticks toTick()
, toOpticalTickD()
The specified time point is converted in ticks from the start of the optical time scale (i.e., from startTime<optical_time>()
). The ticks are from the optical detector clock (OpticalClockPeriod()
). The number of ticks may be fractional.
Definition at line 597 of file DetectorTimings.h.
|
inline |
Returns the optical ticks corresponding to a time
interval.
Ticks | type of tick interval returned (default: optical_time_ticks) |
time
interval expressed as number of optical ticksThe time
interval is represented by the number of optical detector electronics ticks fitting in it. If Ticks
is based on an integral type, the resulting number of ticks is usually truncated.
Definition at line 557 of file DetectorTimings.h.
|
inline |
Converts a time
point into simulation time scale.
FromTime | the time scale the input time is measured in |
time | the time instant to be converted, in FromTime scale |
Example:
Definition at line 495 of file DetectorTimings.h.
TargetTick detinfo::DetectorTimings::toTick | ( | FromTime | time | ) | const |
Returns a time
point as a tick on a different time scale.
TargetTick | the desired time scale |
FromTime | the time scale the input time is measured in |
time | the time instant to be converted, in FromTime scale |
TargetTick
time scaleExample:
Definition at line 1069 of file DetectorTimings.h.
|
inline |
Returns the number of ticks corresponding to a time
interval.
Ticks | type of tick interval returned |
time
interval expressed as number of ticksThe time
interval is represented by the number of ticks on the time scale of Ticks
which fits in that interval. If Ticks
is based on an integral type, the resulting number of ticks is usually truncated.
Definition at line 397 of file DetectorTimings.h.
TargetTime detinfo::DetectorTimings::toTimeScale | ( | FromTime | time | ) | const |
Returns a time
point in a different time scale.
TargetTime | the desired time scale |
FromTime | the time scale the input time is measured in |
time | the time instant to be converted, in FromTime scale |
TargetTime
time scaleExample:
is equivalent to use detinfo::DetectorClocksData::G4ToElecTime(47.5)
.
Definition at line 1061 of file DetectorTimings.h.
|
inline |
Converts a time
point into trigger time scale.
FromTime | the time scale the input time is measured in |
time | the time instant to be converted, in FromTime scale |
Example:
Definition at line 476 of file DetectorTimings.h.
|
inline |
Returns the trigger time as a point in electronics time.
Definition at line 331 of file DetectorTimings.h.
|
friend |
Returns DetectorTimings
object from specified detinfo::DetectorClocksWithUnits
.
Definition at line 714 of file DetectorTimings.h.