LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
detinfo::DetectorTimings Class Reference

A class exposing an upgraded interface of detinfo::DetectorClocksData. More...

#include "DetectorTimings.h"

Inheritance diagram for detinfo::DetectorTimings:
detinfo::DetectorClocksWithUnits

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 &)
 

Imported time scale types

using electronics_time = detinfo::timescales::electronics_time
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using TPCelectronics_time = detinfo::timescales::TPCelectronics_time
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using optical_time = detinfo::timescales::optical_time
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using trigger_time = detinfo::timescales::trigger_time
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using simulation_time = detinfo::timescales::simulation_time
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using electronics_tick = detinfo::timescales::electronics_tick
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using TPCelectronics_tick = detinfo::timescales::TPCelectronics_tick
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using optical_tick = detinfo::timescales::optical_tick
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using trigger_tick = detinfo::timescales::trigger_tick
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using electronics_tick_d = detinfo::timescales::electronics_tick_d
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using TPCelectronics_tick_d = detinfo::timescales::TPCelectronics_tick_d
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using optical_tick_d = detinfo::timescales::optical_tick_d
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using trigger_tick_d = detinfo::timescales::trigger_tick_d
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using time_interval = detinfo::timescales::time_interval
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using electronics_time_ticks = detinfo::timescales::electronics_time_ticks
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using TPCelectronics_time_ticks = detinfo::timescales::TPCelectronics_time_ticks
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using optical_time_ticks = detinfo::timescales::optical_time_ticks
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
using trigger_time_ticks = detinfo::timescales::trigger_time_ticks
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
 DetectorTimings (detinfo::DetectorClocksData const &clockData)
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 
 DetectorTimings (detinfo::DetectorClocksData const *clockData)
 Constructor: wraps around a specified detinfo::DetectorClocksData object. More...
 

Detailed Description

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:

(lar::provider_from<detinfo::DetectorClocksService const>()->DataFor(event));
auto const& timings = detinfo::makeDetectorTimings(detClocksWU);

The timing data is copied locally; see detinfo::DetectorClocksData for considerations on the validity time span of the timing information.

Data types

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 microseconds

Note 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 the
  • 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.

Member Typedef Documentation

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.

template<typename TimeScale >
using detinfo::DetectorTimings::frequency_for = typename traits_of<TimeScale>::frequency_t
private

The frequency type of a specific TimeScale.

Definition at line 233 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.

Constructor: wraps around a specified detinfo::DetectorClocksData object.

Definition at line 256 of file DetectorTimings.h.

template<typename TimeScale >
using detinfo::DetectorTimings::time_interval_for = typename traits_of<TimeScale>::time_interval_t
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 241 of file DetectorTimings.h.

template<typename TimeScale >
using detinfo::DetectorTimings::traits_of = detinfo::timescales::timescale_traits<typename TimeScale::category_t>
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.

Constructor & Destructor Documentation

detinfo::DetectorTimings::DetectorTimings ( detinfo::DetectorClocksData const &  clockData)
inlineexplicit

Constructor: wraps around a specified detinfo::DetectorClocksData object.

Definition at line 269 of file DetectorTimings.h.

271  {}
detinfo::DetectorClocksData const & clockData() const
Returns the detector clocks data.
A partial detinfo::DetectorClocksData supporting units.
detinfo::DetectorTimings::DetectorTimings ( detinfo::DetectorClocksData const *  clockData)
inlineexplicit

Constructor: wraps around a specified detinfo::DetectorClocksData object.

Definition at line 272 of file DetectorTimings.h.

274  {}
detinfo::DetectorClocksData const & clockData() const
Returns the detector clocks data.
A partial detinfo::DetectorClocksData supporting units.

Member Function Documentation

electronics_time detinfo::DetectorTimings::BeamGateTime ( ) const
inline

Returns the beam gate time as a point in electronics time.

See also
detinfo::DetectorClocksData::BeamGateTime()

Definition at line 304 of file DetectorTimings.h.

305  {
307  }
microsecond BeamGateTime() const
Equivalent to detinfo::DetectorClocksData::BeamGateTime().
detinfo::timescales::electronics_time electronics_time
Constructor: wraps around a specified detinfo::DetectorClocksData object.
detinfo::DetectorClocksWithUnits const & detClocksUnits() const
Returns a DetectorClocksWithUnits object.
detinfo::DetectorClocksData const& detinfo::DetectorTimings::clockData ( ) const
inline

