Documentation of 'org.jlab.groot.math.Axis' Java class
Axis
org.jlab.groot.math

Class Axis

  • All Implemented Interfaces:
    java.io.Serializable


    public class Axis
    extends java.lang.Object
    implements java.io.Serializable
    Defines the attributes for creating a basic axis template with a number of bins, a minimum value, and a maximum value
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      double[] axisMargins 
    • Constructor Summary

      Constructors 
      Constructor and Description
      Axis()
      Creates a default axis with 1 bin, a minimum value of 0, and maximum value of 1.0.
      Axis(double[] limits)
      Creates an axis using the desired limits for the bins
      Axis(int bins, double min, double max)
      Creates an axis using the provided number of bins, minimum value, and maximum value
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double convertFromUnit(double xUnit)
      Scales the range by a specified unit
      int getBin(double xVal)
      Finds the specified value and returns which bin it is in in array indexing format (i.e.
      double getBinCenter(int bin)
      Calculates and returns the median value of the bin number entered in the parameter in array indexing format (i.e.
      double[] getBinCenters() 
      double getBinWidth(int bin)
      Calculates and returns the width of the bin specified in the parameter in array indexing format (i.e.
      double[] getLimits()
      A getter for the array of bin limits
      int getNBins()
      A getter for the number of bins, returned in array indexing format (i.e.
      java.lang.String getTitle() 
      double max()
      A getter for the maximum value of the axis
      double min()
      A getter for the minimum value of the axis
      void set(double[] limits)
      Sets the specified limits to the axis
      void set(int bins, double min, double max)
      Sets the number of bins, the min, and the max to the axis as well as calculates the bin widths.
      void setTitle(java.lang.String title) 
      • Methods inherited from class java.lang.Object

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

      • axisMargins

        public double[] axisMargins
    • Constructor Detail

      • Axis

        public Axis()
        Creates a default axis with 1 bin, a minimum value of 0, and maximum value of 1.0.
      • Axis

        public Axis(double[] limits)
        Creates an axis using the desired limits for the bins
        Parameters:
        limits - an array of the upper and lower limits of each bin
      • Axis

        public Axis(int bins,
                    double min,
                    double max)
        Creates an axis using the provided number of bins, minimum value, and maximum value
        Parameters:
        bins - the number of bins to have on the axis
        min - the minimum value for the axis
        max - the maximum value for the axis
    • Method Detail

      • setTitle

        public void setTitle(java.lang.String title)
      • getTitle

        public java.lang.String getTitle()
      • set

        public final void set(double[] limits)
        Sets the specified limits to the axis
        Parameters:
        limits - the desired limits for the bins on the axis
      • set

        public final void set(int bins,
                              double min,
                              double max)
        Sets the number of bins, the min, and the max to the axis as well as calculates the bin widths.
        Parameters:
        bins - the desired number of bins
        min - the minimum value
        max - the maximum value
      • getLimits

        public double[] getLimits()
        A getter for the array of bin limits
        Returns:
        a double array of the bin limits
      • getNBins

        public int getNBins()
        A getter for the number of bins, returned in array indexing format (i.e. 1 bin would return 0, 2 would return 1, etc.)
        Returns:
        the number of bins in array index format
      • max

        public double max()
        A getter for the maximum value of the axis
        Returns:
        the maximum value of the axis
      • getBinCenters

        public double[] getBinCenters()
      • min

        public double min()
        A getter for the minimum value of the axis
        Returns:
        the minimum value of the axis
      • getBinCenter

        public double getBinCenter(int bin)
        Calculates and returns the median value of the bin number entered in the parameter in array indexing format (i.e. for the 1st bin enter 0, the 2nd bin enter 1, etc.)
        Parameters:
        bin - which bin to get the median value of, entered in array indexing format
        Returns:
        the median value of the specified bin
      • getBinWidth

        public double getBinWidth(int bin)
        Calculates and returns the width of the bin specified in the parameter in array indexing format (i.e. for the 1st bin enter 0, the 2nd bin enter 1, etc.)
        Parameters:
        bin - the bin to get the width of
        Returns:
        the width of the specified bin
      • getBin

        public int getBin(double xVal)
        Finds the specified value and returns which bin it is in in array indexing format (i.e. if it is in the 1st bin, it would return 0, the 2nd bin would return 1, ... , the nth bin would return n-1).
        Parameters:
        xVal - the data value to find on the axis
        Returns:
        the bin where the specified value is in array indexing format
      • convertFromUnit

        public double convertFromUnit(double xUnit)
        Scales the range by a specified unit
        Parameters:
        xUnit - the unit to multiply the range of values by
        Returns:
        min value + ((max value - min value) * xUnit)

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.