21#include <fmt/format.h>
46 m_hist1 = std::make_unique<hist_t>(
this,
"Histo1",
"Histogram 1", axis_t{
m_hist1def.value() } );
47 m_hist2 = std::make_unique<hist_t>(
this,
"Histo2",
"Histogram 2", axis_t(
m_hist2def.value() ) );
53 ++( *m_hist1 )[gauss()];
54 ++( *m_hist2 )[gauss()];
59 auto format = []( std::string_view
name,
const nlohmann::json& data ) {
60 return fmt::format(
" | {:25} | {:25} | {:7} |",
name, data[
"axis"][0][
"title"].get<std::string>(),
61 data[
"nEntries"].get<unsigned long long>() );
63 always() << fmt::format(
"Histograms report\n | {:25} | {:25} | {:7} |\n",
"name",
"title",
"entries" )
71 "The parameters for the first histogram" };
73 this,
"Histo2", {
"Histogram2", -5, 5, 200 },
"The parameters for the second histogram" };
75 std::unique_ptr<Gaudi::Accumulators::StaticHistogram<1>>
m_hist1;
76 std::unique_ptr<Gaudi::Accumulators::StaticHistogram<1>>
m_hist2;
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
#define DECLARE_COMPONENT(type)
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
Definition of a default type of Histogram Axis It contains number of bins, min and max value plus a t...
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
StatusCode initialize() override
the default (empty) implementation of IStateful::initialize() method
StatusCode finalize() override
the default (empty) implementation of IStateful::finalize() method
SmartIF< IRndmGenSvc > & randSvc() const
The standard RandomGen service, Return a pointer to the service if present.
const std::string & name() const override
The identifying name of the algorithm object.
Simple helper class for description of 1D-histogram The class is targeted to act as the primary "hist...
Implementation of property with value of concrete type.
simple example, which illustrates the usage of "histogram properties" DO NOT USE.
std::unique_ptr< Gaudi::Accumulators::StaticHistogram< 1 > > m_hist1
StatusCode finalize() override
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
StatusCode initialize() override
StatusCode execute() override
std::unique_ptr< Gaudi::Accumulators::StaticHistogram< 1 > > m_hist2
Gaudi::Property< Gaudi::Histo1DDef > m_hist2def
Gaudi::Property< Gaudi::Histo1DDef > m_hist1def
Parameters for the Gauss random number generation.
Random number accessor This small class encapsulates the use of the random number generator.
This class is used for returning status codes from appropriate routines.
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
constexpr static const auto SUCCESS
HistogramingCounterBase< ND, Atomicity, Arithmetic, naming::histogramString, HistogramingAccumulator, AxisTupleType > StaticHistogram
standard static histograming counter. See HistogramingCounterBase for details
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...