LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
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... | |
using | nanosecond = util::quantities::nanosecond |
using | microsecond = util::quantities::microsecond |
using | megahertz = util::quantities::megahertz |
using | ticks_d = util::quantities::ticks_d |
Private Member Functions | |
microsecond | TPCTime () const |
Equivalent to detinfo::DetectorClocksData::TPCTime() . More... | |
microsecond | G4ToElecTime (nanosecond simTime) const |
Equivalent to detinfo::DetectorClocksData::G4ToElecTime() . More... | |
microsecond | G4ToElecTime (double simTime) const |
Equivalent to detinfo::DetectorClocksData::G4ToElecTime() . More... | |
ticks_d | TPCTick2TDC (ticks_d tpcticks) const |
Equivalent to detinfo::DetectorClocksData::G4ToElecTime() . More... | |
ticks_d | TPCTick2TDC (double tpcticks) const |
Equivalent to detinfo::DetectorClocksData::G4ToElecTime() . More... | |
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 221 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 246 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 251 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 240 of file DetectorTimings.h.
using detinfo::DetectorTimings::electronics_time_ticks = detinfo::timescales::electronics_time_ticks |
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 258 of file DetectorTimings.h.
|
private |
The frequency type of a specific TimeScale
.
Definition at line 233 of file DetectorTimings.h.
|
inherited |
Definition at line 54 of file DetectorTimings.h.
|
inherited |
Definition at line 53 of file DetectorTimings.h.
|
inherited |
Definition at line 52 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 248 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 253 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 242 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 260 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 244 of file DetectorTimings.h.
|
inherited |
Definition at line 55 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 256 of file DetectorTimings.h.
|
private |
The time interval type of a specific TimeScale
.
Definition at line 229 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 247 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 252 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 241 of file DetectorTimings.h.
using detinfo::DetectorTimings::TPCelectronics_time_ticks = detinfo::timescales::TPCelectronics_time_ticks |
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 259 of file DetectorTimings.h.
|
private |
The traits of a specific TimeScale
.
Definition at line 225 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 249 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 254 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 243 of file DetectorTimings.h.
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 261 of file DetectorTimings.h.
|
inlineexplicit |
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 269 of file DetectorTimings.h.
|
inlineexplicit |
Constructor: wraps around a specified detinfo::DetectorClocksData
object.
Definition at line 272 of file DetectorTimings.h.
|
inline |
Returns the beam gate time as a point in electronics time.
Definition at line 304 of file DetectorTimings.h.
|
inline |
Returns the detector clocks data.
Definition at line 288 of file DetectorTimings.h.
detinfo::ElecClock const & detinfo::DetectorTimings::ClockFor | ( | ) | const |
Returns the electronics clock for the specified time scale.
Definition at line 988 of file DetectorTimings.h.
References detinfo::details::ClockForImpl< TimeScale, typename >::get().
|
inline |
Returns the frequency of the clock for the specified time scale.
Definition at line 479 of file DetectorTimings.h.
|
inline |
Returns the period of the clock for the specified time scale.
Definition at line 472 of file DetectorTimings.h.
Referenced by detinfo::details::TimeScaleConverter< FromTick, TargetTime, std::enable_if_t< detinfo::timescales::is_tick_v< FromTick > > >::convert(), and detinfo::details::TickConverter< FromTime, TargetTick, typename >::convertTime().
|
inline |
Returns a DetectorClocksWithUnits object.
Definition at line 282 of file DetectorTimings.h.
Referenced by detinfo::details::StartTickImpl< detinfo::timescales::TPCelectronics_tick_d, detinfo::timescales::electronics_tick_d >::startTick(), detinfo::details::StartTimeImpl< detinfo::timescales::TPCelectronics_time, detinfo::timescales::electronics_time >::startTime(), and detinfo::details::StartTimeImpl< detinfo::timescales::simulation_time, detinfo::timescales::electronics_time >::startTime().
|
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 994 of file DetectorTimings.h.
|
inlineinherited |
Equivalent to detinfo::DetectorClocksData::G4ToElecTime()
.
Definition at line 81 of file DetectorTimings.h.
References detinfo::DetectorClocksWithUnits::clockData(), detinfo::DetectorClocksData::G4ToElecTime(), and util::quantities::concepts::Quantity< Unit, T >::value().
Referenced by detinfo::details::StartTimeImpl< detinfo::timescales::simulation_time, detinfo::timescales::electronics_time >::startTime().
|
inlineinherited |
Equivalent to detinfo::DetectorClocksData::G4ToElecTime()
.
Definition at line 85 of file DetectorTimings.h.
References detinfo::DetectorClocksWithUnits::G4ToElecTime().
Referenced by detinfo::DetectorClocksWithUnits::G4ToElecTime().
|
inline |
Returns the frequency of the optical clock tick.
Definition at line 492 of file DetectorTimings.h.
|
inline |
Returns the duration of the optical clock period and tick.
Definition at line 489 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 967 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 960 of file DetectorTimings.h.
References detinfo::details::StartTimeImpl< TimePoint, TimeScale, typename >::startTime().
Referenced by detinfo::details::TimeScaleConverter< FromTime, TargetTime, typename >::convert(), detinfo::details::TickConverter< FromTime, TargetTick, typename >::convertTime(), detinfo::details::StartTimeImpl< detinfo::timescales::electronics_time, TimeScale, std::enable_if_t<!std::is_same_v< TimeScale, detinfo::timescales::electronics_time > > >::startTime(), and detinfo::details::StartTimeImpl< TimePoint, TimeScale, std::enable_if_t<!std::is_same_v< TimePoint, detinfo::timescales::electronics_time > && !std::is_same_v< TimeScale, detinfo::timescales::electronics_time > && !std::is_same_v< TimeScale, TimePoint > > >::startTime().
|
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 418 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 399 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 380 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 525 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 543 of file DetectorTimings.h.
References detinfo::makeDetectorTimings().
|
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 505 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 454 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 981 of file DetectorTimings.h.
References detinfo::details::TickConverter< FromTime, TargetTick, typename >::convert().
Referenced by detinfo::details::TickConverter< FromTime, TargetTick, typename >::convertTick().
|
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 361 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 974 of file DetectorTimings.h.
References detinfo::details::TimeScaleConverter< FromTime, TargetTime, typename >::convert().
Referenced by detinfo::details::TimeScaleConverter< FromTick, TargetTime, std::enable_if_t< detinfo::timescales::is_tick_v< FromTick > > >::convert(), detinfo::details::TickConverter< FromTime, TargetTick, typename >::convertTick(), and detinfo::details::StartTimeImpl< TimePoint, TimeScale, std::enable_if_t<!std::is_same_v< TimePoint, detinfo::timescales::electronics_time > && !std::is_same_v< TimeScale, detinfo::timescales::electronics_time > && !std::is_same_v< TimeScale, TimePoint > > >::startTime().
|
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 436 of file DetectorTimings.h.
Equivalent to detinfo::DetectorClocksData::G4ToElecTime()
.
Definition at line 90 of file DetectorTimings.h.
References detinfo::DetectorClocksWithUnits::clockData(), detinfo::DetectorClocksData::TPCTick2TDC(), and util::quantities::concepts::Quantity< Unit, T >::value().
Referenced by detinfo::details::StartTickImpl< detinfo::timescales::TPCelectronics_tick_d, detinfo::timescales::electronics_tick_d >::startTick().
|
inlineinherited |
Equivalent to detinfo::DetectorClocksData::G4ToElecTime()
.
Definition at line 94 of file DetectorTimings.h.
References detinfo::DetectorClocksWithUnits::TPCTick2TDC().
Referenced by detinfo::DetectorClocksWithUnits::TPCTick2TDC().
|
inlineinherited |
Equivalent to detinfo::DetectorClocksData::TPCTime()
.
Definition at line 77 of file DetectorTimings.h.
References detinfo::DetectorClocksWithUnits::clockData(), and detinfo::DetectorClocksData::TPCTime().
Referenced by detinfo::details::StartTimeImpl< detinfo::timescales::TPCelectronics_time, detinfo::timescales::electronics_time >::startTime().
|
inline |
Returns the trigger time as a point in electronics time.
Definition at line 297 of file DetectorTimings.h.
Referenced by detinfo::details::StartTimeImpl< detinfo::timescales::trigger_time, detinfo::timescales::electronics_time >::startTime().
|
friend |
Returns DetectorTimings
object from specified detinfo::DetectorClocksWithUnits
.
Definition at line 656 of file DetectorTimings.h.