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

Contains all timing reference information for the detector. More...

#include "DetectorClocksData.h"

Public Member Functions

 DetectorClocksData (double const g4_ref_time, double const trigger_offset_tpc, double const trig_time, double const beam_time, ElecClock const &tpc_clock, ElecClock const &optical_clock, ElecClock const &trigger_clock, ElecClock const &external_clock)
 Returns a complete detinfo::DetectorClocksData object. More...
 
double TriggerOffsetTPC () const
 
double TPCTime () const
 
double G4ToElecTime (double const g4_time) const
 
double TriggerTime () const
 Trigger electronics clock time in [us]. More...
 
double BeamGateTime () const
 Beam gate electronics clock time in [us]. More...
 
ElecClock const & TPCClock () const noexcept
 Borrow a const TPC clock with time set to Trigger time [us]. More...
 
ElecClock const & OpticalClock () const noexcept
 Borrow a const Optical clock with time set to Trigger time [us]. More...
 
ElecClock const & TriggerClock () const noexcept
 Borrow a const Trigger clock with time set to Trigger time [us]. More...
 
ElecClock const & ExternalClock () const noexcept
 Borrow a const Trigger clock with time set to External Time [us]. More...
 
double TPCTick2TrigTime (double const tick) const
 
double TPCTick2BeamTime (double const tick) const
 
double OpticalTick2TrigTime (double const tick, size_t const sample, size_t const frame) const
 
double OpticalTick2BeamTime (double const tick, size_t const sample, size_t const frame) const
 
double ExternalTick2TrigTime (double const tick, size_t const sample, size_t const frame) const
 
double ExternalTick2BeamTime (double const tick, size_t const sample, size_t const frame) const
 
double Time2Tick (double const time) const
 Returns the specified electronics time in TDC electronics ticks. More...
 
double TPCTick2TDC (double const tick) const
 
double TPCG4Time2TDC (double const g4time) const
 
double OpticalTick2TDC (double const tick, size_t const sample, size_t const frame) const
 
double OpticalG4Time2TDC (double const g4time) const
 
double ExternalTick2TDC (double const tick, size_t const sample, size_t const frame) const
 
double ExternalG4Time2TDC (double const g4time) const
 
double TPCTick2Time (double const tick) const
 Given TPC time-tick (waveform index), returns electronics clock [us]. More...
 
double OpticalTick2Time (double const tick, size_t const sample, size_t const frame) const
 
double ExternalTick2Time (double const tick, size_t const sample, size_t const frame) const
 
double TPCTDC2Tick (double const tdc) const
 Given electronics clock count [tdc] returns TPC time-tick. More...
 
double TPCG4Time2Tick (double const g4time) const
 Given G4 time returns electronics clock count [tdc]. More...
 
template<typename Stream >
void debugReport (Stream &out) const
 

Private Member Functions

double doTPCTime () const
 Implementation of TPCTime(). More...
 
double doTime2Tick (double const time) const
 Implementation of Time2Tick(). More...
 

Private Attributes

double fTriggerTime
 Trigger time in [us]. More...
 
double fTriggerOffsetTPC
 Time offset from trigger to TPC readout start. More...
 
double fBeamGateTime
 BeamGate time in [us]. More...
 
double fG4RefTime
 Electronics clock counting start time in G4 time frame [us]. More...
 
ElecClock fTPCClock
 
ElecClock fOpticalClock
 
ElecClock fTriggerClock
 
ElecClock fExternalClock
 

Detailed Description

Contains all timing reference information for the detector.


The timing information object can be obtained in art from any implementation of detinfo::DetectorClocksService, and in non-_art_ contexts from any detinfo::DetectorClocks provider implementation:

in art context without a current event, and better:

in art context when a current event is defined and available.

Validity of the information

The content of this object is static and disconnected from the context it was extracted from. The actual timing information can be updated event by event. In general, a new object might be needed for each event or run change.

Time definitions

