LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DetectorTimings.h
Go to the documentation of this file.
1 
9 #ifndef LARDATAALG_DETECTORINFO_DETECTORTIMINGS_H
10 #define LARDATAALG_DETECTORINFO_DETECTORTIMINGS_H
11 
12 // LArSoft libraries
14 #include "lardataalg/DetectorInfo/DetectorTimingTypes.h" // ns. timescales
18 
19 // C/C++ standard libraries
20 #include <type_traits> // std::enable_if_t, std::is_same_v, std::void_t
21 
22 namespace detinfo {
23 
24  // ---------------------------------------------------------------------------
46 
48  detinfo::DetectorClocksData fClockData; // non-const to allow copy
49 
50  public:
51  // import types
56 
57  // @{
60  : DetectorClocksWithUnits(*detClocks)
61  {}
63  : fClockData(detClocks)
64  {}
65  // @}
66 
69 
72 
75 
77  microsecond TPCTime() const { return microsecond{clockData().TPCTime()}; }
78 
79  // @{
82  {
83  return microsecond{clockData().G4ToElecTime(simTime.value())};
84  }
85  microsecond G4ToElecTime(double simTime) const { return G4ToElecTime(nanosecond{simTime}); }
86  // @}
87 
88  // @{
90  ticks_d TPCTick2TDC(ticks_d tpcticks) const
91  {
92  return ticks_d{clockData().TPCTick2TDC(tpcticks.value())};
93  }
94  ticks_d TPCTick2TDC(double tpcticks) const { return TPCTick2TDC(ticks_d{tpcticks}); }
95  // @}
96 
100  {
102  }
103 
107  {
109  }
110 
111  }; // class DetectorClocksWithUnits
112 
117  {
118  return detinfo::DetectorClocksWithUnits{clockData};
119  }
120 
121  // ---------------------------------------------------------------------------
222 
224  template <typename TimeScale>
226 
228  template <typename TimeScale>
230 
232  template <typename TimeScale>
234 
235  public:
236  // --- BEGIN -- Imported time scale types ----------------------------------
239 
245 
250 
255 
257 
262 
264  // --- END -- Imported time scale types ------------------------------------
265 
266  // note that `makeDetectorTimings()` provides an additional construction way
267  // @{
270  : detinfo::DetectorClocksWithUnits(clockData)
271  {}
273  : detinfo::DetectorClocksWithUnits(clockData)
274  {}
275  // @}
276 
277  // --- BEGIN -- Access to underlying service providers ---------------------
280 
283  {
284  return static_cast<detinfo::DetectorClocksWithUnits const&>(*this);
285  }
286 
288  detinfo::DetectorClocksData const& clockData() const { return detClocksUnits().clockData(); }
289 
291  // --- END -- Access to underlying service providers -----------------------
292 
293  // --- BEGIN -- Electronics times ------------------------------------------
294 
298  {
299  return electronics_time{detClocksUnits().TriggerTime()};
300  }
301 
305  {
306  return electronics_time{detClocksUnits().BeamGateTime()};
307  }
308 
309  // --- END -- Electronics times --------------------------------------------
310 
311  // --- BEGIN -- Conversions ------------------------------------------------
314 
330  template <typename TargetTime, typename FromTime>
331  TargetTime toTimeScale(FromTime time) const;
332 
347  template <typename TargetTick, typename FromTime>
348  TargetTick toTick(FromTime time) const;
349 
360  template <typename Ticks>
361  Ticks toTicks(time_interval time) const
362  {
363  return Ticks::castFrom(time / ClockPeriodFor<Ticks>());
364  }
365 
379  template <typename FromTime>
380  electronics_time toElectronicsTime(FromTime time) const
381  {
382  return toTimeScale<electronics_time>(time);
383  }
384 
398  template <typename FromTime>
400  {
401  return toTick<electronics_tick_d>(time);
402  }
403 
417  template <typename FromTime>
418  electronics_tick toElectronicsTick(FromTime time) const
419  {
420  return toTick<electronics_tick>(time);
421  }
422 
435  template <typename FromTime>
436  trigger_time toTriggerTime(FromTime time) const
437  {
438  return toTimeScale<trigger_time>(time);
439  }
440 
453  template <typename FromTime>
454  simulation_time toSimulationTime(FromTime time) const
455  {
456  return toTimeScale<simulation_time>(time);
457  }
458 
460  // --- END -- Conversions --------------------------------------------------
461 
462  // --- BEGIN -- Clocks -----------------------------------------------------
465 
467  template <typename TimeScale>
468  detinfo::ElecClock const& ClockFor() const;
469 
471  template <typename TimeScale>
473  {
474  return time_interval_for<TimeScale>{microsecond{ClockFor<TimeScale>().TickPeriod()}};
475  }
476 
478  template <typename TimeScale>
480  {
481  return frequency_for<TimeScale>{megahertz{ClockFor<TimeScale>().Frequency()}};
482  }
484  // --- END -- Clocks -------------------------------------------------------
485 
486  // --- BEGIN -- Optical clock ----------------------------------------------
487 
489  auto OpticalClockPeriod() const { return ClockPeriodFor<optical_time>(); }
490 
492  megahertz OpticalClockFrequency() const { return ClockFrequencyFor<optical_time>(); }
493 
504  template <typename Ticks = optical_time_ticks>
505  Ticks toOpticalTicks(time_interval time) const
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  }
511 
524  template <typename TimePoint>
525  optical_tick toOpticalTick(TimePoint time) const
526  {
527  return toTick<optical_tick>(time);
528  }
529 
542  template <typename TimePoint>
543  optical_tick_d toOpticalTickD(TimePoint time) const
544  {
545  return toTick<optical_tick_d>(time);
546  }
547 
548  // --- END -- Optical clock ------------------------------------------------
549 
550  // --- BEGIN -- Reference times --------------------------------------------
553 
563  time_interval fromStart(electronics_time time) const;
564 
593  template <typename TimePoint, typename TimeScale = electronics_time>
594  constexpr TimeScale startTime() const;
595 
629  template <typename TickPoint, typename TimeTickScale = electronics_tick>
630  constexpr TimeTickScale startTick() const;
631 
633  // --- END -- Reference times ----------------------------------------------
634 
635  private:
637 
638  }; // class DetectorTimings
639 
643  {
644  return detinfo::DetectorTimings{detClocks};
645  }
646 
650  {
651  return makeDetectorTimings(*detClocks);
652  }
653 
657  detinfo::DetectorClocksWithUnits const& detClocksWU)
658  {
659  return static_cast<detinfo::DetectorTimings const&>(detClocksWU);
660  }
661 
662  // ---------------------------------------------------------------------------
663 
664 } // namespace detinfo
665 
666 //------------------------------------------------------------------------------
667 //--- template implementation
668 //------------------------------------------------------------------------------
669 namespace detinfo {
670 
671  // ---------------------------------------------------------------------------
672  namespace details {
673 
674  using namespace util::quantities::time_literals;
676 
677  // -------------------------------------------------------------------------
678  // --- StartTimeImpl
679  // -------------------------------------------------------------------------
680  template <typename TimePoint, typename TimeScale = TimePoint, typename = void>
681  struct StartTimeImpl {
682 
683  static constexpr TimeScale startTime [[noreturn]] (DetectorTimings const*)
684  {
685  static_assert(util::always_false_v<TimePoint>,
686  "Start time not implemented for this time in this time scale.");
687  throw false;
688  }
689 
690  }; // StartTimeImpl
691 
692  // -------------------------------------------------------------------------
693  template <typename TimePoint>
694  struct StartTimeImpl<TimePoint, TimePoint> {
695 
696  static constexpr TimePoint startTime(DetectorTimings const*) { return TimePoint{0_us}; }
697 
698  }; // StartTimeImpl<>
699 
700  // -------------------------------------------------------------------------
701  // --- to electronics time
702  // ---
703  template <>
706  > {
708  {
710  }
711 
712  }; // StartTimeImpl<>
713 
714  // -------------------------------------------------------------------------
715  template <>
718  > {
720  {
722  }
723 
724  }; // StartTimeImpl<>
725 
726  // -------------------------------------------------------------------------
727  template <>
730  > {
732  {
734  detTiming->detClocksUnits().G4ToElecTime(0.0_ns)};
735  } // startTime()
736 
737  }; // StartTimeImpl<>
738 
739  // -------------------------------------------------------------------------
740  template <>
741  struct StartTimeImpl<detinfo::timescales::trigger_time, // scale to convert the start of
742  detinfo::timescales::electronics_time // destination scale
743  > {
745  {
746  return detTiming->TriggerTime();
747  }
748 
749  }; // StartTimeImpl<>
750 
751  // -------------------------------------------------------------------------
752  // --- from electronics time
753  // ---
754  template <typename TimeScale>
757  TimeScale, // destination
758  std::enable_if_t<!std::is_same_v<TimeScale, detinfo::timescales::electronics_time>>> {
759  static TimeScale startTime(DetectorTimings const* detTiming)
760  {
761  return TimeScale{
762  -(detTiming->startTime<TimeScale, detinfo::timescales::electronics_time>().quantity())};
763  }
764 
765  }; // StartTimeImpl<>
766 
767  // -------------------------------------------------------------------------
768  // --- via electronics time
769  // ---
770 
771  /*
772  * this is a very generic version, which I hope C++ rules will prevent from
773  * clashing with:
774  * * the most generic version (this is a specialization)
775  * * the one with same target and destination (explicitly vetoed)
776  * * any one involving electronics_time (explicitly vetoed)
777  * * any full specialization (this being partial, the full ones should win)
778  */
779  template <typename TimePoint, typename TimeScale>
781  TimePoint, // source
782  TimeScale, // destination
783  std::enable_if_t<!std::is_same_v<TimePoint, detinfo::timescales::electronics_time> &&
784  !std::is_same_v<TimeScale, detinfo::timescales::electronics_time> &&
785  !std::is_same_v<TimeScale, TimePoint>>> {
786  static TimeScale startTime(DetectorTimings const* detTiming)
787  {
788  return detTiming->toTimeScale<TimeScale>(detTiming->startTime<TimePoint>());
789  }
790  }; // StartTimeImpl<> (via electronics_time)
791 
792  // -------------------------------------------------------------------------
793  // --- StartTickImpl
794  // -------------------------------------------------------------------------
795  template <typename TickPoint, typename TimeTickScale = TickPoint>
797 
798  // -------------------------------------------------------------------------
799  template <typename TickPoint>
800  struct StartTickImpl<TickPoint, TickPoint> {
801 
802  static constexpr TickPoint startTick(DetectorTimings const*)
803  {
804  return TickPoint::castFrom(0.0);
805  }
806 
807  }; // StartTickImpl<>
808 
809  // -------------------------------------------------------------------------
810  template <>
813  > {
815  {
817  detTiming->detClocksUnits().TPCTick2TDC(0_tickd));
818  }
819 
820  }; // StartTimeImpl<>
821 
822  // -------------------------------------------------------------------------
823  template <>
826  > {
828  {
829  return 0_tickd;
830  }
831 
832  }; // StartTickImpl<>
833 
834  // -------------------------------------------------------------------------
835 
836  // default implementation (for any time)
837  template <typename FromTime, typename TargetTime, typename = void>
839 
840  static TargetTime convert(FromTime time, DetectorTimings const* timings)
841  {
842  return timings->startTime<FromTime, TargetTime>() + time.quantity();
843  }
844  };
845 
846  // special implementation when source and target are the same: passthrough
847  template <typename TargetTime>
848  struct TimeScaleConverter<TargetTime, TargetTime> {
849 
850  static TargetTime convert(TargetTime time, DetectorTimings const*) { return time; }
851 
852  }; // TimeScaleConverter<TargetTime, TargetTime>
853 
854  // special implementation for ticks as source
855  template <typename FromTick, typename TargetTime>
856  struct TimeScaleConverter<FromTick,
857  TargetTime,
858  std::enable_if_t<detinfo::timescales::is_tick_v<FromTick>>> {
859 
860  static TargetTime convert(FromTick tick, DetectorTimings const* timings)
861  {
862  using FromTime = typename detinfo::timescales::timescale_traits<
863  typename FromTick::category_t>::time_point_t;
864  return timings->toTimeScale<TargetTime>(
865  FromTime{tick.value() * timings->ClockPeriodFor<FromTick>().quantity()});
866  }
867 
868  }; // TimeScaleConverter<FromTick>
869 
870  // -------------------------------------------------------------------------
871  // default implementation (for any time)
872  template <typename FromTime, typename TargetTick, typename = void>
873  struct TickConverter {
874 
875  static TargetTick convert(FromTime time, DetectorTimings const* timings)
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()
883 
884  static TargetTick convertTime(FromTime time, DetectorTimings const* timings)
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()
893 
894  static TargetTick convertTick(FromTime tick, DetectorTimings const* timings)
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()
904 
905  }; // TickConverter
906 
907  // -------------------------------------------------------------------------
908 
909  // -------------------------------------------------------------------------
910  template <typename TimeScale, typename = void>
911  struct ClockForImpl {
912 
913  static detinfo::ElecClock const& get [[noreturn]] (DetectorTimings const*)
914  {
915  static_assert(util::always_false_v<TimeScale>,
916  "Electronics clock not defined for this time scale.");
917  throw false;
918  }
919 
920  }; // struct ClockForImpl
921 
922  template <typename TimeScale>
923  struct ClockForImpl<TimeScale, std::void_t<typename TimeScale::category_t>>
924  : ClockForImpl<typename TimeScale::category_t> {};
925 
926  template <>
928  static detinfo::ElecClock const& get(DetectorTimings const* timings)
929  {
930  return timings->clockData().TPCClock();
931  }
932  };
933 
934  template <>
936  static detinfo::ElecClock const& get(DetectorTimings const* timings)
937  {
938  return timings->clockData().OpticalClock();
939  }
940  };
941 
942  template <>
944  static detinfo::ElecClock const& get(DetectorTimings const* timings)
945  {
946  return timings->clockData().TriggerClock();
947  }
948  };
949 
950  template <>
952  : ClockForImpl<detinfo::timescales::TPCelectronicsTimeCategory> {};
953 
954  // -------------------------------------------------------------------------
955 
956  } // namespace details
957 
958  // ---------------------------------------------------------------------------
959  template <typename TimePoint, typename TimeScale /* = electronics_time */>
960  constexpr TimeScale DetectorTimings::startTime() const
961  {
963  }
964 
965  // ---------------------------------------------------------------------------
966  template <typename TickPoint, typename TimeTickScale /* = electronics_tick */>
967  constexpr TimeTickScale DetectorTimings::startTick() const
968  {
970  }
971 
972  // ---------------------------------------------------------------------------
973  template <typename TargetTime, typename FromTime>
974  TargetTime DetectorTimings::toTimeScale(FromTime time) const
975  {
977  } // DetectorTimings::toTimeScale()
978 
979  // ---------------------------------------------------------------------------
980  template <typename TargetTick, typename FromTime>
981  TargetTick DetectorTimings::toTick(FromTime time) const
982  {
984  } // DetectorTimings::toTick()
985 
986  // ---------------------------------------------------------------------------
987  template <typename TimeScale>
989  {
991  }
992 
993  // ---------------------------------------------------------------------------
995  {
996  return time - startTime<electronics_time, electronics_time>();
997  }
998 
999  // ---------------------------------------------------------------------------
1000 
1001 } // namespace detinfo
1002 
1003 //------------------------------------------------------------------------------
1004 
1005 #endif // LARDATAALG_DETECTORINFO_DETECTORTIMINGS_H
Literal constants for electronics quantities.
Definition: electronics.h:135
timescale_traits< TriggerTimeCategory >::tick_d_t trigger_tick_d
A point on the trigger time scale expressed in its ticks (real).
electronics_time BeamGateTime() const
megahertz OpticalClockFrequency() const
Dimensioned variables representing frequency quantities.
ticks_d TPCTick2TDC(double tpcticks) const
Equivalent to detinfo::DetectorClocksData::G4ToElecTime().
static detinfo::ElecClock const & get(DetectorTimings const *)
microsecond OpticalClockPeriod() const
timescale_traits< ElectronicsTimeCategory >::tick_t electronics_tick
A point on the electronics time scale expressed in its ticks.
megahertz OpticalClockFrequency() const
Returns the frequency of the optical clock tick.
microsecond BeamGateTime() const
Equivalent to detinfo::DetectorClocksData::BeamGateTime().
detinfo::timescales::TPCelectronics_time_ticks TPCelectronics_time_ticks
Constructor: wraps around a specified detinfo::DetectorClocksData object.
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
Definition: spacetime.h:116
detinfo::timescales::TPCelectronics_time TPCelectronics_time
Constructor: wraps around a specified detinfo::DetectorClocksData object.
microsecond G4ToElecTime(nanosecond simTime) const
Equivalent to detinfo::DetectorClocksData::G4ToElecTime().
Ticks toTicks(time_interval time) const
Returns the number of ticks corresponding to a time interval.
static constexpr TimePoint startTime(DetectorTimings const *)
optical_tick toOpticalTick(TimePoint time) const
Returns the time point converted in units of optical time ticks.
DetectorClocksWithUnits(detinfo::DetectorClocksData const &detClocks)
Constructor: uses detClocks for internal conversions.
trigger_time toTriggerTime(FromTime time) const
Converts a time point into trigger time scale.
detinfo::DetectorClocksData const & clockData() const
Returns the detector clocks data.
ticks_d TPCTick2TDC(ticks_d tpcticks) const
Equivalent to detinfo::DetectorClocksData::G4ToElecTime().
static constexpr detinfo::timescales::electronics_time startTime(DetectorTimings const *)
detinfo::timescales::electronics_time_ticks electronics_time_ticks
Constructor: wraps around a specified detinfo::DetectorClocksData object.
timescale_traits< TriggerTimeCategory >::tick_t trigger_tick
A point on the trigger time scale expressed in its ticks.
Category for electronics time scale.
static TargetTime convert(FromTime time, DetectorTimings const *timings)
detinfo::timescales::electronics_tick electronics_tick
Constructor: wraps around a specified detinfo::DetectorClocksData object.
util::quantities::intervals::microseconds time_interval
STL namespace.
tick_d ticks_d
Alias for common language habits.
Definition: electronics.h:88
frequency_for< TimeScale > ClockFrequencyFor() const
Returns the frequency of the clock for the specified time scale.
detinfo::timescales::TPCelectronics_tick_d TPCelectronics_tick_d
Constructor: wraps around a specified detinfo::DetectorClocksData object.
A collection of traits for a time scale.
static constexpr TimeScale startTime(DetectorTimings const *)
detinfo::DetectorClocksData const & clockData() const
Returns the detector clocks data object.
constexpr value_t value() const
Returns the value of the quantity.
Definition: quantities.h:590
detinfo::timescales::trigger_tick_d trigger_tick_d
Constructor: wraps around a specified detinfo::DetectorClocksData object.
static detinfo::timescales::electronics_time startTime(DetectorTimings const *detTiming)
static TargetTime convert(TargetTime time, DetectorTimings const *)
detinfo::timescales::electronics_time electronics_time
Constructor: wraps around a specified detinfo::DetectorClocksData object.
microsecond G4ToElecTime(double simTime) const
Equivalent to detinfo::DetectorClocksData::G4ToElecTime().
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
DetectorTimings(detinfo::DetectorClocksData const &clockData)
Constructor: wraps around a specified detinfo::DetectorClocksData object.
timescale_traits< OpticalTimeCategory >::tick_interval_t optical_time_ticks
timescale_traits< TPCelectronicsTimeCategory >::tick_d_t TPCelectronics_tick_d
A point on the TPC electronics time scale expressed in its ticks (real).
timescale_traits< TriggerTimeCategory >::time_point_t trigger_time
A point in time on the trigger time scale.
timescale_traits< TriggerTimeCategory >::tick_interval_t trigger_time_ticks
An interval on the trigger time scale expressed in its ticks.
detinfo::DetectorClocksWithUnits const & detClocksUnits() const
Returns a DetectorClocksWithUnits object.
A partial detinfo::DetectorClocksData supporting units.
DetectorClocksWithUnits(detinfo::DetectorClocksData const *detClocks)
Constructor: uses detClocks for internal conversions.
timescale_traits< ElectronicsTimeCategory >::tick_interval_t electronics_time_ticks
An interval on the electronics time scale expressed in its ticks.
electronics_time toElectronicsTime(FromTime time) const
Converts a time point into electronics time scale.
typename traits_of< TimeScale >::time_interval_t time_interval_for
The time interval type of a specific TimeScale.
time_interval_for< TimeScale > ClockPeriodFor() const
Returns the period of the clock for the specified time scale.
double BeamGateTime() const
Beam gate electronics clock time in [us].
detinfo::timescales::simulation_time simulation_time
Constructor: wraps around a specified detinfo::DetectorClocksData object.
Ticks toOpticalTicks(time_interval time) const
Returns the optical ticks corresponding to a time interval.
timescale_traits< SimulationTimeCategory >::time_point_t simulation_time
A point in time on the simulation time scale.
timescale_traits< TPCelectronicsTimeCategory >::tick_interval_t TPCelectronics_time_ticks
An interval on the TPC electronics time scale expressed in its ticks.
detinfo::timescales::trigger_time_ticks trigger_time_ticks
Constructor: wraps around a specified detinfo::DetectorClocksData object.
A value measured in the specified unit.
Definition: quantities.h:554
microsecond TPCTime() const
Equivalent to detinfo::DetectorClocksData::TPCTime().
detinfo::DetectorTimings makeDetectorTimings(detinfo::DetectorClocksData const &detClocks)
static constexpr detinfo::timescales::electronics_tick_d startTick(DetectorTimings const *)
megahertz_as<> megahertz
Type of frequency stored in megahertz, in double precision.
Definition: frequency.h:98
simulation_time toSimulationTime(FromTime time) const
Converts a time point into simulation time scale.
detinfo::timescales::trigger_tick trigger_tick
Constructor: wraps around a specified detinfo::DetectorClocksData object.
detinfo::DetectorClocksData fClockData
The backend instance of detinfo::DetectorClocksData this object uses.
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
typename traits_of< TimeScale >::frequency_t frequency_for
The frequency type of a specific TimeScale.
ElecClock const & OpticalClock() const noexcept
Borrow a const Optical clock with time set to Trigger time [us].
static TargetTick convertTick(FromTime tick, DetectorTimings const *timings)
timescale_traits< OpticalTimeCategory >::time_point_t optical_time
A point in time on the optical detector electronics time scale.
detinfo::timescales::optical_time optical_time
Constructor: wraps around a specified detinfo::DetectorClocksData object.
constexpr TimeTickScale startTick() const
Returns the start tick of the specified time tick scale.
timescale_traits< ElectronicsTimeCategory >::tick_d_t electronics_tick_d
A point on the electronics time scale expressed in its ticks (real).
static detinfo::timescales::electronics_tick_d startTick(DetectorTimings const *detTiming)
General LArSoft Utilities.
detinfo::DetectorClocksWithUnits makeDetectorClocksWithUnits(detinfo::DetectorClocksData const &clockData)
static detinfo::timescales::electronics_time startTime(DetectorTimings const *detTiming)
An interval (duration, length, distance) between two quantity points.
Definition: intervals.h:106
electronics_tick_d toElectronicsTickD(FromTime time) const
Converts a time point into electronics tick (real).
electronics_time TriggerTime() const
Category for trigger time scale.
Literal constants for time quantities.
Definition: spacetime.h:172
double TriggerTime() const
Trigger electronics clock time in [us].
detinfo::timescales::TPCelectronics_tick TPCelectronics_tick
Constructor: wraps around a specified detinfo::DetectorClocksData object.
detinfo::ElecClock const & ClockFor() const
Returns the electronics clock for the specified time scale.
detinfo::timescales::trigger_time trigger_time
Constructor: wraps around a specified detinfo::DetectorClocksData object.
Category for electronics time scale.
Category for TPC electronics time scale.
Dimensioned variables related to electronics.
timescale_traits< OpticalTimeCategory >::tick_t optical_tick
detinfo::timescales::electronics_tick_d electronics_tick_d
Constructor: wraps around a specified detinfo::DetectorClocksData object.
static TargetTick convertTime(FromTime time, DetectorTimings const *timings)
TargetTime toTimeScale(FromTime time) const
Returns a time point in a different time scale.
double G4ToElecTime(double const g4_time) const
TargetTick toTick(FromTime time) const
Returns a time point as a tick on a different time scale.
Contains all timing reference information for the detector.
Dimensioned variables representing space or time quantities.
A class exposing an upgraded interface of detinfo::DetectorClocksData.
Data types for detinfo::DetectorTimings.
nanosecond_as<> nanosecond
Type of time stored in nanoseconds, in double precision.
Definition: spacetime.h:133
constexpr double Frequency() const
Frequency in MHz.
Definition: ElecClock.h:176
detinfo::timescales::optical_tick_d optical_tick_d
Constructor: wraps around a specified detinfo::DetectorClocksData object.
static detinfo::timescales::electronics_time startTime(DetectorTimings const *detTiming)
timescale_traits< OpticalTimeCategory >::tick_d_t optical_tick_d
time_interval fromStart(electronics_time time) const
Converts a electronics time point into a duration from the start of electronics time.
timescale_traits< TPCelectronicsTimeCategory >::time_point_t TPCelectronics_time
A point in time on the TPC electronics time scale.
Class representing the time measured by an electronics clock.
Definition: ElecClock.h:91
auto OpticalClockPeriod() const
Returns the duration of the optical clock period and tick.
microsecond TriggerTime() const
Equivalent to detinfo::DetectorClocksData::TriggerTime().
optical_tick_d toOpticalTickD(TimePoint time) const
Returns the time point converted in units of optical time ticks.
detinfo::timescales::optical_time_ticks optical_time_ticks
Constructor: wraps around a specified detinfo::DetectorClocksData object.
double TPCTick2TDC(double const tick) const
timescale_traits< TPCelectronicsTimeCategory >::tick_t TPCelectronics_tick
A point on the TPC electronics time scale expressed in its ticks.
detinfo::timescales::optical_tick optical_tick
Constructor: wraps around a specified detinfo::DetectorClocksData object.
timescale_traits< ElectronicsTimeCategory >::time_point_t electronics_time
A point in time on the electronics time scale.
electronics_tick toElectronicsTick(FromTime time) const
Converts a time point into electronics tick (truncated).
static constexpr TickPoint startTick(DetectorTimings const *)
constexpr TimeScale startTime() const
Returns the start time of the specified time scale.
DetectorTimings(detinfo::DetectorClocksData const *clockData)
Constructor: wraps around a specified detinfo::DetectorClocksData object.
static TargetTick convert(FromTime time, DetectorTimings const *timings)