18 #include "art/Framework/Services/Registry/ServiceHandle.h"
19 #include "art/Framework/Core/ModuleMacros.h"
20 #include "art/Framework/Core/EDAnalyzer.h"
21 #include "art/Framework/Principal/Event.h"
22 #include "art/Framework/Principal/Handle.h"
23 #include "canvas/Utilities/InputTag.h"
24 #include "canvas/Persistency/Common/Assns.h"
25 #include "messagefacility/MessageLogger/MessageLogger.h"
26 #include "fhiclcpp/types/Atom.h"
33 #include <type_traits>
37 namespace icarus::trigger {
class DumpTriggerGateData; }
98 Name(
"TriggerGateDataTag"),
99 Comment(
"tag of trigger gate data collection")
103 Name(
"PrintChannels"),
104 Comment(
"whether to print the channel of the gate"),
109 Name(
"OutputCategory"),
110 Comment(
"name of the category used for the output"),
111 "DumpTriggerGateData"
135 virtual void analyze(art::Event
const& event)
override;
174 : art::EDAnalyzer(config)
176 , fTriggerGateDataTag(config().TriggerGateDataTag())
177 , fPrintChannels (config().PrintChannels())
178 , fOutputCategory (config().OutputCategory())
180 consumes<std::vector<TriggerGateData_t>>(fTriggerGateDataTag);
181 if (fPrintChannels) {
182 consumes<art::Assns<TriggerGateData_t, raw::OpDetWaveform>>
183 (fTriggerGateDataTag);
198 ?
event.getHandle<art::Assns<TriggerGateData_t, raw::OpDetWaveform>>
203 auto maybeItOpDetWave { gateToWaveforms
204 ? std::make_optional(gateToWaveforms->begin()): std::nullopt
209 << gates.size() <<
" trigger gates:";
211 log <<
"\n[#" << iGate <<
"] " <<
compactdump(gate);
212 if (gateToWaveforms) {
213 auto& itOpDetWave = maybeItOpDetWave.value();
214 auto const owend = gateToWaveforms->end();
222 while (itOpDetWave != owend) {
223 if (itOpDetWave->first.key() == iGate)
break;
226 if (itOpDetWave == owend) {
227 log <<
"\n (not associated with any optical detector waveform!)";
230 auto const firstOpDetWave = itOpDetWave;
231 std::set<raw::Channel_t> channels;
232 while (itOpDetWave != owend) {
233 if (itOpDetWave->first.key() != iGate)
break;
234 channels.insert(itOpDetWave->second->ChannelNumber());
238 log <<
"\n associated with "
240 <<
" optical detector waveforms on ";
241 if (channels.size() == 1U) {
242 log <<
"channel " << *(channels.cbegin());
245 log << channels.size() <<
" channels:";
246 for (
auto const& channel: channels) log <<
" " << channel;
DumpTriggerGateData(Parameters const &config)
fhicl::Atom< art::InputTag > TriggerGateDataTag
Definition of util::enumerate().
bool fPrintChannels
Whether to print associated optical waveform info.
std::string fOutputCategory
Category used for message facility stream.
virtual void analyze(art::Event const &event) override
Fills the plots. Also extracts the information to fill them with.
DumpTriggerGateData & operator=(DumpTriggerGateData const &)=delete
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Logical multi-level gate associated to one or more readout channels.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
fhicl::Atom< bool > PrintChannels
A trigger gate data object for optical detector electronics.
BEGIN_PROLOG vertical distance to the surface Name
Produces plots to inform trigger design.
art::EDAnalyzer::Table< Config > Parameters
OpticalTriggerGateData_t GateData_t
Type for gate data access.
fhicl::Atom< std::string > OutputCategory
art::InputTag fTriggerGateDataTag
Input trigger gate data tag.
auto compactdump(ReadoutTriggerGate< Tick, TickInterval, ChannelIDType > const &gate) -> details::CompactFormatter< ReadoutTriggerGate< Tick, TickInterval, ChannelIDType >>
Manipulator-like function for compact format of trigger gates.