VariableAxis
hep.aida.ref.histogram

Class VariableAxis

  • All Implemented Interfaces:
    IAxis


    public class VariableAxisextends Objectimplements IAxis
    Variable-width axis; A reference implementation of hep.aida.IAxis.
    • Constructor Summary

      Constructors 
      Constructor and Description
      VariableAxis(double[] edges)
      Constructs and returns an axis with the given bin edges.
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      doublebinCenter(int index)
      Get the center of the specified bin.
      doublebinLowerEdge(int index)
      Get the lower edge of the specified bin.
      intbins()
      The number of bins (excluding underflow and overflow) on the IAxis.
      doublebinUpperEdge(int index)
      Get the upper edge of the specified bin.
      doublebinWidth(int index)
      Get the width of the specified bin.
      intcoordToIndex(double coord)
      Convert a coordinate on the axis to a bin number.
      booleanequals(Object o)
      Check if two Axis are equal.
      booleanisFixedBinning()
      Check if the IAxis has fixed binning, i.e.
      doublelowerEdge()
      Get the lower edge of the IAxis.
      doubleupperEdge()
      Get the upper edge of the IAxis.
    • Constructor Detail

      • VariableAxis

        public VariableAxis(double[] edges)
        Constructs and returns an axis with the given bin edges. Example: edges = (0.2, 1.0, 5.0) yields an axis with 2 in-range bins [0.2,1.0), [1.0,5.0) and 2 extra bins [-inf,0.2), [5.0,inf].
        Parameters:
        edges - the bin boundaries the partition shall have; must be sorted ascending and must not contain multiple identical elements.
        Throws:
        IllegalArgumentException - if edges.length < 1.
    • Method Detail

      • binCenter

        public double binCenter(int index)
        Description copied from interface: IAxis
        Get the center of the specified bin.
        Specified by:
        binCenter in interface IAxis
        Parameters:
        index - The bin number: 0 to bins()-1) for the in-range bins or OVERFLOW or UNDERFLOW.
        Returns:
        The center of the corresponding bin. For in-range bins the middle of the upper and lower edge of the bin is returned; for out-of-range bins +/- infinity is returned.
      • binLowerEdge

        public double binLowerEdge(int index)
        Description copied from interface: IAxis
        Get the lower edge of the specified bin.
        Specified by:
        binLowerEdge in interface IAxis
        Parameters:
        index - The bin number: 0 to bins()-1 for the in-range bins or OVERFLOW or UNDERFLOW.
        Returns:
        The lower edge of the corresponding bin; for the underflow bin this is Double.NEGATIVE_INFINITY.
      • bins

        public int bins()
        Description copied from interface: IAxis
        The number of bins (excluding underflow and overflow) on the IAxis.
        Specified by:
        bins in interface IAxis
        Returns:
        The IAxis's number of bins.
      • binUpperEdge

        public double binUpperEdge(int index)
        Description copied from interface: IAxis
        Get the upper edge of the specified bin.
        Specified by:
        binUpperEdge in interface IAxis
        Parameters:
        index - The bin number: 0 to bins()-1 for the in-range bins or OVERFLOW or UNDERFLOW.
        Returns:
        The upper edge of the corresponding bin; for the overflow bin this is Double.POSITIVE_INFINITY.
      • binWidth

        public double binWidth(int index)
        Description copied from interface: IAxis
        Get the width of the specified bin.
        Specified by:
        binWidth in interface IAxis
        Parameters:
        index - The bin number: 0 to bins()-1) for the in-range bins or OVERFLOW or UNDERFLOW.
        Returns:
        The width of the corresponding bin.
      • coordToIndex

        public int coordToIndex(double coord)
        Description copied from interface: IAxis
        Convert a coordinate on the axis to a bin number. If the coordinate is less than the lowerEdge UNDERFLOW is returned; if the coordinate is greater or equal to the upperEdge OVERFLOW is returned.
        Specified by:
        coordToIndex in interface IAxis
        Parameters:
        coord - The coordinate to be converted.
        Returns:
        The corresponding bin number.
      • lowerEdge

        public double lowerEdge()
        Description copied from interface: IAxis
        Get the lower edge of the IAxis.
        Specified by:
        lowerEdge in interface IAxis
        Returns:
        The IAxis's lower edge.
      • upperEdge

        public double upperEdge()
        Description copied from interface: IAxis
        Get the upper edge of the IAxis.
        Specified by:
        upperEdge in interface IAxis
        Returns:
        The IAxis's upper edge.
      • isFixedBinning

        public boolean isFixedBinning()
        Description copied from interface: IAxis
        Check if the IAxis has fixed binning, i.e. if all the bins have the same width.
        Specified by:
        isFixedBinning in interface IAxis
        Returns:
        true if the binning is fixed, false otherwise.
      • equals

        public boolean equals(Object o)
        Check if two Axis are equal.
        Overrides:
        equals in class Object
        Parameters:
        o - the Object to check
        Returns:
        true if o is an instance of FixedAxis and it has the same number of bins, minimum and bin width.

SCaVis 1.7 © jWork.org