DetectorClocks.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file
3 //
4 // \brief pure virtual base interface for detector clocks
5 //
6 // \author jpaley@fnal.gov
7 //
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef DETINFO_IDETCLOCKS_H
10 #define DETINFO_IDETCLOCKS_H
11 
12 #include "DetectorInfo/ElecClock.h"
13 
14 namespace gar {
15  namespace detinfo{
16 
28  };
29 
31 
32  public:
33  DetectorClocks(const DetectorClocks &) = delete;
34  DetectorClocks(DetectorClocks &&) = delete;
35  DetectorClocks& operator = (const DetectorClocks &) = delete;
37  virtual ~DetectorClocks() = default;
38 
39  virtual double TriggerOffsetTPC() const = 0;
40 
41  /// Given Geant4 time [ns], returns relative time [ns] w.r.t. electronics time T0
42  virtual double G4ToElecTime(double g4_time) const = 0;
43 
44  /// Trigger electronics clock time in [ns]
45  virtual double TriggerTime() const = 0;
46 
47  /// Beam gate electronics clock time in [ns]
48  virtual double BeamGateTime() const = 0;
49 
50  /// Duration of spill [ns]
51  virtual double SpillLength() const = 0;
52 
53  virtual std::vector<std::string> ConfigNames() const = 0;
54  virtual std::vector<double> ConfigValues() const = 0;
55 
56  //
57  // Getters of TPC ElecClock
58  //
59  /// Borrow a const TPC clock with time set to Trigger time [ns]
60  virtual const ElecClock& TPCClock() const = 0;
61 
62  /// Create a TPC clock for a given time [ns] from clock counting start
63  virtual ElecClock TPCClock(double time) const = 0;
64 
65  /// Create a TPC clock for a given sample/frame number in TPC clock frequency
66  virtual ElecClock TPCClock(unsigned int sample,unsigned int frame) const = 0;
67 
68  //
69  // Getters of Trigger ElecClock
70  //
71  /// Borrow a const Trigger clock with time set to Trigger time [ns]
72  virtual const detinfo::ElecClock& TriggerClock() const = 0;
73 
74  /// Create a Trigger clock for a given time [ns] from clock counting start
75  virtual detinfo::ElecClock TriggerClock(double time) const = 0;
76 
77  /// Create a Trigger clock for a given sample/frame number in Trigger clock frequency
78  virtual detinfo::ElecClock TriggerClock(unsigned int sample, unsigned int frame) const = 0;
79 
80  //
81  // Getters of External ElecClock
82  //
83  /// Borrow a const Trigger clock with time set to External Time [ns]
84  virtual const detinfo::ElecClock& ExternalClock() const = 0;
85 
86  /// Create a External clock for a given time [ns] from clock counting start
87  virtual detinfo::ElecClock ExternalClock(double time) const = 0;
88 
89  /// Create a External clock for a given sample/frame number in External clock frequency
90  virtual detinfo::ElecClock ExternalClock(unsigned int sample, unsigned int frame) const = 0;
91 
92  //
93  // Getters for time [us] w.r.t. trigger given information from waveform
94  //
95 
96  /// Given TPC time-tick (waveform index), returns time [ns] w.r.t. trigger time stamp
97  virtual double TPCTick2TrigTime(double tick) const = 0;
98 
99  /// Given TPC time-tick (waveform index), returns time [ns] w.r.t. beam gate time
100  virtual double TPCTick2BeamTime(double tick) const = 0;
101 
102  /// Given External time-tick (waveform index), sample and frame number, returns time [ns] w.r.t. trigger time stamp
103  virtual double ExternalTick2TrigTime(double tick, size_t sample, size_t frame) const = 0;
104 
105  /// Given External time-tick (waveform index), sample and frame number, returns time [ns] w.r.t. beam gate time stamp
106  virtual double ExternalTick2BeamTime(double tick, size_t sample, size_t frame) const = 0;
107 
108  //
109  // Getters for time [tdc] (electronics clock counting ... in double precision)
110  //
111 
112  /// Given TPC time-tick (waveform index), returns electronics clock count [tdc]
113  virtual double TPCTick2TDC(double tick) const = 0;
114 
115  /// Given G4 time [ns], returns corresponding TPC electronics clock count [tdc]
116  virtual double TPCG4Time2TDC(double g4time) const = 0;
117 
118  /// Given External time-tick (waveform index), sample and frame number, returns time electronics clock count [tdc]
119  virtual double ExternalTick2TDC(double tick, size_t sample, size_t frame) const = 0;
120 
121  /// Given G4 time [ns], returns corresponding External electronics clock count [tdc]
122  virtual double ExternalG4Time2TDC(double g4time) const = 0;
123 
124  //
125  // Getters for time [ns] (electronics clock counting ... in double precision)
126  //
127  /// Given TPC time-tick (waveform index), returns electronics clock [ns]
128  virtual double TPCTick2Time(double tick) const = 0;
129 
130  /// Given External time-tick (waveform index), sample and frame number, returns electronics clock [ns]
131  virtual double ExternalTick2Time(double tick, size_t sample, size_t frame) const = 0;
132 
133  //
134  // Getters for time [ticks] (waveform index number)
135  //
136 
137  /// Given electronics clock count [tdc] returns TPC time-tick
138  virtual double TPCTDC2Tick(double tdc) const = 0;
139 
140  /// Given G4 time returns electronics clock count [tdc]
141  virtual double TPCG4Time2Tick(double g4time) const = 0;
142 
143  protected:
144  DetectorClocks() = default;
145 
146  }; // class DetectorClocks
147 
148  } //namespace detinfo
149 } // gar
150 
151 #endif
DetectorClocks & operator=(const DetectorClocks &)=delete
virtual double ExternalTick2TDC(double tick, size_t sample, size_t frame) const =0
Given External time-tick (waveform index), sample and frame number, returns time electronics clock co...
virtual double TPCG4Time2Tick(double g4time) const =0
Given G4 time returns electronics clock count [tdc].
virtual double ExternalTick2BeamTime(double tick, size_t sample, size_t frame) const =0
Given External time-tick (waveform index), sample and frame number, returns time [ns] w...
virtual double TPCTDC2Tick(double tdc) const =0
Given electronics clock count [tdc] returns TPC time-tick.
virtual double ExternalG4Time2TDC(double g4time) const =0
Given G4 time [ns], returns corresponding External electronics clock count [tdc]. ...
virtual double ExternalTick2Time(double tick, size_t sample, size_t frame) const =0
Given External time-tick (waveform index), sample and frame number, returns electronics clock [ns]...
virtual double SpillLength() const =0
Duration of spill [ns].
virtual const detinfo::ElecClock & TriggerClock() const =0
Borrow a const Trigger clock with time set to Trigger time [ns].
virtual double TriggerTime() const =0
Trigger electronics clock time in [ns].
virtual double G4ToElecTime(double g4_time) const =0
Given Geant4 time [ns], returns relative time [ns] w.r.t. electronics time T0.
virtual double ExternalTick2TrigTime(double tick, size_t sample, size_t frame) const =0
Given External time-tick (waveform index), sample and frame number, returns time [ns] w...
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:75
virtual double TPCTick2TrigTime(double tick) const =0
Given TPC time-tick (waveform index), returns time [ns] w.r.t. trigger time stamp.
virtual ~DetectorClocks()=default
General LArSoft Utilities.
virtual double TPCG4Time2TDC(double g4time) const =0
Given G4 time [ns], returns corresponding TPC electronics clock count [tdc].
General GArSoft Utilities.
virtual const detinfo::ElecClock & ExternalClock() const =0
Borrow a const Trigger clock with time set to External Time [ns].
virtual double TriggerOffsetTPC() const =0
virtual double TPCTick2BeamTime(double tick) const =0
Given TPC time-tick (waveform index), returns time [ns] w.r.t. beam gate time.
virtual const ElecClock & TPCClock() const =0
Borrow a const TPC clock with time set to Trigger time [ns].
virtual double BeamGateTime() const =0
Beam gate electronics clock time in [ns].
virtual std::vector< std::string > ConfigNames() const =0
virtual std::vector< double > ConfigValues() const =0
virtual double TPCTick2TDC(double tick) const =0
Given TPC time-tick (waveform index), returns electronics clock count [tdc].
virtual double TPCTick2Time(double tick) const =0
Given TPC time-tick (waveform index), returns electronics clock [ns].