Public Member Functions | Private Member Functions | Private Attributes | List of all members
detinfo::DetectorClocksStandard Class Referencefinal

Implementation of detinfo::DetectorClocks interface with fixed settings from configuration. More...

#include <DetectorClocksStandard.h>

Inheritance diagram for detinfo::DetectorClocksStandard:
detinfo::DetectorClocks

Public Member Functions

 DetectorClocksStandard (fhicl::ParameterSet const &pset)
 
 DetectorClocksStandard (DetectorClocksStandard const &)=delete
 
void SetConfigValue (size_t i, double val)
 
std::string const & TrigModuleName () const
 Returns the input tag of the trigger data product. More...
 
std::string G4RefCorrTrigModuleName () const
 Returns the input tag of the trigger data product for G4Ref correctons. More...
 
std::vector< std::string > const & ConfigNames () const override
 
std::vector< double > const & ConfigValues () const override
 
DetectorClocksData DataForJob () const override
 Returns a complete detinfo::DetectorClocksData object. More...
 
DetectorClocksData DataFor (double const g4_ref_time, double const trigger_time, double const beam_time) const override
 Returns a complete detinfo::DetectorClocksData object. More...
 
void ApplyParams ()
 Internal function to apply loaded parameters to member attributes. More...
 
bool IsRightConfig (const fhicl::ParameterSet &ps) const
 
void debugReport () const
 Dumps the current configuration to screen. More...
 
- Public Member Functions inherited from detinfo::DetectorClocks
virtual ~DetectorClocks ()=default
 

Private Member Functions

void SetTriggerTime (double const trig_time, double const beam_time)
 Setter for trigger times. More...
 
double TriggerOffsetTPC () const
 

Private Attributes

std::vector< std::stringfConfigName
 
std::vector< double > fConfigValue
 
std::string fTrigModuleName
 
std::string fG4RefCorrTrigModuleName
 
double fTriggerOffsetTPC
 Time offset from trigger to TPC readout start. More...
 
double fTriggerTime
 Trigger time in [us]. More...
 
double fBeamGateTime
 BeamGate time in [us]. More...
 
double fFramePeriod
 Frame period. More...
 
ElecClock fTPCClock
 

Detailed Description

Implementation of detinfo::DetectorClocks interface with fixed settings from configuration.

In this implementation, all quantities are defined at configuration time and are unchanged for the duration of the entire job, with the exception of the trigger time (see below).

Configuration parameters

All configuration parameters are mandatory, unless explicitly stated.

Consistency check

The consistency check feature verifies that the current configuration of detinfo::DetectorClocksStandard is compatible with the one from previous jobs. It is expected that when this feature is enabled (InheritClockConfig is configured to be true), either the configuration is overridden to follow the previous ones, or an exception is thrown in case of inconsistency.

The service provider (detinfo::DetectorClocksStandard) does not provide a facility to inherit configuration from a previous job, but it stores the expectation whether this should happen (InheritClockConfig()). The service provider manager is in charge of implementing this feature (see detinfo::DetectorClocksStandardService for the manager in the art environment).

Timing specifics

For the general timing requirements, see the documentation of detinfo::DetectorClocks.

Trigger time

In this implementation, the trigger time and the beam gate time both default to 0.0 µs.

The manager of this provider is expected to set those values by calling detinfo::DetectorClocksStandard::SetTriggerTime(). See detinfo::DetectorClocksStandardService for the manager in the art environment.

Bug:
ExternalClock() clock is never initialized!

Definition at line 122 of file DetectorClocksStandard.h.

Constructor & Destructor Documentation

detinfo::DetectorClocksStandard::DetectorClocksStandard ( fhicl::ParameterSet const &  pset)

Definition at line 9 of file DetectorClocksStandard.cxx.

10  : fConfigName{"G4RefTime",
11  "TriggerOffsetTPC",
12  "FramePeriod",
13  "ClockSpeedTPC",
14  "ClockSpeedOptical",
15  "ClockSpeedTrigger",
16  "ClockSpeedExternal",
17  "DefaultTrigTime",
18  "DefaultBeamTime"}
19  , fConfigValue{pset.get<double>(fConfigName[kG4RefTime]),
20  pset.get<double>(fConfigName[kTriggerOffsetTPC]),
21  pset.get<double>(fConfigName[kFramePeriod]),
22  pset.get<double>(fConfigName[kClockSpeedTPC]),
23  pset.get<double>(fConfigName[kClockSpeedOptical]),
24  pset.get<double>(fConfigName[kClockSpeedTrigger]),
25  pset.get<double>(fConfigName[kClockSpeedExternal]),
26  pset.get<double>(fConfigName[kDefaultTrigTime]),
27  pset.get<double>(fConfigName[kDefaultBeamTime])}
28  , fTrigModuleName{pset.get<std::string>("TrigModuleName")}
29  , fG4RefCorrTrigModuleName{pset.get<std::string>("G4RefCorrTrigModuleName", "baddefault")}
35 {
37 }
std::string string
Definition: nybbler.cc:12
std::vector< std::string > fConfigName
double fTriggerTime
Trigger time in [us].
double fBeamGateTime
BeamGate time in [us].
double fTriggerOffsetTPC
Time offset from trigger to TPC readout start.
void SetTriggerTime(double const trig_time, double const beam_time)
Setter for trigger times.
detinfo::DetectorClocksStandard::DetectorClocksStandard ( DetectorClocksStandard const &  )
delete

