Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
caldata::DumpWires Class Reference

Prints the content of all the wires on screen. More...

Inheritance diagram for caldata::DumpWires:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Classes

struct  Config
 

Public Types

using Parameters = art::EDAnalyzer::Table< Config >
 
- Public Types inherited from art::EDAnalyzer
using WorkerType = WorkerT< EDAnalyzer >
 
using ModuleType = EDAnalyzer
 

Public Member Functions

 DumpWires (Parameters const &config)
 Constructor. More...
 
virtual void analyze (art::Event const &evt) override
 Does the printing. More...
 
- Public Member Functions inherited from art::EDAnalyzer
 EDAnalyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDAnalyzer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Analyzer
virtual ~Analyzer () noexcept
 
 Analyzer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 Analyzer (Table< Config > const &config)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Observer
 ~Observer () noexcept
 
 Observer (Observer const &)=delete
 
 Observer (Observer &&)=delete
 
Observeroperator= (Observer const &)=delete
 
Observeroperator= (Observer &&)=delete
 
void registerProducts (ProductDescriptions &, ModuleDescription const &)
 
void fillDescriptions (ModuleDescription const &)
 
fhicl::ParameterSetID selectorConfig () const
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

template<typename Stream >
void PrintWire (Stream &&out, recob::Wire const &wire, std::string indent=" ", std::string firstIndent=" ") const
 Dumps a single recob:Wire to the specified output stream. More...
 

Private Attributes

art::InputTag fCalWireModuleLabel
 Input tag for wires. More...
 
std::string fOutputCategory
 Category for LogVerbatim output. More...
 
unsigned int fDigitsPerLine
 Ticks/digits per line in the output. More...
 

Additional Inherited Members

- Protected Member Functions inherited from art::Observer
std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResultsgetTriggerResults (Event const &e) const
 
 Observer (fhicl::ParameterSet const &config)
 
 Observer (std::vector< std::string > const &select_paths, std::vector< std::string > const &reject_paths, fhicl::ParameterSet const &config)
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Detailed Description

Prints the content of all the wires on screen.

This analyser prints the content of all the wires into the LogVerbatim stream.

Configuration parameters

Definition at line 71 of file DumpWires_module.cc.

Member Typedef Documentation

Definition at line 98 of file DumpWires_module.cc.

Constructor & Destructor Documentation

caldata::DumpWires::DumpWires ( Parameters const &  config)
explicit

Constructor.

Definition at line 128 of file DumpWires_module.cc.

129  : EDAnalyzer (config)
130  , fCalWireModuleLabel(config().CalWireModuleLabel())
131  , fOutputCategory (config().OutputCategory())
132  , fDigitsPerLine (config().DigitsPerLine())
133  {}
art::InputTag fCalWireModuleLabel
Input tag for wires.
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::string fOutputCategory
Category for LogVerbatim output.
static Config * config
Definition: config.cpp:1054
unsigned int fDigitsPerLine
Ticks/digits per line in the output.

Member Function Documentation

void caldata::DumpWires::analyze ( art::Event const &  evt)
overridevirtual

Does the printing.

Implements art::EDAnalyzer.

Definition at line 137 of file DumpWires_module.cc.

137  {
138 
139  auto const& Wires
140  = *(evt.getValidHandle<std::vector<recob::Wire>>(fCalWireModuleLabel));
141 
142  mf::LogVerbatim(fOutputCategory) << "Event " << evt.id()
143  << " contains " << Wires.size() << " '" << fCalWireModuleLabel.encode()
144  << "' wires";
145 
146  for (recob::Wire const& wire: Wires) {
147 
149 
150  } // for wire
151 
152 } // caldata::DumpWires::analyze()
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
art::InputTag fCalWireModuleLabel
Input tag for wires.
std::string encode() const
Definition: InputTag.cc:97
std::string fOutputCategory
Category for LogVerbatim output.
void PrintWire(Stream &&out, recob::Wire const &wire, std::string indent=" ", std::string firstIndent=" ") const
Dumps a single recob:Wire to the specified output stream.
Class holding the regions of interest of signal from a channel.
Definition: Wire.h:118
TCEvent evt
Definition: DataStructs.cxx:7
template<typename Stream >
void caldata::DumpWires::PrintWire ( Stream &&  out,
recob::Wire const &  wire,
std::string  indent = "  ",
std::string  firstIndent = "  " 
) const
private

Dumps a single recob:Wire to the specified output stream.

Definition at line 157 of file DumpWires_module.cc.

160  {
161 
162  using RegionsOfInterest_t = recob::Wire::RegionsOfInterest_t;
163 
164  RegionsOfInterest_t const & RoIs = wire.SignalROI();
165 
166  //
167  // print a header for the wire
168  //
169  out << firstIndent << "channel #" << wire.Channel() << " on view "
170  << ViewName(wire.View()) << "; " << wire.NSignal() << " time ticks";
171  if (wire.NSignal() != RoIs.size())
172  out << " [!!! EXPECTED " << RoIs.size() << "]";
173  if (RoIs.n_ranges() == 0) {
174  out << " with nothing in them";
175  return;
176  }
177  out << " with " << RoIs.n_ranges() << " regions of interest:";
178 
179  //
180  // print the list of regions of interest
181  //
182  for (RegionsOfInterest_t::datarange_t const& RoI: RoIs.get_ranges()) {
183  out << "\n" << indent
184  << " from " << RoI.offset << " for " << RoI.size() << " ticks";
185  } // for
186 
187  //
188  // print the content of the wire
189  //
190  if (fDigitsPerLine > 0) {
191 
192  std::vector<RegionsOfInterest_t::value_type> DigitBuffer(fDigitsPerLine),
193  LastBuffer;
194 
195  unsigned int repeat_count = 0; // additional lines like the last one
196  unsigned int index = 0;
198  out << "\n" << indent
199  << " content of the wire (" << fDigitsPerLine << " ticks per line):";
200  auto iTick = RoIs.cbegin(), tend = RoIs.cend();
201  while (iTick != tend) {
202  // the next line will show at most fDigitsPerLine ticks
203  unsigned int line_size
204  = std::min(fDigitsPerLine, (unsigned int) RoIs.size() - index);
205  if (line_size == 0) break; // no more ticks
206 
207  // fill the new buffer (iTick will move forward)
208  DigitBuffer.resize(line_size);
209  auto iBuf = DigitBuffer.begin(), bend = DigitBuffer.end();
210  while ((iBuf != bend) && (iTick != tend))
211  Extrema.add(*(iBuf++) = *(iTick++));
212  index += line_size;
213 
214  // if the new buffer is the same as the old one, just mark it
215  if (DigitBuffer == LastBuffer) {
216  repeat_count += 1;
217  continue;
218  }
219 
220  // if there are previous repeats, write that on screen
221  // before the new, different line
222  if (repeat_count > 0) {
223  out << "\n" << indent
224  << " [ ... repeated " << repeat_count << " more times, "
225  << (repeat_count * LastBuffer.size()) << " ticks ]";
226  repeat_count = 0;
227  }
228 
229  // dump the new line of ticks
230  out << "\n" << indent
231  << " " << std::fixed << std::setprecision(3);
232  for (auto digit: DigitBuffer) out << std::setw(8) << digit;
233 
234  // quick way to assign DigitBuffer to LastBuffer
235  // (we don't care we lose the former)
236  std::swap(LastBuffer, DigitBuffer);
237 
238  } // while
239  if (repeat_count > 0) {
240  out << "\n" << indent
241  << " [ ... repeated " << repeat_count << " more times to the end ]";
242  }
243  if (Extrema.min() < Extrema.max()) {
244  out << "\n" << indent
245  << " range of " << index
246  << " samples: [" << Extrema.min() << ";" << Extrema.max() << "]";
247  }
248  } // if dumping the ticks
249 
250 } // caldata::DumpWires::PrintWire()
Data_t max() const
Returns the accumulated maximum, or a very small number if no values.
This_t & add(Data_t value)
Include a single value in the statistics.
size_type size() const
Returns the size of the vector.
lar::sparse_vector< float > RegionsOfInterest_t
a region of interest is a pair (TDC offset, readings)
Definition: Wire.h:121
Q_EXPORT QTSManip setprecision(int p)
Definition: qtextstream.h:343
Keeps track of the minimum and maximum value we observed.
Data_t min() const
Returns the accumulated minimum, or a very large number if no values.
void swap(Handle< T > &a, Handle< T > &b)
unsigned int fDigitsPerLine
Ticks/digits per line in the output.
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55

Member Data Documentation

art::InputTag caldata::DumpWires::fCalWireModuleLabel
private

Input tag for wires.

Definition at line 109 of file DumpWires_module.cc.

unsigned int caldata::DumpWires::fDigitsPerLine
private

Ticks/digits per line in the output.

Definition at line 111 of file DumpWires_module.cc.

std::string caldata::DumpWires::fOutputCategory
private

Category for LogVerbatim output.

Definition at line 110 of file DumpWires_module.cc.


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