hep.aida.ref.histogram
Class Histogram2D
- java.lang.Object
-
- hep.aida.ref.event.AIDAObservable
-
- hep.aida.ref.ManagedObject
-
- hep.aida.ref.histogram.AbstractBaseHistogram
-
- hep.aida.ref.histogram.Histogram
-
- hep.aida.ref.histogram.Histogram2D
-
- All Implemented Interfaces:
- IDevManagedObject, IBaseHistogram, IHistogram, IHistogram2D, IManagedObject, Connectable, IsObservable, java.io.Serializable
public class Histogram2D extends Histogram implements IHistogram2D
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Histogram2D()Create a 2-dimensional Histogram.Histogram2D(java.lang.String name, java.lang.String title, IAxis xAxis, IAxis yAxis)Create a 2-dimensional Histogram.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(IHistogram2D hist)Modifies this histogram by adding the contents of h to it.intbinEntries(int indexX, int indexY)Number of entries in the corresponding bin (ie the number of times fill was called for this bin).intbinEntriesX(int indexX)Number of entries with a given x bin number (ie the number of times fill was called for these bins).intbinEntriesY(int indexY)Number of entries with a given y bin number (ie the number of times fill was called for these bins).doublebinError(int indexX, int indexY)The error on this bin.doublebinHeight(int indexX, int indexY)Total height of the corresponding bin.doublebinHeightX(int indexX)Total height of the corresponding x bin along y.doublebinHeightY(int indexY)Total height of the corresponding y bin along x.doublebinMeanX(int indexX, int indexY)Get the mean of a bin along the x axis.doublebinMeanY(int indexX, int indexY)Get the mean of a bin along the y axis.doublebinRmsX(int indexX, int indexY)Get the RMS of a bin along the x axis.doublebinRmsY(int indexX, int indexY)Get the RMS of a bin along the y axis.intcoordToIndexX(double coordX)Convenience method, equivalent to xAxis().coordToIndex(coord).intcoordToIndexY(double coordY)Convenience method, equivalent to yAxis().coordToIndex(coord).intextraEntries()Get the number of entries in the underflow and overflow bins.voidfill(double x, double y)Fill the Histogram with unit weight.voidfill(double x, double y, double weight)Fill the Histogram.voidinitHistogram2D(IAxis xAxis, IAxis yAxis, java.lang.String options)doublemaxBinHeight()Get the maximum height of in-range bins in the Histogram.doublemeanX()Get the mean of the whole Histogram as projected on the x axis.doublemeanY()Get the mean of the whole Histogram as projected on the y axis.doubleminBinHeight()Get the minimum height of in-range bins in the Histogram.voidreset()Reset the Histogram.doublermsX()Get the RMS of the whole Histogram as projected on the x axis.doublermsY()Get the RMS of the whole Histogram as projected on the y axis.voidscale(double scaleFactor)Scale the weights and the errors by a given factor.voidsetBinError(int indexX, int indexY, double error)Set the error on this bin.voidsetContents(double[][] heights, double[][] errors, int[][] entries, double[][] meanXs, double[][] rmsXs, double[][] meanYs, double[][] rmsYs)Set the content of the whole Histogram at once.voidsetMeanX(double meanX)All the non-AIDA methods should go below this point.voidsetMeanY(double meanY)voidsetRmsX(double rmsX)voidsetRmsY(double rmsY)doublesumAllBinHeights()Get the sum of the bin heights for all the entries, in-range and out-range ones.doublesumExtraBinHeights()Get the sum of the bin heights for all the entries outside the Histogram's range.IAxisxAxis()Get the X axis.IAxisyAxis()Get the Y axis.-
Methods inherited from class hep.aida.ref.histogram.Histogram
allEntries, entries, equivalentBinEntries, isMeanAndRmsSet, nanEntries, setNEntries, setValidEntries, sumBinHeights
-
Methods inherited from class hep.aida.ref.histogram.AbstractBaseHistogram
annotation, dimension, mapBinNumber, setAnnotation, setTitle, title
-
Methods inherited from class hep.aida.ref.ManagedObject
isFillable, name, setFillable, setName, type, typeForClass
-
Methods inherited from class hep.aida.ref.event.AIDAObservable
addListener, isConnected, removeAllListeners, removeListener, setConnected, setValid, setValidForAll
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hep.aida.IHistogram
allEntries, equivalentBinEntries, sumBinHeights
-
Methods inherited from interface hep.aida.IBaseHistogram
annotation, dimension, entries, nanEntries, setTitle, title
-
Methods inherited from interface hep.aida.ref.event.IsObservable
addListener, removeAllListeners, removeListener, setValid
-
Methods inherited from interface hep.aida.ref.event.Connectable
isConnected, setConnected
-
-
-
-
Constructor Detail
-
Histogram2D
public Histogram2D()
Create a 2-dimensional Histogram.
-
Histogram2D
public Histogram2D(java.lang.String name, java.lang.String title, IAxis xAxis, IAxis yAxis)Create a 2-dimensional Histogram.- Parameters:
name- The name of the Histogram as a ManagedObject.title- The title of the Histogram.xAxis- The x-axis of the Histogram.yAxis- The y-axis of the Histogram.
-
-
Method Detail
-
fill
public void fill(double x, double y)Fill the Histogram with unit weight.- Specified by:
fillin interfaceIHistogram2D- Parameters:
x- The x value to be filled.y- The y value to be filled.
-
fill
public void fill(double x, double y, double weight)Fill the Histogram.- Specified by:
fillin interfaceIHistogram2D- Parameters:
x- The x value to be filled.y- The y value to be filled.weight- The weight for this entry.
-
reset
public void reset()
Reset the Histogram. After calling this method the Histogram is as it was just created.- Specified by:
resetin interfaceIBaseHistogram- Overrides:
resetin classHistogram
-
extraEntries
public int extraEntries()
Get the number of entries in the underflow and overflow bins.- Specified by:
extraEntriesin interfaceIHistogram- Specified by:
extraEntriesin classHistogram- Returns:
- The number of entries outside the range of the Histogram.
-
sumAllBinHeights
public double sumAllBinHeights()
Get the sum of the bin heights for all the entries, in-range and out-range ones.- Specified by:
sumAllBinHeightsin interfaceIHistogram- Specified by:
sumAllBinHeightsin classHistogram- Returns:
- The sum of all the bin's heights.
-
sumExtraBinHeights
public double sumExtraBinHeights()
Get the sum of the bin heights for all the entries outside the Histogram's range.- Specified by:
sumExtraBinHeightsin interfaceIHistogram- Specified by:
sumExtraBinHeightsin classHistogram- Returns:
- The sum of the out of range bin's heights.
-
minBinHeight
public double minBinHeight()
Get the minimum height of in-range bins in the Histogram.- Specified by:
minBinHeightin interfaceIHistogram- Specified by:
minBinHeightin classHistogram- Returns:
- The minimum bin height for in range bins.
-
maxBinHeight
public double maxBinHeight()
Get the maximum height of in-range bins in the Histogram.- Specified by:
maxBinHeightin interfaceIHistogram- Specified by:
maxBinHeightin classHistogram- Returns:
- The maximum bin height for in range bins.
-
binEntries
public int binEntries(int indexX, int indexY)Number of entries in the corresponding bin (ie the number of times fill was called for this bin).- Specified by:
binEntriesin interfaceIHistogram2D- Parameters:
indexX- the x bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.indexY- the y bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The number of entries for the corresponding bin.
-
binEntriesX
public int binEntriesX(int indexX)
Number of entries with a given x bin number (ie the number of times fill was called for these bins). Equivalent to projectionX().binEntries(indexX).- Specified by:
binEntriesXin interfaceIHistogram2D- Parameters:
indexX- the x bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The number of entries for the corresponding bins.
-
binEntriesY
public int binEntriesY(int indexY)
Number of entries with a given y bin number (ie the number of times fill was called for these bins). Equivalent to projectionY().binEntries(indexY).- Specified by:
binEntriesYin interfaceIHistogram2D- Parameters:
indexY- the y bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The number of entries for the corresponding bins.
-
binHeight
public double binHeight(int indexX, int indexY)Total height of the corresponding bin.- Specified by:
binHeightin interfaceIHistogram2D- Parameters:
indexX- The x bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.indexY- The y bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The bin height for the corresponding bin.
-
binHeightX
public double binHeightX(int indexX)
Total height of the corresponding x bin along y. Equivalent to projectionX().binHeight(indexX).- Specified by:
binHeightXin interfaceIHistogram2D- Parameters:
indexX- The x bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The bin height for the corresponding bin.
-
binHeightY
public double binHeightY(int indexY)
Total height of the corresponding y bin along x. Equivalent to projectionY().binHeight(indexY).- Specified by:
binHeightYin interfaceIHistogram2D- Parameters:
indexY- The y bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The bin height for the corresponding bin.
-
binError
public double binError(int indexX, int indexY)The error on this bin.- Specified by:
binErrorin interfaceIHistogram2D- Parameters:
indexX- The x bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.indexY- The y bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The error on the corresponding bin.
-
meanX
public double meanX()
Get the mean of the whole Histogram as projected on the x axis. It includes all the entries (in and out of range).- Specified by:
meanXin interfaceIHistogram2D- Returns:
- The mean of the Histogram on the x axis.
-
meanY
public double meanY()
Get the mean of the whole Histogram as projected on the y axis. It includes all the entries (in and out of range).- Specified by:
meanYin interfaceIHistogram2D- Returns:
- The mean of the Histogram on the y axis.
-
rmsX
public double rmsX()
Get the RMS of the whole Histogram as projected on the x axis. It includes all the entries (in and out of range).- Specified by:
rmsXin interfaceIHistogram2D- Returns:
- The RMS of the Histogram on the x axis.
-
rmsY
public double rmsY()
Get the RMS of the whole Histogram as projected on the y axis. It includes all the entries (in and out of range).- Specified by:
rmsYin interfaceIHistogram2D- Returns:
- The RMS of the Histogram on the y axis.
-
xAxis
public IAxis xAxis()
Get the X axis.- Specified by:
xAxisin interfaceIHistogram2D- Returns:
- The x axis.
-
yAxis
public IAxis yAxis()
Get the Y axis.- Specified by:
yAxisin interfaceIHistogram2D- Returns:
- The y axis.
-
coordToIndexX
public int coordToIndexX(double coordX)
Convenience method, equivalent to xAxis().coordToIndex(coord).- Specified by:
coordToIndexXin interfaceIHistogram2D- Parameters:
coordX- The coordinalte along the x axis.- Returns:
- The bin's index along the x axis corresponding to the position coordX.
- See Also:
IAxis.coordToIndex(double)
-
coordToIndexY
public int coordToIndexY(double coordY)
Convenience method, equivalent to yAxis().coordToIndex(coord).- Specified by:
coordToIndexYin interfaceIHistogram2D- Parameters:
coordY- The coordinalte along the y axis.- Returns:
- The bin's index along the y axis corresponding to the position coordY.
- See Also:
IAxis.coordToIndex(double)
-
scale
public void scale(double scaleFactor)
Scale the weights and the errors by a given factor.- Specified by:
scalein interfaceIHistogram- Specified by:
scalein classHistogram- Parameters:
scaleFactor- The scale factor.
-
add
public void add(IHistogram2D hist) throws java.lang.IllegalArgumentException
Modifies this histogram by adding the contents of h to it.- Specified by:
addin interfaceIHistogram2D- Parameters:
hist- The histogram to be added to this histogram- Throws:
java.lang.IllegalArgumentException- if histogram binnings are incompatible
-
setMeanX
public void setMeanX(double meanX)
All the non-AIDA methods should go below this point.
-
setRmsX
public void setRmsX(double rmsX)
-
setMeanY
public void setMeanY(double meanY)
-
setRmsY
public void setRmsY(double rmsY)
-
binMeanX
public double binMeanX(int indexX, int indexY)Get the mean of a bin along the x axis.- Specified by:
binMeanXin interfaceIHistogram2D- Parameters:
indexX- The x bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.indexY- The y bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The mean of the corresponding bin along x. If the bin has zero height, zero is returned.
-
binMeanY
public double binMeanY(int indexX, int indexY)Get the mean of a bin along the y axis.- Specified by:
binMeanYin interfaceIHistogram2D- Parameters:
indexX- The x bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.indexY- The y bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The mean of the corresponding bin along y. If the bin has zero height, zero is returned.
-
binRmsX
public double binRmsX(int indexX, int indexY)Get the RMS of a bin along the x axis.- Parameters:
indexX- The x bin number in the external representation:(0...N-1) or OVERFLOW or UNDERFLOW.indexY- The y bin number in the external representation:(0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The RMS of the corresponding bin along x. If the bin has zero height, zero is returned.
-
binRmsY
public double binRmsY(int indexX, int indexY)Get the RMS of a bin along the y axis.- Parameters:
indexX- The x bin number in the external representation:(0...N-1) or OVERFLOW or UNDERFLOW.indexY- The y bin number in the external representation:(0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The RMS of the corresponding bin along y. If the bin has zero height, zero is returned.
-
setBinError
public void setBinError(int indexX, int indexY, double error)Set the error on this bin.- Parameters:
indexX- the bin number (0...N-1) or OVERFLOW or UNDERFLOW.indexY- the bin number (0...N-1) or OVERFLOW or UNDERFLOW.error- the error.
-
setContents
public void setContents(double[][] heights, double[][] errors, int[][] entries, double[][] meanXs, double[][] rmsXs, double[][] meanYs, double[][] rmsYs)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 bin heightserrors- The bin errorsentries- The bin entriesmeanXs- The means of the bin along the x axisrmsXs- The rmss of the bin along the x axismeanYs- The means of the bin along the y axisrmsYs- The rmss of the bin along the y axis
-
-
DMelt 3.0 © DataMelt by jWork.ORG