Many different components contribute to the operation of a LArTPC, and more are needed for the simulation. Some of the relevant events and time points associated with time are:

  • hardware trigger: the instant the trigger happens or is expected; data acquisition reacts at this time (multi-event)
  • beam gate opening: the instant the beam particles are expected to enter the detector (multi-event)
  • software trigger: additional logic can provide a more detailed estimation of the physics event time; this usually comes too late for the electronics time to be defined by it (multi-event)
  • electronics start time: a reference time instant; this is usually matching the instant the TPC readout starts recording raw digits (multi-event)
  • TPC electronics start time: the instant corresponding to the first sample of the raw digits from TPC; for untampered raw::RawDigit objects, this time matches the general electronics start time definition, and for the model of data acquisition described here, this time is by definition function of the hardware trigger. Trimmed raw::RawDigit with a start portion clipped away will break the assumption of electronics time matching the TPC one (which is defined as seen by raw::RawDigit) (multi-event)
  • other electronics start times (optical detector, cosmic ray tagger, etc.) represent the instant the respective data acquisition subsystems start digitizing the data from their detectors (multi-event)
  • event trigger: the instant the physics event is detected (in reconstruction jargon this is a $ t_{0} $); ideally, for most events involving beam particles this is the a little after beam gate opening, and on top of the hardware trigger (per event)
  • charge collection: the instant the ionisation from a particle reaches the charge readout (per particle)
  • photon collection: the instant scintillation photons from a particle reaches the optical readout (per particle)
  • physics event time: the instant the main interaction happens; this is assigned by the event generator (per event)
  • Geant4 time start: assigned to each particle by the simulation of propagation through matter (Geant4); note that this is not necessarily the same as the event time. (per event)

In parentheses, it is indicated if such instant is defined for each considered particle, or for the complete physics process ("event") or for all physics processes recorded in the same time window ("multi-event").

We can also define many ways to measure these times with respect to the others. We use the following time scales and frames:

  • electronics time: from the electronics start time; this is the "glue" time frame connecting most of the others [µs]
  • TPC time: from the TPC electronics start time [µs]
  • other electronics times ( optical electronics time, external electronics time, etc.): from the respective start times; note that in LArSoft the definition of these times is not fully defined (see below). [µs]
  • beam gate time: from the beam gate opening time [µs]
  • trigger time: from the hardware trigger [µs]
  • event time: from an event trigger [µs]
  • generation time: from the time the generators assigns to the main physics event; this is stored in the trajectory points of simb::MCParticle (usually the generators store a single trajectory point for each particle) [ns]
  • GEANT4 time: from the GEANT4 time start; this is stored into each trajectory point of simb::MCParticle produced by LArG4 module or equivalent [ns]
  • simulation time: the same as GEANT4 time (and also generation time, which in LArSoft happens to match the former) [ns]

The list above reports in square brackets the "standard" unit, used for that times in that scale by all LArSoft code unless explicitly specified otherwise. For the times bound to readout, there is also an equivalent tick count time (from the TDC), which is an integral value representing the number of elapsed sampling periods of the detector they refer too (and that period may be different for each piece of hardware). Be sure to read the documentation about the methods you want to use to convert ticks, because their implications and assumptions may be quite subtle.

Time conversions

While this system is carefully designed to give physicists an headache, detinfo::DetectorClocksData attempts to tame this complexity by providing methods to convert from one time to the other. Also see detinfo::DetectorTimings for a higher level interface.

The following table represents the available conversion functions, with the time in the first column as the time to be converted and in the columns the times to convert to:

to → electronics time (ticks) TPC time ticks trigger time trigger clock ticks beam gate time Optical clock ticks External clock ticks
(unit) µs µs µs
hardware trigger TriggerTime() TPCClock() TriggerClock() OpticalClock() ExternalClock()
beam gate point BeamGateTime()
electronics time Time2Tick()
  (ticks) TPCTDC2Tick()
TPC time
  (ticks) TPCTick2Time() TPCTick2TDC() TPCTick2TrigTime() TPCTick2BeamTime()
trigger time
  (ticks)
