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

Class H2F

  • All Implemented Interfaces:
    IDataSet


    public class H2F
    extends java.lang.Object
    implements IDataSet
    Specifies the methods to create a 2D Histogram and operations to fill it and set values to its bins
    • Constructor Summary

      Constructors 
      Constructor and Description
      H2F() 
      H2F(java.lang.String name)
      Creates an empty 2D Histogram with 1 bin x and y axes
      H2F(java.lang.String name, int bx, double xmin, double xmax, int by, double ymin, double ymax)
      Creates a 2D Histogram with the specified parameters.
      H2F(java.lang.String name, java.lang.String title, int bx, double xmin, double xmax, int by, double ymin, double ymax) 
    • Constructor Detail

      • H2F

        public H2F()
      • H2F

        public H2F(java.lang.String name)
        Creates an empty 2D Histogram with 1 bin x and y axes
        Parameters:
        name - the desired name of the 2D Histogram
      • H2F

        public H2F(java.lang.String name,
                   int bx,
                   double xmin,
                   double xmax,
                   int by,
                   double ymin,
                   double ymax)
        Creates a 2D Histogram with the specified parameters.
        Parameters:
        name - the name of the histogram
        bx - the number of x axis bins
        xmin - the minimum x axis value
        xmax - the maximum x axis value
        by - the number of y axis bins
        ymin - the minimum y axis value
        ymax - the maximum y axis value
      • H2F

        public H2F(java.lang.String name,
                   java.lang.String title,
                   int bx,
                   double xmin,
                   double xmax,
                   int by,
                   double ymin,
                   double ymax)
    • Method Detail

      • setName

        public void setName(java.lang.String name)
        Specified by:
        setName in interface IDataSet
      • set

        public final void set(int bx,
                              double xmin,
                              double xmax,
                              int by,
                              double ymin,
                              double ymax)
        Sets the bins to the x and y axes and creates the buffer of the histogram
        Parameters:
        bx - number of bins on the x axis
        xmin - the minimum value on the x axis
        xmax - the maximum value on the x axis
        by - number of bins on the y axis
        ymin - the minimum value on the y axis
        ymax - the maximum value on the y axis
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface IDataSet
        Returns:
        the name of the Histogram
      • getXAxis

        public Axis getXAxis()
        Returns:
        the x-axis of the 2D Histogram
      • getYAxis

        public Axis getYAxis()
        Returns:
        the y-axis of the 2D Histogram
      • getMaximum

        public double getMaximum()
      • getBinContent

        public double getBinContent(int bx,
                                    int by)
        Finds the bin content at that bin
        Parameters:
        bx - The x coordinate of the bin
        by - The y coordinate of the bin
        Returns:
        The content at that bin
      • modify

        public void modify(DataVector vecX,
                           DataVector vecY,
                           double xmin,
                           double xmax,
                           double ymin,
                           double ymax)
      • create

        public static H2F create(java.lang.String name,
                                 int binsX,
                                 int binsY,
                                 DataVector vecX,
                                 DataVector vecY)
        creates 2D histogram from given DataVectors, min and max are determined by data vectors.
        Parameters:
        name - name of 2D histogram
        binsX - number of bins in X
        binsY - number of bins in Y
        vecX - DataVector with x-points
        vecY - DataVector with y-points
        Returns:
        histogram 2D
      • 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
      • 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
      • setTitle

        public final void setTitle(java.lang.String title)
        Sets the specified parameter as the title of the histogram
        Parameters:
        title - The desired title of the histogram
      • getDataBufferSize

        public int getDataBufferSize()
      • getDataBufferBin

        public float getDataBufferBin(int bin)
      • setDataBufferBin

        public void setDataBufferBin(int bin,
                                     float value)
      • setBinContent

        public void setBinContent(int bx,
                                  int by,
                                  double w)
        Sets the bin to that value
        Parameters:
        bx - The x coordinate of the bin
        by - The y coordinate of the bin
        w - The desired value to set the bin to
      • fill

        public void fill(double x,
                         double y)
        Adds 1.0 to the bin with that value
        Parameters:
        x - the x coordinate value
        y - the y coordinate value
      • fill

        public void fill(double x,
                         double y,
                         double w)
      • getSlicesX

        public java.util.ArrayList<H1F> getSlicesX()
      • getSlicesY

        public java.util.ArrayList<H1F> getSlicesY()
      • add

        public void add(H2F h)
      • divide

        public static H2F divide(H2F h1,
                                 H2F h2)
      • divide

        public void divide(H2F h)
      • findBin

        public int findBin(double x,
                           double y)
        Finds which bin has that value.
        Parameters:
        x - The x value to search for
        y - The y value to search for
        Returns:
        The bin, in array indexing format, which holds that x-y value
      • getContentBuffer

        public double[][] getContentBuffer()
        Generates a 2D array with the content in the histogram
        Returns:
        a 2D array with each bin in its array index
      • getErrorBuffer

        public double[][] getErrorBuffer()
        Creates an error buffer with each element being 0.0
        Returns:
        a double 2D array with a size of xAxis * yAxis with each element being 0.0
      • getRegion

        public H2F getRegion(java.lang.String name,
                             int bx_start,
                             int bx_end,
                             int by_start,
                             int by_end)
        Specifies the region in the 2D histogram with those attributes
        Parameters:
        name - The name of the histogram
        bx_start - The x coordinate beginning
        bx_end - The x coordinate end
        by_start - The y coordinate beginning
        by_end - The y coordinate end
        Returns:
        A 2D histogram with the entered specifications
      • histClone

        public H2F histClone(java.lang.String name)
      • rebinX

        public H2F rebinX(int ngroups)
        Parameters:
        ngroups - indicates how many bins of this have to be merged into one bin of the result NOTE: If ngroup is not an exact divider of the number of bins, the top limit of the rebinned histogram is reduced to the upper edge of the last bin that can make a complete group.
        Returns:
        a H2F object obtained from original histogram with rebinned x-axis
      • rebinY

        public H2F rebinY(int ngroups)
        Parameters:
        ngroups - indicates how many bins of this have to be merged into one bin of the result NOTE: If ngroup is not an exact divider of the number of bins, the top limit of the rebinned histogram is reduced to the upper edge of the last bin that can make a complete group.
        Returns:
        a H2F object obtained from original histogram with rebinned y-axis
      • projectionX

        public H1F projectionX()
        Creates a projection of the 2D histogram onto the X Axis, adding up all the y bins for each x bin
        Returns:
        a H1F object that is a projection of the Histogram2D object onto the x-axis
      • projectionY

        public H1F projectionY()
        Creates a projection of the 2D histogram onto the Y Axis, adding up all the x bins for each y bin
        Returns:
        a H1F object that is a projection of the Histogram2D object onto the y-axis
      • sliceX

        public H1F sliceX(int xBin)
        Creates a 1-D Histogram slice of the specified y Bin
        Parameters:
        xBin - the bin on the y axis to create a slice of
        Returns:
        a slice of the x bins on the specified y bin as a 1-D Histogram
      • sliceY

        public H1F sliceY(int yBin)
        Creates a 1-D Histogram slice of the specified x Bin
        Parameters:
        yBin - the bin on the x axis to create a slice of
        Returns:
        a slice of the y bins on the specified x bin as a 1-D Histogram
      • offset

        public float[] offset()
      • reset

        public void reset()
        Resets the content of the histogram, sets all bin contents to 0
        Specified by:
        reset 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

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.