Returns the detector clocks data.

Definition at line 288 of file DetectorTimings.h.

288 { return detClocksUnits().clockData(); }
detinfo::DetectorClocksData const & clockData() const
Returns the detector clocks data object.
detinfo::DetectorClocksWithUnits const & detClocksUnits() const
Returns a DetectorClocksWithUnits object.
template<typename TimeScale >
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().

989  {
991  }
static detinfo::ElecClock const & get(DetectorTimings const *)
template<typename TimeScale >
frequency_for<TimeScale> detinfo::DetectorTimings::ClockFrequencyFor ( ) const
inline

Returns the frequency of the clock for the specified time scale.

Definition at line 479 of file DetectorTimings.h.

480  {
481  return frequency_for<TimeScale>{megahertz{ClockFor<TimeScale>().Frequency()}};
482  }
util::quantities::megahertz megahertz
template<typename TimeScale >
time_interval_for<TimeScale> detinfo::DetectorTimings::ClockPeriodFor ( ) const
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().

473  {
474  return time_interval_for<TimeScale>{microsecond{ClockFor<TimeScale>().TickPeriod()}};
475  }
util::quantities::microsecond microsecond
auto detinfo::DetectorTimings::fromStart ( electronics_time  time) const
inline

Converts a electronics time point into a duration from the start of electronics time.

Parameters
timeelectronics time point to be converted
Returns
time elapsed from the start of electronics time to 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.

995  {
996  return time - startTime<electronics_time, electronics_time>();
997  }
microsecond detinfo::DetectorClocksWithUnits::G4ToElecTime ( nanosecond  simTime) const
inlineinherited
microsecond detinfo::DetectorClocksWithUnits::G4ToElecTime ( double  simTime) const
inlineinherited

Equivalent to detinfo::DetectorClocksData::G4ToElecTime().

Definition at line 85 of file DetectorTimings.h.

References detinfo::DetectorClocksWithUnits::G4ToElecTime().

Referenced by detinfo::DetectorClocksWithUnits::G4ToElecTime().

85 { return G4ToElecTime(nanosecond{simTime}); }
microsecond G4ToElecTime(nanosecond simTime) const
Equivalent to detinfo::DetectorClocksData::G4ToElecTime().
util::quantities::nanosecond nanosecond
megahertz detinfo::DetectorTimings::OpticalClockFrequency ( ) const
inline

Returns the frequency of the optical clock tick.

Definition at line 492 of file DetectorTimings.h.

492 { return ClockFrequencyFor<optical_time>(); }
auto detinfo::DetectorTimings::OpticalClockPeriod ( ) const
inline

Returns the duration of the optical clock period and tick.

Definition at line 489 of file DetectorTimings.h.

489 { return ClockPeriodFor<optical_time>(); }
template<typename TickPoint , typename TimeTickScale >
constexpr TimeTickScale detinfo::DetectorTimings::startTick ( ) const

Returns the start tick of the specified time tick scale.

Template Parameters
TickPointthe type of tick point on the requested scale
TimeTickScalethe 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:

using namespace detinfo::timescales;
electronics_time_tick const TPCstartTick
= detTimings.startTick<TPCelectronics_time_tick>();

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).

Todo:
The example is not even supported yet!

Implemented scales

  • all where TickPoint is the same as TimeScale (trivially, 0)
  • TPCelectronics_time to:
    • electronics_time

Definition at line 967 of file DetectorTimings.h.

968  {
969  return details::StartTickImpl<TickPoint, TimeTickScale>::startTick(this);
970  }
template<typename TimePoint , typename TimeScale >
constexpr TimeScale detinfo::DetectorTimings::startTime ( ) const

Returns the start time of the specified time scale.

Template Parameters
TimePointthe type of time point on the requested scale
TimeScalethe 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:

using namespace detinfo::timescales;
electronics_time const TPCstartTime
= detTimings.startTime<TPCelectronics_time>();

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().

Implemented scales

  • all where 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().

