Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
HistogramArray.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2022 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
14 #include <utility>
15 
16 namespace Gaudi::Accumulators {
17 
18  namespace details {
19 
25  std::string_view text;
26  FormatHistDefault( std::string_view t ) : text{ t } {}
27  std::string operator()( size_t n );
28  };
29 
34  template <typename Histo, std::size_t N>
35  struct HistogramArrayInternal : std::array<Histo, N> {
37  template <typename OWNER, typename FormatName, typename FormatTitle, std::size_t... Ns, typename... Axis,
38  typename = typename std::enable_if_t<std::is_invocable_v<FormatName, int>>,
39  typename = typename std::enable_if_t<std::is_invocable_v<FormatTitle, int>>>
40  HistogramArrayInternal( OWNER* owner, FormatName&& fname, FormatTitle&& ftitle,
42  : std::array<Histo, N>{ Histo{ owner, fname( Ns ), ftitle( Ns ), allAxis... }... } {
43  static_assert( sizeof...( Ns ) < 1000, "Using HistogramArray with 1000 arrays or more is prohibited. This "
44  "would lead to very long compilation times" );
45  }
47  template <typename OWNER, std::size_t... Ns, typename... Axis>
48  HistogramArrayInternal( OWNER* owner, std::string_view name, std::string_view title,
50  : std::array<Histo, N>{
51  Histo{ owner, FormatHistDefault{ name }( Ns ), FormatHistDefault{ title }( Ns ), allAxis... }... } {
52  static_assert( sizeof...( Ns ) < 1000, "Using HistogramArray with 1000 arrays or more is prohibited. This "
53  "would lead to very long compilation times" );
54  }
55  };
56  } // namespace details
57 
70  template <typename Histo, std::size_t N, typename Seq>
72  template <typename Histo, std::size_t N, std::size_t... NDs>
73  struct HistogramArrayBase<Histo, N, std::index_sequence<NDs...>> : details::HistogramArrayInternal<Histo, N> {
74  template <typename OWNER, typename FormatName, typename FormatTitle>
75  HistogramArrayBase( OWNER* owner, FormatName&& fname, FormatTitle&& ftitle,
77  : details::HistogramArrayInternal<Histo, N>( owner, fname, ftitle, std::make_integer_sequence<std::size_t, N>{},
78  allAxis... ) {}
79  };
80  template <typename Histo, std::size_t N>
82 
83 } // namespace Gaudi::Accumulators
Gaudi::Accumulators::details::FormatHistDefault::operator()
std::string operator()(size_t n)
Definition: HistogramArray.cpp:23
std::string
STL class.
IOTest.N
N
Definition: IOTest.py:110
std::integer_sequence
Histogram.h
Gaudi::Accumulators::details::FormatHistDefault::text
std::string_view text
Definition: HistogramArray.h:25
Gaudi::Accumulators::details::FormatHistDefault
Default formating for histogram names and title, only calling fmt::format on the text given at constr...
Definition: HistogramArray.h:24
Gaudi::Accumulators::details::alwaysT
T alwaysT
Definition: Histogram.h:30
Gaudi::Accumulators::Axis
Definition of an Histogram Axis.
Definition: Histogram.h:154
bug_34121.t
t
Definition: bug_34121.py:30
TimingHistograms.name
name
Definition: TimingHistograms.py:25
details
Definition: AnyDataWrapper.h:18
Gaudi::Accumulators::details::HistogramArrayInternal
internal class implementing an array of histograms
Definition: HistogramArray.h:35
Gaudi::Accumulators::details::HistogramArrayInternal::HistogramArrayInternal
HistogramArrayInternal(OWNER *owner, std::string_view name, std::string_view title, std::integer_sequence< std::size_t, Ns... >, Axis &&... allAxis)
constructor for strings, FormatHistDefault is used as the default callable
Definition: HistogramArray.h:48
Gaudi::Accumulators::details::HistogramArrayInternal::HistogramArrayInternal
HistogramArrayInternal(OWNER *owner, FormatName &&fname, FormatTitle &&ftitle, std::integer_sequence< std::size_t, Ns... >, Axis &&... allAxis)
constructor with callables for FormatName and FormatTitle
Definition: HistogramArray.h:40
std::array
STL class.
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:235
Gaudi::Accumulators
Definition: HistogramsTests.cpp:19
Containers::array
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition: KeyedObjectManager.h:37
std
STL namespace.
Gaudi::Accumulators::details::FormatHistDefault::FormatHistDefault
FormatHistDefault(std::string_view t)
Definition: HistogramArray.h:26
std::size_t
Gaudi::Accumulators::HistogramArrayBase< Histo, N, std::index_sequence< NDs... > >::HistogramArrayBase
HistogramArrayBase(OWNER *owner, FormatName &&fname, FormatTitle &&ftitle, details::alwaysT< NDs, typename Histo::AxisType > &&... allAxis)
Definition: HistogramArray.h:75
Gaudi::Accumulators::HistogramArrayBase
generic class implementing an array of histograms The only addition to a raw array is the constructor...
Definition: HistogramArray.h:71