Optical
  (ticks) OpticalTick2Time() OpticalTick2TDC() OpticalTick2TrigTime() OpticalTick2BeamTime()
External
  (ticks) ExternalTick2Time() ExternalTick2TDC() ExternalTick2TrigTime() ExternalTick2BeamTime()
simulation time G4ToElecTime() TPCG4Time2TDC() TPCG4Time2Tick() OpticalG4Time2TDC() ExternalG4Time2TDC()

Note that the complete definition of optical and external time requires additional information: see the note on electronics time frames below.

The names are not thoroughly consistent, but they roughly follow the following rules:

Note on electronics time frames

The conversion of some electronic time ticks, especially the optical and external ones, assumes that the tick values to be converted are relative to an arbitrary reference, meaning that the absolute (or, e.g., electronics) time for tick 0 is not centrally defined. Instead, it is expected that additional information is provided to locate when this tick 0 actually happens. This is usually done via another pair of arguments, the frame number and the sample number within that frame. In the end, this just moves the questions to when frame 0 sample 0 happens: as those are input arguments, that absolute reference is left to the caller to define; but usually it is referring to the electronics start time.

Clocks

A clock object (ElecClock) contains settings for a specific hardware clock. DetectorClocksData provides four clock objects:

clock name purpose default time
TPCClock() TPC readout and "general" electronics TriggerTime()
OpticalClock() optical detector electronics TriggerTime()
TriggerClock() hardware trigger electronics TriggerTime()
ExternalClock() not specified TriggerTime()

A clock object does not change the time frame: in the conversions between times and ticks, and the other way around, it always assumes that at tick 0 (and frame 0, sample 0, if needed), the time is also 0 (see the note on electronics time frames above). Therefore, once again, a clock object does not help in converting between different time scales, and the output times are in the same time frame as the input.

The "default time" is the time the clock is set when returned by the methods with no argument (e.g. TriggerClock()).

All times (including frame lengths) are measured in microseconds, and all the frequencies are measured in megahertz.

TPCClock() deals with TPC readout, and the "electronics time" clock is defined to have the same parameters as the TPC readout one.

Note
The TriggerClock() clock has little in common with TriggerTime(): the former is an electronics setting for a piece of hardware generating the trigger, while the latter is the instant the hardware trigger actually happened.

Definition at line 282 of file DetectorClocksData.h.

Constructor & Destructor Documentation

detinfo::DetectorClocksData::DetectorClocksData ( double const  g4_ref_time,
double const  trigger_offset_tpc,
double const  trig_time,
double const  beam_time,
ElecClock const &  tpc_clock,
ElecClock const &  optical_clock,
ElecClock const &  trigger_clock,
ElecClock const &  external_clock 
)
inline

Returns a complete detinfo::DetectorClocksData object.

Parameters
g4_ref_timestart of simulation time in electronics time scale [ns]
trigger_offset_tpchardware trigger time in electronics time (see the full description below)
trigger_timethe default hardware trigger time in electronics time
beam_timethe default beam gate opening time in electronics time
tpc_clockuse a copy of this as TPC clock object
optical_clockuse a copy of this as optical detector clock object
trigger_clockuse a copy of this as trigger clock object
external_clockuse a copy of this as external clock object

Details of the definition of the different parameters:

  • g4_ref_time is the simulation (Geant4) start time in electronics time scale, i.e. when time 0.0 of simulation happens in the electronics time scale *trigger_offset_tpc: time elapsed between the start of the TPC readout clock and the hardware trigger; it can be expressed in one of two ways:

    • negative number [µs]: the offset of the start of the TPC readout clock start respect to the trigger time (where negative means that the clock starts before the trigger arrives)
    • positive number [ticks]: the number of TPC readout clock tick at which the trigger arrives; despite this being a tick number, it can be fractional for added precision

    For example, trigger_offset_tpc of -1600.0 means that the TDC clock starts 1.6 milliseconds before the hardware trigger. trigger_offset_tpc of 3200.0 means that the trigger arrives at the exact start of tick 3200 of the TPC readout. In this example, if the sampling frequency of that readout is 2 MHz, these two settings are equivalent.

  • trigger_time (microseconds): the default hardware trigger time, measured in the electronics time frame
  • beam_time (microseconds): the default beam gate opening time, measured in the electronics time frame

