![]() |
The Gaudi Framework
master (ff829712)
|
Efficient counter implementations for Gaudi. More...
Namespaces | |
namespace | details |
namespace | naming |
Classes | |
class | AccumulatorSet |
AccumulatorSet is an Accumulator that holds a set of Accumulators templated by same Arithmetic and Atomicity and increase them altogether. More... | |
struct | Adder |
An Adder ValueHandler operator(a, b) means a += b. More... | |
struct | Adder< Arithmetic, atomicity::full > |
Adder specialization in the case of atomicity full. More... | |
struct | Adder< Arithmetic, atomicity::none > |
Adder specialization in the case of atomicity none. More... | |
struct | AveragingAccumulatorBase |
AveragingAccumulatorBase. More... | |
struct | AveragingCounter |
A counter aiming at computing sum and average. More... | |
class | Axis |
Definition of a default type of Histogram Axis It contains number of bins, min and max value plus a title and defines the basic type of Axis (non log) It may also contain labels for the bins. More... | |
struct | BaseValueHandler |
Base type for all functors used as ValuesHandler. More... | |
struct | BaseValueHandler< Arithmetic, atomicity::full > |
BaseValueHandler specialization in the case of atomicity full. More... | |
struct | BaseValueHandler< Arithmetic, atomicity::none > |
BaseValueHandler specialization in the case of atomicity none. More... | |
struct | BinomialAccumulator |
BinomialAccumulator. More... | |
struct | BinomialCounter |
A counter dealing with binomial data. More... | |
class | Buffer |
Buffer is a non atomic Accumulator which, when it goes out-of-scope, updates the underlying thread-safe Accumulator for all previous updates in one go. More... | |
class | BufferableCounter |
An empty ancester of all counters that provides a buffer method that returns a buffer on itself Also registers the counter to its owner, with default type "counter" Due to this registration, move semantic is disabled. More... | |
struct | Constant |
A functor always returning the value N. More... | |
struct | construct_empty_t |
constant used to disambiguate construction of an empty Accumulator versus the copy constructor. More... | |
struct | CountAccumulator |
CountAccumulator. More... | |
struct | Counter |
A basic integral counter;. More... | |
struct | CounterArray |
generic class implementing an array of counters The only addition to a raw array is the constructor that allows to build names of the counters automatically from the index of the counter in the array There are 2 possibilities : More... | |
struct | CustomAxis |
struct | ExtractWeight |
A functor to extract weight, take a pair (valueTuple, weight) as input. More... | |
struct | Extremum |
An Extremum ValueHandler, to be reused for Minimum and Maximum operator(a, b) means if (Compare(b,a)) a = b In case of full atomicity, compare_exchange_weak is used. More... | |
struct | Extremum< Arithmetic, atomicity::full, Compare, Initial > |
Extremum specialization in the case of atomicity full. More... | |
struct | Extremum< Arithmetic, atomicity::none, Compare, Initial > |
Extremum specialization in the case of atomicity none. More... | |
struct | FalseAccumulator |
FalseAccumulator. More... | |
struct | FalseTo1 |
helper functor for the FalseAccumulator More... | |
class | GenericAccumulator |
Generic Accumulator, templated by. More... | |
struct | HistogramArray |
generic class implementing an array of histograms The only addition to a raw array is the constructor that allows to build names and titles for the histograms automatically from the index of the histogram in the array There are 2 possibilities : More... | |
struct | HistogramArray< Histo, N, std::integer_sequence< unsigned int, ND... > > |
class | HistogramingAccumulatorInternal |
Internal Accumulator class dealing with Histograming. More... | |
class | HistogramingCounterBase |
A base counter dealing with Histograms. More... | |
class | HistogramingCounterBase< ND, Atomicity, Arithmetic, Type, Accumulator, std::tuple< AxisTypes... > > |
struct | HistogramMap |
generic class implementing a thread safe map of histograms More... | |
struct | HistogramMap< Key, Histo, std::integer_sequence< unsigned int, ND... > > |
class | HistogramWrapperInternal |
A Wrapper of a static Histogram base class using Properties to define title and axis. More... | |
class | HistogramWrapperInternal< HistogramType, std::integer_sequence< unsigned int, ND... > > |
struct | HistoInputType |
small class used as InputType for regular Histograms basically a tuple of the given values, specialized in case of a single entry so that the syntax is more natural. More... | |
struct | HistoInputType< std::tuple< Elements... >, NIndex > |
struct | Identity |
An Identity functor. More... | |
struct | IntegralAccumulator |
IntegralAccumulator. More... | |
struct | MaxAccumulator |
MaxAccumulator. More... | |
struct | MinAccumulator |
MinAccumulator. More... | |
class | MsgCounter |
struct | PrintableCounter |
An empty ancester of all counters that knows how to print themselves. More... | |
struct | RootHistogramingAccumulator |
Class implementing a root histogram accumulator. More... | |
struct | RootHistogramingAccumulator< Atomicity, Arithmetic, std::integral_constant< unsigned int, 1 >, AxisTupleType > |
struct | RootHistogramingAccumulator< Atomicity, Arithmetic, std::integral_constant< unsigned int, 2 >, AxisTupleType > |
struct | RootHistogramingAccumulator< Atomicity, Arithmetic, std::integral_constant< unsigned int, 3 >, AxisTupleType > |
class | RootHistogramingAccumulatorInternal |
Internal Accumulator class dealing with RootHistograming. More... | |
class | RootHistogramingCounterBase |
Extension of the standard Gaudi histogram to provide similar functionnality as ROOT. More... | |
class | RootHistogramingCounterBase< 1, Atomicity, Arithmetic, Type, AxisTupleType > |
class | RootHistogramingCounterBase< 2, Atomicity, Arithmetic, Type, AxisTupleType > |
class | RootHistogramingCounterBase< 3, Atomicity, Arithmetic, Type, AxisTupleType > |
struct | SigmaAccumulatorBase |
SigmaAccumulatorBase. More... | |
struct | SigmaCounter |
A counter aiming at computing average and sum2 / variance / standard deviation. More... | |
struct | SigmaNAccumulator |
struct | SigmaNAccumulator< Arithmetic, Atomicity, 1 > |
specialization for ND=1 to allow for better syntax More... | |
struct | SigmasValueHandler |
struct | Square |
A Square functor. More... | |
struct | SquareAccumulator |
SquareAccumulator. More... | |
struct | StatCounter |
A counter aiming at computing average and sum2 / variance / standard deviation. More... | |
struct | SumAccumulator |
SumAccumulator. More... | |
struct | TrueAccumulator |
TrueAccumulator. More... | |
struct | TrueTo1 |
helper functor for the TrueAccumulator More... | |
struct | WeightedAdder |
An Adder ValueHandler, taking weight into account and computing a count plus the sum of the weights In case of full atomicity, fetch_add or compare_exchange_weak are used for each element, that is we do not have full atomicity accross the two elements. More... | |
struct | WeightedCountAccumulator |
WeightedCountAccumulator. More... | |
struct | WeightedHistoInputType |
small class used as InputType for weighted Histograms only a pair of the InnerType and the weight. More... | |
struct | WeightedProduct |
A Product functor, take a pair (value, weight) as input. More... | |
struct | WeightedProfileTransform |
An inputTransform for WeightedProfile histograms, keeping weight and replacing value by 1. More... | |
struct | WeightedSquare |
A WeightedSquare functor, take a pair (value, weight) as input. More... | |
struct | WeightedSquareAccumulator |
WeightedSquareAccumulator. More... | |
struct | WeightedSumAccumulator |
WeightedSumAccumulator. More... | |
Typedefs | |
template<typename Arithmetic, typename Result = double> | |
using | fp_result_type = std::conditional_t<std::is_integral_v<Arithmetic>, Result, Arithmetic> |
type_trait for the result type of a floating point operation on the type Arithmetic | |
template<typename Arithmetic, atomicity Atomicity = atomicity::full> | |
using | Minimum = Extremum<Arithmetic, Atomicity, std::less<Arithmetic>, std::numeric_limits<Arithmetic>::max> |
A Minimun ValueHandler operator(a, b) means a = min(a, b) In case of full atomicity, compare_exchange_weak is used. | |
template<typename Arithmetic, atomicity Atomicity = atomicity::full> | |
using | Maximum = Extremum<Arithmetic, Atomicity, std::greater<Arithmetic>, std::numeric_limits<Arithmetic>::lowest> |
An Maximum ValueHandler operator(a, b) means a = max(a, b) In case of full atomicity, compare_exchange_weak is used. | |
template<atomicity Atomicity, typename Arithmetic> | |
using | AveragingAccumulator = AveragingAccumulatorBase<Atomicity, Arithmetic, CountAccumulator, SumAccumulator> |
AveragingAccumulator. | |
template<atomicity Atomicity, typename Arithmetic> | |
using | SigmaAccumulator = SigmaAccumulatorBase<Atomicity, Arithmetic, AveragingAccumulator, SquareAccumulator> |
SigmaAccumulator. | |
template<atomicity Atomicity, typename Arithmetic> | |
using | StatAccumulator |
StatAccumulator. | |
template<typename Arithmetic = double, atomicity Atomicity = atomicity::full> | |
using | SummingCounter = AveragingCounter<Arithmetic, Atomicity> |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | Histogram = HistogramWrapper<StaticHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
standard custom histogram. See HistogramWrapper and StaticHistogram for details | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | WeightedHistogram = HistogramWrapper<StaticWeightedHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
custom histogram with weight. See HistogramWrapper and StaticWeightedHistogram for details | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | ProfileHistogram = HistogramWrapper<StaticProfileHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
custom profile histograming. See HistogramWrapper and StaticProfileHistogram for details | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | WeightedProfileHistogram |
custom weighted profile histogram. See HistogramWrapper and StaticWeightedProfileHistogram for details | |
template<typename HistogramType> | |
using | HistogramWrapper = HistogramWrapperInternal<HistogramType> |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | RootHistogram = HistogramWrapper<StaticRootHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
standard custom histogram | |
template<atomicity Atomicity, typename Arithmetic> | |
using | WeightedAveragingAccumulator |
WeightedAveragingAccumulator. | |
template<atomicity Atomicity, typename Arithmetic> | |
using | WeightedSigmaAccumulator |
WeightedSigmaAccumulator. | |
template<atomicity Atomicity, typename Arithmetic, typename ND, typename AxisTupleType> | |
using | HistogramingAccumulator |
Class implementing a regular histogram accumulator. | |
template<atomicity Atomicity, typename Arithmetic, typename ND, typename AxisTupleType> | |
using | WeightedHistogramingAccumulator |
Class implementing a weighted histogram accumulator. | |
template<atomicity Atomicity, typename Arithmetic, typename ND, typename AxisTupleType> | |
using | ProfileHistogramingAccumulator |
Class implementing a profile histogram accumulator. | |
template<atomicity Atomicity, typename Arithmetic, typename ND, typename AxisTupleType> | |
using | WeightedProfileHistogramingAccumulator |
Class implementing a weighted profile histogram accumulator. | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | StaticHistogram |
standard static histograming counter. See HistogramingCounterBase for details | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | StaticWeightedHistogram |
standard static histograming counter with weight. See HistogramingCounterBase for details | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | StaticProfileHistogram |
profile static histograming counter. See HistogramingCounterBase for details | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | StaticWeightedProfileHistogram |
weighted static profile histograming counter. See HistogramingCounterBase for details | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double, typename AxisTupleType = make_tuple_t<Axis<Arithmetic>, ND>> | |
using | StaticRootHistogram |
Root histograming counter. See RootHistogramingCounterBase for details. | |
Enumerations | |
enum class | atomicity { none , full } |
Defines atomicity of the accumulators. More... | |
Functions | |
template<class Rep, class Period> | |
auto | sqrt (std::chrono::duration< Rep, Period > d) |
sqrt for std::chrono::duration | |
template<class Rep1, class Rep2, class Period> | |
auto | operator* (const std::chrono::duration< Rep1, Period > &lhs, const std::chrono::duration< Rep2, Period > &rhs) |
Multiplication of two std::chrono::duration objects with same Period. | |
template<class T> | |
auto | sqrt (T d) |
forward declaration of sqrt for custom types | |
template<typename AtomicType, typename Arithmetic> | |
void | fetch_add (AtomicType &atVar, Arithmetic value) |
generic fetch_add, also dealing with atomic types with no fetch_add member method | |
std::ostream & | operator<< (std::ostream &s, const PrintableCounter &counter) |
external printout operator to a stream type | |
MsgStream & | operator<< (MsgStream &s, const PrintableCounter &counter) |
template<typename Counter, typename Container, typename Fun> | |
void | accumulate (Counter &counter, const Container &container, Fun f=Identity{}) |
A helper function for accumulating data from a container into a counter This is internally using buffers so that the original counter is only updated once. | |
template<typename Arithmetic> | |
void | to_json (nlohmann::json &j, const Axis< Arithmetic > &axis) |
automatic conversion of the Axis type to json | |
constexpr unsigned int | NSUMS (unsigned int ND) |
number of items in sums for a given dimension = 1 (nb items) + ND (sums of each dimension) + ND*(ND+1)/2 (square sums) | |
void | to_json (nlohmann::json &j, const CustomAxis &axis) |
Variables | |
constexpr construct_empty_t | construct_empty {} |
Efficient counter implementations for Gaudi.
A number of concepts and templated classes are defined:
All counters are serialized into JSON strings using nlohmann's json library (pure header) See https://github.com/nlohmann/json for details, but here are few notes :
Symetrically to serialization, all counters objects can be constructed from json objects using the same nlohmann's json library via a the fromJSON static method;
The serialized json needs to contain a 'type' entry defining the rest of the json structure. If the type value contains a ':' character, then the part preceding it will be considered as a namespace. The rest is free text.
Here is a list of types defined in this header and their corresponding fields. Note that there are 2 kinds of fields : raw ones and derived ones, built on top of raw ones. Note also that <prec> when present is a string defining the precision of the data when numerical. It is described at the end of the list for each dependent field, the computation formula is given
All Accumulators and Counters defined above are provided in their atomic and non atomic versions
Here is an example of the typical usage of these classes :
using Gaudi::Accumulators::AveragingAccumulator = AveragingAccumulatorBase<Atomicity, Arithmetic, CountAccumulator, SumAccumulator> |
An AveragingAccumulator is an Accumulator able to compute an average
Definition at line 758 of file Accumulators.h.
using Gaudi::Accumulators::fp_result_type = std::conditional_t<std::is_integral_v<Arithmetic>, Result, Arithmetic> |
type_trait for the result type of a floating point operation on the type Arithmetic
Definition at line 303 of file Accumulators.h.
using Gaudi::Accumulators::Histogram = HistogramWrapper<StaticHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
standard custom histogram. See HistogramWrapper and StaticHistogram for details
Definition at line 22 of file Histogram.h.
using Gaudi::Accumulators::HistogramingAccumulator |
Class implementing a regular histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 564 of file StaticHistogram.h.
using Gaudi::Accumulators::HistogramWrapper = HistogramWrapperInternal<HistogramType> |
Definition at line 171 of file HistogramWrapper.h.
using Gaudi::Accumulators::Maximum = Extremum<Arithmetic, Atomicity, std::greater<Arithmetic>, std::numeric_limits<Arithmetic>::lowest> |
An Maximum ValueHandler operator(a, b) means a = max(a, b) In case of full atomicity, compare_exchange_weak is used.
Definition at line 430 of file Accumulators.h.
using Gaudi::Accumulators::Minimum = Extremum<Arithmetic, Atomicity, std::less<Arithmetic>, std::numeric_limits<Arithmetic>::max> |
A Minimun ValueHandler operator(a, b) means a = min(a, b) In case of full atomicity, compare_exchange_weak is used.
Definition at line 423 of file Accumulators.h.
using Gaudi::Accumulators::ProfileHistogram = HistogramWrapper<StaticProfileHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
custom profile histograming. See HistogramWrapper and StaticProfileHistogram for details
Definition at line 32 of file Histogram.h.
using Gaudi::Accumulators::ProfileHistogramingAccumulator |
Class implementing a profile histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 585 of file StaticHistogram.h.
using Gaudi::Accumulators::RootHistogram = HistogramWrapper<StaticRootHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
standard custom histogram
Definition at line 22 of file RootHistogram.h.
using Gaudi::Accumulators::SigmaAccumulator = SigmaAccumulatorBase<Atomicity, Arithmetic, AveragingAccumulator, SquareAccumulator> |
A SigmaAccumulator is an Accumulator able to compute an average and variance/rms
Definition at line 819 of file Accumulators.h.
using Gaudi::Accumulators::StatAccumulator |
A StatAccumulator is an Accumulator able to compute an average, variance/rms and min/max
Definition at line 826 of file Accumulators.h.
using Gaudi::Accumulators::StaticHistogram |
standard static histograming counter. See HistogramingCounterBase for details
Definition at line 733 of file StaticHistogram.h.
using Gaudi::Accumulators::StaticProfileHistogram |
profile static histograming counter. See HistogramingCounterBase for details
Definition at line 745 of file StaticHistogram.h.
using Gaudi::Accumulators::StaticRootHistogram |
Root histograming counter. See RootHistogramingCounterBase for details.
Definition at line 358 of file StaticRootHistogram.h.
using Gaudi::Accumulators::StaticWeightedHistogram |
standard static histograming counter with weight. See HistogramingCounterBase for details
Definition at line 739 of file StaticHistogram.h.
using Gaudi::Accumulators::StaticWeightedProfileHistogram |
weighted static profile histograming counter. See HistogramingCounterBase for details
Definition at line 751 of file StaticHistogram.h.
using Gaudi::Accumulators::SummingCounter = AveragingCounter<Arithmetic, Atomicity> |
Definition at line 1005 of file Accumulators.h.
using Gaudi::Accumulators::WeightedAveragingAccumulator |
An WeightedAveragingAccumulator is an Accumulator able to compute an average This implementation takes a pair (value, weight) as input
Definition at line 210 of file StaticHistogram.h.
using Gaudi::Accumulators::WeightedHistogram = HistogramWrapper<StaticWeightedHistogram<ND, Atomicity, Arithmetic, AxisTupleType>> |
custom histogram with weight. See HistogramWrapper and StaticWeightedHistogram for details
Definition at line 27 of file Histogram.h.
using Gaudi::Accumulators::WeightedHistogramingAccumulator |
Class implementing a weighted histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 574 of file StaticHistogram.h.
using Gaudi::Accumulators::WeightedProfileHistogram |
custom weighted profile histogram. See HistogramWrapper and StaticWeightedProfileHistogram for details
Definition at line 37 of file Histogram.h.
using Gaudi::Accumulators::WeightedProfileHistogramingAccumulator |
Class implementing a weighted profile histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 596 of file StaticHistogram.h.
using Gaudi::Accumulators::WeightedSigmaAccumulator |
A WeightedSigmaAccumulator is an Accumulator able to compute an average and variance/rms This implementation takes a pair (value, weight) as input
Definition at line 219 of file StaticHistogram.h.
|
strong |
Defines atomicity of the accumulators.
Enumerator | |
---|---|
none | |
full |
Definition at line 262 of file Accumulators.h.
void Gaudi::Accumulators::accumulate | ( | Counter & | counter, |
const Container & | container, | ||
Fun | f = Identity{} ) |
A helper function for accumulating data from a container into a counter This is internally using buffers so that the original counter is only updated once.
Definition at line 1227 of file Accumulators.h.
void Gaudi::Accumulators::fetch_add | ( | AtomicType & | atVar, |
Arithmetic | value ) |
generic fetch_add, also dealing with atomic types with no fetch_add member method
Definition at line 357 of file Accumulators.h.
|
constexpr |
number of items in sums for a given dimension = 1 (nb items) + ND (sums of each dimension) + ND*(ND+1)/2 (square sums)
Definition at line 29 of file StaticRootHistogram.h.
auto Gaudi::Accumulators::operator* | ( | const std::chrono::duration< Rep1, Period > & | lhs, |
const std::chrono::duration< Rep2, Period > & | rhs ) |
Multiplication of two std::chrono::duration objects with same Period.
Definition at line 40 of file Counters.h.
|
inline |
Definition at line 890 of file Accumulators.h.
|
inline |
external printout operator to a stream type
Definition at line 889 of file Accumulators.h.
auto Gaudi::Accumulators::sqrt | ( | std::chrono::duration< Rep, Period > | d | ) |
sqrt for std::chrono::duration
Definition at line 34 of file Counters.h.
auto Gaudi::Accumulators::sqrt | ( | T | d | ) |
forward declaration of sqrt for custom types
void Gaudi::Accumulators::to_json | ( | nlohmann::json & | j, |
const Axis< Arithmetic > & | axis ) |
automatic conversion of the Axis type to json
Definition at line 318 of file StaticHistogram.h.
void Gaudi::Accumulators::to_json | ( | nlohmann::json & | j, |
const CustomAxis & | axis ) |
Definition at line 57 of file HistogramsTests.cpp.
|
constexpr |
Definition at line 440 of file Accumulators.h.