An axis with categorical bins.
For example, the following creates an axis with 3 categories:
It is possible to disable the overflow bin by passing enableOverflowBin = false. In that case, arguments outside the axis will be silently discarded.
Definition at line 43 of file RCategoricalAxis.hxx.
Public Types | |
| using | ArgumentType = std::string_view |
Public Member Functions | |
| RCategoricalAxis (std::vector< std::string > categories, bool enableOverflowBin=true) | |
| Construct an axis object with categories. | |
| RLinearizedIndex | ComputeLinearizedIndex (std::string_view x) const |
| Compute the linarized index for a single argument. | |
| const std::vector< std::string > & | GetCategories () const |
| RBinIndexRange | GetFullRange () const |
| Get the full range of all bins. | |
| RLinearizedIndex | GetLinearizedIndex (RBinIndex index) const |
| Get the linearized index for an RBinIndex. | |
| std::uint64_t | GetNNormalBins () const |
| RBinIndexRange | GetNormalRange () const |
| Get the range of all normal bins. | |
| RBinIndexRange | GetNormalRange (RBinIndex begin, RBinIndex end) const |
| Get a range of normal bins. | |
| std::uint64_t | GetTotalNBins () const |
| bool | HasOverflowBin () const |
| RCategoricalAxis | Slice (const RSliceSpec &sliceSpec) const |
| Slice this axis according to the specification. | |
| void | Streamer (TBuffer &) |
| ROOT Streamer function to throw when trying to store an object of this class. | |
Private Attributes | |
| std::vector< std::string > | fCategories |
| The categories as defined by the user. | |
| bool | fEnableOverflowBin |
| Whether the overflow bin is enabled. | |
Friends | |
| bool | operator== (const RCategoricalAxis &lhs, const RCategoricalAxis &rhs) |
#include <ROOT/RCategoricalAxis.hxx>
| using ROOT::Experimental::RCategoricalAxis::ArgumentType = std::string_view |
Definition at line 45 of file RCategoricalAxis.hxx.
|
inlineexplicit |
Construct an axis object with categories.
| [in] | categories | the categories without duplicates, must define at least one bin (i.e. size >= 1) |
| [in] | enableOverflowBin | whether to enable the overflow bin |
Definition at line 58 of file RCategoricalAxis.hxx.
|
inline |
Compute the linarized index for a single argument.
The normal bins have indices \(0\) to \(fCategories.size() - 1\) and the overflow bin has index \(fCategories.size()\). If the argument is not a recognized category and the overflow bin is disabled, the return value is invalid.
| [in] | x | the argument |
Definition at line 92 of file RCategoricalAxis.hxx.
|
inline |
Definition at line 76 of file RCategoricalAxis.hxx.
|
inline |
Get the full range of all bins.
This includes the overflow bin, if enabled.
Definition at line 165 of file RCategoricalAxis.hxx.
|
inline |
Get the linearized index for an RBinIndex.
The normal bins have indices \(0\) to \(fCategories.size() - 1\) and the overflow bin has index \(fCategories.size()\).
| [in] | index | the RBinIndex |
Definition at line 112 of file RCategoricalAxis.hxx.
|
inline |
Definition at line 74 of file RCategoricalAxis.hxx.
|
inline |
Get the range of all normal bins.
Definition at line 130 of file RCategoricalAxis.hxx.
|
inline |
Get a range of normal bins.
| [in] | begin | the begin of the bin index range (inclusive), must be normal |
| [in] | end | the end of the bin index range (exclusive), must be normal and >= begin |
Definition at line 140 of file RCategoricalAxis.hxx.
|
inline |
Definition at line 75 of file RCategoricalAxis.hxx.
|
inline |
Definition at line 77 of file RCategoricalAxis.hxx.
|
inline |
Slice this axis according to the specification.
A categorical axis cannot be sliced. The method will throw if a specification other than the default slice operation is passed.
| [in] | sliceSpec | the slice specification |
Definition at line 178 of file RCategoricalAxis.hxx.
|
inline |
ROOT Streamer function to throw when trying to store an object of this class.
Definition at line 197 of file RCategoricalAxis.hxx.
|
friend |
Definition at line 79 of file RCategoricalAxis.hxx.
|
private |
The categories as defined by the user.
Definition at line 49 of file RCategoricalAxis.hxx.
|
private |
Whether the overflow bin is enabled.
Definition at line 51 of file RCategoricalAxis.hxx.