org.jlab.groot.data
Class H2F
- java.lang.Object
-
- org.jlab.groot.data.H2F
-
-
Constructor Summary
Constructors Constructor and Description H2F()H2F(java.lang.String name)Creates an empty 2D Histogram with 1 bin x and y axesH2F(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)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(H2F h)static H2Fcreate(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.voiddivide(H2F h)static H2Fdivide(H2F h1, H2F h2)voidfill(double x, double y)Adds 1.0 to the bin with that valuevoidfill(double x, double y, double w)intfindBin(double x, double y)Finds which bin has that value.DatasetAttributesgetAttributes()doublegetBinContent(int bx, int by)Finds the bin content at that bindouble[][]getContentBuffer()Generates a 2D array with the content in the histogramdoublegetData(int xbin, int ybin)floatgetDataBufferBin(int bin)intgetDataBufferSize()doublegetDataEX(int bin)doublegetDataEY(int bin)intgetDataSize(int axis)doublegetDataX(int bin)doublegetDataY(int bin)double[][]getErrorBuffer()Creates an error buffer with each element being 0.0doublegetMaximum()java.lang.StringgetName()GraphErrorsgetProfileX()GraphErrorsgetProfileY()H2FgetRegion(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 attributesjava.util.ArrayList<H1F>getSlicesX()java.util.ArrayList<H1F>getSlicesY()PaveTextgetStatBox()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()AxisgetYAxis()H2FhistClone(java.lang.String name)voidmodify(DataVector vecX, DataVector vecY, double xmin, double xmax, double ymin, double ymax)float[]offset()H1FprojectionX()Creates a projection of the 2D histogram onto the X Axis, adding up all the y bins for each x binH1FprojectionY()Creates a projection of the 2D histogram onto the Y Axis, adding up all the x bins for each y binH2FrebinX(int ngroups)H2FrebinY(int ngroups)voidreset()Resets the content of the histogram, sets all bin contents to 0voidset(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 histogramvoidsetBinContent(int bx, int by, double w)Sets the bin to that valuevoidsetDataBufferBin(int bin, float value)voidsetName(java.lang.String name)voidsetTitle(java.lang.String title)Sets the specified parameter as the title of the histogramvoidsetTitleX(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 parameterH1FsliceX(int xBin)Creates a 1-D Histogram slice of the specified y BinH1FsliceY(int yBin)Creates a 1-D Histogram slice of the specified x Bin
-
-
-
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 histogrambx- the number of x axis binsxmin- the minimum x axis valuexmax- the maximum x axis valueby- the number of y axis binsymin- the minimum y axis valueymax- 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
-
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 axisxmin- the minimum value on the x axisxmax- the maximum value on the x axisby- number of bins on the y axisymin- the minimum value on the y axisymax- the maximum value on the y axis
-
getName
public java.lang.String getName()
-
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 binby- 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 histogrambinsX- number of bins in XbinsY- number of bins in YvecX- DataVector with x-pointsvecY- 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 binby- The y coordinate of the binw- 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 valuey- 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 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 fory- 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 histogrambx_start- The x coordinate beginningbx_end- The x coordinate endby_start- The y coordinate beginningby_end- The y coordinate end- Returns:
- A 2D histogram with the entered specifications
-
histClone
public H2F histClone(java.lang.String name)
-
getProfileX
public GraphErrors getProfileX()
-
getProfileY
public GraphErrors getProfileY()
-
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
-
getDataSize
public int getDataSize(int axis)
- Specified by:
getDataSizein interfaceIDataSet
-
getAttributes
public DatasetAttributes getAttributes()
- Specified by:
getAttributesin interfaceIDataSet
-
getStatBox
public PaveText getStatBox()
- Specified by:
getStatBoxin interfaceIDataSet
-
-
DMelt 3.0 © DataMelt by jWork.ORG