Definition at line 325 of file DetectorClocksData.h.

References fBeamGateTime, fExternalClock, fG4RefTime, fOpticalClock, fTPCClock, fTriggerClock, and fTriggerOffsetTPC.

333  : fTriggerTime{trig_time}
334  , fTriggerOffsetTPC{trigger_offset_tpc}
335  , fBeamGateTime{beam_time}
336  , fG4RefTime{g4_ref_time}
337  , fTPCClock{tpc_clock}
338  , fOpticalClock{optical_clock}
339  , fTriggerClock{trigger_clock}
340  , fExternalClock{external_clock}
341  {}
double fTriggerOffsetTPC
Time offset from trigger to TPC readout start.
double fBeamGateTime
BeamGate time in [us].
double fG4RefTime
Electronics clock counting start time in G4 time frame [us].
double fTriggerTime
Trigger time in [us].

Member Function Documentation

double detinfo::DetectorClocksData::BeamGateTime ( ) const
inline

Beam gate electronics clock time in [us].

Definition at line 369 of file DetectorClocksData.h.

References fBeamGateTime.

Referenced by detinfo::DetectorClocksWithUnits::BeamGateTime(), ExternalTick2BeamTime(), OpticalTick2BeamTime(), and TPCTick2BeamTime().

369 { return fBeamGateTime; }
double fBeamGateTime
BeamGate time in [us].
template<typename Stream >
void detinfo::DetectorClocksData::debugReport ( Stream &  out) const
inline

Definition at line 521 of file DetectorClocksData.h.

References fBeamGateTime, fExternalClock, fG4RefTime, fOpticalClock, detinfo::ElecClock::Frequency(), fTPCClock, fTriggerClock, fTriggerTime, Time2Tick(), TPCG4Time2Tick(), TPCTDC2Tick(), TPCTick2BeamTime(), TPCTick2TDC(), TPCTick2TrigTime(), TriggerOffsetTPC(), and TriggerTime().

Referenced by detinfo::DetectorClocksStandard::debugReport().

522  {
523  out << "Trigger time @ " << fTriggerTime << "\nBeamGate time @ " << fBeamGateTime
524  << "\nTrigOffsetTPC @ " << TriggerOffsetTPC() << "\nG4RefTime @ " << fG4RefTime
525  << "\nTPC Freq. @ " << fTPCClock.Frequency() << "\nOptical Freq. @ "
526  << fOpticalClock.Frequency() << "\nTrigger Freq. @ " << fTriggerClock.Frequency()
527  << "\nExternal Freq. @ " << fExternalClock.Frequency()
528  << "\nTPC start tick [tdc] : " << TPCTick2TDC(0)
529  << "\nTPC start tick from trigger [us] : " << TPCTick2TrigTime(0)
530  << "\nTPC start tick from beam [us] : " << TPCTick2BeamTime(0)
531  << "\nTPC tdc=0 in tick : " << TPCTDC2Tick(0)
532  << "\nTPC G4 time 0 in tick : " << TPCG4Time2Tick(0)
533  << "\nTrigger in TPC tick : " << Time2Tick(TriggerTime()) << "\n";
534  }
double TPCTick2BeamTime(double const tick) const
double TPCG4Time2Tick(double const g4time) const
Given G4 time returns electronics clock count [tdc].
double TPCTDC2Tick(double const tdc) const
Given electronics clock count [tdc] returns TPC time-tick.
double fBeamGateTime
BeamGate time in [us].
double fG4RefTime
Electronics clock counting start time in G4 time frame [us].
double fTriggerTime
Trigger time in [us].
double TriggerTime() const
Trigger electronics clock time in [us].
constexpr double Frequency() const
Frequency in MHz.
Definition: ElecClock.h:176
double TPCTick2TrigTime(double const tick) const
double TPCTick2TDC(double const tick) const
double Time2Tick(double const time) const
Returns the specified electronics time in TDC electronics ticks.
double detinfo::DetectorClocksData::doTime2Tick ( double const  time) const
inlineprivate

