A RAxisGrow that has a label assigned to each bin and a bin width of 1.
While filling still works through coordinates (i.e. arrays of doubles), RAxisLabels allows to convert a string to a bin number or the bin's coordinate center. The number of labels and the number of bins reported by RAxisGrow might differ: the RAxisGrow will only grow when seeing a Fill(), while the RAxisLabels will add a new label whenever GetBinCenter()
is called.
Implementation details: Filling happens often; GetBinCenter()
needs to be fast. Thus the unordered_map. The painter needs the reverse: it wants the label for bin 0, bin 1 etc. The axis should only store the bin labels once; referencing them is (due to re-allocation, hashing etc) non-trivial. So instead, build a vector<string_view>
for the few times the axis needs to be painted.
Definition at line 738 of file RAxis.hxx.
|
| RAxisLabels (const std::vector< std::string > &labels) |
| Construct a RAxisLables from a vector of string s. More...
|
|
| RAxisLabels (const std::vector< std::string_view > &labels) |
| Construct a RAxisLables from a vector of string_view s. More...
|
|
| RAxisLabels (std::string_view title, const std::vector< std::string > &labels) |
| Construct a RAxisLables from a vector of string s, with title. More...
|
|
| RAxisLabels (std::string_view title, const std::vector< std::string_view > &labels) |
| Construct a RAxisLables from a vector of string_view s, with title. More...
|
|
LabelsCmpFlags | CompareBinLabels (const RAxisLabels &other) const noexcept |
| Compare the labels of this axis with those of another axis. More...
|
|
int | FindBinByName (const std::string &label) |
| Get the bin index with label. More...
|
|
double | GetBinCenterByName (const std::string &label) |
| Get the center of the bin with label. More...
|
|
std::vector< std::string_view > | GetBinLabels () const |
| Build a vector of labels. The position in the vector defines the label's bin. More...
|
|
| operator RAxisConfig () const |
| Convert to RAxisConfig. More...
|
|
| RAxisGrow (int nbins, double low, double high) noexcept |
| Initialize a RAxisGrow. More...
|
|
| RAxisGrow (std::string_view title, int nbins, double low, double high) noexcept |
| Initialize a RAxisGrow. More...
|
|
bool | CanGrow () const noexcept final override |
| This axis kind can increase its range. More...
|
|
int | Grow (int toBin) |
| Grow this axis to make the "virtual bin" toBin in-range. More...
|
|
| operator RAxisConfig () const |
| Convert to RAxisConfig. More...
|
|
| RAxisEquidistant ()=default |
|
| RAxisEquidistant (int nbinsNoOver, double low, double high) noexcept |
| Initialize a RAxisEquidistant. More...
|
|
| RAxisEquidistant (std::string_view title, int nbinsNoOver, double low, double high) noexcept |
| Initialize a RAxisEquidistant. More...
|
|
bool | CanGrow () const noexcept override |
| This axis cannot grow. More...
|
|
int | FindBin (double x) const noexcept final override |
| Find the adjusted bin index (returning kUnderflowBin for underflow and kOverflowBin for overflow) for the given coordinate. More...
|
|
double | GetBinCenter (int bin) const final override |
| Get the bin center for the given bin index. More...
|
|
double | GetBinFrom (int bin) const final override |
| Get the low bin border for the given bin index. More...
|
|
int | GetBinIndexForLowEdge (double x) const noexcept final override |
| If the coordinate x is within 10 ULPs of a bin low edge coordinate, return the bin for which this is a low edge. More...
|
|
double | GetBinWidth () const noexcept |
| Get the width of the bins. More...
|
|
double | GetInverseBinWidth () const noexcept |
| Get the inverse of the width of the bins. More...
|
|
int | GetNBinsNoOver () const noexcept final override |
| Get the number of bins, excluding under- and overflow. More...
|
|
| operator RAxisConfig () const |
| Convert to RAxisConfig. More...
|
|
virtual bool | CanGrow () const noexcept=0 |
| Whether this axis can grow (and thus has no overflow bins). More...
|
|
virtual int | FindBin (double x) const noexcept=0 |
| Find the adjusted bin index (returning kUnderflowBin for underflow and kOverflowBin for overflow) for the given coordinate. More...
|
|
virtual double | GetBinCenter (int bin) const =0 |
| Get the bin center for the given bin index. More...
|
|
virtual double | GetBinFrom (int bin) const =0 |
| Get the low bin border ("left edge") for the given bin index. More...
|
|
virtual int | GetBinIndexForLowEdge (double x) const noexcept=0 |
| If the coordinate x is within 10 ULPs of a bin low edge coordinate, return the bin for which this is a low edge. More...
|
|
double | GetBinTo (int bin) const |
| Get the high bin border ("right edge") for the given bin index. More...
|
|
int | GetFirstBin () const noexcept |
| Get the bin index for the first bin of the axis. More...
|
|
int | GetLastBin () const noexcept |
| Get the bin index for the last bin of the axis. More...
|
|
double | GetMaximum () const |
| Get the high end of the axis range. More...
|
|
double | GetMinimum () const |
| Get the low end of the axis range. More...
|
|
int | GetNBins () const noexcept |
| Get the number of bins, including under- and overflow. More...
|
|
virtual int | GetNBinsNoOver () const noexcept=0 |
| Get the number of bins, excluding under- and overflow. More...
|
|
int | GetNOverflowBins () const noexcept |
| Get the number of over- and underflow bins: 0 for growable axes, 2 otherwise. More...
|
|
int | GetOverflowBin () const noexcept |
| Get the bin index for the overflow bin (or kInvalidBin if CanGrow()). More...
|
|
const std::string & | GetTitle () const |
| Get the axis's title. More...
|
|
int | GetUnderflowBin () const noexcept |
| Get the bin index for the underflow bin (or kInvalidBin if CanGrow()). More...
|
|
bool | HasSameBinningAs (const RAxisBase &other) const |
| Check if two axes use the same binning convention, i.e. More...
|
|
const_iterator | begin () const noexcept |
| Get a const_iterator pointing to the first regular bin. More...
|
|
const_iterator | end () const noexcept |
| Get a const_iterator pointing beyond the last regular bin. More...
|
|