The Gaudi Framework
master (594c33fa)
|
Namespaces | |
details | |
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... | |
struct | Axis |
Definition of an Histogram Axis. More... | |
struct | Axis< Gaudi::Tests::Histograms::CustomAxis::Category > |
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 | 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 | HistogramArrayBase |
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 | HistogramArrayBase< Histo, N, std::index_sequence< NDs... > > |
class | HistogramingAccumulatorInternal |
Internal Accumulator class dealing with Histograming. More... | |
class | HistogramingCounterBaseInternal |
A base counter dealing with Histograms. More... | |
class | HistogramingCounterBaseInternal< ND, Atomicity, Arithmetic, Type, Accumulator, std::index_sequence< NDs... > > |
struct | HistoInputType |
small class used as InputType for regular Histograms More... | |
class | HistoInputType< Arithmetic, 1 > |
specialization of HistoInputType for ND == 1 in order to have simpler syntax that is, no tuple of one item More... | |
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< int, 1 > > |
struct | RootHistogramingAccumulator< Atomicity, Arithmetic, std::integral_constant< int, 2 > > |
struct | RootHistogramingAccumulator< Atomicity, Arithmetic, std::integral_constant< int, 3 > > |
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 > |
class | RootHistogramingCounterBase< 2, Atomicity, Arithmetic, Type > |
class | RootHistogramingCounterBase< 3, Atomicity, Arithmetic, Type > |
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 | WeightedCountAccumulator |
WeightedCountAccumulator. More... | |
struct | WeightedHistoInputType |
small class used as InputType for weighted Histograms More... | |
struct | WeightedProduct |
A Product functor, take a pair (value, weight) as input. More... | |
struct | WeightedSquare |
A WeightedSquare functor, take a pair (value, weight) as input. More... | |
struct | WeightedSquareAccumulator |
WeightedSquareAccumulator. More... | |
struct | WeightedSumAccumulator |
WeightedSumAccumulator. More... | |
Typedefs | |
template<atomicity Atomicity, typename Arithmetic > | |
using | WeightedAveragingAccumulator = AveragingAccumulatorBase< Atomicity, Arithmetic, WeightedCountAccumulator, WeightedSumAccumulator > |
WeightedAveragingAccumulator. More... | |
template<atomicity Atomicity, typename Arithmetic > | |
using | WeightedSigmaAccumulator = SigmaAccumulatorBase< Atomicity, Arithmetic, WeightedAveragingAccumulator, WeightedSquareAccumulator > |
WeightedSigmaAccumulator. More... | |
template<atomicity Atomicity, typename Arithmetic , typename ND > | |
using | HistogramingAccumulator = HistogramingAccumulatorInternal< Atomicity, HistoInputType< Arithmetic, ND::value >, unsigned long, ND, IntegralAccumulator > |
Class implementing a regular histogram accumulator. More... | |
template<atomicity Atomicity, typename Arithmetic , typename ND > | |
using | WeightedHistogramingAccumulator = HistogramingAccumulatorInternal< Atomicity, WeightedHistoInputType< Arithmetic, ND::value >, Arithmetic, ND, WeightedCountAccumulator > |
Class implementing a weighted histogram accumulator. More... | |
template<atomicity Atomicity, typename Arithmetic , typename ND > | |
using | ProfileHistogramingAccumulator = HistogramingAccumulatorInternal< Atomicity, HistoInputType< Arithmetic, ND::value+1, ND::value >, Arithmetic, ND, SigmaAccumulator > |
Class implementing a profile histogram accumulator. More... | |
template<atomicity Atomicity, typename Arithmetic , typename ND > | |
using | WeightedProfileHistogramingAccumulator = HistogramingAccumulatorInternal< Atomicity, WeightedHistoInputType< Arithmetic, ND::value+1, ND::value >, Arithmetic, ND, WeightedSigmaAccumulator > |
Class implementing a weighted profile histogram accumulator. More... | |
template<unsigned int ND, atomicity Atomicity, typename Arithmetic , const char * Type, template< atomicity, typename, typename > typename Accumulator> | |
using | HistogramingCounterBase = HistogramingCounterBaseInternal< ND, Atomicity, Arithmetic, Type, Accumulator, std::make_index_sequence< ND > > |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double> | |
using | Histogram = HistogramingCounterBase< ND, Atomicity, Arithmetic, naming::histogramString, HistogramingAccumulator > |
standard histograming counter. See HistogramingCounterBase for details More... | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double> | |
using | WeightedHistogram = HistogramingCounterBase< ND, Atomicity, Arithmetic, naming::weightedHistogramString, WeightedHistogramingAccumulator > |
standard histograming counter with weight. See HistogramingCounterBase for details More... | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double> | |
using | ProfileHistogram = HistogramingCounterBase< ND, Atomicity, Arithmetic, naming::profilehistogramString, ProfileHistogramingAccumulator > |
profile histograming counter. See HistogramingCounterBase for details More... | |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double> | |
using | WeightedProfileHistogram = HistogramingCounterBase< ND, Atomicity, Arithmetic, naming::weightedProfilehistogramString, WeightedProfileHistogramingAccumulator > |
weighted profile histograming counter. See HistogramingCounterBase for details More... | |
template<typename Histo , std::size_t N> | |
using | HistogramArray = HistogramArrayBase< Histo, N, std::make_index_sequence< Histo::NumberDimensions::value > > |
template<unsigned int ND, atomicity Atomicity = atomicity::full, typename Arithmetic = double> | |
using | RootHistogram = RootHistogramingCounterBase< ND, Atomicity, Arithmetic, naming::histogramString > |
Root histograming counter. See RootHistogramingCounterBase for details. More... | |
template<typename T , typename = int> | |
using | has_fetch_add_ = decltype(std::declval< T & >().fetch_add(0)) |
type_traits for checking the presence of fetch_add More... | |
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 More... | |
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. More... | |
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. More... | |
template<atomicity Atomicity, typename Arithmetic > | |
using | AveragingAccumulator = AveragingAccumulatorBase< Atomicity, Arithmetic, CountAccumulator, SumAccumulator > |
AveragingAccumulator. More... | |
template<atomicity Atomicity, typename Arithmetic > | |
using | SigmaAccumulator = SigmaAccumulatorBase< Atomicity, Arithmetic, AveragingAccumulator, SquareAccumulator > |
SigmaAccumulator. More... | |
template<atomicity Atomicity, typename Arithmetic > | |
using | StatAccumulator = AccumulatorSet< Arithmetic, Atomicity, Arithmetic, SigmaAccumulator, MinAccumulator, MaxAccumulator > |
StatAccumulator. More... | |
template<typename Arithmetic = double, atomicity Atomicity = atomicity::full> | |
using | SummingCounter = AveragingCounter< Arithmetic, Atomicity > |
Enumerations | |
enum | atomicity { atomicity::none, atomicity::full } |
Defines atomicity of the accumulators. More... | |
Functions | |
template<typename Arithmetic > | |
void | to_json (nlohmann::json &j, const Axis< Arithmetic > &axis) |
automatic conversion of the Axis type to json More... | |
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) More... | |
template<class Rep , class Period > | |
auto | sqrt (std::chrono::duration< Rep, Period > d) |
sqrt for std::chrono::duration More... | |
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. More... | |
template<class T > | |
auto | sqrt (T d) |
forward declaration of sqrt for custom types More... | |
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 More... | |
std::ostream & | operator<< (std::ostream &s, const PrintableCounter &counter) |
external printout operator to a stream type More... | |
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. More... | |
Variables | |
template<typename T > | |
constexpr bool | has_fetch_add_v = Gaudi::cpp17::is_detected_v<has_fetch_add_, T> |
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 = typedef AveragingAccumulatorBase<Atomicity, Arithmetic, CountAccumulator, SumAccumulator> |
AveragingAccumulator.
An AveragingAccumulator is an Accumulator able to compute an average
Definition at line 771 of file Accumulators.h.
using Gaudi::Accumulators::fp_result_type = typedef 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 312 of file Accumulators.h.
using Gaudi::Accumulators::has_fetch_add_ = typedef decltype( std::declval<T&>().fetch_add( 0 ) ) |
type_traits for checking the presence of fetch_add
Definition at line 304 of file Accumulators.h.
using Gaudi::Accumulators::Histogram = typedef HistogramingCounterBase<ND, Atomicity, Arithmetic, naming::histogramString, HistogramingAccumulator> |
standard histograming counter. See HistogramingCounterBase for details
Definition at line 538 of file Histogram.h.
using Gaudi::Accumulators::HistogramArray = typedef HistogramArrayBase<Histo, N, std::make_index_sequence<Histo::NumberDimensions::value> > |
Definition at line 104 of file HistogramArray.h.
using Gaudi::Accumulators::HistogramingAccumulator = typedef HistogramingAccumulatorInternal<Atomicity, HistoInputType<Arithmetic, ND::value>, unsigned long, ND, IntegralAccumulator> |
Class implementing a regular histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 374 of file Histogram.h.
using Gaudi::Accumulators::HistogramingCounterBase = typedef HistogramingCounterBaseInternal<ND, Atomicity, Arithmetic, Type, Accumulator, std::make_index_sequence<ND> > |
Definition at line 527 of file Histogram.h.
using Gaudi::Accumulators::Maximum = typedef 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 439 of file Accumulators.h.
using Gaudi::Accumulators::Minimum = typedef 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 432 of file Accumulators.h.
using Gaudi::Accumulators::ProfileHistogram = typedef HistogramingCounterBase<ND, Atomicity, Arithmetic, naming::profilehistogramString, ProfileHistogramingAccumulator> |
profile histograming counter. See HistogramingCounterBase for details
Definition at line 548 of file Histogram.h.
using Gaudi::Accumulators::ProfileHistogramingAccumulator = typedef HistogramingAccumulatorInternal<Atomicity, HistoInputType<Arithmetic, ND::value + 1, ND::value>, Arithmetic, ND, SigmaAccumulator> |
Class implementing a profile histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 393 of file Histogram.h.
using Gaudi::Accumulators::RootHistogram = typedef RootHistogramingCounterBase<ND, Atomicity, Arithmetic, naming::histogramString> |
Root histograming counter. See RootHistogramingCounterBase for details.
Definition at line 343 of file RootHistogram.h.
using Gaudi::Accumulators::SigmaAccumulator = typedef SigmaAccumulatorBase<Atomicity, Arithmetic, AveragingAccumulator, SquareAccumulator> |
SigmaAccumulator.
A SigmaAccumulator is an Accumulator able to compute an average and variance/rms
Definition at line 832 of file Accumulators.h.
using Gaudi::Accumulators::StatAccumulator = typedef AccumulatorSet<Arithmetic, Atomicity, Arithmetic, SigmaAccumulator, MinAccumulator, MaxAccumulator> |
StatAccumulator.
A StatAccumulator is an Accumulator able to compute an average, variance/rms and min/max
Definition at line 839 of file Accumulators.h.
using Gaudi::Accumulators::SummingCounter = typedef AveragingCounter<Arithmetic, Atomicity> |
Definition at line 1015 of file Accumulators.h.
using Gaudi::Accumulators::WeightedAveragingAccumulator = typedef AveragingAccumulatorBase<Atomicity, Arithmetic, WeightedCountAccumulator, WeightedSumAccumulator> |
WeightedAveragingAccumulator.
An AveragingAccumulator is an Accumulator able to compute an average This implementation takes a pair (value, weight) as input
Definition at line 138 of file Histogram.h.
using Gaudi::Accumulators::WeightedHistogram = typedef HistogramingCounterBase<ND, Atomicity, Arithmetic, naming::weightedHistogramString, WeightedHistogramingAccumulator> |
standard histograming counter with weight. See HistogramingCounterBase for details
Definition at line 543 of file Histogram.h.
using Gaudi::Accumulators::WeightedHistogramingAccumulator = typedef HistogramingAccumulatorInternal<Atomicity, WeightedHistoInputType<Arithmetic, ND::value>, Arithmetic, ND, WeightedCountAccumulator> |
Class implementing a weighted histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 383 of file Histogram.h.
using Gaudi::Accumulators::WeightedProfileHistogram = typedef HistogramingCounterBase<ND, Atomicity, Arithmetic, naming::weightedProfilehistogramString, WeightedProfileHistogramingAccumulator> |
weighted profile histograming counter. See HistogramingCounterBase for details
Definition at line 553 of file Histogram.h.
using Gaudi::Accumulators::WeightedProfileHistogramingAccumulator = typedef HistogramingAccumulatorInternal<Atomicity, WeightedHistoInputType<Arithmetic, ND::value + 1, ND::value>, Arithmetic, ND, WeightedSigmaAccumulator> |
Class implementing a weighted profile histogram accumulator.
Actually only an alias to HistogramingAccumulatorInternal with proper template parameters
Definition at line 403 of file Histogram.h.
using Gaudi::Accumulators::WeightedSigmaAccumulator = typedef SigmaAccumulatorBase<Atomicity, Arithmetic, WeightedAveragingAccumulator, WeightedSquareAccumulator> |
WeightedSigmaAccumulator.
A SigmaAccumulator is an Accumulator able to compute an average and variance/rms This implementation takes a pair (value, weight) as input
Definition at line 147 of file Histogram.h.
|
strong |
Defines atomicity of the accumulators.
Enumerator | |
---|---|
none | |
full |
Definition at line 263 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 1239 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 366 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 21 of file RootHistogram.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 901 of file Accumulators.h.
|
inline |
external printout operator to a stream type
Definition at line 900 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 | ||
) |
|
constexpr |
Definition at line 449 of file Accumulators.h.
|
inlineconstexpr |
Definition at line 306 of file Accumulators.h.