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

Class containing configuration for a V1730 board. More...

#include <V1730Configuration.h>

Public Member Functions

unsigned int preTriggerTicks () const
 Ticks in the waveform before the trigger. More...
 
unsigned int postTriggerTicks () const
 Ticks in the waveform after the trigger. More...
 
float bufferTime () const
 Duration of the waveform [us]. More...
 
float preTriggerTime () const
 Time in the waveform before the trigger [us]. More...
 
float postTriggerTime () const
 Time in the waveform after the trigger [us]. More...
 
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== (V1730Configuration const &other) const
 Comparison: all fields need to have the same values. More...
 
bool operator!= (V1730Configuration const &other) const
 

Static Public Member Functions

static float ticks2us (int ticks)
 Convert a number of ticks into a time interval in microseconds. More...
 

Public Attributes

std::string boardName
 Name (mnemonic) of the board. More...
 
unsigned int boardID = std::numeric_limits<unsigned int>::max()
 Numeric ID of the board (board_id). More...
 
unsigned int fragmentID = std::numeric_limits<unsigned int>::max()
 DAQ fragment ID. More...
 
unsigned int bufferLength = 0U
 Ticks in each buffer (recordLength). More...
 
float postTriggerFrac = 0.0f
 Fraction of the waveform after the trigger signal (postPercent). More...
 
unsigned int nChannels = 0U
 Number of channels (nChannels). More...
 
bool useTimeTagForTimeStamp = false
 Whether fragment timestamp is synchronised with server NTP and with TTT. More...
 
std::vector
< sbn::V1730channelConfiguration
channels
 Configuration of each channel. More...
 

Static Public Attributes

static constexpr unsigned int MaxDumpVerbosity = V1730channelConfiguration::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 a V1730 board.

This is an informative class containing configuration of a V1730 board 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 V1730Configuration.h.

Member Function Documentation

float sbn::V1730Configuration::bufferTime ( ) const
inline

Duration of the waveform [us].

Definition at line 199 of file V1730Configuration.h.

200  { return ticks2us(bufferLength); }
unsigned int bufferLength
Ticks in each buffer (recordLength).
static float ticks2us(int ticks)
Convert a number of ticks into a time interval in microseconds.
void sbn::V1730Configuration::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: name of the board, board and fragment ID, number of channels
  • 1: waveform length and post-trigger fraction; also: information on each channel, one per line, as with V1730channelConfiguration::dump() with verbosity one level smaller than the value ofverbosityargument *2`: also setting of fragment timestamp

Definition at line 21 of file V1730Configuration.cxx.

24  {
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()
std::string boardName
Name (mnemonic) of the board.
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).
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].
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].
void sbn::V1730Configuration::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 158 of file V1730Configuration.h.

159  { 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::V1730Configuration::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 170 of file V1730Configuration.h.

174  { 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::V1730Configuration::operator!= ( V1730Configuration const &  other) const
inline

Definition at line 104 of file V1730Configuration.h.

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

Comparison: all fields need to have the same values.

Definition at line 215 of file V1730Configuration.h.

216 {
217 
218  if (boardName != other.boardName ) return false;
219  if (boardID != other.boardID ) return false;
220  if (fragmentID != other.fragmentID ) return false;
221  if (bufferLength != other.bufferLength ) return false;
222  if (postTriggerFrac != other.postTriggerFrac ) return false;
223  if (useTimeTagForTimeStamp != other.useTimeTagForTimeStamp) return false;
224  if (nChannels != other.nChannels ) return false;
225  if (channels != other.channels ) return false;
226 
227  return true;
228 } // sbn::V1730Configuration::operator==()
std::string boardName
Name (mnemonic) of the board.
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).
bool useTimeTagForTimeStamp
Whether fragment timestamp is synchronised with server NTP and with TTT.
float postTriggerFrac
Fraction of the waveform after the trigger signal (postPercent).
std::vector< sbn::V1730channelConfiguration > channels
Configuration of each channel.
unsigned int sbn::V1730Configuration::postTriggerTicks ( ) const
inline

Ticks in the waveform after the trigger.

Definition at line 194 of file V1730Configuration.h.

195  { return static_cast<unsigned int>(postTriggerFrac * bufferLength); }
unsigned int bufferLength
Ticks in each buffer (recordLength).
float postTriggerFrac
Fraction of the waveform after the trigger signal (postPercent).
float sbn::V1730Configuration::postTriggerTime ( ) const
inline

Time in the waveform after the trigger [us].

Definition at line 209 of file V1730Configuration.h.

210  { return ticks2us(postTriggerTicks()); }
unsigned int postTriggerTicks() const
Ticks in the waveform after the trigger.
static float ticks2us(int ticks)
Convert a number of ticks into a time interval in microseconds.
unsigned int sbn::V1730Configuration::preTriggerTicks ( ) const
inline

Ticks in the waveform before the trigger.

Definition at line 189 of file V1730Configuration.h.

190  { return static_cast<unsigned int>((1.0f - postTriggerFrac) * bufferLength); }
unsigned int bufferLength
Ticks in each buffer (recordLength).
float postTriggerFrac
Fraction of the waveform after the trigger signal (postPercent).
float sbn::V1730Configuration::preTriggerTime ( ) const
inline

Time in the waveform before the trigger [us].

Definition at line 204 of file V1730Configuration.h.

205  { return ticks2us(preTriggerTicks()); }
unsigned int preTriggerTicks() const
Ticks in the waveform before the trigger.
static float ticks2us(int ticks)
Convert a number of ticks into a time interval in microseconds.
static float sbn::V1730Configuration::ticks2us ( int  ticks)
inlinestatic

Convert a number of ticks into a time interval in microseconds.

Definition at line 180 of file V1730Configuration.h.

180 { return ticks * 0.002f; }
tick ticks
Alias for common language habits.
Definition: electronics.h:78

Member Data Documentation

unsigned int sbn::V1730Configuration::boardID = std::numeric_limits<unsigned int>::max()

Numeric ID of the board (board_id).

Definition at line 55 of file V1730Configuration.h.

std::string sbn::V1730Configuration::boardName

Name (mnemonic) of the board.

Definition at line 52 of file V1730Configuration.h.

unsigned int sbn::V1730Configuration::bufferLength = 0U

Ticks in each buffer (recordLength).

Definition at line 61 of file V1730Configuration.h.

std::vector<sbn::V1730channelConfiguration> sbn::V1730Configuration::channels

Configuration of each channel.

Definition at line 73 of file V1730Configuration.h.

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

Default verbosity level for dump().

Definition at line 120 of file V1730Configuration.h.

unsigned int sbn::V1730Configuration::fragmentID = std::numeric_limits<unsigned int>::max()

DAQ fragment ID.

Definition at line 58 of file V1730Configuration.h.

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

Maximum supported verbosity level supported by dump().

Definition at line 117 of file V1730Configuration.h.

unsigned int sbn::V1730Configuration::nChannels = 0U

Number of channels (nChannels).

Definition at line 67 of file V1730Configuration.h.

float sbn::V1730Configuration::postTriggerFrac = 0.0f

Fraction of the waveform after the trigger signal (postPercent).

Definition at line 64 of file V1730Configuration.h.

bool sbn::V1730Configuration::useTimeTagForTimeStamp = false

Whether fragment timestamp is synchronised with server NTP and with TTT.

Definition at line 70 of file V1730Configuration.h.


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