22 #ifndef LARDATAALG_DETECTORINFO_DETECTORCLOCKSSTANDARDTRIGGERLOADER_H 23 #define LARDATAALG_DETECTORINFO_DETECTORCLOCKSSTANDARDTRIGGERLOADER_H 30 #include "cetlib_except/exception.h" 56 template <
typename Event>
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()));
103 template <
typename Event>
107 using TriggerHandle_t =
typename Event::template HandleT<std::vector<raw::Trigger>>;
109 TriggerHandle_t triggerHandle;
110 if (!event.template getByLabel(triggerTag, triggerHandle))
return std::nullopt;
114 auto const& triggers = *triggerHandle;
115 if (triggers.empty())
return std::nullopt;
118 if (triggers.size() != 1) {
120 <<
"Found " << triggers.size() <<
" trigger objects in '" << triggerTag.
encode()
121 <<
"' (only one trigger per event is supported)\n";
124 return std::make_optional(triggers.front().TriggerTime());
129 #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.