16 #include "art/Framework/Principal/Event.h"
17 #include "art/Framework/Principal/Handle.h"
18 #include "art/Framework/Core/ModuleMacros.h"
19 #include "art/Framework/Core/EDAnalyzer.h"
20 #include "canvas/Persistency/Provenance/ProductToken.h"
21 #include "canvas/Persistency/Provenance/EventID.h"
22 #include "canvas/Utilities/InputTag.h"
23 #include "messagefacility/MessageLogger/MessageLogger.h"
24 #include "fhiclcpp/types/Sequence.h"
25 #include "fhiclcpp/types/Atom.h"
34 namespace sbn {
class DumpArtDAQfragments; }
74 Comment(
"tag of fragment collection data products to be dumped")
78 Name(
"OutputCategory"),
79 Comment(
"name of the category used for the output"),
98 virtual void analyze(art::Event
const& event)
override;
121 (std::vector<art::InputTag>
const& tags);
125 art::Event
const& event,
126 art::InputTag
const& inputTag,
127 art::ProductToken<artdaq::Fragments>
const& inputToken
140 : art::EDAnalyzer(config)
142 , fInputTags (config().FragmentTags())
143 , fInputTokens (getFragmentTokens(fInputTags))
144 , fOutputCategory(config().OutputCategory())
146 assert(fInputTags.size() == fInputTokens.size());
163 art::Event
const& event,
164 art::InputTag
const& inputTag,
165 art::ProductToken<artdaq::Fragments>
const& inputToken
168 art::Handle<artdaq::Fragments> fragmentHandle;
171 if ( !(fragmentHandle = event.getHandle<artdaq::Fragments>(inputToken)) ) {
172 mf::LogVerbatim(fOutputCategory)
173 <<
"No fragment collection found as '" << inputTag.encode() <<
"'.";
177 artdaq::Fragments
const& fragments = *fragmentHandle;
178 mf::LogVerbatim log { fOutputCategory };
179 log <<
"Data product '" << inputTag.encode() <<
"' has " << fragments.size()
181 for (
auto const& [ iFragment, fragment ]:
util::enumerate(fragments)) {
190 std::vector<art::ProductToken<artdaq::Fragments>>
192 (std::vector<art::InputTag>
const& tags)
194 auto getToken = [
this](art::InputTag
const& tag)
195 {
return consumes<artdaq::Fragments>(tag); };
197 std::vector<art::ProductToken<artdaq::Fragments>> tokens;
std::vector< art::ProductToken< artdaq::Fragments > > const fInputTokens
Input data tokens.
Definition of util::zip().
fhicl::Atom< std::string > OutputCategory
Definition of util::enumerate().
std::string const fOutputCategory
Category used for message facility stream.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
fhicl::Sequence< art::InputTag > FragmentTags
void dumpFragments(art::Event const &event, art::InputTag const &inputTag, art::ProductToken< artdaq::Fragments > const &inputToken) const
Dumps a single fragment collection.
std::vector< art::InputTag > const fInputTags
Input data tokens.
Dumps on console the content of artdaq::Fragment collections.
auto end(FixedBins< T, C > const &) noexcept
BEGIN_PROLOG vertical distance to the surface Name
std::vector< art::ProductToken< artdaq::Fragments > > getFragmentTokens(std::vector< art::InputTag > const &tags)
Get art tokens for specified input data products.
Utility to dump a artDAQ fragment on screen.
virtual void analyze(art::Event const &event) override
Does nothing, but it is mandatory.
auto begin(FixedBins< T, C > const &) noexcept
art::EDAnalyzer::Table< Config > Parameters
details::DumpFragWrap dumpFragment(artdaq::Fragment const &frag)
Dump a artDAQ fragment into an output stream.
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
DumpArtDAQfragments(Parameters const &config)