Loading [MathJax]/extensions/tex2jax.js
Go to the documentation of this file.
13 #include <boost/algorithm/string/predicate.hpp>
14 #include <boost/format.hpp>
22 Gaudi::Accumulators::StatAccumulator,
23 Gaudi::Accumulators::BinomialAccumulator> {
35 const double maxFlag ) {
69 std::make_tuple( se.nEntries(), se.sum(), se.min(), se.max(), se.sum2() );
73 this->AccumulatorSet::operator+=( by );
80 unsigned long add(
const double v ) {
86 double Sum()
const {
return sum(); }
89 double rms()
const {
return standard_deviation(); }
90 double Rms()
const {
return standard_deviation(); }
91 double RMS()
const {
return standard_deviation(); }
92 double Eff()
const {
return eff(); }
96 double flag()
const {
return sum(); }
97 double flag2()
const {
return sum2(); }
99 double flagRMS()
const {
return standard_deviation(); }
104 using boost::algorithm::icontains;
105 return icontains(
name,
"eff" ) || icontains(
name,
"acc" ) || icontains(
name,
"filt" ) ||
106 icontains(
name,
"fltr" ) || icontains(
name,
"pass" );
108 template <
typename stream>
112 return o <<
fmt.str();
119 template <
typename stream>
122 ( 0 ==
min() || 1 ==
min() ) && ( 0 ==
max() || 1 ==
max() ) ) {
125 if (
name.empty() ) {
126 constexpr
auto fmt =
"|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%%| ------- | ------- |";
128 ( efficiencyErr() * 100 );
131 "|%|10d| |%|11.5g| |(%|#9.7g| +- %|-#8.7g|)%%| ------- | ------- |" );
136 constexpr
auto fmt =
"#=%|-7lu| Sum=%|-11.5g| Eff=|(%|#9.7g| +- %|-#8.6g|)%%|";
138 ( efficiencyErr() * 100 );
143 if (
name.empty() ) {
144 constexpr
auto fmt =
"|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |";
149 "|%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" );
151 mean() % standard_deviation() %
min() %
max();
154 constexpr
auto fmt =
"#=%|-7lu| Sum=%|-11.5g| Mean=%|#10.4g| +- %|-#10.5g| Min/Max=%|#10.4g|/%|-#10.4g|";
160 std::string_view fmtHead =
"%|-48.48s|%|27t|" )
const {
164 std::string_view fmtHead =
"%|-48.48s|%|27t|" )
const {
168 return print( o,
true, tag,
true );
173 return print( o, tableFormat, emptyName,
true );
177 return print( o, tableFormat, emptyName,
true );
191 {
"sum", this->sum() },
192 {
"mean", this->
mean() },
193 {
"sum2", this->sum2() },
194 {
"standard_deviation", this->standard_deviation() },
195 {
"min", this->
min() },
196 {
"max", this->
max() },
197 {
"nTrueEntries", this->nTrueEntries() },
198 {
"nFalseEntries", this->nFalseEntries() },
199 {
"efficiency", this->efficiency() },
200 {
"efficiencyErr", this->efficiencyErr() } };
205 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)