Static Public Member Functions | List of all members
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 949 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 953 of file DetectorTimings.h.

954  {
955  // dispatcher
956  if constexpr(detinfo::timescales::is_tick_v<FromTime>)
957  return convertTick(time, timings);
958  else
959  return convertTime(time, timings);
960  } // 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 975 of file DetectorTimings.h.

976  {
977  static_assert(detinfo::timescales::is_tick_v<FromTime>);
978  // effectively we must go very close to the times from the tick;
979  // so we go all the way there
980  using TargetTime = typename detinfo::timescales::timescale_traits<
981  typename TargetTick::category_t>::time_point_t;
982  auto const time = timings->toTimeScale<TargetTime>(tick);
983  return timings->toTick<TargetTick>(time);
984  } // convertTick()
A collection of traits for a time scale.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
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 964 of file DetectorTimings.h.

965  {
966  static_assert(!detinfo::timescales::is_tick_v<FromTime>);
967  using TargetTime = typename detinfo::timescales::timescale_traits<
968  typename TargetTick::category_t>::time_point_t;
969  auto const timeFromStart = time - timings->startTime<TargetTime, FromTime>();
970  auto const clockPeriod = timings->ClockPeriodFor<TargetTick>();
971  return TargetTick::castFrom(timeFromStart / clockPeriod);
972  } // convertTime()
A collection of traits for a time scale.

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