961  {
963  }
static constexpr TimeScale startTime(DetectorTimings const *)
template<typename FromTime >
electronics_tick detinfo::DetectorTimings::toElectronicsTick ( FromTime  time) const
inline

Converts a time point into electronics tick (truncated).

Template Parameters
FromTimethe time scale the input time is measured in
Parameters
timethe time instant to be converted, in FromTime scale
Returns
the time instant converted into electronics tick number.
See also
toTick(), toElectronicsTime(), toElectronicsTickD()

Example:

simulation_time nuTime = 47.5_ns;
electronics_tick_d nuElecTick = timings.toElectronicsTime(nuTime);

Definition at line 418 of file DetectorTimings.h.

419  {
420  return toTick<electronics_tick>(time);
421  }
template<typename FromTime >
electronics_tick_d detinfo::DetectorTimings::toElectronicsTickD ( FromTime  time) const
inline

Converts a time point into electronics tick (real).

Template Parameters
FromTimethe time scale the input time is measured in
Parameters
timethe time instant to be converted, in FromTime scale
Returns
the time instant converted into electronics tick number.
See also
toTick(), toElectronicsTime(), toElectronicsTick()

Example:

simulation_time nuTime = 47.5_ns;
electronics_tick_d nuElecTick = timings.toElectronicsTime(nuTime);

Definition at line 399 of file DetectorTimings.h.

400  {
401  return toTick<electronics_tick_d>(time);
402  }
template<typename FromTime >
electronics_time detinfo::DetectorTimings::toElectronicsTime ( FromTime  time) const
inline

Converts a time point into electronics time scale.

Template Parameters
FromTimethe time scale the input time is measured in
Parameters
timethe time instant to be converted, in FromTime scale
Returns
the time instant converted into electronics time scale.

Example:

simulation_time nuTime = 47.5_ns;
electronics_time nuElecTime = timings.toElectronicsTime(nuTime);

is equivalent to use detinfo::DetectorClocksData::G4ToElecTime(47.5).

Definition at line 380 of file DetectorTimings.h.

381  {
382  return toTimeScale<electronics_time>(time);
383  }
template<typename TimePoint >
optical_tick detinfo::DetectorTimings::toOpticalTick ( TimePoint  time) const
inline

Returns the time point converted in units of optical time ticks.

Template Parameters
TimePointtype of the time to be converted
Parameters
timetime point to be converted into an optical tick
Returns
the time point expressed as integral number of ticks
See also
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.

526  {
527  return toTick<optical_tick>(time);
528  }
template<typename TimePoint >
optical_tick_d detinfo::DetectorTimings::toOpticalTickD ( TimePoint  time) const
inline

Returns the time point converted in units of optical time ticks.

Template Parameters
TimePointtype of the time to be converted
Parameters
timetime point to be converted into an optical tick
Returns
the time point expressed as real number of ticks
See also
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().

544  {
545  return toTick<optical_tick_d>(time);
546  }
template<typename Ticks = optical_time_ticks>
Ticks detinfo::DetectorTimings::toOpticalTicks ( time_interval  time) const
inline

Returns the optical ticks corresponding to a time interval.

Template Parameters
Tickstype of tick interval returned (default: optical_time_ticks)
Returns
the time interval expressed as number of optical ticks

The 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.

506  {
507  static_assert(traits_of<Ticks>::template same_category_as<optical_tick>,
508  "Specified ticks are not for optical time scale!");
509  return toTicks<Ticks>(time);
510  }
template<typename FromTime >
simulation_time detinfo::DetectorTimings::toSimulationTime ( FromTime  time) const
inline

Converts a time point into simulation time scale.

Template Parameters
FromTimethe time scale the input time is measured in
Parameters
timethe time instant to be converted, in FromTime scale
Returns
the time instant converted into simulation time scale.

Example:

electronics_time beamTime = 47.5_ns;
simulation_time firstParticleTime = timings.toSimulationTime(beamTime);

Definition at line 454 of file DetectorTimings.h.

455  {
456  return toTimeScale<simulation_time>(time);
457  }
template<typename TargetTick , typename FromTime >
TargetTick detinfo::DetectorTimings::toTick ( FromTime  time) const

Returns a time point as a tick on a different time scale.

