HProf1D
jhplot

Class HProf1D

  • All Implemented Interfaces:
    Serializable


    public class HProf1Dextends Objectimplements Serializable
    Create profile histogram in 1D. It is used to show the mean values in each bin of a second variable. To show it, convert it to the usual H1D histogram (getH1D method). You can specify errors as errors on the mean or spread RMS.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      HProf1D()
      Build 1D histogram.
      HProf1D(IProfile1D h1)
      Create profile histogram from JAIDA class
      HProf1D(Profile1D h1)
      Create H1D histogram from JAIDA Histogram1D class.
      HProf1D(String title, double[] edges)
      Create 1D profile histogram with variable bin size.
      HProf1D(String title, HProf1D h1d)
      Create profile histogram from another instance.
      HProf1D(String title, IAxis axis)
      Create 1D histogram with variable bin size.
      HProf1D(String title, int bins, double min, double max)
      Build 1D profile histogram
      HProf1D(hep.io.root.interfaces.TProfile h1t)
      Create profile histogram from JAIDA histogram class
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      intallEntries()
      Get number of all entries
      doublebinCenter(int index)
      Get bin centres.
      double[]binCenters()
      Get all bin centers in form of array
      int[]binEntries()
      Get all entries of the histogram as an array
      intbinEntries(int index)
      Number of entries in a bin with index i
      doublebinError(int index)
      Error on the bin with index i
      double[]binErrors()
      Get all bin errors of the histogram as an array
      doublebinHeight(int index)
      Height of the corresponding bin
      double[]binHeights()
      Get all heights of the histogram as an array
      doublebinLowerEdge(int index)
      Get bin lower edge.
      double[]binLowerEdges()
      Get all lower edges in form of array
      doublebinMean(int index)
      Mean in a single bin with index
      doublebinRms(int index)
      RMS of a single bin with index
      doublebinUpperEdge(int index)
      Get bin upper edge.
      double[]binUpperEdges()
      Get all upper edges in form of array
      HProf1Dcopy()
      Make a copy of the data holder
      HProf1Dcopy(String newtitle)
      Get exact copy of the current histogram.
      voiddoc()
      Show online documentation.
      intentries()
      Number of in-range entries in the histogram
      intextraEntries()
      Number of under and overflow entries in the histogram.
      voidfill(double[] x, double[] y)
      Fill histogram with array of double values.
      voidfill(double[] x, double[] y, double[] weight)
      Fill histogram with array of double values.
      voidfill(double x, double y)
      Fill profile histogram with X and Y
      voidfill(double x, double y, double weight)
      Fill profile histogram with X and Y
      voidfillInvBinSizeWeight(double value)
      Fill histogram with a value, weighting it by inverse of bin size.
      voidfillP0D(P0D p0d, P0D p1d)
      Fill histogram from two P0D arrays
      Profile1Dget()
      Get JAIDA histogram
      IAxisgetAxis()
      Get histogram Axis class.
      intgetBins()
      Get the number of bins
      doublegetBinSize()
      Get bin width in case of fixed-size bins.
      doublegetEntropy()
      Returns the entropy of the histogram.
      H1DgetH1D()
      Make H1D copy of the current histogram.
      H1DgetH1D(String newtitle)
      Convert to H1D for graphical representation using default graphics attributes.
      H1DgetH1D(String newtitle, String option)
      Convert to H1D for graphical representation using default graphics attributes.
      doublegetMax()
      Get Maximum value of axis
      doublegetMin()
      Get Minimum value of the axis
      intgetOverflow()
      Number of overflow entries
      doublegetOverflowlowHeight()
      Overflow height
      StringgetTitle()
      get Title of the histogram
      intgetUnderflow()
      Number of underflow entries
      doublegetUnderflowHeight()
      Underflow height
      double[][]getValues(int mode)
      Get positions in X,Y and Errors.
      booleanisFixedBinning()
      Return true if bins have constant bin width
      doublemaxBinHeight()
      Max value of all bins
      doublemean()
      Get mean of the histogram
      doubleminBinHeight()
      Min value of all bins
      HProf1DoperSmooth(boolean isWeighted, int k)
      Smooth the histogram.
      HProf1DoperSmoothGauss(double standardDeviation)
      Computes a Gaussian smoothed version of the histogram.
      voidprint()
      Print histogram on screen
      doublerms()
      Get RMS of histogram
      voidscale(double scaleFactor)
      Scale the histogram.
      voidscale(String title, double scaleFactor)
      Scale the histogram.
      voidsetBins(int bins)
      Sets the number of bins
      voidsetContents(double[] values, double[] errors)
      Sets the content of histogram.
      voidsetContents(double[] heights, double[] errors, int[] entries, double[] means, double[] rmss)
      Set the content of the whole Histogram at once.
      voidsetMax(double max)
      Set Maximum value of axis
      voidsetMeanAndRms(double mean, double rms)
      Sets the Mean and RMS of H1D histogram
      voidsetMin(double min)
      Set Min value of axis
      voidsetNEntries(int entries)
      Sets number of entries of the histogram.
      voidsetTitle(String title)
      Sets the title
      voidsetValidEntries(int entries)
      Sets number of valid entries.
      voidshift(double d)
      Shift all bins by some value
      doublesumAllBinHeights()
      Sum of all heights
      voidtoFile(String name)
      Write the profile histogram to a file
      voidtoTable()
      Print the profile histogram to a Table in a separate Frame.
    • Constructor Detail

      • HProf1D

        public HProf1D()
        Build 1D histogram. Default constructor. Does not do anything.
      • HProf1D

        public HProf1D(String title,       int bins,       double min,       double max)
        Build 1D profile histogram
        Parameters:
        title - Title
        bins - Number of bins
        min - Minimum value
        max - Maximum value
      • HProf1D

        public HProf1D(String title,       double[] edges)
        Create 1D profile histogram with variable bin size.
        Parameters:
        title - Title of histogram.
        edges - edges
      • HProf1D

        public HProf1D(String title,       IAxis axis)
        Create 1D histogram with variable bin size.
        Parameters:
        title - Title of histogram.
        edges - edges
      • HProf1D

        public HProf1D(Profile1D h1)
        Create H1D histogram from JAIDA Histogram1D class.
        Parameters:
        h1 - Profile1D histogram from JAIDA
      • HProf1D

        public HProf1D(IProfile1D h1)
        Create profile histogram from JAIDA class
        Parameters:
        h1 - IProfile1D histogram from JAIDA
      • HProf1D

        public HProf1D(String title,       HProf1D h1d)
        Create profile histogram from another instance.
        Parameters:
        title - new title
        h1d - input H1D
      • HProf1D

        public HProf1D(hep.io.root.interfaces.TProfile h1t)
        Create profile histogram from JAIDA histogram class
        Parameters:
        h1t - TProfile histogram from JAIDA
    • Method Detail

      • print

        public void print()
        Print histogram on screen
      • fillP0D

        public void fillP0D(P0D p0d,           P0D p1d)
        Fill histogram from two P0D arrays
        Parameters:
        p0d - input P0D array
        p1d - input P1D
      • getAxis

        public IAxis getAxis()
        Get histogram Axis class.
        Returns:
        Axis used for this histogram.
      • binCenter

        public double binCenter(int index)
        Get bin centres.
        Parameters:
        index - bin index
        Returns:
        bin centre.
      • binCenters

        public double[] binCenters()
        Get all bin centers in form of array
        Returns:
        double[] array of bin centers
      • binLowerEdge

        public double binLowerEdge(int index)
        Get bin lower edge.
        Parameters:
        index - bin index
        Returns:
        lower edge
      • binLowerEdges

        public double[] binLowerEdges()
        Get all lower edges in form of array
        Returns:
        double[] array of low edges
      • binUpperEdge

        public double binUpperEdge(int index)
        Get bin upper edge.
        Parameters:
        index - bin index
        Returns:
        upper edge
      • binUpperEdges

        public double[] binUpperEdges()
        Get all upper edges in form of array
        Returns:
        double[] array of upper edges
      • toTable

        public void toTable()
        Print the profile histogram to a Table in a separate Frame. One can sort and search the data in this table (but not modify)
      • toFile

        public void toFile(String name)
        Write the profile histogram to a file
        Parameters:
        name - File name
      • setContents

        public void setContents(double[] values,               double[] errors)
        Sets the content of histogram. Start from 1 to bins+2.
        Parameters:
        values - array with values in Y (dimension: bins + 2)
        errors - array with errors on Y (dimension: bins + 2)
      • setContents

        public void setContents(double[] heights,               double[] errors,               int[] entries,               double[] means,               double[] rmss)
        Set the content of the whole Histogram at once. This is a convenience method for saving/restoring Histograms. Of the arguments below the heights array cannot be null. The errors array should in general be non-null, but this depends on the specific binner. The entries array can be null, in which case the entry of a bin is taken to be the integer part of the height. If the means array is null, the mean is defaulted to the geometric center of the bin. If the rms array is null, the rms is taken to be the bin width over the root of 12.
        Parameters:
        heights - The bins heights
        errors - The bins errors
        entries - The bin entries.
        means - The means of the bins.
        rmss - The rmss of the bins
      • setMeanAndRms

        public void setMeanAndRms(double mean,                 double rms)
        Sets the Mean and RMS of H1D histogram
        Parameters:
        mean - mean of the histogram
        rms - RMS to be set
      • setNEntries

        public void setNEntries(int entries)
        Sets number of entries of the histogram.
        Parameters:
        entries - Number of entries
      • setValidEntries

        public void setValidEntries(int entries)
        Sets number of valid entries.
        Parameters:
        entries - Number of valid entries
      • setTitle

        public void setTitle(String title)
        Sets the title
        Parameters:
        title - Title
      • getTitle

        public String getTitle()
        get Title of the histogram
        Returns:
        Title of histogram
      • get

        public Profile1D get()
        Get JAIDA histogram
        Returns:
        JAIDA Profile1D histogram
      • setMin

        public void setMin(double min)
        Set Min value of axis
        Parameters:
        min - Minimum value of axis
      • getMin

        public double getMin()
        Get Minimum value of the axis
        Returns:
        Minimum value of the axis
      • setMax

        public void setMax(double max)
        Set Maximum value of axis
        Parameters:
        max - Maximum value of axis
      • getMax

        public double getMax()
        Get Maximum value of axis
        Returns:
        Maximum value of axis
      • setBins

        public void setBins(int bins)
        Sets the number of bins
        Parameters:
        bins - Number of bins
      • getBins

        public int getBins()
        Get the number of bins
        Returns:
        Number of bins
      • getBinSize

        public double getBinSize()
        Get bin width in case of fixed-size bins.
        Returns:
        bin width (max-min) /bins
      • shift

        public void shift(double d)
        Shift all bins by some value
        Parameters:
        d - parameter used to shift bins
      • isFixedBinning

        public boolean isFixedBinning()
        Return true if bins have constant bin width
        Returns:
        true if bin width is fixed
      • fill

        public void fill(double x,        double y)
        Fill profile histogram with X and Y
        Parameters:
        x - value in X
        y - value in Y
      • fill

        public void fill(double x,        double y,        double weight)
        Fill profile histogram with X and Y
        Parameters:
        x - value in X
        y - value in Y
        weight - weight for entry
      • fill

        public void fill(double[] x,        double[] y)
        Fill histogram with array of double values. Take into account weights. make sure that both arrays have the same length;
        Parameters:
        x - array of double X values
        y - array of double Y values
      • fill

        public void fill(double[] x,        double[] y,        double[] weight)
        Fill histogram with array of double values. Take into account weights. make sure that both arrays have the same length;
        Parameters:
        x - array of double X values
        y - array of double Y values
        weight - arrays with weights
      • mean

        public double mean()
        Get mean of the histogram
        Returns:
        Mean of histogram
      • rms

        public double rms()
        Get RMS of histogram
        Returns:
        RMS of histogram
      • allEntries

        public int allEntries()
        Get number of all entries
        Returns:
        Number of all entries
      • extraEntries

        public int extraEntries()
        Number of under and overflow entries in the histogram.
        Returns:
        Number of under and overflow entries
      • entries

        public int entries()
        Number of in-range entries in the histogram
        Returns:
        Number of in-range entries
      • getUnderflow

        public int getUnderflow()
        Number of underflow entries
        Returns:
        Number of underflow
      • getUnderflowHeight

        public double getUnderflowHeight()
        Underflow height
        Returns:
        height of underflow
      • getOverflowlowHeight

        public double getOverflowlowHeight()
        Overflow height
        Returns:
        Height of underflow
      • getOverflow

        public int getOverflow()
        Number of overflow entries
        Returns:
        Number of overflow entries
      • fillInvBinSizeWeight

        public void fillInvBinSizeWeight(double value)
        Fill histogram with a value, weighting it by inverse of bin size. Should be useful for histograms with irregular binning.
        Parameters:
        value - Value to filled histogram with.
      • scale

        public void scale(String title,         double scaleFactor)
        Scale the histogram.
        Parameters:
        title - New title
        scaleFactor - Scale factor
      • scale

        public void scale(double scaleFactor)
        Scale the histogram.
        Parameters:
        scaleFactor - Scale factor
      • operSmooth

        public HProf1D operSmooth(boolean isWeighted,                 int k)
        Smooth the histogram.

        Each band of the histogram is smoothed by averaging over a moving window of a size specified by the method parameter: if the value of the parameter is k then the width of the window is 2*k + 1. If the window runs off the end of the histogram only those values which intersect the histogram are taken into consideration. The smoothing may optionally be weighted to favor the central value using a "triangular" weighting. For example, for a value of k equal to 2 the central bin would have weight 1/3, the adjacent bins 2/9, and the next adjacent bins 1/9. Errors are kept the same as before.

        Parameters:
        isWeighted - Whether bins will be weighted using a triangular weighting scheme favoring bins near the central bin.
        k - The smoothing parameter which must be non-negative. If zero, the histogram object will be returned with no smoothing applied.
        Returns:
        A smoothed version of the histogram.
      • operSmoothGauss

        public HProf1D operSmoothGauss(double standardDeviation)
        Computes a Gaussian smoothed version of the histogram.

        Each band of the histogram is smoothed by discrete convolution with a kernel approximating a Gaussian impulse response with the specified standard deviation.

        Parameters:
        standardDeviation - The standard deviation of the Gaussian smoothing kernel which must be non-negative or an IllegalArgumentException will be thrown. If zero, the histogram object will be returned with no smoothing applied.
        Returns:
        A Gaussian smoothed version of the histogram.
      • getEntropy

        public double getEntropy()
        Returns the entropy of the histogram.

        The entropy is defined to be the negation of the sum of the products of the probability associated with each bin with the base-2 log of the probability.

        Returns:
        The entropy of the histogram.
      • copy

        public HProf1D copy()
        Make a copy of the data holder
        Returns:
        New data holder
      • copy

        public HProf1D copy(String newtitle)
        Get exact copy of the current histogram. This means it makes a new object.
        Parameters:
        newtitle - New title
        Returns:
        a new copy of the histogram
      • getH1D

        public H1D getH1D()
        Make H1D copy of the current histogram. Default graphical attributes are assumed.
        Returns:
        a new H1D copy of the histogram
      • getH1D

        public H1D getH1D(String newtitle)
        Convert to H1D for graphical representation using default graphics attributes. The errors on points are shown as error o the mean.
        Parameters:
        newtitle - New title
        Returns:
        a new H1D copy of the histogram
      • getH1D

        public H1D getH1D(String newtitle,         String option)
        Convert to H1D for graphical representation using default graphics attributes.
        Parameters:
        newtitle - New title
        option - if option is "s", spread is shown as error
        Returns:
        a new H1D copy of the histogram
      • binEntries

        public int binEntries(int index)
        Number of entries in a bin with index i
        Parameters:
        index - Bin index
        Returns:
        Number of entries
      • binEntries

        public int[] binEntries()
        Get all entries of the histogram as an array
        Returns:
        array with histogram entries.
      • binError

        public double binError(int index)
        Error on the bin with index i
        Parameters:
        index - Bin index
        Returns:
        Error
      • binHeight

        public double binHeight(int index)
        Height of the corresponding bin
        Parameters:
        index - Bin index
        Returns:
        Bin Height
      • binHeights

        public double[] binHeights()
        Get all heights of the histogram as an array
        Returns:
        array with histogram heights.
      • binErrors

        public double[] binErrors()
        Get all bin errors of the histogram as an array
        Returns:
        array with histogram errors.
      • binMean

        public double binMean(int index)
        Mean in a single bin with index
        Parameters:
        index - Bin index
        Returns:
        Mean value inside of this bin
      • binRms

        public double binRms(int index)
        RMS of a single bin with index
        Parameters:
        index - Bin index
        Returns:
        RMS of this bin
      • maxBinHeight

        public double maxBinHeight()
        Max value of all bins
        Returns:
        Max value
      • minBinHeight

        public double minBinHeight()
        Min value of all bins
        Returns:
        Min value
      • sumAllBinHeights

        public double sumAllBinHeights()
        Sum of all heights
        Returns:
        Sum of all Heights
      • getValues

        public double[][] getValues(int mode)
        Get positions in X,Y and Errors. For x, we take mean values
        Parameters:
        mode - if =1, take center of the bins. In all other cases - mean value in each bin
        Returns:
        array with X,Y, and Error on Y, double[3][bins];
      • doc

        public void doc()
        Show online documentation.

SCaVis 1.7 © jWork.org