ATLAS Offline Software
Public Member Functions | Public Attributes | List of all members
ActsUtils::Stat Class Reference

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

#include <StatUtils.h>

Inheritance diagram for ActsUtils::Stat:
Collaboration diagram for ActsUtils::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 More...
 
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. More...
 
Statoperator+= (const Stat &b)
 @breif Add the statistics gathered in the Stat object b More...
 

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 16 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 20 of file StatUtils.h.

20  {
21  ++m_n;
22  m_sum += val;
23  m_sum2 += val*val;
26  }

◆ max()

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

Definition at line 29 of file StatUtils.h.

29 { return m_max; }

◆ mean()

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

Definition at line 30 of file StatUtils.h.

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

◆ min()

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

Definition at line 28 of file StatUtils.h.

28 { return m_min; }

◆ n()

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

Definition at line 27 of file StatUtils.h.

27 { 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 44 of file StatUtils.h.

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

◆ reset()

void ActsUtils::Stat::reset ( )
inline

Set statistics to zero.

Definition at line 35 of file StatUtils.h.

35  {
36  m_n=0;
37  m_sum=0.;
38  m_sum2=0.;
41  }

◆ rms()

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

Definition at line 32 of file StatUtils.h.

32 { return std::sqrt( rms2() ); }

◆ rms2()

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

Definition at line 31 of file StatUtils.h.

31 { 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 57 of file StatUtils.h.

◆ m_min

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

Definition at line 56 of file StatUtils.h.

◆ m_n

unsigned int ActsUtils::Stat::m_n =0

Definition at line 53 of file StatUtils.h.

◆ m_sum

double ActsUtils::Stat::m_sum =0.

Definition at line 54 of file StatUtils.h.

◆ m_sum2

double ActsUtils::Stat::m_sum2 =0.

Definition at line 55 of file StatUtils.h.


The documentation for this class was generated from the following file:
max
#define max(a, b)
Definition: cfImp.cxx:41
ActsUtils::Stat::m_max
double m_max
Definition: StatUtils.h:57
ActsUtils::Stat::m_sum
double m_sum
Definition: StatUtils.h:54
ActsUtils::Stat::m_n
unsigned int m_n
Definition: StatUtils.h:53
min
#define min(a, b)
Definition: cfImp.cxx:40
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
ActsUtils::Stat::m_sum2
double m_sum2
Definition: StatUtils.h:55
ActsUtils::Stat::m_min
double m_min
Definition: StatUtils.h:56
ActsUtils::Stat::rms2
double rms2() const
Definition: StatUtils.h:31
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14