Implementation of Time2Tick().

Definition at line 558 of file DetectorClocksData.h.

References doTPCTime(), and detinfo::ElecClock::TickPeriod().

Referenced by Time2Tick().

559  {
560  return (time - doTPCTime()) / fTPCClock.TickPeriod();
561  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double doTPCTime() const
Implementation of TPCTime().
double detinfo::DetectorClocksData::doTPCTime ( ) const
inlineprivate

Implementation of TPCTime().

Definition at line 555 of file DetectorClocksData.h.

References fTriggerOffsetTPC.

Referenced by doTime2Tick(), TPCG4Time2Tick(), TPCTDC2Tick(), TPCTick2TDC(), TPCTick2Time(), and TPCTime().

555 { return fTriggerTime + fTriggerOffsetTPC; }
double fTriggerOffsetTPC
Time offset from trigger to TPC readout start.
double fTriggerTime
Trigger time in [us].
ElecClock const& detinfo::DetectorClocksData::ExternalClock ( ) const
inlinenoexcept

Borrow a const Trigger clock with time set to External Time [us].

Definition at line 393 of file DetectorClocksData.h.

References fExternalClock.

393 { return fExternalClock; }
double detinfo::DetectorClocksData::ExternalG4Time2TDC ( double const  g4time) const
inline

Given G4 time [ns], returns corresponding External electronics clock count [tdc]

Definition at line 478 of file DetectorClocksData.h.

References fExternalClock, G4ToElecTime(), and detinfo::ElecClock::TickPeriod().

479  {
480  return G4ToElecTime(g4time) / fExternalClock.TickPeriod();
481  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double G4ToElecTime(double const g4_time) const
double detinfo::DetectorClocksData::ExternalTick2BeamTime ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given External time-tick (waveform index), sample and frame number, returns time [us] w.r.t. beam gate time stamp

Definition at line 432 of file DetectorClocksData.h.

References BeamGateTime(), fExternalClock, detinfo::ElecClock::TickPeriod(), and detinfo::ElecClock::Time().

433  {
434  return fExternalClock.TickPeriod() * tick + fExternalClock.Time(sample, frame) -
435  BeamGateTime();
436  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double BeamGateTime() const
Beam gate electronics clock time in [us].
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
constexpr double Time() const noexcept
Current time (as stored) in microseconds.
Definition: ElecClock.h:132
double detinfo::DetectorClocksData::ExternalTick2TDC ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given External time-tick (waveform index), sample and frame number, returns time electronics clock count [tdc]

Definition at line 472 of file DetectorClocksData.h.

References fExternalClock, and detinfo::ElecClock::Ticks().

473  {
474  return fExternalClock.Ticks(sample, frame) + tick;
475  }
constexpr int Ticks() const noexcept
Current clock tick (that is, the number of tick Time() falls in).
Definition: ElecClock.h:182
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
double detinfo::DetectorClocksData::ExternalTick2Time ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given External time-tick (waveform index), sample and frame number, returns electronics clock [us]

Definition at line 500 of file DetectorClocksData.h.

References fExternalClock, detinfo::ElecClock::TickPeriod(), and detinfo::ElecClock::Time().

501  {
502  return fExternalClock.Time(sample, frame) + tick * fExternalClock.TickPeriod();
503  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
constexpr double Time() const noexcept
Current time (as stored) in microseconds.
Definition: ElecClock.h:132
double detinfo::DetectorClocksData::ExternalTick2TrigTime ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given External time-tick (waveform index), sample and frame number, returns time [us] w.r.t. trigger time stamp

Definition at line 425 of file DetectorClocksData.h.

References fExternalClock, detinfo::ElecClock::TickPeriod(), detinfo::ElecClock::Time(), and TriggerTime().

426  {
427  return fExternalClock.TickPeriod() * tick + fExternalClock.Time(sample, frame) -
428  TriggerTime();
429  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
constexpr double Time() const noexcept
Current time (as stored) in microseconds.
Definition: ElecClock.h:132
double TriggerTime() const
Trigger electronics clock time in [us].
double detinfo::DetectorClocksData::G4ToElecTime ( double const  g4_time) const
inline

Given Geant4 time [ns], returns relative time [us] w.r.t. electronics time T0

Definition at line 363 of file DetectorClocksData.h.

References fG4RefTime.

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons(), ExternalG4Time2TDC(), detinfo::DetectorClocksWithUnits::G4ToElecTime(), OpticalG4Time2TDC(), TPCG4Time2TDC(), and TPCG4Time2Tick().

363 { return g4_time * 1.e-3 - fG4RefTime; }
double fG4RefTime
Electronics clock counting start time in G4 time frame [us].
ElecClock const& detinfo::DetectorClocksData::OpticalClock ( ) const
inlinenoexcept

Borrow a const Optical clock with time set to Trigger time [us].

Definition at line 381 of file DetectorClocksData.h.

References fOpticalClock.

Referenced by opdet::ConstructFlash(), opdet::ConstructHit(), detinfo::DetectorClocksWithUnits::OpticalClockFrequency(), and detinfo::DetectorClocksWithUnits::OpticalClockPeriod().

381 { return fOpticalClock; }
double detinfo::DetectorClocksData::OpticalG4Time2TDC ( double const  g4time) const
inline

Given G4 time [ns], returns corresponding Optical electronics clock count [tdc]

Definition at line 466 of file DetectorClocksData.h.

References fOpticalClock, G4ToElecTime(), and detinfo::ElecClock::TickPeriod().

467  {
468  return G4ToElecTime(g4time) / fOpticalClock.TickPeriod();
469  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double G4ToElecTime(double const g4_time) const
double detinfo::DetectorClocksData::OpticalTick2BeamTime ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given Optical time-tick (waveform index), sample and frame number, returns time [us] w.r.t. beam gate time stamp

Definition at line 419 of file DetectorClocksData.h.

References BeamGateTime(), fOpticalClock, detinfo::ElecClock::TickPeriod(), and detinfo::ElecClock::Time().

420  {
421  return fOpticalClock.TickPeriod() * tick + fOpticalClock.Time(sample, frame) - BeamGateTime();
422  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double BeamGateTime() const
Beam gate electronics clock time in [us].
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
constexpr double Time() const noexcept
Current time (as stored) in microseconds.
Definition: ElecClock.h:132
double detinfo::DetectorClocksData::OpticalTick2TDC ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given Optical time-tick (waveform index), sample and frame number, returns time electronics clock count [tdc]

Definition at line 460 of file DetectorClocksData.h.

References fOpticalClock, and detinfo::ElecClock::Ticks().

461  {
462  return fOpticalClock.Ticks(sample, frame) + tick;
463  }
constexpr int Ticks() const noexcept
Current clock tick (that is, the number of tick Time() falls in).
Definition: ElecClock.h:182
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
double detinfo::DetectorClocksData::OpticalTick2Time ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given Optical time-tick (waveform index), sample and frame number, returns electronics clock [us]

Definition at line 494 of file DetectorClocksData.h.

References fOpticalClock, detinfo::ElecClock::TickPeriod(), and detinfo::ElecClock::Time().

495  {
496  return fOpticalClock.Time(sample, frame) + tick * fOpticalClock.TickPeriod();
497  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
constexpr double Time() const noexcept
Current time (as stored) in microseconds.
Definition: ElecClock.h:132
double detinfo::DetectorClocksData::OpticalTick2TrigTime ( double const  tick,
size_t const  sample,
size_t const  frame 
) const
inline

Given Optical time-tick (waveform index), sample and frame number, returns time [us] w.r.t. trigger time stamp

Definition at line 413 of file DetectorClocksData.h.

References fOpticalClock, detinfo::ElecClock::TickPeriod(), detinfo::ElecClock::Time(), and TriggerTime().

414  {
415  return fOpticalClock.TickPeriod() * tick + fOpticalClock.Time(sample, frame) - TriggerTime();
416  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
constexpr double Time() const noexcept
Current time (as stored) in microseconds.
Definition: ElecClock.h:132
double TriggerTime() const
Trigger electronics clock time in [us].
double detinfo::DetectorClocksData::Time2Tick ( double const  time) const
inline

Returns the specified electronics time in TDC electronics ticks.

Definition at line 439 of file DetectorClocksData.h.

References doTime2Tick().

Referenced by debugReport().

439 { return doTime2Tick(time); }
double doTime2Tick(double const time) const
Implementation of Time2Tick().
ElecClock const& detinfo::DetectorClocksData::TPCClock ( ) const
inlinenoexcept

Borrow a const TPC clock with time set to Trigger time [us].

Definition at line 375 of file DetectorClocksData.h.

References fTPCClock.

Referenced by larg4::LArVoxelReadout::DriftIonizationElectrons(), detinfo::sampling_rate(), pma::Track3D::SetT0FromDx(), detinfo::trigger_offset(), and DUNE::NeutrinoTrackingEff::truthLength().

375 { return fTPCClock; }
double detinfo::DetectorClocksData::TPCG4Time2TDC ( double const  g4time) const
inline

Given G4 time [ns], returns corresponding TPC electronics clock count [tdc]

Definition at line 454 of file DetectorClocksData.h.

References fTPCClock, G4ToElecTime(), and detinfo::ElecClock::TickPeriod().

455  {
456  return G4ToElecTime(g4time) / fTPCClock.TickPeriod();
457  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double G4ToElecTime(double const g4_time) const
double detinfo::DetectorClocksData::TPCG4Time2Tick ( double const  g4time) const
inline

Given G4 time returns electronics clock count [tdc].

Definition at line 515 of file DetectorClocksData.h.

References doTPCTime(), fTPCClock, G4ToElecTime(), and detinfo::ElecClock::TickPeriod().

Referenced by debugReport().

516  {
517  return (G4ToElecTime(g4time) - doTPCTime()) / fTPCClock.TickPeriod();
518  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double doTPCTime() const
Implementation of TPCTime().
double G4ToElecTime(double const g4_time) const
double detinfo::DetectorClocksData::TPCTDC2Tick ( double const  tdc) const
inline

Given electronics clock count [tdc] returns TPC time-tick.

Definition at line 510 of file DetectorClocksData.h.

References doTPCTime(), fTPCClock, and detinfo::ElecClock::TickPeriod().

Referenced by debugReport(), hit::HitAnaAlg::FindAndStoreMCHitsInRange(), and nnet::TrainingDataAlg::setEventData().

511  {
512  return (tdc - doTPCTime() / fTPCClock.TickPeriod());
513  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double doTPCTime() const
Implementation of TPCTime().
double detinfo::DetectorClocksData::TPCTick2BeamTime ( double const  tick) const
inline

Given TPC time-tick (waveform index), returns time [us] w.r.t. beam gate time

Definition at line 407 of file DetectorClocksData.h.

References BeamGateTime(), TPCTick2TrigTime(), and TriggerTime().

Referenced by debugReport().

408  {
410  }
double BeamGateTime() const
Beam gate electronics clock time in [us].
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
double TriggerTime() const
Trigger electronics clock time in [us].
double TPCTick2TrigTime(double const tick) const
double detinfo::DetectorClocksData::TPCTick2TDC ( double const  tick) const
inline

Given TPC time-tick (waveform index), returns electronics clock count [tdc]

Definition at line 448 of file DetectorClocksData.h.

References doTPCTime(), fTPCClock, and detinfo::ElecClock::TickPeriod().

Referenced by cheat::BackTracker::ChannelToTrackIDEs(), debugReport(), cheat::BackTracker::HitToAvgSimIDEs(), cheat::BackTracker::HitToSimIDEs_Ps(), btutil::MCBTAlg::MCQ(), and detinfo::DetectorClocksWithUnits::TPCTick2TDC().

449  {
450  return (doTPCTime() / fTPCClock.TickPeriod() + tick);
451  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double doTPCTime() const
Implementation of TPCTime().
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
double detinfo::DetectorClocksData::TPCTick2Time ( double const  tick) const
inline

Given TPC time-tick (waveform index), returns electronics clock [us].

Definition at line 488 of file DetectorClocksData.h.

References doTPCTime(), fTPCClock, and detinfo::ElecClock::TickPeriod().

489  {
490  return doTPCTime() + tick * fTPCClock.TickPeriod();
491  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
double doTPCTime() const
Implementation of TPCTime().
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
double detinfo::DetectorClocksData::TPCTick2TrigTime ( double const  tick) const
inline

Given TPC time-tick (waveform index), returns time [us] w.r.t. trigger time stamp

Definition at line 401 of file DetectorClocksData.h.

References fTPCClock, detinfo::ElecClock::TickPeriod(), and TriggerOffsetTPC().

Referenced by debugReport(), and TPCTick2BeamTime().

402  {
403  return fTPCClock.TickPeriod() * tick + TriggerOffsetTPC();
404  }
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:73
double detinfo::DetectorClocksData::TPCTime ( ) const
inline

Returns the TPC electronics start time in electronics time.

Definition at line 359 of file DetectorClocksData.h.

References doTPCTime().

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

359 { return doTPCTime(); }
double doTPCTime() const
Implementation of TPCTime().
ElecClock const& detinfo::DetectorClocksData::TriggerClock ( ) const
inlinenoexcept

Borrow a const Trigger clock with time set to Trigger time [us].

Definition at line 387 of file DetectorClocksData.h.

References fTriggerClock.

387 { return fTriggerClock; }
double detinfo::DetectorClocksData::TriggerOffsetTPC ( ) const
inline
See also
detinfo::DetectorClocks::TriggerOffsetTPC()

This offset is set via configuration parameter TriggerOffsetTPC.

Definition at line 348 of file DetectorClocksData.h.

References detinfo::ElecClock::Frequency(), fTPCClock, and fTriggerOffsetTPC.

Referenced by debugReport(), pma::Track3D::SetT0FromDx(), TPCTick2TrigTime(), and detinfo::trigger_offset().

349  {
350  if (fTriggerOffsetTPC < 0)
351  return fTriggerOffsetTPC;
352  else
353  return -fTriggerOffsetTPC / fTPCClock.Frequency(); // convert ticks to
354  // us
355  }
double fTriggerOffsetTPC
Time offset from trigger to TPC readout start.
constexpr double Frequency() const
Frequency in MHz.
Definition: ElecClock.h:176
double detinfo::DetectorClocksData::TriggerTime ( ) const
inline

Member Data Documentation

double detinfo::DetectorClocksData::fBeamGateTime
private

BeamGate time in [us].

Definition at line 544 of file DetectorClocksData.h.

Referenced by BeamGateTime(), debugReport(), and DetectorClocksData().

double detinfo::DetectorClocksData::fG4RefTime
private

Electronics clock counting start time in G4 time frame [us].

Definition at line 547 of file DetectorClocksData.h.

Referenced by debugReport(), DetectorClocksData(), and G4ToElecTime().

ElecClock detinfo::DetectorClocksData::fTriggerClock
private

Definition at line 551 of file DetectorClocksData.h.

Referenced by debugReport(), DetectorClocksData(), and TriggerClock().

double detinfo::DetectorClocksData::fTriggerOffsetTPC
private

Time offset from trigger to TPC readout start.

Definition at line 541 of file DetectorClocksData.h.

Referenced by DetectorClocksData(), doTPCTime(), and TriggerOffsetTPC().

double detinfo::DetectorClocksData::fTriggerTime
private

Trigger time in [us].

Definition at line 538 of file DetectorClocksData.h.

Referenced by debugReport(), and TriggerTime().


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