The Gaudi Framework  master (594c33fa)
Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc > Struct Template Reference

SigmaAccumulatorBase. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/Gaudi/Accumulators.h>

Inheritance diagram for Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >:
Collaboration diagram for Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >:

Public Member Functions

template<typename Result = fp_result_type<Arithmetic>>
auto biased_sample_variance () const
 
template<typename Result = fp_result_type<Arithmetic>>
auto unbiased_sample_variance () const
 
template<typename Result = fp_result_type<Arithmetic>>
auto standard_deviation () const
 
Arithmetic rms () const
 
template<typename Result = fp_result_type<Arithmetic>>
auto meanErr () const
 
- Public Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< Arithmetic, Atomicity, AvgAcc< Atomicity, Arithmetic >::InputType, AvgAcc, SquareAcc >
constexpr AccumulatorSet ()=default
 
 AccumulatorSet (construct_empty_t, const AccumulatorSet< Arithmetic, ato, InputType, AvgAcc ... > &)
 constructor of an empty AccumulatorSet, copying the (non existent) config from another GenericAccumulator More...
 
AccumulatorSetoperator+= (const InputType by)
 
OutputType value () const
 
void reset ()
 
void mergeAndReset (AccumulatorSet< Arithmetic, Ato, InputType, AvgAcc ... > &other)
 
void operator+ (AccumulatorSet< Arithmetic, Ato, InputType, AvgAcc ... > &&other)
 

Additional Inherited Members

- Public Types inherited from Gaudi::Accumulators::AccumulatorSet< Arithmetic, Atomicity, AvgAcc< Atomicity, Arithmetic >::InputType, AvgAcc, SquareAcc >
using InputType = AvgAcc< Atomicity, Arithmetic >::InputType
 
using OutputType = std::tuple< typename AvgAcc< Atomicity, Arithmetic >::OutputType... >
 
using InternalType = std::tuple< typename AvgAcc< Atomicity, Arithmetic >::InternalType... >
 
using JSONStringEntriesType = std::tuple< typename AvgAcc< Atomicity, Arithmetic >::JSONStringEntriesType... >
 
- Protected Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< Arithmetic, Atomicity, AvgAcc< Atomicity, Arithmetic >::InputType, AvgAcc, SquareAcc >
 AccumulatorSet (const InternalType &t)
 
void reset (const InternalType &t)
 
- Static Protected Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< Arithmetic, Atomicity, AvgAcc< Atomicity, Arithmetic >::InputType, AvgAcc, SquareAcc >
static InternalType extractJSONData (const nlohmann::json &j, const JSONStringEntriesType &entries)
 

Detailed Description

template<atomicity Atomicity, typename Arithmetic, template< atomicity, typename > typename AvgAcc, template< atomicity, typename > typename SquareAcc>
struct Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >

SigmaAccumulatorBase.

A SigmaAccumulator is an Accumulator able to compute an average and variance/rms This Base class is still templated on the averaging and square accumulators

See also
Gaudi::Accumulators for detailed documentation

Definition at line 780 of file Accumulators.h.

Member Function Documentation

◆ biased_sample_variance()

template<atomicity Atomicity, typename Arithmetic , template< atomicity, typename > typename AvgAcc, template< atomicity, typename > typename SquareAcc>
template<typename Result = fp_result_type<Arithmetic>>
auto Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >::biased_sample_variance ( ) const
inline

Definition at line 788 of file Accumulators.h.

788  {
789  auto n = this->nEntries();
790  Result sum = this->sum();
791  return ( n > 0 ) ? static_cast<Result>( ( this->sum2() - sum * ( sum / n ) ) / n ) : Result{};
792  }

◆ meanErr()

template<atomicity Atomicity, typename Arithmetic , template< atomicity, typename > typename AvgAcc, template< atomicity, typename > typename SquareAcc>
template<typename Result = fp_result_type<Arithmetic>>
auto Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >::meanErr ( ) const
inline

Definition at line 815 of file Accumulators.h.

815  {
816  auto n = this->nEntries();
817  if ( 0 == n ) return Result{};
818  // Note the usage of using, aiming at using the std version of sqrt by default, without preventing
819  // more specialized versions to be used via ADL (see http://en.cppreference.com/w/cpp/language/adl)
821  using std::sqrt;
822  Result v = biased_sample_variance();
823  return ( Result{ 0 } > v ) ? Result{} : static_cast<Result>( sqrt( v / n ) );
824  }

◆ rms()

template<atomicity Atomicity, typename Arithmetic , template< atomicity, typename > typename AvgAcc, template< atomicity, typename > typename SquareAcc>
Arithmetic Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >::rms ( ) const
inline

Definition at line 810 of file Accumulators.h.

810  {
811  return standard_deviation();
812  }

◆ standard_deviation()

template<atomicity Atomicity, typename Arithmetic , template< atomicity, typename > typename AvgAcc, template< atomicity, typename > typename SquareAcc>
template<typename Result = fp_result_type<Arithmetic>>
auto Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >::standard_deviation ( ) const
inline

Definition at line 802 of file Accumulators.h.

802  {
803  // Note the usage of using, aiming at using the std version of sqrt by default, without preventing
804  // more specialized versions to be used via ADL (see http://en.cppreference.com/w/cpp/language/adl)
806  using std::sqrt;
807  Result v = biased_sample_variance();
808  return ( Result{ 0 } > v ) ? Result{} : static_cast<Result>( sqrt( v ) );
809  }

◆ unbiased_sample_variance()

template<atomicity Atomicity, typename Arithmetic , template< atomicity, typename > typename AvgAcc, template< atomicity, typename > typename SquareAcc>
template<typename Result = fp_result_type<Arithmetic>>
auto Gaudi::Accumulators::SigmaAccumulatorBase< Atomicity, Arithmetic, AvgAcc, SquareAcc >::unbiased_sample_variance ( ) const
inline

Definition at line 795 of file Accumulators.h.

795  {
796  auto n = this->nEntries();
797  Result sum = this->sum();
798  return ( n > 1 ) ? static_cast<Result>( ( this->sum2() - sum * ( sum / n ) ) / ( n - 1 ) ) : Result{};
799  }

The documentation for this struct was generated from the following file:
Gaudi::Accumulators::sqrt
auto sqrt(std::chrono::duration< Rep, Period > d)
sqrt for std::chrono::duration
Definition: Counters.h:34
std::sqrt
T sqrt(T... args)
GaudiAlg.HistoUtils.nEntries
nEntries
Definition: HistoUtils.py:938
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:234
Gaudi::Accumulators::SigmaAccumulatorBase::standard_deviation
auto standard_deviation() const
Definition: Accumulators.h:802
Properties.v
v
Definition: Properties.py:122
Gaudi::Accumulators::SigmaAccumulatorBase::biased_sample_variance
auto biased_sample_variance() const
Definition: Accumulators.h:788