Documentation of 'org.jlab.groot.data.H1F' Java class
H1F
org.jlab.groot.data

Class H1F

  • All Implemented Interfaces:
    IDataSet


    public class H1F
    extends java.lang.Object
    implements IDataSet
    Defines the class to create a basic 1D Histogram
    • Constructor Summary

      Constructors 
      Constructor and Description
      H1F()
      The default constructor, which creates a Histogram1D object with the Name "default", the Title "default", no Axis titles, and sets the minimum xAxis value to 0, the maximum x value to 1, and creates 1 bin.
      H1F(java.lang.String name, double xMin, double xMax, float[] binHeights)
      Creates a 1-D Histogram with the specified name, minimum and maximum x-axis values, and the bin heights
      H1F(java.lang.String name, int bins, double xMin, double xMax)
      Creates a 1-D Histogram with the specified name, number of bins, and minimum and maximum x-axis values
      H1F(java.lang.String name, java.lang.String title, double xMin, double xMax)
      Creates a new histogram using the name, title, minimum, and maximum.
      H1F(java.lang.String name, java.lang.String title, int bins, double xMin, double xMax)
      Creates a 1-D Histogram with the specified name, title, number of bins, and minimum and maximum x-axis values
      H1F(java.lang.String hName, java.lang.String xTitle, java.lang.String yTitle, int bins, double xMin, double xMax)
      Creates a Histogram1D object using the specified name, axis titles, number of bins, and minimum and maximum x axis values.
    • Constructor Detail

      • H1F

        public H1F()
        The default constructor, which creates a Histogram1D object with the Name "default", the Title "default", no Axis titles, and sets the minimum xAxis value to 0, the maximum x value to 1, and creates 1 bin.
      • H1F

        public H1F(java.lang.String hName,
                   java.lang.String xTitle,
                   java.lang.String yTitle,
                   int bins,
                   double xMin,
                   double xMax)
        Creates a Histogram1D object using the specified name, axis titles, number of bins, and minimum and maximum x axis values.
        Parameters:
        hName - the desired name of the 1-D Histogram
        xTitle - the desired x-axis title
        yTitle - the desired y-axis title
        bins - the desired number of bins
        xMin - the desired minimum value on the x axis
        xMax - the desired maximum value on the x axis
      • H1F

        public H1F(java.lang.String name,
                   double xMin,
                   double xMax,
                   float[] binHeights)
        Creates a 1-D Histogram with the specified name, minimum and maximum x-axis values, and the bin heights
        Parameters:
        name - the desired name of the histogram
        xMin - the desired minimum x-axis value
        xMax - the desired maximum x-axis value
        binHeights - a double array of the heights of the bins
      • H1F

        public H1F(java.lang.String name,
                   int bins,
                   double xMin,
                   double xMax)
        Creates a 1-D Histogram with the specified name, number of bins, and minimum and maximum x-axis values
        Parameters:
        name - The desired name of the histogram
        bins - The desired number of bins
        xMin - The desired minimum x-axis value
        xMax - The desired maximum x-axis value
      • H1F

        public H1F(java.lang.String name,
                   java.lang.String title,
                   int bins,
                   double xMin,
                   double xMax)
        Creates a 1-D Histogram with the specified name, title, number of bins, and minimum and maximum x-axis values
        Parameters:
        name - The desired name of the histogram
        title - The desired title of the histogram
        bins - The desired number of bins
        xMin - The desired minimum x-axis value
        xMax - The desired maximum x-axis value
      • H1F

        public H1F(java.lang.String name,
                   java.lang.String title,
                   double xMin,
                   double xMax)
        Creates a new histogram using the name, title, minimum, and maximum.
        Parameters:
        name - The desired name of the histogram
        title - The desired title of the histogram
        xMin - The desired minimum x-axis value
        xMax - The desired maximum x-axis value
    • Method Detail

      • initAttributes

        public final void initAttributes()
      • setTitle

        public final void setTitle(java.lang.String title)
      • setTitleX

        public final void setTitleX(java.lang.String xTitle)
        Sets the x-axis title to the specified parameter
        Parameters:
        xTitle - The desired title of the x-axis
      • setTitleY

        public final void setTitleY(java.lang.String yTitle)
        Sets the y-axis title to the specified parameter
        Parameters:
        yTitle - The desired title of the y-axis
      • create

        public static H1F create(java.lang.String name,
                                 int bins,
                                 DataVector vec)
      • getTitle

        public java.lang.String getTitle()
        The getter for the histogram title.
        Returns:
        Title of the histogram.
      • getTitleX

        public java.lang.String getTitleX()
        The getter for the x-axis title.
        Returns:
        The title of the x-axis as a string
      • getTitleY

        public java.lang.String getTitleY()
        The getter for the y-axis title.
        Returns:
        The title of the y-axis as a string
      • setName

        public final void setName(java.lang.String name)
        Sets the specified parameter as the name of the histogram
        Specified by:
        setName in interface IDataSet
        Parameters:
        name - The desired name of the histogram
      • reset

        public void reset()
        Resets all bins to 0
        Specified by:
        reset in interface IDataSet
      • getEntries

        public int getEntries()
      • getMean

        public double getMean()
        Calculates the mean of the data in the histogram
        Returns:
        the mean of the histogram data as a double
      • getStatText

        public java.lang.String[] getStatText()
      • getRMS

        public double getRMS()
        Calculates the root mean square of the histogram data
        Returns:
        the root mean square of the histogram data
      • set

        public final void set(int bins,
                              double min,
                              double max)
        Sets the specified number of bins, min and max to the x axis and creates a standard Y axis with a min value of 0 and a max value of 0. Additionally, sets up the axes to store data.
        Parameters:
        bins - the desired number of bins.
        min - the desired minimum x value
        max - the desired maximum y value
      • getIntegral

        public double getIntegral()
      • integral

        public double integral()
      • integral

        public double integral(int start_bin,
                               int end_bin)
      • fill

        public void fill(double value)
        Increments the bin corresponding to that value by 1
        Parameters:
        value - the value to increment
      • fill

        public void fill(double value,
                         double weight)
        Increments the bin corresponding to that value by that weight
        Parameters:
        value - the value to increment
        weight - the weight to increment by
      • normalize

        public void normalize(double number)
        Normalizes the histogram data to the specified number
        Parameters:
        number - the value to normalize the data to
      • incrementBinContent

        public void incrementBinContent(int bin)
        Increments the content in the specified bin by one. The bin is specified in array indexing format (to increment the 1st bin, enter 0, the 2nd, enter 1, ... , the nth, enter n-1)
        Parameters:
        bin - the bin to be incremented, specified in array indexing format.
      • incrementBinContent

        public void incrementBinContent(int bin,
                                        double weight)
        Increments the content in the specified bin by the entered weight. The bin is specified in array indexing format (to increment the 1st bin, enter 0, the 2nd, enter 1, ... , the nth, enter n-1)
        Parameters:
        bin - the bin to be incremented, specified in array indexing format.
        weight - the weight to increment by
      • modify

        public void modify(DataVector vec,
                           double rmin,
                           double rmax)
      • add

        public void add(H1F h)
      • divide

        public void divide(double number)
      • divide

        public static H1F divide(H1F h1,
                                 H1F h2)
        Static method for H1D to divide two histograms, the resulting histogram is created, and arguments are untouched.
        Parameters:
        h1 -
        h2 -
        Returns:
      • add

        public static H1F add(H1F h1,
                              H1F h2)
        Adds two histograms. Returns a new histogram.
        Parameters:
        h1 - first histogram
        h2 - second histogram
        Returns:
        sum of two histograms
      • normalized

        public static H1F normalized(H1F h1,
                                     H1F h2)
        returns a new histogram with a content of h1 where the integral is normalized to histogram h2.
        Parameters:
        h1 - histogram to normalize
        h2 - histogram for normalization
        Returns:
        histogram with bin content of h1 normalized to h2 integral
      • divide

        public void divide(H1F hist)
        Divides the current histogram object by the parameter 1-D histogram. Requires that both histograms have the same number of bins.
        Parameters:
        hist - the 1-D histogram object to divide the current object by
      • setBinContent

        public void setBinContent(int bin,
                                  double value)
        Sets the value to the specified bin. The bin is specified in array indexing format (i.e. to set the value to the 1st bin, enter 0, to the 2nd bin, enter 1, ... , the nth bin, enter n-1)
        Parameters:
        bin - the bin to enter the value into, specified in array indexing format
        value - the value to store in the specified bin
      • histClone

        public H1F histClone(java.lang.String name)
        returns a copy of the histogram with different name.
        Parameters:
        name -
        Returns:
      • setBinError

        public void setBinError(int bin,
                                double value)
        Sets the bin error to the specified bin. The bin is specified in array indexing format (i.e. to set the value to the 1st bin, enter 0, to the 2nd bin, enter 1, ... , the nth bin, enter n-1)
        Parameters:
        bin - the bin to enter the value of the error into, specified in array indexing format
        value - the error to store in the specified bin
      • getBinContent

        public double getBinContent(int bin)
        Returns the content of the specified bin as a double. The bin is defined in array indexing format (i.e. to retrieve the 1st bin's content, enter 0, for the 2nd bin, enter 1, ... , for the nth bin, enter n-1)
        Parameters:
        bin - The bin to retrieve the content of, specified in array indexing format
        Returns:
        The content of the bin entered as a parameter
      • getBinError

        public double getBinError(int bin)
        Returns the error of the specified bin as a double. The bin is defined in array indexing format (i.e. to retrieve the 1st bin's error, enter 0, for the 2nd bin, enter 1, ... , for the nth bin, enter n-1)
        Parameters:
        bin - The bin to retrieve the error of, specified in array indexing format
        Returns:
        The error of the bin entered as a parameter
      • getXaxis

        public Axis getXaxis()
      • getYaxis

        public Axis getYaxis()
      • getxAxis

        public Axis getxAxis()
        Retrieves the x-axis as an Axis object
        Returns:
        the x-axis of the histogram as an Axis object
      • getyAxis

        public Axis getyAxis()
        Retrieves the y-axis as an Axis object
        Returns:
        the y-axis of the histogram as an Axis object
      • getAxis

        public Axis getAxis()
        Retrieves the x-axis as an Axis object
        Returns:
        the x-axis of the histogram as an Axis object
      • toString

        public java.lang.String toString()
        Overrides the toString method of type Object
        Overrides:
        toString in class java.lang.Object
        Returns:
        a formatted string representation of the content in the histogram
      • getGraph

        public GraphErrors getGraph()
        Retrieves a graph of the histogram
        Returns:
        a DataPoints object of the histogram data
      • getData

        public float[] getData()
        Returns:
        the data in the histogram
      • getDataError

        public float[] getDataError()
        Returns:
        the data error in the histogram
      • getMaximumBin

        public int getMaximumBin()
        Returns bin number with maximum entries.
        Returns:
      • fixBinWidths

        public void fixBinWidths(double sensitivity)
        Changes the bin widths to vary with a set minimum slope to be allowed as its own bin.
        Parameters:
        sensitivity - what percentage of the maximum slope all bins have to be at minimum to be considered its own distinct bin
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface IDataSet
      • getDataSize

        public int getDataSize(int axis)
        Specified by:
        getDataSize in interface IDataSet
      • getDataX

        public double getDataX(int bin)
        Specified by:
        getDataX in interface IDataSet
      • getDataY

        public double getDataY(int bin)
        Specified by:
        getDataY in interface IDataSet
      • getDataEX

        public double getDataEX(int bin)
        Specified by:
        getDataEX in interface IDataSet
      • getDataEY

        public double getDataEY(int bin)
        Specified by:
        getDataEY in interface IDataSet
      • getData

        public double getData(int xbin,
                              int ybin)
        Specified by:
        getData in interface IDataSet
      • setFillColor

        public H1F setFillColor(int color)
        ROOT COMPATABILITY Functions
        Parameters:
        color -
        Returns:
      • getFillColor

        public int getFillColor()
      • setLineColor

        public H1F setLineColor(int color)
      • getLineColor

        public int getLineColor()
      • setLineWidth

        public H1F setLineWidth(int width)
      • getLineWidth

        public int getLineWidth()
      • setFunction

        public void setFunction(Func1D f)
      • getFunction

        public Func1D getFunction()
      • setOptStat

        public void setOptStat(int i)
      • setOptStat

        public void setOptStat(java.lang.String i)

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.