Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
srcs
icaruscode
icaruscode
PMT
Data
WaveformRMS.h
Go to the documentation of this file.
1
/**
2
* @file icaruscode/PMT/Data/WaveformRMS.h
3
* @brief A baseline RMS for a waveform.
4
* @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5
* @date May 9, 2022
6
* @see icaruscode/PMT/Data/WaveformRMS.cxx
7
*/
8
9
#ifndef ICARUSCODE_PMT_DATA_WAVEFORMRMS_H
10
#define ICARUSCODE_PMT_DATA_WAVEFORMRMS_H
11
12
13
// C/C++ standard libraries
14
#include <iosfwd>
// std::ostream
15
#include <cmath>
// std::round()
16
17
18
//------------------------------------------------------------------------------
19
namespace
icarus {
20
21
struct
WaveformRMS;
22
23
/// Prints the value of the RMS into a stream.
24
std::ostream&
operator
<<
25
(std::ostream& out,
icarus::WaveformRMS
const
&
baseline
);
26
27
}
// namespace icarus
28
29
/**
30
* @brief Class containing a waveform baseline RMS value.
31
* @see `icarus::WaveformBaseline`
32
*
33
* The baseline RMS is stored as a floating point value.
34
*
35
* This class is a data product wrapper for a simple value, with some usability
36
* candies attached.
37
*
38
*
39
* Example of simple usage
40
* ------------------------
41
*
42
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
43
*
44
* icarus::WaveformRMS const RMS { 3.2f };
45
*
46
* std::cout << "RMS: " << RMS << " ADC" << std::endl;
47
*
48
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49
* will print `RMS: 3.2 ADC`.
50
*/
51
struct
icarus::WaveformRMS
{
52
53
using
BaselineRMS_t
= float;
///< Type of baseline RMS value.
54
55
BaselineRMS_t
fRMS
{};
///< The current value of the baseline RMS.
56
57
58
// --- BEGIN -- Constructors -------------------------------------------------
59
60
/// Constructor: default baseline RMS (`0`).
61
WaveformRMS
() =
default
;
62
63
/// Constructor: sets the baseline RMS.
64
WaveformRMS
(
BaselineRMS_t
RMS
):
fRMS
(RMS) {}
65
66
// --- END -- Constructors ---------------------------------------------------
67
68
69
// --- BEGIN -- Access to the baseline RMS -----------------------------------
70
/**
71
* @name Access to the baseline RMS
72
*
73
* In addition to the direct method (`RMS()`) a few candies are offered:
74
* a function-like operator for baseline RMS access.
75
*
76
*/
77
/// @{
78
/// Returns the current baseline RMS value.
79
BaselineRMS_t
RMS
()
const
{
return
fRMS
; }
80
81
/// Returns the current baseline RMS value.
82
BaselineRMS_t
operator()
()
const
{
return
RMS
(); }
83
84
// --- END -- Access to the baseline RMS -------------------------------------
85
86
};
// icarus::trigger::WaveformRMS
87
88
89
//------------------------------------------------------------------------------
90
91
#endif // ICARUSCODE_PMT_DATA_WAVEFORMRMS_H
icarus::WaveformRMS::WaveformRMS
WaveformRMS()=default
Constructor: default baseline RMS (0).
icarus::WaveformRMS::RMS
BaselineRMS_t RMS() const
Definition:
WaveformRMS.h:79
icarus::WaveformRMS::operator()
BaselineRMS_t operator()() const
Returns the current baseline RMS value.
Definition:
WaveformRMS.h:82
icarus::WaveformRMS::BaselineRMS_t
float BaselineRMS_t
Type of baseline RMS value.
Definition:
WaveformRMS.h:53
icarus::WaveformRMS::fRMS
BaselineRMS_t fRMS
The current value of the baseline RMS.
Definition:
WaveformRMS.h:55
baseline
BEGIN_PROLOG baseline
Definition:
OnlineDecoder.fcl:14
icarus::WaveformRMS
Class containing a waveform baseline RMS value.
Definition:
WaveformRMS.h:51
icarus::WaveformRMS::WaveformRMS
WaveformRMS(BaselineRMS_t RMS)
Constructor: sets the baseline RMS.
Definition:
WaveformRMS.h:64
Generated by
1.8.5