ATLAS Offline Software
Loading...
Searching...
No Matches
histogram.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef H5_HISTOGRAMS_H
6#define H5_HISTOGRAMS_H
7
8namespace H5 {
9 class Group;
10}
11
12#include <string>
13
14// the main user-facing functions are defined as members of a struct
15// rather than free functions to ensure that the full set of overloads
16// here matches those in the `.icc` file. The struct has one global
17// instance, `write_hist_to_group`, that behaves exactly like a free
18// function.
19
20
21namespace H5Utils::hist::detail {
23 // Simple form, writes boost::histogram to an HDF5 group with some
24 // name.
25 template <typename T>
27 H5::Group& group,
28 const T& hist,
29 const std::string& name) const;
30
31 // Overload with external label override (positional list or name
32 // map). By default axes are labeled in the boost::histogram
33 // metadata, but this can be overwritten when writing. Several
34 // forms for `Labels` are allowed:
35 //
36 // - A mapping from axis name to axis labeling overrides. All keys
37 // must be valid axis names in the existing histogram, but any
38 // axes without an override are left unchanged.
39 //
40 // - A list of axis labeling overrides. This list must be equal in
41 // length to the number of axes in the histogram.
42 //
43 // The axis labeling itself specifies bin names in discrete axes,
44 // and can either be a list of labels (in the same order in which
45 // bins were specified) or a mapping between the discrete bin
46 // values and the label names. For more examples see
47 // `util/test-histogram.cxx`.
48 //
49 template <typename T, typename Labels>
51 H5::Group& group,
52 const T& hist,
53 const std::string& name,
54 const Labels& labels) const;
55 };
56}
57
58namespace H5Utils::hist {
60}
61
62#include "histogram.icc"
63
64#endif
constexpr detail::write_hist_to_group_fn write_hist_to_group
Definition histogram.h:59
HDF5 Traits.
Definition H5Traits.h:17
Group
Properties of a chain group.
void operator()(H5::Group &group, const T &hist, const std::string &name, const Labels &labels) const
void operator()(H5::Group &group, const T &hist, const std::string &name) const