|
ACTS
Experiment-independent tracking
|
Multi-dimensional histogram wrapper using boost::histogram for data collection. More...
#include <Acts/Utilities/Histogram.hpp>
Public Member Functions | |
| Histogram (const Histogram &other)=default | |
| Copy constructor. | |
| Histogram (Histogram &&other) noexcept=default | |
| Move constructor. | |
| Histogram (std::string name, std::string title, const std::array< AxisVariant, Dim > &axes) | |
| Construct multi-dimensional histogram from axes. | |
| double | binContent (const std::array< int, Dim > &indices) const |
| Get the content of a single bin. | |
| double | binError (const std::array< int, Dim > &indices) const |
| Get the error of a single bin. | |
| void | fill (const std::array< double, Dim > &values) |
| Fill histogram with values. | |
| const BoostHist & | histogram () const |
| Direct access to boost::histogram (for converters and tests). | |
| const std::string & | name () const |
| Get histogram name. | |
| Histogram & | operator= (const Histogram &other)=default |
| Copy assignment operator. | |
| Histogram & | operator= (Histogram &&other) noexcept=default |
| Move assignment operator. | |
| void | setBin (const std::array< int, Dim > &indices, double content, double error) |
| Set the content and error of a single bin, discarding whatever was there before. | |
| void | setBinContent (const std::array< int, Dim > &indices, double content) |
| Set the content of a single bin, discarding whatever was there before. | |
| Histogram< 1 > | sliceLastAxis (const std::array< int, Dim - 1 > &outerBins) const |
| Extract the distribution along the last axis at a fixed bin of the other axes. | |
| template<std::integral... Ints> requires (sizeof...(Ints) + 1 == Dim) | |
| Histogram< 1 > | sliceLastAxis (Ints... outerBins) const |
| Extract the distribution along the last axis at a fixed bin of the other axes, given as individual bin indices rather than an array. | |
| const std::string & | title () const |
| Get histogram title. | |
| double | totalContent () const |
| Total content of the histogram's in-range bins. | |
Static Public Member Functions | |
| static constexpr std::size_t | rank () |
| Get number of dimensions (compile-time constant). | |
Multi-dimensional histogram wrapper using boost::histogram for data collection.
This class wraps boost::histogram to provide a ROOT-independent histogram implementation with compile-time dimensionality. Every bin carries a content and an error: fill() gives the usual \( \sqrt{N} \) error, while setBin() can write an arbitrary value/error pair, e.g. from a fit.
| Dim | Number of dimensions |
| Acts::Experimental::Histogram< Dim >::Histogram | ( | std::string | name, |
| std::string | title, | ||
| const std::array< AxisVariant, Dim > & | axes ) |
Construct multi-dimensional histogram from axes.
| name | Histogram name (for identification and output) |
| title | Histogram title (for plotting) |
| axes | Array of axes with binning and metadata |
|
default |
Copy constructor.
| other | The other histogram to copy from |
|
defaultnoexcept |
Move constructor.
| other | The other histogram to move from |
| double Acts::Experimental::Histogram< Dim >::binContent | ( | const std::array< int, Dim > & | indices | ) | const |
Get the content of a single bin.
| indices | Zero-based bin index per axis, excluding under-/overflow |
| double Acts::Experimental::Histogram< Dim >::binError | ( | const std::array< int, Dim > & | indices | ) | const |
Get the error of a single bin.
| indices | Zero-based bin index per axis, excluding under-/overflow |
| void Acts::Experimental::Histogram< Dim >::fill | ( | const std::array< double, Dim > & | values | ) |
Fill histogram with values.
| values | Values to fill (one per axis) |
| const BoostHist & Acts::Experimental::Histogram< Dim >::histogram | ( | ) | const |
Direct access to boost::histogram (for converters and tests).
| const std::string & Acts::Experimental::Histogram< Dim >::name | ( | ) | const |
Get histogram name.
|
default |
Copy assignment operator.
| other | The other histogram to copy from |
|
defaultnoexcept |
Move assignment operator.
| other | The other histogram to move from |
|
staticconstexpr |
Get number of dimensions (compile-time constant).
| void Acts::Experimental::Histogram< Dim >::setBin | ( | const std::array< int, Dim > & | indices, |
| double | content, | ||
| double | error ) |
Set the content and error of a single bin, discarding whatever was there before.
| indices | Zero-based bin index per axis, excluding under-/overflow |
| content | The content to store |
| error | The uncertainty on content |
| void Acts::Experimental::Histogram< Dim >::setBinContent | ( | const std::array< int, Dim > & | indices, |
| double | content ) |
Set the content of a single bin, discarding whatever was there before.
| indices | Zero-based bin index per axis, excluding under-/overflow |
| content | The content to store |
fill() would give a bin with that many entries. Use setBin to set an arbitrary value/error pair instead. | Histogram< 1 > Acts::Experimental::Histogram< Dim >::sliceLastAxis | ( | const std::array< int, Dim - 1 > & | outerBins | ) | const |
Extract the distribution along the last axis at a fixed bin of the other axes.
Equivalent to ROOT's TH2::ProjectionY(name, xBin + 1, xBin + 1) for a 2D histogram, or TH3::ProjectionZ(name, xBin + 1, xBin + 1, yBin + 1, yBin + 1) for a 3D one.
| outerBins | Zero-based bin index for every axis but the last, in axis order |
outerBins must be in range for its axis | Histogram< 1 > Acts::Experimental::Histogram< Dim >::sliceLastAxis | ( | Ints... | outerBins | ) | const |
Extract the distribution along the last axis at a fixed bin of the other axes, given as individual bin indices rather than an array.
| outerBins | Zero-based bin index for every axis but the last, in axis order |
outerBins must be in range for its axis | const std::string & Acts::Experimental::Histogram< Dim >::title | ( | ) | const |
Get histogram title.
| double Acts::Experimental::Histogram< Dim >::totalContent | ( | ) | const |
Total content of the histogram's in-range bins.
The ROOT-independent equivalent of TH1::GetEntries() on a filled histogram.