LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DetectorClocksStandardDataFor.h
Go to the documentation of this file.
1 
10 #ifndef LARDATAALG_DETECTORINFO_DETECTORCLOCKSSTANDARDDATAFOR_H
11 #define LARDATAALG_DETECTORINFO_DETECTORCLOCKSSTANDARDDATAFOR_H
12 
13 // LArSoft libraries
15 #include "lardataobj/RawData/TriggerData.h" // raw::Trigger
16 
17 // framework libraries
19 #include "cetlib_except/exception.h"
20 
21 // C++ standard libraries
22 #include <optional>
23 #include <vector>
24 
25 namespace detinfo {
26 
66  template <typename Event>
68  detinfo::DetectorClocksStandard const& detClocks,
69  Event const& event)
70  {
71 
72  auto const& config_values = detClocks.ConfigValues();
73  // Trigger times
74  double trig_time{config_values[kDefaultTrigTime]};
75  double beam_time{config_values[kDefaultBeamTime]};
76  if (auto times = trigger_times_for_event(detClocks.TrigModuleName(), event)) {
77  std::tie(trig_time, beam_time) = *times;
78  }
79 
80  double g4_ref_time{config_values[kG4RefTime]};
81  if (auto sim_trig_time = g4ref_time_for_event(detClocks.G4RefCorrTrigModuleName(), event)) {
82  g4_ref_time -= trig_time;
83  g4_ref_time += *sim_trig_time;
84  }
85  return detClocks.DataFor(g4_ref_time, trig_time, beam_time);
86  } // detinfo::detectorClocksStandardDataFor()
87 
88 } // namespace detinfo
89 
90 #endif // LARDATA_DETECTORINFO_DETECTORCLOCKSSTANDARDTRIGGERLOADER_H
DetectorClocksData DataFor(double const g4_ref_time, double const trigger_time, double const beam_time) const override
Returns a complete detinfo::DetectorClocksData object.
std::optional< double > g4ref_time_for_event(art::InputTag const &triggerTag, Event const &event)
Loads DetectorClocksStandard G4Ref correction times.
std::string const & TrigModuleName() const
Returns the input tag of the trigger data product.
std::vector< double > const & ConfigValues() const override
std::string G4RefCorrTrigModuleName() const
Returns the input tag of the trigger data product for G4Ref correctons.
General LArSoft Utilities.
detinfo::DetectorClocksData detectorClocksStandardDataFor(detinfo::DetectorClocksStandard const &detClocks, Event const &event)
Returns DetectorClocksData tuned on the specified event.
Contains all timing reference information for the detector.
Implementation of detinfo::DetectorClocks interface with fixed settings from configuration.
Functions to load trigger time in detinfo::DetectorClocksStandard.
std::optional< std::pair< double, double > > trigger_times_for_event(art::InputTag const &triggerTag, Event const &event)
Loads DetectorClocksStandard trigger times.
Event finding and building.