22 #include "art/Framework/Core/SharedProducer.h"
23 #include "art/Framework/Core/ModuleMacros.h"
24 #include "art/Framework/Principal/Event.h"
25 #include "art/Persistency/Common/PtrMaker.h"
26 #include "canvas/Persistency/Common/Assns.h"
27 #include "canvas/Persistency/Common/Ptr.h"
28 #include "canvas/Utilities/InputTag.h"
29 #include "messagefacility/MessageLogger/MessageLogger.h"
30 #include "fhiclcpp/types/Atom.h"
41 namespace icarus::trigger {
class OpDetWaveformMetaMaker; }
106 Comment(
"tag of input optical detector waveforms")
112 Comment(
"name of the category used for the output"),
113 "OpDetWaveformMetaMaker"
126 (
Parameters const& config, art::ProcessingFrame
const&);
134 virtual void produce(art::Event& event, art::ProcessingFrame
const&)
override;
159 template <
typename T>
160 std::unique_ptr<T> moveToUniquePtr(T& data)
161 {
return std::make_unique<T>(std::move(data)); }
169 : art::SharedProducer(config)
171 , fWaveformTag(config().Waveforms())
175 async<art::InEvent>();
180 produces<std::vector<sbn::OpDetWaveformMeta>>();
181 produces<art::Assns<sbn::OpDetWaveformMeta, raw::OpDetWaveform>>();
189 <<
"\n - input waveforms: '" << fWaveformTag.encode() <<
'\''
197 (art::Event& event, art::ProcessingFrame
const&)
206 (art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event))
212 auto const& waveformHandle
213 =
event.getValidHandle<std::vector<raw::OpDetWaveform>>(fWaveformTag);
219 <<
"Event " <<
event.id() <<
" has beam gate starting at " << beamGateTime
220 <<
" and trigger at " << triggerTime <<
"."
221 <<
"\nNow extracting information from " << waveformHandle->size()
231 std::vector<sbn::OpDetWaveformMeta> PMTinfo;
232 art::Assns<sbn::OpDetWaveformMeta, raw::OpDetWaveform> infoToWaveform;
234 art::PtrMaker<sbn::OpDetWaveformMeta>
const makeInfoPtr {
event };
235 art::PtrMaker<raw::OpDetWaveform>
const makeWaveformPtr
236 { event, waveformHandle.id() };
238 for (
auto const& [ iWaveform, waveform ]:
util::enumerate(*waveformHandle)) {
239 assert(iWaveform == PMTinfo.size());
246 log <<
"Coverage for waveform #" << iWaveform
247 <<
" on channel " << info.
channel <<
": "
249 if (info.
withTrigger()) log <<
"; includes trigger";
250 if (info.
withBeamGate()) log <<
"; includes beam gate start";
253 infoToWaveform.addSingle
254 (makeInfoPtr(iWaveform), makeWaveformPtr(iWaveform));
261 event.put(moveToUniquePtr(PMTinfo));
262 event.put(moveToUniquePtr(infoToWaveform));
electronics_time BeamGateTime() const
Utilities related to art service access.
OpDetWaveformMeta makeOpDetWaveformMeta(raw::OpDetWaveform const &waveform, detinfo::DetectorTimings const &detTimings)
Creates a sbn::OpDetWaveformMeta out of a raw::OpDetWaveform.
Definition of util::enumerate().
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Interface to detinfo::DetectorClocks.
detinfo::DetectorTimings makeDetectorTimings(detinfo::DetectorClocksData const &detClocks)
BEGIN_PROLOG vertical distance to the surface Name
electronics_time TriggerTime() const
A class exposing an upgraded interface of detinfo::DetectorClocksData.
Data types for detinfo::DetectorTimings.
timescale_traits< ElectronicsTimeCategory >::time_point_t electronics_time
A point in time on the electronics time scale.