Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Gaudi::Accumulators::HistogramArray< Histo, N, Seq > Struct Template Reference

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...

#include </builds/gaudi/Gaudi/GaudiKernel/include/Gaudi/Accumulators/HistogramArray.h>

Detailed Description

template<typename Histo, std::size_t N, typename Seq = std::make_integer_sequence<unsigned int, std::tuple_size_v<typename Histo::AxisTupleType>>>
struct Gaudi::Accumulators::HistogramArray< Histo, N, Seq >

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 :

  • if 2 string_views are given, they are used in a call to std::format(name/title, n);
  • if 2 callables are given, they are called on the index they should take a size_t and return some type convertible to string_view actual implementation is in HistogramArrayInternal

Typical usage : // Array of 5 1D histograms with simple names and titles // Names will be GaudiH1D-0, GaudiH1D-1, ... and similarly for titles Gaudi::Accumulators::HistogramArray<Gaudi::Accumulators::Histogram<1>, 5> histo1d{ &algo, "GaudiH1D-{}", "A Gaudi 1D histogram - number {}", { 21, -10.5, 10.5, "X" } }; ++histo1d[3][-10.0]; // Array of 5 2D weighted histograms with simple names and titles // Names will be Name0, Name1, ... and similarly for titles Gaudi::Accumulators::HistogramArray<Gaudi::Accumulators::WeightedHistogram<2>, 7> histo2dw{ &algo, "Name{}", "Title {}", { 21, -10.5, 10.5, "X" }, { 21, -10.5, 10.5, "Y" } }; histo2dw[1][{ -10.0, -10.0 }] += 0.25; // Array of histograms with custom name and titles // Names will be GaudiH1D-0-0, GaudiH1D-1-1, GaudiH1D-2-4, ... // Titles will be "Title 1 of 5", "Title 2 of 5", "Title 3 of 5", ... Gaudi::Accumulators::HistogramArray<Gaudi::Accumulators::Histogram<1>, 5> histoCustom{ &algo, []( int n ) { return fmt::format( "GaudiH1D-{}-{}", n, n*n ); }, [nb = 5]( int n ) { return fmt::format( "Title {} of {}", n+1, nb ); }, { 21, -10.5, 10.5, "X" } }; ++histoCustom[2][-10.0];

Definition at line 98 of file HistogramArray.h.


The documentation for this struct was generated from the following file: