All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PMTconfiguration.cxx
Go to the documentation of this file.
1 /**
2  * @file sbnobj/Common/PMT/Data/PMTconfiguration.cxx
3  * @brief Information from the configuration of a V1730 PMT readout board.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date February 18, 2021
6  * @see sbnobj/Common/PMT/Data/PMTconfiguration.h
7  */
8 
9 
10 // library header
12 
13 // C/C++ standard libraries
14 #include <ostream>
15 #include <cassert>
16 
17 
18 //------------------------------------------------------------------------------
20 
21 //------------------------------------------------------------------------------
22 void sbn::PMTconfiguration::dump(std::ostream& out,
23  std::string const& indent, std::string const& firstIndent,
24  unsigned int verbosity /* = MaxDumpVerbosity */
25 ) const{
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()
77 
78 
79 //------------------------------------------------------------------------------
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().
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.
Information from the configuration of PMT readout.
static constexpr unsigned int DefaultDumpVerbosity
Default verbosity level for dump().
std::vector< sbn::V1730Configuration > boards
Configuration of all PMT readout boards.
Class containing configuration for a V1730 board.