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::V1730channelConfiguration Struct Reference

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

#include <V1730channelConfiguration.h>

Public Member Functions

bool hasChannelID () const
 Returns whether the channel ID is set. More...
 
short signed int relativeThreshold () const
 Threshold relative to the baseline (ticks). 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== (V1730channelConfiguration const &other) const
 Comparison: all fields need to have the same values. More...
 
bool operator!= (V1730channelConfiguration const &other) const
 

Public Attributes

short unsigned int channelNo = std::numeric_limits<short unsigned int>::max()
 Number of the channel on the board (0-15). More...
 
raw::Channel_t channelID = NoChannelID
 Offline channel ID. More...
 
short signed int baseline = 0
 Baseline (BaselineCh<N+1>). More...
 
short signed int threshold = 0
 Threshold (triggerThreshold<N>). More...
 
bool enabled = false
 Channel is enabled (enable). More...
 

Static Public Attributes

static constexpr auto NoChannelID = std::numeric_limits<raw::Channel_t>::max()
 Special value for unassigned channel ID. More...
 
static constexpr unsigned int 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 channel.

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

Member Function Documentation

void sbn::V1730channelConfiguration::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: channel number and whether it is enabled or not (also off-line channel ID if available)
  • 1: also baseline and threshold

Definition at line 21 of file V1730channelConfiguration.cxx.

24  {
25 
26  do { // fake look for easy break: `goto` in disguise
27 
28  // start a new line with indentation:
29  auto const outnl
30  = [&out,&indent]() -> std::ostream& { return out << '\n' << indent; };
31 
32  unsigned int level = 0U;
33 
34  // --- verbosity: 0+ -------------------------------------------------------
35  out << firstIndent
36  << "board channel #" << channelNo
37  << " (" << (enabled? "enabled": "disabled") << ")"
38  ;
39  if (hasChannelID()) out << ", offline ID: " << channelID;
40 
41  if (++level > verbosity) break;
42  // --- verbosity: 1+ -------------------------------------------------------
43  out << ", baseline: " << baseline << ", threshold: " << threshold
44  << " (delta=" << relativeThreshold() << ")"
45  ;
46 
47  if (++level > verbosity) break;
48  // --- verbosity: 2+ -------------------------------------------------------
49 
50  assert(level == MaxDumpVerbosity + 1U);
51 
52  // this is more debug information than anything else: verbosity was too high
53  outnl() << "No more information available (reached level " << level << ").";
54 
55  } while(false);
56 
57  out << "\n";
58 
59 } // sbn::V1730channelConfiguration::dump()
short signed int threshold
Threshold (triggerThreshold&lt;N&gt;).
short unsigned int channelNo
Number of the channel on the board (0-15).
short signed int relativeThreshold() const
Threshold relative to the baseline (ticks).
static constexpr unsigned int MaxDumpVerbosity
Maximum supported verbosity level supported by dump().
short signed int baseline
Baseline (BaselineCh&lt;N+1&gt;).
bool enabled
Channel is enabled (enable).
raw::Channel_t channelID
Offline channel ID.
bool hasChannelID() const
Returns whether the channel ID is set.
void sbn::V1730channelConfiguration::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 138 of file V1730channelConfiguration.h.

139  { 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::V1730channelConfiguration::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 150 of file V1730channelConfiguration.h.

154  { 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::V1730channelConfiguration::hasChannelID ( ) const
inline

Returns whether the channel ID is set.

Definition at line 165 of file V1730channelConfiguration.h.

166  { return channelID != NoChannelID; }
static constexpr auto NoChannelID
Special value for unassigned channel ID.
raw::Channel_t channelID
Offline channel ID.
bool sbn::V1730channelConfiguration::operator!= ( V1730channelConfiguration const &  other) const
inline

Definition at line 88 of file V1730channelConfiguration.h.

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

Comparison: all fields need to have the same values.

Definition at line 177 of file V1730channelConfiguration.h.

178 {
179  if (channelNo != other.channelNo) return false;
180  if (channelID != other.channelID) return false;
181  if (baseline != other.baseline ) return false;
182  if (threshold != other.threshold) return false;
183  if (enabled != other.enabled ) return false;
184 
185  return true;
186 } // sbn::V1730channelConfiguration::operator==()
short signed int threshold
Threshold (triggerThreshold&lt;N&gt;).
short unsigned int channelNo
Number of the channel on the board (0-15).
short signed int baseline
Baseline (BaselineCh&lt;N+1&gt;).
bool enabled
Channel is enabled (enable).
raw::Channel_t channelID
Offline channel ID.
short signed int sbn::V1730channelConfiguration::relativeThreshold ( ) const
inline

Threshold relative to the baseline (ticks).

Definition at line 171 of file V1730channelConfiguration.h.

172  { return baseline - threshold; }
short signed int threshold
Threshold (triggerThreshold&lt;N&gt;).
short signed int baseline
Baseline (BaselineCh&lt;N+1&gt;).

Member Data Documentation

short signed int sbn::V1730channelConfiguration::baseline = 0

Baseline (BaselineCh<N+1>).

Definition at line 62 of file V1730channelConfiguration.h.

raw::Channel_t sbn::V1730channelConfiguration::channelID = NoChannelID

Offline channel ID.

Definition at line 59 of file V1730channelConfiguration.h.

short unsigned int sbn::V1730channelConfiguration::channelNo = std::numeric_limits<short unsigned int>::max()

Number of the channel on the board (0-15).

Definition at line 56 of file V1730channelConfiguration.h.

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

Default verbosity level for dump().

Definition at line 103 of file V1730channelConfiguration.h.

bool sbn::V1730channelConfiguration::enabled = false

Channel is enabled (enable).

Definition at line 68 of file V1730channelConfiguration.h.

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

Maximum supported verbosity level supported by dump().

Definition at line 100 of file V1730channelConfiguration.h.

constexpr auto sbn::V1730channelConfiguration::NoChannelID = std::numeric_limits<raw::Channel_t>::max()
static

Special value for unassigned channel ID.

Definition at line 49 of file V1730channelConfiguration.h.

short signed int sbn::V1730channelConfiguration::threshold = 0

Threshold (triggerThreshold<N>).

Definition at line 65 of file V1730channelConfiguration.h.


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