All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
V1730Configuration.cxx
Go to the documentation of this file.
1 /**
2  * @file sbnobj/Common/PMT/Data/V1730Configuration.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/V1730Configuration.h
7  */
8 
9 // library header
11 
12 // C/C++ standard libraries
13 #include <ostream>
14 #include <cassert>
15 
16 
17 //------------------------------------------------------------------------------
19 
20 //------------------------------------------------------------------------------
21 void sbn::V1730Configuration::dump(std::ostream& out,
22  std::string const& indent, std::string const& firstIndent,
23  unsigned int verbosity /* = MaxDumpVerbosity */
24 ) const{
25 
26  do {
27  // fake look for easy break: `goto` in disguise;
28  // `break` will add a final `'\n'`, `return` will not.
29 
30  // start a new line with indentation:
31  auto const outnl
32  = [&out,&indent]() -> std::ostream& { return out << '\n' << indent; };
33 
34  unsigned int level = 0U;
35 
36 
37  // --- verbosity: 0+ -------------------------------------------------------
38  out << firstIndent
39  << "board name: '" << boardName << "' (ID: " << boardID
40  << "; fragment ID: " << fragmentID << "), "
41  << nChannels << " configured channels"
42  ;
43 
44  if (++level > verbosity) break;
45  // --- verbosity: 1+ -------------------------------------------------------
46  outnl()
47  << "waveform: " << bufferLength << " ticks (" << bufferTime()
48  << " us), post-trigger fraction: " << (postTriggerFrac*100.0)
49  << "% (" << preTriggerTime() << " + " << postTriggerTime() << " us)"
50  ;
51  out << '\n';
52  for (std::size_t iChannel = 0U; iChannel < nChannels; ++iChannel) {
53 
54  sbn::V1730channelConfiguration const& channel = channels[iChannel];
55 
56  out << indent << "[" << iChannel << "] ";
57  channel.dump(out, indent + " ", "", verbosity - 1U);
58 
59  } // for channels
60  // ends on new line
61 
62  if (++level > verbosity) return;
63  // --- verbosity: 2+ -------------------------------------------------------
64 
65  out << indent // absorb the newline from the previous level
66  << "fragment timestamp "
67  << (useTimeTagForTimeStamp? "follows": "does not follow")
68  << " the Trigger Time Tag"
69  ;
70 
71  if (++level > verbosity) break;
72  // --- verbosity: 3+ -------------------------------------------------------
73 
74  assert(level == MaxDumpVerbosity + 1U);
75 
76  // this is more debug information than anything else: verbosity was too high
77  outnl() << "No more information available (reached level " << level << ").";
78 
79  } while(false);
80 
81  out << "\n";
82 
83 } // sbn::V1730Configuration::dump()
84 
85 
86 //------------------------------------------------------------------------------
std::string boardName
Name (mnemonic) of the board.
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.
unsigned int nChannels
Number of channels (nChannels).
unsigned int boardID
Numeric ID of the board (board_id).
unsigned int fragmentID
DAQ fragment ID.
unsigned int bufferLength
Ticks in each buffer (recordLength).
Information from the configuration of a V1730 PMT readout board.
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.
float bufferTime() const
Duration of the waveform [us].
bool useTimeTagForTimeStamp
Whether fragment timestamp is synchronised with server NTP and with TTT.
static constexpr unsigned int MaxDumpVerbosity
Maximum supported verbosity level supported by dump().
float postTriggerFrac
Fraction of the waveform after the trigger signal (postPercent).
float postTriggerTime() const
Time in the waveform after the trigger [us].
static constexpr unsigned int DefaultDumpVerbosity
Default verbosity level for dump().
std::vector< sbn::V1730channelConfiguration > channels
Configuration of each channel.
Class containing configuration for a V1730 channel.
float preTriggerTime() const
Time in the waveform before the trigger [us].