Member Function Documentation

void detinfo::DetectorClocksStandard::ApplyParams ( )

Internal function to apply loaded parameters to member attributes.

Definition at line 40 of file DetectorClocksStandard.cxx.

std::vector<std::string> const& detinfo::DetectorClocksStandard::ConfigNames ( ) const
inlineoverridevirtual

Returns a list of provider configuration names.

See also
ConfigValues()

Implements detinfo::DetectorClocks.

Definition at line 160 of file DetectorClocksStandard.h.

161  {
162  return fConfigName;
163  }
std::vector< std::string > fConfigName
std::vector<double> const& detinfo::DetectorClocksStandard::ConfigValues ( ) const
inlineoverridevirtual

Returns a list of provider configuration values (same order as ConfigNames()).

See also
ConfigNames()

Implements detinfo::DetectorClocks.

Definition at line 165 of file DetectorClocksStandard.h.

166  {
167  return fConfigValue;
168  }
DetectorClocksData detinfo::DetectorClocksStandard::DataFor ( double const  g4_ref_time,
double const  trigger_time,
double const  beam_time 
) const
inlineoverridevirtual

Returns a complete detinfo::DetectorClocksData object.

Parameters
g4_ref_timestart of simulation time in electronics time scale [ns]
trigger_timethe default hardware trigger time in electronics time
beam_timethe default beam gate opening time in electronics time

The returned timing information reflects the current context, defined by the parameters passed to this method.

If the information required by the parameters is not available, users will be forced to use DataForJob() instead.

For more details on the definition of the parameters, see the documentation of detinfo::DetectorClocksData constructor.

Implements detinfo::DetectorClocks.

Definition at line 185 of file DetectorClocksStandard.h.

