22 #ifndef LARDATAALG_DETECTORINFO_DETECTORCLOCKSSTANDARDTRIGGERLOADER_H 23 #define LARDATAALG_DETECTORINFO_DETECTORCLOCKSSTANDARDTRIGGERLOADER_H 30 #include "cetlib_except/exception.h" 56 template <
typename Event>
57 std::optional<std::pair<double, double>>
62 using TriggerHandle_t =
typename Event::template HandleT<std::vector<raw::Trigger>>;
64 TriggerHandle_t triggerHandle;
65 if (!event.template getByLabel(triggerTag, triggerHandle)) {
return std::nullopt; }
69 auto const& triggers = *triggerHandle;
70 if (triggers.empty()) {
return std::nullopt; }
73 if (triggers.size() != 1) {
75 <<
"Found " << triggers.size() <<
" trigger objects in '" << triggerTag.
encode()
76 <<
"' (only one trigger per event is supported)\n";
79 auto const&
trigger = triggers.front();
80 return std::make_optional(std::make_pair(
trigger.TriggerTime(),
trigger.BeamGateTime()));
101 template <
typename Event>
102 std::optional<double>
106 using TriggerHandle_t =
typename Event::template HandleT<std::vector<raw::Trigger>>;
108 TriggerHandle_t triggerHandle;
109 if (!event.template getByLabel(triggerTag, triggerHandle))
return std::nullopt;
113 auto const& triggers = *triggerHandle;
114 if (triggers.empty())
return std::nullopt;
117 if (triggers.size() != 1) {
119 <<
"Found " << triggers.size() <<
" trigger objects in '" << triggerTag.
encode()
120 <<
"' (only one trigger per event is supported)\n";
123 return std::make_optional(triggers.front().TriggerTime());
128 #endif // LARDATAALG_DETECTORINFO_DETECTORCLOCKSSTANDARDTRIGGERLOADER_H std::optional< double > g4ref_time_for_event(art::InputTag const &triggerTag, Event const &event)
Loads DetectorClocksStandard G4Ref correction times.
General LArSoft Utilities.
cet::coded_exception< error, detail::translate > exception
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.