15 #include "art/Framework/Core/SharedProducer.h"
16 #include "art/Framework/Core/ModuleMacros.h"
17 #include "art/Framework/Principal/Event.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
19 #include "fhiclcpp/types/TableAs.h"
20 #include "fhiclcpp/types/Sequence.h"
21 #include "fhiclcpp/types/Atom.h"
30 namespace icarus::trigger {
class WriteBeamGateInfo; }
100 Comment(
"length of gate time interval")
105 Comment(
"open the beam gate this long after the nominal beam gate time"),
109 fhicl::Atom<std::string>
Type {
124 throw art::Exception(art::errors::Configuration)
125 <<
"Invalid value for '" <<
Type.name()
126 <<
"' parameter: '" << e.
label() <<
"'; valid options: "
133 fhicl::Sequence<fhicl::TableAs<sim::BeamGateInfo, GateConfig>>
BeamGates {
135 Comment(
"list of gates to write")
141 Comment(
"name of the category used for the output"),
156 (
Parameters const& config, art::ProcessingFrame
const&);
164 virtual void produce(art::Event& event, art::ProcessingFrame
const&)
override;
184 namespace icarus::trigger {
205 namespace icarus::trigger {
210 { BeamType_t::kUnknown,
"unknown" }
220 : art::SharedProducer(config)
222 , fBeamGates(config().BeamGates())
229 produces<std::vector<sim::BeamGateInfo>>();
231 async<art::InEvent>();
238 log <<
"Writing " << fBeamGates.size() <<
" gates in each event:";
240 auto const& beamType = Config::GateConfig::BeamTypeSelector.get
242 log <<
"\n * [ " << gate.Start() <<
" -- " << gate.Start() + gate.Width()
243 <<
" ] ns (duration: " << gate.Width() <<
" ns), type: "
244 << beamType.name() <<
" (" << gate.BeamType() <<
")"
254 (art::Event& event, art::ProcessingFrame
const&)
258 event.put(std::make_unique<std::vector<sim::BeamGateInfo>>(fBeamGates));
Request for unknown option.
fhicl::Atom< microseconds > Start
DiscriminatePMTwaveformsByChannel::ChannelInfo_t convert(DiscriminatePMTwaveformsByChannel::ChannelConfig const &config)
std::vector< sim::BeamGateInfo > const fBeamGates
The gates to write.
fhicl::Atom< std::string > Type
Helper to select an string option among a set of allowed choices.
microseconds_as<> microseconds
Type of time interval stored in microseconds, in double precision.
Option_t const & parse(std::string const &label) const
Returns the option matching the specified label.
std::string optionListString(std::string const &sep=", ") const
Returns a string with the (main) name of all options.
static util::MultipleChoiceSelection< BeamType_t > const BeamTypeSelector
Selector for Type parameter.
std::string const fLogCategory
Message facility stream category for output.
Option_t const & get(Choices_t value) const
Returns the specified option.
WriteBeamGateInfo(Parameters const &config, art::ProcessingFrame const &)
fhicl::Atom< microseconds > Duration
art::SharedProducer::Table< Config > Parameters
BEGIN_PROLOG vertical distance to the surface Name
An interval (duration, length, distance) between two quantity points.
fhicl::Sequence< fhicl::TableAs< sim::BeamGateInfo, GateConfig > > BeamGates
virtual void produce(art::Event &event, art::ProcessingFrame const &) override
Fills the plots. Also extracts the information to fill them with.
std::string name() const
Returns the name of the option (i.e. the main label).
sim::BeamType_t getBeamType() const
nanoseconds_as<> nanoseconds
Type of time interval stored in nanoseconds, in double precision.
Utilities to read interval and point quantity FHiCL configuration.
Dimensioned variables representing space or time quantities.
std::string const & label() const
fhicl::Atom< std::string > LogCategory
BeamType_t
Defines category of beams to be stored in sim::BeamGateInfo.
Choices_t value() const
Returns a copy of the value of the option.
nanosecond nanoseconds
Alias for common language habits.
Writes a set collection of beam gates into each event.