The Gaudi Framework  v36r9p1 (5c15b2bb)
Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity > Struct Template Reference

A counter dealing with binomial data. More...

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

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

Public Member Functions

template<typename OWNER >
 BinomialCounter (OWNER *o, std::string const &name)
 
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
 
template<typename stream >
stream & printImpl (stream &o, std::string_view tag) const
 
std::ostreamprint (std::ostream &o, std::string_view tag) const override
 prints the counter to a stream in table format, with the given tag More...
 
MsgStreamprint (MsgStream &o, std::string_view tag) const override
 
bool toBePrinted () const override
 hint whether we should print that counter or not. More...
 
virtual nlohmann::json toJSON () const override
 Basic JSON export for Gaudi::Monitoring::Hub support. More...
 
- Public Member Functions inherited from Gaudi::Accumulators::BufferableCounter< atomicity::full, BinomialAccumulator, double >
 BufferableCounter ()=default
 
 BufferableCounter (OWNER *o, std::string const &name)
 
 BufferableCounter (BufferableCounter const &)=delete
 
Buffer< BinomialAccumulator, Atomicity, Args... > buffer ()
 
BufferableCounteroperator= (BufferableCounter const &)=delete
 
 ~BufferableCounter ()
 
- Public Member Functions inherited from Gaudi::Accumulators::PrintableCounter
 PrintableCounter ()=default
 
virtual ~PrintableCounter ()=default
 destructor More...
 
template<typename stream >
stream & printImpl (stream &s, std::string_view tag) const
 
std::string toString () const
 get a string representation More...
 
- Public Member Functions inherited from Gaudi::Accumulators::BinomialAccumulator< Atomicity, Args... >
unsigned long nEntries () const
 
auto efficiency () const
 
auto eff () const
 
auto efficiencyErr () const
 
auto effErr () const
 
BinomialAccumulatoroperator+= (binomial_t b)
 
- Public Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< bool, Atomicity, bool, TrueAccumulator, FalseAccumulator >
constexpr AccumulatorSet ()=default
 
 AccumulatorSet (construct_empty_t, const AccumulatorSet< bool, ato, InputType, TrueAccumulator ... > &)
 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< bool, Ato, InputType, TrueAccumulator ... > &&other)
 
void operator+ (AccumulatorSet< bool, Ato, InputType, TrueAccumulator ... > &&other)
 
- Public Member Functions inherited from Gaudi::Accumulators::TrueAccumulator< Atomicity, bool >
unsigned long nTrueEntries () const
 
- Public Member Functions inherited from Gaudi::Accumulators::GenericAccumulator< bool, unsigned long, Atomicity, TrueTo1 >
 GenericAccumulator ()=default
 
 GenericAccumulator (construct_empty_t, const GenericAccumulator< InputType, unsigned long, ato, TrueTo1, Identity, VH > &)
 constructor of an empty GenericAccumulator, copying the (non existent) config from another GenericAccumulator More...
 
 GenericAccumulator (std::in_place_t, Args &&... args)
 
 GenericAccumulator (const GenericAccumulator &other)
 
GenericAccumulator operator+= (const InputType by)
 
GenericAccumulatoroperator= (const GenericAccumulator &other)
 
OutputType value () const
 
void reset ()
 
void mergeAndReset (GenericAccumulator< InputType, unsigned long, ato, TrueTo1, Identity, VH > &&other)
 
void operator+ (GenericAccumulator< InputType, unsigned long, ato, TrueTo1, Identity, VH > &&other)
 

Static Public Member Functions

static BinomialCounter fromJSON (const nlohmann::json &j)
 

Static Public Attributes

static const std::string typeString
 
- Static Public Attributes inherited from Gaudi::Accumulators::BufferableCounter< atomicity::full, BinomialAccumulator, double >
static const std::string typeString
 

Additional Inherited Members

