Package hep.aida.ref

Class VariableAxis

  • All Implemented Interfaces:
    IAxis, java.io.Serializable

    public class VariableAxis
    extends java.lang.Object
    implements IAxis
    Variable-width axis; A reference implementation of hep.aida.IAxis.
    Version:
    1.0, 23/03/2000
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int bins  
      protected double[] edges  
      protected double min  
    • Constructor Summary

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double binCentre​(int index)
      Centre of the bin specified.
      double binLowerEdge​(int index)
      Lower edge of the specified bin.
      int bins()
      The number of bins (excluding underflow and overflow) on the axis.
      double binUpperEdge​(int index)
      Upper edge of the specified bin.
      double binWidth​(int index)
      Width of the bin specified.
      int coordToIndex​(double coord)
      Converts a coordinate on the axis to a bin number.
      double lowerEdge()
      Lower axis edge.
      protected static java.lang.String toString​(double[] array)
      Returns a string representation of the specified array.
      double upperEdge()
      Upper axis edge.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • min

        protected double min
      • bins

        protected int bins
      • edges

        protected double[] edges
    • 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:
        java.lang.IllegalArgumentException - if edges.length < 1.
    • Method Detail

      • binCentre

        public double binCentre​(int index)
        Description copied from interface: IAxis
        Centre of the bin specified.
        Specified by:
        binCentre in interface IAxis
        Parameters:
        index - Bin number (0...bins()-1) or OVERFLOW or UNDERFLOW.
      • binLowerEdge

        public double binLowerEdge​(int index)
        Description copied from interface: IAxis
        Lower edge of the specified bin.
        Specified by:
        binLowerEdge in interface IAxis
        Parameters:
        index - Bin number (0...bins()-1) or OVERFLOW or UNDERFLOW.
        Returns:
        the lower edge of the 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 axis.
        Specified by:
        bins in interface IAxis
      • binUpperEdge

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

        public double binWidth​(int index)
        Description copied from interface: IAxis
        Width of the bin specified.
        Specified by:
        binWidth in interface IAxis
        Parameters:
        index - Bin number (0...bins()-1) or OVERFLOW or UNDERFLOW.
      • coordToIndex

        public int coordToIndex​(double coord)
        Description copied from interface: IAxis
        Converts a coordinate on the axis to a bin number. If the coordinate is < lowerEdge returns UNDERFLOW, and if the coordinate is >= upperEdge returns OVERFLOW.
        Specified by:
        coordToIndex in interface IAxis
      • lowerEdge

        public double lowerEdge()
        Description copied from interface: IAxis
        Lower axis edge.
        Specified by:
        lowerEdge in interface IAxis
      • toString

        protected static java.lang.String toString​(double[] array)
        Returns a string representation of the specified array. The string representation consists of a list of the arrays's elements, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space).
        Returns:
        a string representation of the specified array.
      • upperEdge

        public double upperEdge()
        Description copied from interface: IAxis
        Upper axis edge.
        Specified by:
        upperEdge in interface IAxis