ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ActsTrk::detail::SumOfValues Class Reference

Helper class to gather statistics and compute the biased variance. More...

#include <HitSummaryDataUtils.h>

Collaboration diagram for ActsTrk::detail::SumOfValues:

Public Member Functions

void reset ()
 
void add (double value)
 
std::array< double, 2 > meanAndBiasedVariance () const
 
double biasedVariance () const
 

Private Attributes

double m_sum = 0.
 
double m_sum2 = 0.
 
unsigned int m_n =0u
 

Detailed Description

Helper class to gather statistics and compute the biased variance.

Definition at line 235 of file HitSummaryDataUtils.h.

Member Function Documentation

◆ add()

void ActsTrk::detail::SumOfValues::add ( double  value)
inline

Definition at line 246 of file HitSummaryDataUtils.h.

246  {
247  m_sum += value;
248  m_sum2 += value * value;
249  ++m_n;
250  }

◆ biasedVariance()

double ActsTrk::detail::SumOfValues::biasedVariance ( ) const
inline

Definition at line 256 of file HitSummaryDataUtils.h.

256  {
257  double inv_n = m_n>0 ? 1./m_n : 0 ;
258  return (m_sum2 - m_sum * m_sum *inv_n) * inv_n;
259  }

◆ meanAndBiasedVariance()

std::array<double,2> ActsTrk::detail::SumOfValues::meanAndBiasedVariance ( ) const
inline

Definition at line 251 of file HitSummaryDataUtils.h.

251  {
252  double inv_n = m_n>0 ? 1/m_n : 0 ;
253  double mean = m_sum * inv_n;
254  return std::array<double, 2> { mean, (m_sum2 - m_sum * mean) * inv_n };
255  }

◆ reset()

void ActsTrk::detail::SumOfValues::reset ( )
inline

Definition at line 241 of file HitSummaryDataUtils.h.

241  {
242  m_sum=0.;
243  m_sum2=0.;
244  m_n=0u;
245  }

Member Data Documentation

◆ m_n

unsigned int ActsTrk::detail::SumOfValues::m_n =0u
private

Definition at line 239 of file HitSummaryDataUtils.h.

◆ m_sum

double ActsTrk::detail::SumOfValues::m_sum = 0.
private

Definition at line 237 of file HitSummaryDataUtils.h.

◆ m_sum2

double ActsTrk::detail::SumOfValues::m_sum2 = 0.
private

Definition at line 238 of file HitSummaryDataUtils.h.


The documentation for this class was generated from the following file:
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
athena.value
value
Definition: athena.py:124
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
ActsTrk::detail::SumOfValues::m_sum
double m_sum
Definition: HitSummaryDataUtils.h:237
ActsTrk::detail::SumOfValues::m_sum2
double m_sum2
Definition: HitSummaryDataUtils.h:238
ActsTrk::detail::SumOfValues::m_n
unsigned int m_n
Definition: HitSummaryDataUtils.h:239