- Public Types inherited from Gaudi::Accumulators::AccumulatorSet< bool, Atomicity, bool, TrueAccumulator, FalseAccumulator >
using InputType = bool
 
using OutputType = std::tuple< typename TrueAccumulator< Atomicity, bool >::OutputType... >
 
using InternalType = std::tuple< typename TrueAccumulator< Atomicity, bool >::InternalType... >
 
using JSONStringEntriesType = std::tuple< typename TrueAccumulator< Atomicity, bool >::JSONStringEntriesType... >
 
- Public Types inherited from Gaudi::Accumulators::GenericAccumulator< bool, unsigned long, Atomicity, TrueTo1 >
using InputType = bool
 
using OutputType = std::decay_t< std::result_of_t< Identity(unsigned long)> >
 
using InternalType = unsigned long
 
using JSONStringEntriesType = std::string
 
- Protected Member Functions inherited from Gaudi::Accumulators::BufferableCounter< atomicity::full, BinomialAccumulator, double >
 BufferableCounter (OWNER *o, std::string const &name, SELF &self, CARGS... args)
 
- Protected Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< bool, Atomicity, bool, TrueAccumulator, FalseAccumulator >
 AccumulatorSet (const InternalType &t)
 
void reset (const InternalType &t)
 
- Protected Member Functions inherited from Gaudi::Accumulators::GenericAccumulator< bool, unsigned long, Atomicity, TrueTo1 >
 GenericAccumulator (unsigned long in)
 
void reset (unsigned long in)
 
auto rawValue () const
 
- Static Protected Member Functions inherited from Gaudi::Accumulators::AccumulatorSet< bool, Atomicity, bool, TrueAccumulator, FalseAccumulator >
static InternalType extractJSONData (const nlohmann::json &j, const JSONStringEntriesType &entries)
 
- Static Protected Member Functions inherited from Gaudi::Accumulators::GenericAccumulator< bool, unsigned long, Atomicity, TrueTo1 >
static unsigned long extractJSONData (const nlohmann::json &j, const JSONStringEntriesType &entries)
 

Detailed Description

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

A counter dealing with binomial data.

See also
Gaudi::Accumulators for detailed documentation

Definition at line 1065 of file Accumulators.h.

Constructor & Destructor Documentation

◆ BinomialCounter()

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
template<typename OWNER >
Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity >::BinomialCounter ( OWNER *  o,
std::string const &  name 
)
inline

Definition at line 1070 of file Accumulators.h.

1071  : BufferableCounter<Atomicity, BinomialAccumulator, Arithmetic>( o, name, *this ) {}

Member Function Documentation

◆ fromJSON()

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
static BinomialCounter Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity >::fromJSON ( const nlohmann::json &  j)
inlinestatic

Definition at line 1105 of file Accumulators.h.

1105  {
1106  return BinomialAccumulator<Atomicity, Arithmetic>::extractJSONData( j, { "nTrueEntries", "nFalseEntries" } );
1107  }

◆ print() [1/4]

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

Implements Gaudi::Accumulators::PrintableCounter.

Definition at line 1084 of file Accumulators.h.

1084 { return printImpl( o, tableFormat ); }

◆ print() [2/4]

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
MsgStream& Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity >::print ( MsgStream o,
std::string_view  tag 
) const
inlineoverridevirtual

Reimplemented from Gaudi::Accumulators::PrintableCounter.

Definition at line 1094 of file Accumulators.h.

1094 { return printImpl( o, tag ); }

◆ print() [3/4]

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

prints the counter to a stream

Implements Gaudi::Accumulators::PrintableCounter.

Definition at line 1081 of file Accumulators.h.

1081  {
1082  return printImpl( o, tableFormat );
1083  }

◆ print() [4/4]

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
std::ostream& Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity >::print ( std::ostream o,
std::string_view  tag 
) const
inlineoverridevirtual

prints the counter to a stream in table format, with the given tag

Reimplemented from Gaudi::Accumulators::PrintableCounter.

Definition at line 1093 of file Accumulators.h.

1093 { return printImpl( o, tag ); }

◆ printImpl() [1/2]

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

Definition at line 1074 of file Accumulators.h.

1074  {
1075  auto fmt = ( tableFormat ? "|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%% |"
1076  : "#=%|-7lu| Sum=%|-11.5g| Eff=|(%|#9.7g| +- %|-#8.6g|)%%|" );
1077  return o << boost::format{ fmt } % this->nEntries() % this->nTrueEntries() % ( this->efficiency() * 100 ) %
1078  ( this->efficiencyErr() * 100 );
1079  }

◆ printImpl() [2/2]

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
template<typename stream >
stream& Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity >::printImpl ( stream &  o,
std::string_view  tag 
) const
inline

Definition at line 1087 of file Accumulators.h.

1087  {
1088  // override default print to add a '*' in from of the name
1089  o << boost::format{ " |*%|-48.48s|%|50t|" } % ( std::string{ "\"" }.append( tag ).append( "\"" ) );
1090  return print( o, true );
1091  }

◆ toBePrinted()

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
bool Gaudi::Accumulators::BinomialCounter< 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 1095 of file Accumulators.h.

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

◆ toJSON()

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
virtual nlohmann::json Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity >::toJSON ( ) const
inlineoverridevirtual

Basic JSON export for Gaudi::Monitoring::Hub support.

Implements Gaudi::Accumulators::PrintableCounter.

Definition at line 1096 of file Accumulators.h.

1096  {
1097  return { { "type", typeString },
1098  { "empty", this->nEntries() == 0 },
1099  { "nEntries", this->nTrueEntries() + this->nFalseEntries() },
1100  { "nTrueEntries", this->nTrueEntries() },
1101  { "nFalseEntries", this->nFalseEntries() },
1102  { "efficiency", this->efficiency() },
1103  { "efficiencyErr", this->efficiencyErr() } };
1104  }

Member Data Documentation

◆ typeString

template<typename Arithmetic = double, atomicity Atomicity = atomicity::full>
const std::string Gaudi::Accumulators::BinomialCounter< Arithmetic, Atomicity >::typeString
inlinestatic
Initial value:
{ std::string{ "counter:BinomialCounter:" } +
typeid( Arithmetic ).name() }

Definition at line 1066 of file Accumulators.h.


The documentation for this struct was generated from the following file:
Gaudi::Accumulators::BinomialCounter::typeString
static const std::string typeString
Definition: Accumulators.h:1066
Gaudi::Accumulators::AccumulatorSet< bool, Atomicity, bool, TrueAccumulator, FalseAccumulator >::extractJSONData
static InternalType extractJSONData(const nlohmann::json &j, const JSONStringEntriesType &entries)
Definition: Accumulators.h:525
std::string
STL class.
Gaudi::Accumulators::BinomialCounter::print
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
Definition: Accumulators.h:1081
TimingHistograms.name
name
Definition: TimingHistograms.py:25
Gaudi::Accumulators::BinomialAccumulator< Atomicity, Args... >::efficiencyErr
auto efficiencyErr() const
Definition: Accumulators.h:682
format
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition: MsgStream.cpp:119
Gaudi::Accumulators::BinomialAccumulator< Atomicity, Args... >::efficiency
auto efficiency() const
Definition: Accumulators.h:674
std::string::append
T append(T... args)
fmt
Gaudi::Accumulators::BinomialAccumulator< Atomicity, Args... >::nEntries
unsigned long nEntries() const
Definition: Accumulators.h:671
Gaudi::Accumulators::BinomialCounter::printImpl
stream & printImpl(stream &o, bool tableFormat) const
Definition: Accumulators.h:1074
Gaudi::Accumulators::TrueAccumulator< Atomicity, bool >::nTrueEntries
unsigned long nTrueEntries() const
Definition: Accumulators.h:644