Template Parameters
TargetTickthe desired time scale
FromTimethe time scale the input time is measured in
Parameters
timethe time instant to be converted, in FromTime scale
Returns
the time instant converted as tick into TargetTick time scale

Example:

simulation_time nuTime = 47.5_ns;
= timings.toTick<TPCelectronics_tick_d>(nuTime);

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().

982  {
984  } // DetectorTimings::toTick()
static TargetTick convert(FromTime time, DetectorTimings const *timings)
template<typename Ticks >
Ticks detinfo::DetectorTimings::toTicks ( time_interval  time) const
inline

Returns the number of ticks corresponding to a time interval.

Template Parameters
Tickstype of tick interval returned
Returns
the time interval expressed as number of ticks

The 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.

362  {
363  return Ticks::castFrom(time / ClockPeriodFor<Ticks>());
364  }
template<typename TargetTime , typename FromTime >
TargetTime detinfo::DetectorTimings::toTimeScale ( FromTime  time) const

Returns a time point in a different time scale.

Template Parameters
TargetTimethe desired time scale
FromTimethe time scale the input time is measured in
Parameters
timethe time instant to be converted, in FromTime scale
Returns
the time instant converted into TargetTime time scale

Example:

simulation_time nuTime = 47.5_ns;
electronics_time nuElecTime
= timings.toTimeScale<electronics_time>(nuTime);

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().

975  {
977  } // DetectorTimings::toTimeScale()
static TargetTime convert(FromTime time, DetectorTimings const *timings)
template<typename FromTime >
trigger_time detinfo::DetectorTimings::toTriggerTime ( FromTime  time) const
inline

Converts a time point into trigger time scale.

Template Parameters
FromTimethe time scale the input time is measured in
Parameters
timethe time instant to be converted, in FromTime scale
Returns
the time instant converted into trigger time scale.

Example:

simulation_time nuTime = 47.5_ns;
trigger_time nuTriggerTime = timings.toTriggerTime(nuTime);

Definition at line 436 of file DetectorTimings.h.

437  {
438  return toTimeScale<trigger_time>(time);
439  }
ticks_d detinfo::DetectorClocksWithUnits::TPCTick2TDC ( ticks_d  tpcticks) const
inlineinherited
ticks_d detinfo::DetectorClocksWithUnits::TPCTick2TDC ( double  tpcticks) const
inlineinherited

Equivalent to detinfo::DetectorClocksData::G4ToElecTime().

Definition at line 94 of file DetectorTimings.h.

References detinfo::DetectorClocksWithUnits::TPCTick2TDC().

Referenced by detinfo::DetectorClocksWithUnits::TPCTick2TDC().

94 { return TPCTick2TDC(ticks_d{tpcticks}); }
ticks_d TPCTick2TDC(ticks_d tpcticks) const
Equivalent to detinfo::DetectorClocksData::G4ToElecTime().
util::quantities::ticks_d ticks_d
microsecond detinfo::DetectorClocksWithUnits::TPCTime ( ) const
inlineinherited
electronics_time detinfo::DetectorTimings::TriggerTime ( ) const
inline

Returns the trigger time as a point in electronics time.

See also
detinfo::DetectorClocksData::TriggerTime()

Definition at line 297 of file DetectorTimings.h.

Referenced by detinfo::details::StartTimeImpl< detinfo::timescales::trigger_time, detinfo::timescales::electronics_time >::startTime().

298  {
300  }
detinfo::timescales::electronics_time electronics_time
Constructor: wraps around a specified detinfo::DetectorClocksData object.
detinfo::DetectorClocksWithUnits const & detClocksUnits() const
Returns a DetectorClocksWithUnits object.
microsecond TriggerTime() const
Equivalent to detinfo::DetectorClocksData::TriggerTime().

Friends And Related Function Documentation

detinfo::DetectorTimings makeDetectorTimings ( detinfo::DetectorClocksWithUnits const &  detClocksWU)
friend

Returns DetectorTimings object from specified detinfo::DetectorClocksWithUnits.

Definition at line 656 of file DetectorTimings.h.

658  {
659  return static_cast<detinfo::DetectorTimings const&>(detClocksWU);
660  }
A class exposing an upgraded interface of detinfo::DetectorClocksData.

The documentation for this class was generated from the following file: