ATLAS Offline Software
Loading...
Searching...
No Matches
Dbg::Stat Class Reference

Simple class to gather statistics : min, max, mean, rms. More...

#include <StatUtils.h>

Inheritance diagram for Dbg::Stat:
Collaboration diagram for Dbg::Stat:

Public Member Functions

void add (double val)
 @bruef Gather a new value will update min, max and the sums to compute mean and rms
unsigned int n () const
double min () const
double max () const
double mean () const
double rms2 () const
double rms () const
void reset ()
 Set statistics to zero.
Statoperator+= (const Stat &b)
 @breif Add the statistics gathered in the Stat object b

Public Attributes

unsigned int m_n =0
double m_sum =0.
double m_sum2 =0.
double m_min =std::numeric_limits<double>::max()
double m_max =-std::numeric_limits<double>::max()

Detailed Description

Simple class to gather statistics : min, max, mean, rms.

Definition at line 17 of file StatUtils.h.

Member Function Documentation

◆ add()

void ActsUtils::Stat::add ( double val)
inline

@bruef Gather a new value will update min, max and the sums to compute mean and rms

Definition at line 21 of file StatUtils.h.

21 {
22 ++m_n;
23 m_sum += val;
24 m_sum2 += val*val;
25 m_min=std::min(m_min,val);
26 m_max=std::max(m_max,val);
27 }
double m_max
Definition StatUtils.h:58
double m_sum2
Definition StatUtils.h:56
double m_min
Definition StatUtils.h:57
double m_sum
Definition StatUtils.h:55
unsigned int m_n
Definition StatUtils.h:54

◆ max()

double ActsUtils::Stat::max ( ) const
inline

Definition at line 30 of file StatUtils.h.

30{ return m_max; }

◆ mean()

double ActsUtils::Stat::mean ( ) const
inline

Definition at line 31 of file StatUtils.h.

31{ return m_n>0 ? m_sum/m_n : 0.; }

◆ min()

double ActsUtils::Stat::min ( ) const
inline

Definition at line 29 of file StatUtils.h.

29{ return m_min; }

◆ n()

unsigned int ActsUtils::Stat::n ( ) const
inline

Definition at line 28 of file StatUtils.h.

28{ return m_n; }

◆ operator+=()

Stat & ActsUtils::Stat::operator+= ( const Stat & b)
inline

@breif Add the statistics gathered in the Stat object b

Definition at line 45 of file StatUtils.h.

45 {
46 m_n += b.m_n;
47 m_sum += b.m_sum;
48 m_sum2 += b.m_sum2;
49 m_min = std::min(m_min, b.m_min);
50 m_max = std::max(m_max, b.m_max);
51 return *this;
52 }

◆ reset()

void ActsUtils::Stat::reset ( )
inline

Set statistics to zero.

Definition at line 36 of file StatUtils.h.

36 {
37 m_n=0;
38 m_sum=0.;
39 m_sum2=0.;
40 m_min=std::numeric_limits<double>::max();
41 m_max=-std::numeric_limits<double>::max();
42 }

◆ rms()

double ActsUtils::Stat::rms ( ) const
inline

Definition at line 33 of file StatUtils.h.

33{ return std::sqrt( rms2() ); }
double rms2() const
Definition StatUtils.h:32

◆ rms2()

double ActsUtils::Stat::rms2 ( ) const
inline

Definition at line 32 of file StatUtils.h.

32{ return m_n>1 ? (m_sum2 - m_sum *m_sum/m_n)/(m_n-1) : 0.; }

Member Data Documentation

◆ m_max

double ActsUtils::Stat::m_max =-std::numeric_limits<double>::max()

Definition at line 58 of file StatUtils.h.

◆ m_min

double ActsUtils::Stat::m_min =std::numeric_limits<double>::max()

Definition at line 57 of file StatUtils.h.

◆ m_n

unsigned int ActsUtils::Stat::m_n =0

Definition at line 54 of file StatUtils.h.

◆ m_sum

double ActsUtils::Stat::m_sum =0.

Definition at line 55 of file StatUtils.h.

◆ m_sum2

double ActsUtils::Stat::m_sum2 =0.

Definition at line 56 of file StatUtils.h.


The documentation for this class was generated from the following file: