All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
sbn::PMTconfiguration Struct Reference

Class containing configuration for PMT readout. More...

#include <PMTconfiguration.h>

Public Member Functions

void dump (std::ostream &out, std::string const &indent, std::string const &firstIndent, unsigned int verbosity=MaxDumpVerbosity) const
 Dumps the content of the configuration into out stream. More...
 
void dump (std::ostream &out, std::string const &indent="") const
 Dumps the content of the configuration into out stream. More...
 
void dump (std::ostream &out, unsigned int verbosity, std::string const &indent="") const
 Dumps the content of the configuration into out stream. More...
 
bool operator== (PMTconfiguration const &other) const
 Comparison: all fields need to have the same values. More...
 
bool operator!= (PMTconfiguration const &other) const
 

Public Attributes

std::vector
< sbn::V1730Configuration
boards
 Configuration of all PMT readout boards. More...
 

Static Public Attributes

static constexpr unsigned int MaxDumpVerbosity = V1730Configuration::MaxDumpVerbosity + 1U
 Maximum supported verbosity level supported by dump(). More...
 
static constexpr unsigned int DefaultDumpVerbosity = MaxDumpVerbosity
 Default verbosity level for dump(). More...
 

Detailed Description

Class containing configuration for PMT readout.

This is an informative class containing configuration of all V1730 boards extracted from some other source (typically, DAQ) made readily available to the users.

This class does not include any configuration extraction code.

The class is default-constructible only, and its content needs to be added element by element.

Definition at line 45 of file PMTconfiguration.h.

Member Function Documentation

void sbn::PMTconfiguration::dump ( std::ostream &  out,
std::string const &  indent,
std::string const &  firstIndent,
unsigned int  verbosity = MaxDumpVerbosity 
) const

Dumps the content of the configuration into out stream.

Parameters
outstream to dump the information into
indentindentation string
firstIndentspecial indentation string for the first line
verbosity(default: DefaultDumpVerbosity) level of verbosity

The indentation string is prepended to each new line of the dump. The first line indentation string is prepended before the first line of the dump. The dump ends on a new empty line.

The amount of information printed depends on the verbosity level:

  • 0: only the number of boards in the configuration
  • 1: information on each board, as in V1730Configuration::dump() with verbosity one level smaller than the value of verbosity argument

Definition at line 22 of file PMTconfiguration.cxx.

25  {
26 
27  do { // fake look for easy break: `goto` in disguise
28 
29  // start a new line with indentation:
30  auto const outnl
31  = [&out,&indent]() -> std::ostream& { return out << '\n' << indent; };
32 
33  unsigned int level = 0U;
34 
35 
36  // --- verbosity: 0+ -------------------------------------------------------
37  std::size_t const nReadoutBoards = boards.size();
38  out << firstIndent
39  << nReadoutBoards << " readout board configurations"
40  ;
41 
42  if (++level > verbosity) break;
43  // --- verbosity: 1+ -------------------------------------------------------
44  out << ":"
45  << "\n"; // since V1730Configuration::dump() ends line...
46  for (std::size_t iBoard = 0U; iBoard != nReadoutBoards; ++iBoard) {
47 
48  sbn::V1730Configuration const& boardConfig
49  = boards[iBoard];
50  out << indent << "[B" << iBoard << "]: ";
51  boardConfig.dump(out, indent + " ", "", verbosity - 1U);
52 
53  } // for
54 
55  if (++level > verbosity) break;
56  // --- verbosity: 2+ -------------------------------------------------------
57 
58  // nothing special here, but still counts
59 
60  if (++level > verbosity) break;
61  // --- verbosity: 3+ -------------------------------------------------------
62 
63  // nothing special here, but still counts
64 
65  if (++level > verbosity) break;
66  // --- verbosity: 4+ -------------------------------------------------------
67  assert(level == MaxDumpVerbosity + 1U);
68 
69  // this is more debug information than anything else: verbosity was too high
70  outnl() << "No more information available (reached level " << level << ").";
71 
72  } while(false);
73 
74  out << "\n";
75 
76 } // sbn::PMTconfiguration::dump()
void dump(std::ostream &out, std::string const &indent, std::string const &firstIndent, unsigned int verbosity=MaxDumpVerbosity) const
Dumps the content of the configuration into out stream.
static constexpr unsigned int MaxDumpVerbosity
Maximum supported verbosity level supported by dump().
std::vector< sbn::V1730Configuration > boards
Configuration of all PMT readout boards.
Class containing configuration for a V1730 board.
void sbn::PMTconfiguration::dump ( std::ostream &  out,
std::string const &  indent = "" 
) const
inline

Dumps the content of the configuration into out stream.

Parameters
outstream to dump the information into
indentindentation level
See Also
dump(std::ostream&, std::string const&, std::string const&, unsigned int) const

Version of dump() with same first indentation level as the rest, and default verbosity.

Definition at line 111 of file PMTconfiguration.h.

112  { dump(out, indent, indent); }
void dump(std::ostream &out, std::string const &indent, std::string const &firstIndent, unsigned int verbosity=MaxDumpVerbosity) const
Dumps the content of the configuration into out stream.
void sbn::PMTconfiguration::dump ( std::ostream &  out,
unsigned int  verbosity,
std::string const &  indent = "" 
) const
inline

Dumps the content of the configuration into out stream.

Parameters
outstream to dump the information into
indent(default: none) indentation string
See Also
dump(std::ostream&, std::string const&, std::string const&, unsigned int) const

Version of dump() with the specified verbosity level and same first indentation level as the rest.

Definition at line 123 of file PMTconfiguration.h.

127  { dump(out, indent, indent, verbosity); }
void dump(std::ostream &out, std::string const &indent, std::string const &firstIndent, unsigned int verbosity=MaxDumpVerbosity) const
Dumps the content of the configuration into out stream.
bool sbn::PMTconfiguration::operator!= ( PMTconfiguration const &  other) const
inline

Definition at line 60 of file PMTconfiguration.h.

61  { return ! this->operator== (other); }
bool operator==(PMTconfiguration const &other) const
Comparison: all fields need to have the same values.
bool sbn::PMTconfiguration::operator== ( sbn::PMTconfiguration const &  other) const
inline

Comparison: all fields need to have the same values.

Definition at line 139 of file PMTconfiguration.h.

140 {
141 
142  if (boards != other.boards) return false;
143 
144  return true;
145 } // sbn::PMTconfiguration::operator==()
std::vector< sbn::V1730Configuration > boards
Configuration of all PMT readout boards.

Member Data Documentation

std::vector<sbn::V1730Configuration> sbn::PMTconfiguration::boards

Configuration of all PMT readout boards.

Definition at line 52 of file PMTconfiguration.h.

constexpr unsigned int sbn::PMTconfiguration::DefaultDumpVerbosity = MaxDumpVerbosity
static

Default verbosity level for dump().

Definition at line 76 of file PMTconfiguration.h.

constexpr unsigned int sbn::PMTconfiguration::MaxDumpVerbosity = V1730Configuration::MaxDumpVerbosity + 1U
static

Maximum supported verbosity level supported by dump().

Definition at line 73 of file PMTconfiguration.h.


The documentation for this struct was generated from the following files: