org.jlab.groot.data
Class H1F
- java.lang.Object
-
- org.jlab.groot.data.H1F
-
-
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 heightsH1F(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 valuesH1F(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 valuesH1F(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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(H1F h)static H1Fadd(H1F h1, H1F h2)Adds two histograms.static H1Fcreate(java.lang.String name, int bins, DataVector vec)static H1Fcreate(java.lang.String name, int bins, DataVector vec, DataVector weight)voiddivide(double number)voiddivide(H1F hist)Divides the current histogram object by the parameter 1-D histogram.static H1Fdivide(H1F h1, H1F h2)Static method for H1D to divide two histograms, the resulting histogram is created, and arguments are untouched.voidfill(DataVector vec)voidfill(DataVector vec, DataVector weight)voidfill(double value)Increments the bin corresponding to that value by 1voidfill(double value, double weight)Increments the bin corresponding to that value by that weightvoidfixBinWidths(double sensitivity)Changes the bin widths to vary with a set minimum slope to be allowed as its own bin.DatasetAttributesgetAttributes()AxisgetAxis()Retrieves the x-axis as an Axis objectdoublegetBinContent(int bin)Returns the content of the specified bin as a double.doublegetBinError(int bin)Returns the error of the specified bin as a double.float[]getData()doublegetData(int xbin, int ybin)float[]getDataError()doublegetDataEX(int bin)doublegetDataEY(int bin)intgetDataSize(int axis)doublegetDataX(int bin)doublegetDataY(int bin)intgetEntries()intgetFillColor()Func1DgetFunction()GraphErrorsgetGraph()Retrieves a graph of the histogramdoublegetIntegral()intgetLineColor()intgetLineWidth()intgetMaximumBin()Returns bin number with maximum entries.doublegetMean()Calculates the mean of the data in the histogramjava.lang.StringgetName()doublegetRMS()Calculates the root mean square of the histogram dataPaveTextgetStatBox()java.lang.String[]getStatText()java.lang.StringgetTitle()The getter for the histogram title.java.lang.StringgetTitleX()The getter for the x-axis title.java.lang.StringgetTitleY()The getter for the y-axis title.AxisgetxAxis()Retrieves the x-axis as an Axis objectAxisgetXaxis()AxisgetyAxis()Retrieves the y-axis as an Axis objectAxisgetYaxis()H1FhistClone(java.lang.String name)returns a copy of the histogram with different name.voidincrementBinContent(int bin)Increments the content in the specified bin by one.voidincrementBinContent(int bin, double weight)Increments the content in the specified bin by the entered weight.voidinitAttributes()doubleintegral()doubleintegral(int start_bin, int end_bin)voidmodify(DataVector vec, double rmin, double rmax)voidnormalize(double number)Normalizes the histogram data to the specified numberstatic H1Fnormalized(H1F h1, H1F h2)returns a new histogram with a content of h1 where the integral is normalized to histogram h2.voidreset()Resets all bins to 0voidset(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.voidsetBinContent(int bin, double value)Sets the value to the specified bin.voidsetBinError(int bin, double value)Sets the bin error to the specified bin.H1FsetFillColor(int color)ROOT COMPATABILITY FunctionsvoidsetFunction(Func1D f)H1FsetLineColor(int color)H1FsetLineWidth(int width)voidsetName(java.lang.String name)Sets the specified parameter as the name of the histogramvoidsetOptStat(int i)voidsetOptStat(java.lang.String i)voidsetTitle(java.lang.String title)voidsetTitleX(java.lang.String xTitle)Sets the x-axis title to the specified parametervoidsetTitleY(java.lang.String yTitle)Sets the y-axis title to the specified parameterjava.lang.StringtoString()Overrides the toString method of type Object
-
-
-
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 HistogramxTitle- the desired x-axis titleyTitle- the desired y-axis titlebins- the desired number of binsxMin- the desired minimum value on the x axisxMax- 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 histogramxMin- the desired minimum x-axis valuexMax- the desired maximum x-axis valuebinHeights- 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 histogrambins- The desired number of binsxMin- The desired minimum x-axis valuexMax- 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 histogramtitle- The desired title of the histogrambins- The desired number of binsxMin- The desired minimum x-axis valuexMax- 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 histogramtitle- The desired title of the histogramxMin- The desired minimum x-axis valuexMax- 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, DataVector weight)
-
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
-
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 valuemax- 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 incrementweight- 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)
-
fill
public void fill(DataVector vec)
-
fill
public void fill(DataVector vec, DataVector weight)
-
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 histogramh2- 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 normalizeh2- 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 formatvalue- 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 formatvalue- 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:
toStringin classjava.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
-
getDataSize
public int getDataSize(int axis)
- Specified by:
getDataSizein interfaceIDataSet
-
getAttributes
public DatasetAttributes getAttributes()
- Specified by:
getAttributesin interfaceIDataSet
-
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()
-
getStatBox
public PaveText getStatBox()
- Specified by:
getStatBoxin interfaceIDataSet
-
setOptStat
public void setOptStat(int i)
-
setOptStat
public void setOptStat(java.lang.String i)
-
-
DMelt 3.0 © DataMelt by jWork.ORG