The Gaudi Framework  v32r2 (46d42edc)
Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity > Struct Template Reference

A counter aiming at computing average and sum2 / variance / standard deviation. More...

#include <GaudiKernel/Counters.h>

Inheritance diagram for Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity >:
Collaboration diagram for Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity >:

Public Member Functions

template<typename stream >
stream & printImpl (stream &o, bool tableFormat) const
 
std::ostreamprint (std::ostream &o, bool tableFormat=false) const override
 prints the counter to a stream More...
 
MsgStreamprint (MsgStream &o, bool tableFormat=false) const override
 
bool toBePrinted () const override
 hint whether we should print that counter or not. More...
 
- Public Member Functions inherited from Gaudi::Accumulators::BufferableCounter< Arithmetic, Atomicity, Accumulator >
Buffer< Arithmetic, Accumulator > buffer ()
 
 PrintableCounter ()=default
 
template<class OWNER >
 PrintableCounter (OWNER *o, const std::string &tag)
 
- Public Member Functions inherited from Gaudi::Accumulators::PrintableCounter
 PrintableCounter ()=default
 
template<class OWNER >
 PrintableCounter (OWNER *o, const std::string &tag)
 
virtual ~PrintableCounter ()=default
 destructor More...
 
template<typename stream >
stream & printImpl (stream &s, const std::string &tag) const
 
virtual std::ostreamprint (std::ostream &o, const std::string &tag) const
 prints the counter to a stream in table format, with the given tag More...
 
virtual MsgStreamprint (MsgStream &o, const std::string &tag) const
 
std::string toString () const
 get a string representation More...
 
- Public Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< Arithmetic, Atomicity, Bases >
constexpr AccumulatorSet ()=default
 
AccumulatorSetoperator+= (const InputType by)
 
OutputType value () const
 
void reset ()
 
template<atomicity Ato>
void mergeAndReset (AccumulatorSet< Arithmetic, Ato, Bases... > &&other)
 

Additional Inherited Members

- Public Types inherited from Gaudi::Accumulators::AccumulatorSet< Arithmetic, Atomicity, Bases >
using InputType = Arithmetic
 
using OutputType = std::tuple< typename Bases< Arithmetic, Atomicity >::OutputType... >
 
- Protected Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< Arithmetic, Atomicity, Bases >
void reset (const std::tuple< typename Bases< Arithmetic, Atomicity >::OutputType... > &t)
 

Detailed Description

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
struct Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity >

A counter aiming at computing average and sum2 / variance / standard deviation.

See also
Gaudi::Accumulators for detailed documentation

Definition at line 744 of file Counters.h.

Member Function Documentation

◆ print() [1/2]

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
std::ostream& Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity >::print ( std::ostream ,
bool  tableFormat = false 
) const
inlineoverridevirtual

prints the counter to a stream

Implements Gaudi::Accumulators::PrintableCounter.

Definition at line 756 of file Counters.h.

756  {
757  return printImpl( o, tableFormat );
758  }
stream & printImpl(stream &o, bool tableFormat) const
Definition: Counters.h:749

◆ print() [2/2]

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
MsgStream& Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity >::print ( MsgStream o,
bool  tableFormat = false 
) const
inlineoverridevirtual

Implements Gaudi::Accumulators::PrintableCounter.

Definition at line 759 of file Counters.h.

759 { return printImpl( o, tableFormat ); }
stream & printImpl(stream &o, bool tableFormat) const
Definition: Counters.h:749

◆ printImpl()

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
template<typename stream >
stream& Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity >::printImpl ( stream &  o,
bool  tableFormat 
) const
inline

Definition at line 749 of file Counters.h.

749  {
750  auto fmt = ( tableFormat ? "|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |"
751  : "#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|" );
752  return o << boost::format{fmt} % this->nEntries() % this->sum() % this->mean() % this->standard_deviation() %
753  this->min() % this->max();
754  }
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:109
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:202
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
Definition: EventIDBase.h:215

◆ toBePrinted()

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
bool Gaudi::Accumulators::StatCounter< Arithmetic, Atomicity >::toBePrinted ( ) const
inlineoverridevirtual

hint whether we should print that counter or not.

Typically empty counters may not be printed

Reimplemented from Gaudi::Accumulators::PrintableCounter.

Definition at line 760 of file Counters.h.

760 { return this->nEntries() > 0; }

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