LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
detinfo::details::TickConverter< FromTime, TargetTick, typename > Struct Template Reference

#include "DetectorTimings.h"

Static Public Member Functions

static TargetTick convert (FromTime time, DetectorTimings const *timings)
 
static TargetTick convertTime (FromTime time, DetectorTimings const *timings)
 
static TargetTick convertTick (FromTime tick, DetectorTimings const *timings)
 

Detailed Description

template<typename FromTime, typename TargetTick, typename = void>
struct detinfo::details::TickConverter< FromTime, TargetTick, typename >

Definition at line 873 of file DetectorTimings.h.

Member Function Documentation

template<typename FromTime , typename TargetTick , typename = void>
static TargetTick detinfo::details::TickConverter< FromTime, TargetTick, typename >::convert ( FromTime  time,
DetectorTimings const *  timings 
)
inlinestatic

Definition at line 875 of file DetectorTimings.h.

Referenced by detinfo::DetectorTimings::toTick().

876  {
877  // dispatcher
878  if constexpr (detinfo::timescales::is_tick_v<FromTime>)
879  return convertTick(time, timings);
880  else
881  return convertTime(time, timings);
882  } // convert()
static TargetTick convertTick(FromTime tick, DetectorTimings const *timings)
static TargetTick convertTime(FromTime time, DetectorTimings const *timings)
template<typename FromTime , typename TargetTick , typename = void>
static TargetTick detinfo::details::TickConverter< FromTime, TargetTick, typename >::convertTick ( FromTime  tick,
DetectorTimings const *  timings 
)
inlinestatic

Definition at line 894 of file DetectorTimings.h.

References detinfo::DetectorTimings::toTick(), and detinfo::DetectorTimings::toTimeScale().

895  {
896  static_assert(detinfo::timescales::is_tick_v<FromTime>);
897  // effectively we must go very close to the times from the tick;
898  // so we go all the way there
899  using TargetTime = typename detinfo::timescales::timescale_traits<
900  typename TargetTick::category_t>::time_point_t;
901  auto const time = timings->toTimeScale<TargetTime>(tick);
902  return timings->toTick<TargetTick>(time);
903  } // convertTick()
A collection of traits for a time scale.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
template<typename FromTime , typename TargetTick , typename = void>
static TargetTick detinfo::details::TickConverter< FromTime, TargetTick, typename >::convertTime ( FromTime  time,
DetectorTimings const *  timings 
)
inlinestatic

Definition at line 884 of file DetectorTimings.h.

References detinfo::DetectorTimings::ClockPeriodFor(), and detinfo::DetectorTimings::startTime().

885  {
886  static_assert(!detinfo::timescales::is_tick_v<FromTime>);
887  using TargetTime = typename detinfo::timescales::timescale_traits<
888  typename TargetTick::category_t>::time_point_t;
889  auto const timeFromStart = time - timings->startTime<TargetTime, FromTime>();
890  auto const clockPeriod = timings->ClockPeriodFor<TargetTick>();
891  return TargetTick::castFrom(timeFromStart / clockPeriod);
892  } // convertTime()
A collection of traits for a time scale.

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