Extend Stat helper by an equidistant binned histogram.
More...
#include <StatUtils.h>
|
| | StatHist ()=default |
| | The default constructor will disable histogramming.
|
| | StatHist (unsigned int n_bins, float xmin, float xmax) |
| | Set up class to also fill a histogram.
|
| void | setBinning (unsigned int n_bins, float xmin, float xmax) |
| | Define histogramm bins and enable histogramming.
|
| StatHist | createEmptyClone () |
| void | add (double val) |
| | Gather statistics and fill the histogram if not disabled.
|
| void | reset () |
| | Set histogram contents and statistics to zero.
|
| StatHist & | operator+= (const StatHist &b) |
| | Add the statistucs and histogrammed data fro the given object.
|
| double | lowerEdge (unsigned int i) const |
| | Get the lower edge of the given bin.
|
| std::string | histogramToString () const |
| | Create a string showing the contents of the histogram The string.
|
| unsigned int | n () const |
| double | min () const |
| double | max () const |
| double | mean () const |
| double | rms2 () const |
| double | rms () const |
| Stat & | operator+= (const Stat &b) |
| | @breif Add the statistics gathered in the Stat object b
|
Extend Stat helper by an equidistant binned histogram.
Definition at line 81 of file StatUtils.h.
◆ StatHist() [1/2]
| ActsUtils::StatHist::StatHist |
( |
| ) |
|
|
default |
The default constructor will disable histogramming.
◆ StatHist() [2/2]
| ActsUtils::StatHist::StatHist |
( |
unsigned int | n_bins, |
|
|
float | xmin, |
|
|
float | xmax ) |
|
inline |
Set up class to also fill a histogram.
- Parameters
-
| n_bins | number of bins without over and underflow |
| the | value at the lower edge of the first bin |
| the | value at the upper edge of the last bin |
Definition at line 90 of file StatUtils.h.
91 {
93 }
void setBinning(unsigned int n_bins, float xmin, float xmax)
Define histogramm bins and enable histogramming.
◆ add()
| void ActsUtils::StatHist::add |
( |
double | val | ) |
|
|
inline |
Gather statistics and fill the histogram if not disabled.
Definition at line 117 of file StatUtils.h.
117 {
120 unsigned int bin = std::min(
static_cast<unsigned int>(
m_histogram.size()-1),
121 static_cast<unsigned int>( std::max(0.,(val -
m_xmin)*
m_scale)) );
123 }
124 }
std::vector< unsigned int > m_histogram
void add(double val)
@bruef Gather a new value will update min, max and the sums to compute mean and rms
◆ createEmptyClone()
| StatHist ActsUtils::StatHist::createEmptyClone |
( |
| ) |
|
|
inline |
Definition at line 108 of file StatUtils.h.
108 {
114 }
StatHist()=default
The default constructor will disable histogramming.
◆ histogramToString()
| std::string ActsUtils::StatHist::histogramToString |
( |
| ) |
const |
|
inline |
Create a string showing the contents of the histogram The string.
Definition at line 153 of file StatUtils.h.
153 {
154 std::stringstream
msg;
158 const unsigned int w = max_val > 0 ?
static_cast<unsigned int>(
log(1.*max_val) /
log(10.))+1 : 1;
159 const unsigned int wtitle = std::max(10u, w);
161 << std::setw(wtitle) << "lower edge" << " |";
164 }
165 msg <<
" | " << std::endl;
167
171 }
173 }
175 }
double lowerEdge(unsigned int i) const
Get the lower edge of the given bin.
◆ lowerEdge()
| double ActsUtils::StatHist::lowerEdge |
( |
unsigned int | i | ) |
const |
|
inline |
Get the lower edge of the given bin.
- Parameters
-
| i | the bin (0: underflow; n+1 overflow) |
Definition at line 147 of file StatUtils.h.
◆ max()
| double ActsUtils::Stat::max |
( |
| ) |
const |
|
inlineinherited |
◆ mean()
| double ActsUtils::Stat::mean |
( |
| ) |
const |
|
inlineinherited |
◆ min()
| double ActsUtils::Stat::min |
( |
| ) |
const |
|
inlineinherited |
◆ n()
| unsigned int ActsUtils::Stat::n |
( |
| ) |
const |
|
inlineinherited |
◆ operator+=() [1/2]
| Stat & ActsUtils::Stat::operator+= |
( |
const Stat & | b | ) |
|
|
inlineinherited |
@breif Add the statistics gathered in the Stat object b
Definition at line 45 of file StatUtils.h.
45 {
51 return *this;
52 }
◆ operator+=() [2/2]
Add the statistucs and histogrammed data fro the given object.
Definition at line 135 of file StatUtils.h.
135 {
138 for (
unsigned int bin_i=0; bin_i<
m_histogram.size(); ++bin_i) {
140 }
141 }
142 return *this;
143 }
Stat & operator+=(const Stat &b)
@breif Add the statistics gathered in the Stat object b
◆ reset()
| void ActsUtils::StatHist::reset |
( |
| ) |
|
|
inline |
Set histogram contents and statistics to zero.
Definition at line 127 of file StatUtils.h.
127 {
131 }
132 }
void reset()
Set statistics to zero.
@ u
Enums for curvilinear frames.
◆ rms()
| double ActsUtils::Stat::rms |
( |
| ) |
const |
|
inlineinherited |
◆ rms2()
| double ActsUtils::Stat::rms2 |
( |
| ) |
const |
|
inlineinherited |
◆ setBinning()
| void ActsUtils::StatHist::setBinning |
( |
unsigned int | n_bins, |
|
|
float | xmin, |
|
|
float | xmax ) |
|
inline |
Define histogramm bins and enable histogramming.
- Parameters
-
| n_bins | number of bins without over and underflow |
| the | value at the lower edge of the first bin |
| the | value at the upper edge of the last bin |
Definition at line 99 of file StatUtils.h.
◆ m_histogram
| std::vector<unsigned int> ActsUtils::StatHist::m_histogram |
◆ m_max
| double ActsUtils::Stat::m_max =-std::numeric_limits<double>::max() |
|
inherited |
◆ m_min
| double ActsUtils::Stat::m_min =std::numeric_limits<double>::max() |
|
inherited |
◆ m_n
| unsigned int ActsUtils::Stat::m_n =0 |
|
inherited |
◆ m_scale
| double ActsUtils::StatHist::m_scale {1.0} |
◆ m_sum
| double ActsUtils::Stat::m_sum =0. |
|
inherited |
◆ m_sum2
| double ActsUtils::Stat::m_sum2 =0. |
|
inherited |
◆ m_xmin
| double ActsUtils::StatHist::m_xmin {} |
The documentation for this class was generated from the following file: