14 #include <ROOT/RHist.hxx> 15 #include <boost/format.hpp> 16 #include <boost/histogram/algorithm/sum.hpp> 17 #include <boost/histogram/fwd.hpp> 23 template <
typename HistogramType>
27 template <
int DIMENSIONS,
class PRECISION,
template <
int D_,
class P_>
class... STAT>
29 using histogram_t = ROOT::Experimental::RHist<DIMENSIONS, PRECISION, STAT...>;
37 template <
class... Ts>
39 return hist.Fill(
ts... );
41 template <
class... Ts>
43 return hist.Fill(
ts... );
49 template <
typename stream>
50 stream&
printImpl( stream& o,
bool tableFormat )
const {
51 auto fmt =
boost::format{tableFormat ?
"H%|10d| |" :
"#=%|-7lu|"};
52 return o << fmt % hist.GetEntries();
55 operator bool()
const {
return hist.GetEntries(); }
59 template <
class Axes,
class Storage>
61 using histogram_t = boost::histogram::histogram<Axes, Storage>;
68 template <
class... Ts>
73 template <
class... Ts>
86 template <
typename stream>
87 stream&
printImpl( stream& o,
bool tableFormat )
const {
88 auto fmt =
boost::format{tableFormat ?
"H%|10d| |" :
"#=%|-7lu|"};
89 return o << fmt % boost::histogram::algorithm::sum( hist );
92 operator bool()
const {
return filled; }
131 template <
typename HistogramType>
137 template <
class OWNER>
139 o->declareCounter( tag, *
this );
144 template <
class... Ts>
149 template <typename T = HistogramType, typename INC = typename Details::HistogramAdapter<T>::increment_t>
154 template <
class... Ts>
168 using PrintableCounter::print;
170 return m_hist.printImpl(
s, tableFormat );
173 return m_hist.printImpl(
s, tableFormat );
HistogramAdapter(histogram_t &&h)
Definition of the MsgStream class used to transmit messages.
boost::histogram::histogram< Axes, Storage > histogram_t
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
std::ostream & print(std::ostream &s, bool tableFormat=false) const override
prints the counter to a stream
auto fill(const Ts &... ts)
bool toBePrinted() const override
hint whether we should print that counter or not.
ROOT::Experimental::RHist< DIMENSIONS, PRECISION, STAT... > histogram_t
Histogram & operator()(const Ts &... ts)
const HistogramType & hist() const
auto fill(const Ts &... ts)
auto operator+=(const T &x)
Histogram(HistogramType h)
stream & printImpl(stream &o, bool tableFormat) const
Basic formatting showing only total count.
stream & printImpl(stream &o, bool tableFormat) const
Basic formatting showing only total count.
auto operator+=(const increment_t &x)
Histogram(OWNER *o, const std::string &tag, HistogramType h)
auto operator()(const Ts &... ts)
Counter class for histogram storage.
typename histogram_t::CoordArray_t increment_t
auto operator()(const Ts &... ts)
Histogram & fill(const Ts &... ts)
Efficient counter implementations for Gaudi.
HistogramAdapter(histogram_t &&h)
Histogram & operator+=(const INC &x)
Helper to provide uniform interface to different histograms implementations, at the moment ROOT7 and ...
MsgStream & print(MsgStream &s, bool tableFormat=true) const override