All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
sbn::DumpArtDAQfragments Class Reference

Dumps on console the content of artdaq::Fragment collections. More...

Inheritance diagram for sbn::DumpArtDAQfragments:

Classes

struct  Config
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 

Public Member Functions

 DumpArtDAQfragments (Parameters const &config)
 
virtual void analyze (art::Event const &event) override
 Does nothing, but it is mandatory. More...
 

Private Member Functions

std::vector< art::ProductToken
< artdaq::Fragments > > 
getFragmentTokens (std::vector< art::InputTag > const &tags)
 Get art tokens for specified input data products. More...
 
void dumpFragments (art::Event const &event, art::InputTag const &inputTag, art::ProductToken< artdaq::Fragments > const &inputToken) const
 Dumps a single fragment collection. More...
 

Private Attributes

std::vector< art::InputTag > const fInputTags
 Input data tokens. More...
 
std::vector< art::ProductToken
< artdaq::Fragments > > const 
fInputTokens
 Input data tokens. More...
 
std::string const fOutputCategory
 Category used for message facility stream. More...
 

Detailed Description

Dumps on console the content of artdaq::Fragment collections.

Input data products

Configuration parameters

A terse description of the parameters is printed by running lar --print-description DumpArtDAQfragments.

Definition at line 62 of file DumpArtDAQfragments_module.cc.

Member Typedef Documentation

using sbn::DumpArtDAQfragments::Parameters = art::EDAnalyzer::Table<Config>

Definition at line 85 of file DumpArtDAQfragments_module.cc.

Constructor & Destructor Documentation

sbn::DumpArtDAQfragments::DumpArtDAQfragments ( Parameters const &  config)
explicit

Definition at line 139 of file DumpArtDAQfragments_module.cc.

140  : art::EDAnalyzer(config)
141  // configuration
142  , fInputTags (config().FragmentTags())
144  , fOutputCategory(config().OutputCategory())
145 {
146  assert(fInputTags.size() == fInputTokens.size());
147 } // sbn::DumpArtDAQfragments::DumpArtDAQfragments()
std::vector< art::ProductToken< artdaq::Fragments > > const fInputTokens
Input data tokens.
std::string const fOutputCategory
Category used for message facility stream.
std::vector< art::InputTag > const fInputTags
Input data tokens.
std::vector< art::ProductToken< artdaq::Fragments > > getFragmentTokens(std::vector< art::InputTag > const &tags)
Get art tokens for specified input data products.

Member Function Documentation

void sbn::DumpArtDAQfragments::analyze ( art::Event const &  event)
overridevirtual

Does nothing, but it is mandatory.

Definition at line 151 of file DumpArtDAQfragments_module.cc.

151  {
152 
153  mf::LogVerbatim(fOutputCategory) << event.id() << ":";
154 
155  for (auto const& [ tag, token ]: util::zip(fInputTags, fInputTokens))
156  dumpFragments(event, tag, token);
157 
158 } // sbn::DumpArtDAQfragments::analyze()
std::vector< art::ProductToken< artdaq::Fragments > > const fInputTokens
Input data tokens.
std::string const fOutputCategory
Category used for message facility stream.
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.
auto zip(Iterables &&...iterables)
Range-for loop helper iterating across many collections at the same time.
Definition: zip.h:295
void sbn::DumpArtDAQfragments::dumpFragments ( art::Event const &  event,
art::InputTag const &  inputTag,
art::ProductToken< artdaq::Fragments > const &  inputToken 
) const
private

Dumps a single fragment collection.

Definition at line 162 of file DumpArtDAQfragments_module.cc.

166  {
167 
168  art::Handle<artdaq::Fragments> fragmentHandle;
169  //bool found = event.getByToken(inputToken, fragmentHandle);
170 
171  if ( !(fragmentHandle = event.getHandle<artdaq::Fragments>(inputToken)) ) {
172  mf::LogVerbatim(fOutputCategory)
173  << "No fragment collection found as '" << inputTag.encode() << "'.";
174  return;
175  }
176 
177  artdaq::Fragments const& fragments = *fragmentHandle;
178  mf::LogVerbatim log { fOutputCategory };
179  log << "Data product '" << inputTag.encode() << "' has " << fragments.size()
180  << " fragments.";
181  for (auto const& [ iFragment, fragment ]: util::enumerate(fragments)) {
182  // TODO special case for artdaq::ContainerFragment?
183  log << "\n[#" << iFragment << "] " << sbndaq::dumpFragment(fragment);
184  } // for
185 
186 } // sbn::DumpArtDAQfragments::dumpFragments()
std::string const fOutputCategory
Category used for message facility stream.
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
details::DumpFragWrap dumpFragment(artdaq::Fragment const &frag)
Dump a artDAQ fragment into an output stream.
std::vector< art::ProductToken< artdaq::Fragments > > sbn::DumpArtDAQfragments::getFragmentTokens ( std::vector< art::InputTag > const &  tags)
private

Get art tokens for specified input data products.

Definition at line 192 of file DumpArtDAQfragments_module.cc.

193 {
194  auto getToken = [this](art::InputTag const& tag)
195  { return consumes<artdaq::Fragments>(tag); };
196 
197  std::vector<art::ProductToken<artdaq::Fragments>> tokens;
198  std::transform(begin(tags), end(tags), back_inserter(tokens), getToken);
199  return tokens;
200 } // sbn::DumpArtDAQfragments::getFragmentTokens()
static constexpr Sample_t transform(Sample_t sample)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573

Member Data Documentation

std::vector<art::InputTag> const sbn::DumpArtDAQfragments::fInputTags
private

Input data tokens.

Definition at line 108 of file DumpArtDAQfragments_module.cc.

std::vector<art::ProductToken<artdaq::Fragments> > const sbn::DumpArtDAQfragments::fInputTokens
private

Input data tokens.

Definition at line 111 of file DumpArtDAQfragments_module.cc.

std::string const sbn::DumpArtDAQfragments::fOutputCategory
private

Category used for message facility stream.

Definition at line 114 of file DumpArtDAQfragments_module.cc.


The documentation for this class was generated from the following file: