Go to the documentation of this file.
20 Gaudi::Accumulators::StatAccumulator,
21 Gaudi::Accumulators::BinomialAccumulator> {
33 const double maxFlag ) {
67 std::make_tuple( se.nEntries(), se.sum(), se.min(), se.max(), se.sum2() );
71 this->AccumulatorSet::operator+=( by );
78 unsigned long add(
const double v ) {
84 double Sum()
const {
return sum(); }
87 double rms()
const {
return standard_deviation(); }
88 double Rms()
const {
return standard_deviation(); }
89 double RMS()
const {
return standard_deviation(); }
90 double Eff()
const {
return eff(); }
94 double flag()
const {
return sum(); }
95 double flag2()
const {
return sum2(); }
97 double flagRMS()
const {
return standard_deviation(); }
102 using boost::algorithm::icontains;
103 return icontains(
name,
"eff" ) || icontains(
name,
"acc" ) || icontains(
name,
"filt" ) ||
104 icontains(
name,
"fltr" ) || icontains(
name,
"pass" );
106 template <
typename stream>
110 return o <<
fmt.str();
117 template <
typename stream>
120 ( 0 ==
min() || 1 ==
min() ) && ( 0 ==
max() || 1 ==
max() ) ) {
123 if (
name.empty() ) {
124 constexpr
auto fmt =
"|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%%| ------- | ------- |";
126 ( efficiencyErr() * 100 );
129 "|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%%| ------- | ------- |" );
134 constexpr
auto fmt =
"#=%|-7lu| Sum=%|-11.5g| Eff=|(%|#9.7g| +- %|-#8.6g|)%%|";
136 ( efficiencyErr() * 100 );
141 if (
name.empty() ) {
142 constexpr
auto fmt =
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |";
147 "|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" );
149 mean() % standard_deviation() %
min() %
max();
152 constexpr
auto fmt =
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|";
158 std::string_view fmtHead =
"%|-48.48s|%|27t|" )
const {
162 std::string_view fmtHead =
"%|-48.48s|%|27t|" )
const {
166 return print( o,
true, tag,
true );
171 return print( o, tableFormat, emptyName,
true );
175 return print( o, tableFormat, emptyName,
true );
189 {
"sum", this->sum()},
190 {
"mean", this->
mean()},
191 {
"sum2", this->sum2()},
192 {
"standard_deviation", this->standard_deviation()},
193 {
"min", this->
min()},
194 {
"max", this->
max()},
195 {
"nTrueEntries", this->nTrueEntries()},
196 {
"nFalseEntries", this->nFalseEntries()},
197 {
"efficiency", this->efficiency()},
198 {
"efficiencyErr", this->efficiencyErr()}};
203 j, {{{{
"nEntries",
"sum"},
"sum2"},
"min",
"max"}, {
"nTrueEntries",
"nFalseEntries"}} ) );
An empty ancester of all counters that knows how to print themselves.
static InternalType extractJSONData(const nlohmann::json &j, const JSONStringEntriesType &entries)
StatEntity & operator+=(double by)
void operator=(double by)
virtual nlohmann::json toJSON() const override
Basic JSON export for Gaudi::Monitoring::Hub support.
AccumulatorSet is an Accumulator that holds a set of Accumulators templated by same Arithmetic and At...
stream & printFormattedImpl(stream &o, const std::string &format) const
StatEntity(const unsigned long entries, const double flag, const double flag2, const double minFlag, const double maxFlag)
std::ostream & print(std::ostream &o, bool tableFormat=false) const override
prints the counter to a stream
StatEntity & operator+=(StatEntity by)
stream & printImpl(stream &o, bool tableFormat, std::string_view name, bool flag, std::string_view fmtHead) const
backward compatible StatEntity class.
MsgStream & print(MsgStream &o, bool tableFormat=false) const override
StatEntity operator--(int)
StatEntity & operator-=(double by)
MsgStream & printFormatted(MsgStream &o, const std::string &format) const
EventIDBase max(const EventIDBase &lhs, const EventIDBase &rhs)
static StatEntity fromJSON(const nlohmann::json &j)
StatEntity & operator--()
void mergeAndReset(AccumulatorSet< double, Ato, InputType, Gaudi::Accumulators::StatAccumulator ... > &&other)
double flagMeanErr() const
MsgStream & print(MsgStream &o, bool tableFormat, std::string_view name, bool flag=true, std::string_view fmtHead="%|-48.48s|%|27t|") const
std::ostream & print(std::ostream &o, bool tableFormat, std::string_view name, bool flag=true, std::string_view fmtHead="%|-48.48s|%|27t|") const
std::ostream & printFormatted(std::ostream &o, const std::string &format) const
AccumulatorSet< Arithmetic, Atomicity, Arithmetic, SigmaAccumulator, MinAccumulator, MaxAccumulator > StatAccumulator
StatAccumulator.
virtual std::ostream & print(std::ostream &o, std::string_view tag) const override
prints the counter to a stream in table format, with the given tag
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
static const std::string typeString
EventIDBase min(const EventIDBase &lhs, const EventIDBase &rhs)
std::string toString() const
unsigned long addFlag(const double v)
std::ostream & fillStream(std::ostream &o) const
unsigned long add(const double v)
virtual MsgStream & print(MsgStream &o, std::string_view tag) const override
bool operator<(const StatEntity &se) const
StatEntity & operator++()
static bool effCounter(std::string_view name)
unsigned long nEntries() const
virtual std::ostream & print(std::ostream &, bool tableFormat=false) const =0
prints the counter to a stream
StatEntity()=default
the constructor with automatic registration in the owner's counter map
MsgStream & fillStream(MsgStream &o) const
StatEntity operator++(int)