188  {
189  return DetectorClocksData{
190  g4_ref_time,
192  trigger_time,
193  beam_time,
194  ElecClock{trigger_time, fConfigValue[kFramePeriod], fConfigValue[kClockSpeedTPC]},
195  ElecClock{trigger_time, fConfigValue[kFramePeriod], fConfigValue[kClockSpeedOptical]},
196  ElecClock{trigger_time, fConfigValue[kFramePeriod], fConfigValue[kClockSpeedTrigger]},
198  }
timescale_traits< TriggerTimeCategory >::time_point_t trigger_time
A point in time on the trigger time scale.
double fTriggerOffsetTPC
Time offset from trigger to TPC readout start.
constexpr double kDEFAULT_FREQUENCY_EXTERNAL
Default External clock speed in MHz.
constexpr double kDEFAULT_FRAME_PERIOD
Default Frame period in micro-second.
DetectorClocksData detinfo::DetectorClocksStandard::DataForJob ( ) const
inlineoverridevirtual

Returns a complete detinfo::DetectorClocksData object.

The returned timing information is based on information independent of the current input file, run or event. It is recommended that DataFor() is used instead whenever possible.

Implements detinfo::DetectorClocks.

Definition at line 171 of file DetectorClocksStandard.h.

172  {
173  return DetectorClocksData{
174  fConfigValue[kG4RefTime], // FIXME: Should be run-dependent?
176  fTriggerTime,
178  ElecClock{fTriggerTime, fConfigValue[kFramePeriod], fConfigValue[kClockSpeedTPC]},
179  ElecClock{fTriggerTime, fConfigValue[kFramePeriod], fConfigValue[kClockSpeedOptical]},
180  ElecClock{fTriggerTime, fConfigValue[kFramePeriod], fConfigValue[kClockSpeedTrigger]},
182  }
double fTriggerTime
Trigger time in [us].
double fBeamGateTime
BeamGate time in [us].
double fTriggerOffsetTPC
Time offset from trigger to TPC readout start.
constexpr double kDEFAULT_FREQUENCY_EXTERNAL
Default External clock speed in MHz.
constexpr double kDEFAULT_FRAME_PERIOD
Default Frame period in micro-second.
void detinfo::DetectorClocksStandard::debugReport ( ) const

Dumps the current configuration to screen.

Definition at line 58 of file DetectorClocksStandard.cxx.

59 {
60  std::cout << "fConfigValues contents: " << std::endl;
61 
62  for(auto const& [ name, value ]: util::zip(fConfigName, fConfigValue))
63  std::cout << "\n " << name << " ... " << value;
64  std::cout << std::endl;
65 
66  DataForJob().debugReport(std::cout);
67  std::cout.flush();
68 
69 } // detinfo::DetectorClocksStandard::debugReport()
static QCString name
Definition: declinfo.cpp:673
DetectorClocksData DataForJob() const override
Returns a complete detinfo::DetectorClocksData object.
std::vector< std::string > fConfigName
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
void debugReport(Stream &out) const
QTextStream & endl(QTextStream &s)
std::string detinfo::DetectorClocksStandard::G4RefCorrTrigModuleName ( ) const
inline

Returns the input tag of the trigger data product for G4Ref correctons.

Returns
the input tag of the trigger data product (as string)

The trigger module name is set directly in the configuration as G4RefCorrTrigModuleName.

Definition at line 154 of file DetectorClocksStandard.h.

155  {
157  }
bool detinfo::DetectorClocksStandard::IsRightConfig ( const fhicl::ParameterSet ps) const

Internal function used to search for the right configuration set in the data file

Definition at line 48 of file DetectorClocksStandard.cxx.

49 {
50  if (ps.has_key("module_label")) { return false; }
51  return std::all_of(fConfigName.cbegin(), fConfigName.cend(), [&ps](auto const& config_name) {
52  return ps.has_key(config_name);
53  });
54 }
std::vector< std::string > fConfigName
bool has_key(std::string const &key) const
static constexpr double ps
Definition: Units.h:99
void detinfo::DetectorClocksStandard::SetConfigValue ( size_t  i,
double  val 
)
inline

Definition at line 128 of file DetectorClocksStandard.h.

129  {
130  fConfigValue[i] = val;
131  }
void detinfo::DetectorClocksStandard::SetTriggerTime ( double const  trig_time,
double const  beam_time 
)
inlineprivate

Setter for trigger times.

Parameters
trig_timehardware triggertime" in @ref DetectorClocksElectronicsTime "electronics time scale" @param beam_time @ref DetectorClocksBeamGateOpening "beam gate opening time" in @ref DetectorClocksElectronicsTime "electronics time scale"

The hardware trigger and beam gate opening times are set, and the electronic clocks are updated to store the new trigger time.

Definition at line 223 of file DetectorClocksStandard.h.

224  {
225  fTriggerTime = trig_time;
226  fBeamGateTime = beam_time;
228  }
double fTriggerTime
Trigger time in [us].
double fBeamGateTime
BeamGate time in [us].
double detinfo::DetectorClocksStandard::TriggerOffsetTPC ( ) const
inlineprivate

Definition at line 231 of file DetectorClocksStandard.h.

232  {
233  if (fTriggerOffsetTPC < 0)
234  return fTriggerOffsetTPC;
235  else
236  return -fTriggerOffsetTPC / fTPCClock.Frequency(); // convert ticks to
237  // us
238  }
double fTriggerOffsetTPC
Time offset from trigger to TPC readout start.
constexpr double Frequency() const
Frequency in MHz.
Definition: ElecClock.h:191
std::string const& detinfo::DetectorClocksStandard::TrigModuleName ( ) const
inline

Returns the input tag of the trigger data product.

Returns
the input tag of the trigger data product (as string)

The trigger module name is set directly in the configuration as TrigModuleName.

Definition at line 141 of file DetectorClocksStandard.h.

142  {
143  return fTrigModuleName;
144  }

Member Data Documentation

double detinfo::DetectorClocksStandard::fBeamGateTime
private

BeamGate time in [us].

Definition at line 253 of file DetectorClocksStandard.h.

std::vector<std::string> detinfo::DetectorClocksStandard::fConfigName
private

Definition at line 240 of file DetectorClocksStandard.h.

std::vector<double> detinfo::DetectorClocksStandard::fConfigValue
private

Definition at line 241 of file DetectorClocksStandard.h.

double detinfo::DetectorClocksStandard::fFramePeriod
private

Frame period.

Definition at line 256 of file DetectorClocksStandard.h.

std::string detinfo::DetectorClocksStandard::fG4RefCorrTrigModuleName
private

Definition at line 244 of file DetectorClocksStandard.h.

ElecClock detinfo::DetectorClocksStandard::fTPCClock
private

Definition at line 258 of file DetectorClocksStandard.h.

double detinfo::DetectorClocksStandard::fTriggerOffsetTPC
private

Time offset from trigger to TPC readout start.

Definition at line 247 of file DetectorClocksStandard.h.

double detinfo::DetectorClocksStandard::fTriggerTime
private

Trigger time in [us].

Definition at line 250 of file DetectorClocksStandard.h.

std::string detinfo::DetectorClocksStandard::fTrigModuleName
private

Definition at line 243 of file DetectorClocksStandard.h.


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