The Gaudi Framework  v37r0 (b608885e)
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 743 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 751 of file Accumulators.h.

751  {
752  auto n = this->nEntries();
753  Result sum = this->sum();
754  return ( n > 0 ) ? static_cast<Result>( ( this->sum2() - sum * ( sum / n ) ) / n ) : Result{};
755  }

◆ 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 778 of file Accumulators.h.

778  {
779  auto n = this->nEntries();
780  if ( 0 == n ) return Result{};
781  // Note the usage of using, aiming at using the std version of sqrt by default, without preventing
782  // more specialized versions to be used via ADL (see http://en.cppreference.com/w/cpp/language/adl)
784  using std::sqrt;
785  Result v = biased_sample_variance();
786  return ( Result{ 0 } > v ) ? Result{} : static_cast<Result>( sqrt( v / n ) );
787  }

◆ 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 773 of file Accumulators.h.

773  {
774  return standard_deviation();
775  }

◆ 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 765 of file Accumulators.h.

765  {
766  // Note the usage of using, aiming at using the std version of sqrt by default, without preventing
767  // more specialized versions to be used via ADL (see http://en.cppreference.com/w/cpp/language/adl)
769  using std::sqrt;
770  Result v = biased_sample_variance();
771  return ( Result{ 0 } > v ) ? Result{} : static_cast<Result>( sqrt( v ) );
772  }

◆ 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 758 of file Accumulators.h.

758  {
759  auto n = this->nEntries();
760  Result sum = this->sum();
761  return ( n > 1 ) ? static_cast<Result>( ( this->sum2() - sum * ( sum / n ) ) / ( n - 1 ) ) : Result{};
762  }

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:939
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:235
Gaudi::Accumulators::SigmaAccumulatorBase::standard_deviation
auto standard_deviation() const
Definition: Accumulators.h:765
Properties.v
v
Definition: Properties.py:123
Gaudi::Accumulators::SigmaAccumulatorBase::biased_sample_variance
auto biased_sample_variance() const
Definition: Accumulators.h:751