7 #include "art/Framework/Core/EDProducer.h"
8 #include "art/Framework/Core/ModuleMacros.h"
9 #include "art/Utilities/make_tool.h"
10 #include "art/Framework/Services/Registry/ServiceHandle.h"
11 #include "art/Framework/Principal/Event.h"
13 #include "canvas/Utilities/InputTag.h"
14 #include "canvas/Utilities/Exception.h"
15 #include "fhiclcpp/ParameterSet.h"
16 #include "fhiclcpp/types/Atom.h"
17 #include "fhiclcpp/types/DelegatedParameter.h"
18 #include "messagefacility/MessageLogger/MessageLogger.h"
20 #include "artdaq-core/Data/Fragment.hh"
50 Name(
"FragmentsLabel"),
51 Comment(
"data product with the PMT fragments from DAQ"),
56 Name(
"SurviveExceptions"),
58 (
"when the decoding tool throws an exception, print a message and move on"),
65 (
"configuration of decoding tool (daq::IDecoder) to be loaded and used")
85 void beginRun(art::Run& run)
override;
88 void produce(art::Event &
e)
override;
105 : art::EDProducer{params}
106 , fInputTag{ params().FragmentsLabel() }
107 , fSurviveExceptions{ params().SurviveExceptions() }
109 fDecoderTool = art::make_tool<IDecoder>
110 (params().DecoderTool.get<fhicl::ParameterSet>());
113 consumes<artdaq::Fragments>(fInputTag);
117 fDecoderTool->produces(producesCollector());
139 auto const& fragments =
event.getProduct<artdaq::Fragments>(
fInputTag);
142 if (!fragments.empty())
144 for (
auto const &rawFrag: fragments)
fDecoderTool->process_fragment(rawFrag);
147 catch(cet::exception
const&
e) {
149 std::cout <<
"DaqDecoderICARUSPMT: Did not find daq data products to decode:"
150 <<
"\n" << e.what() << std::endl;
155 std::cout <<
"DaqDecoderICARUSPMT: Did not find daq data products to decode" << std::endl;
void produce(art::Event &e) override
This provides an art tool interface definition for tools which "decode" artdaq fragments into LArSoft...
fhicl::Atom< art::InputTag > FragmentsLabel
FHiCL configuration of the module.
fhicl::Atom< bool > SurviveExceptions
void beginRun(art::Run &run) override
Initiates PMT configuration reading at run transition.
DaqDecoderICARUSPMT & operator=(DaqDecoderICARUSPMT const &)=delete
BEGIN_PROLOG vertical distance to the surface Name
std::unique_ptr< IDecoder > fDecoderTool
Decoder tools.
bool const fSurviveExceptions
art::EDProducer::Table< Config > Parameters
DaqDecoderICARUSPMT(Parameters const ¶ms)
art::InputTag const fInputTag
fhicl::DelegatedParameter DecoderTool
BEGIN_PROLOG could also be cout