hep.aida.ref.histogram
Class Histogram1D
- 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.Histogram1D
-
- All Implemented Interfaces:
- IDevManagedObject, IBaseHistogram, IHistogram, IHistogram1D, IManagedObject, Connectable, IsObservable, java.io.Serializable
public class Histogram1D extends Histogram implements IHistogram1D, IsObservable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Histogram1D()Create a 1-dimensional Histogram.Histogram1D(java.lang.String name, java.lang.String title, IAxis axis)Create a 1-dimensional Histogram.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(IHistogram1D hist)Modifies this histogram by adding the contents of h to it.IAxisaxis()Get the X axis.intbinEntries(int index)Number of entries in the corresponding bin (ie the number of times fill was called for this bin).doublebinError(int index)The error on this bin.doublebinHeight(int index)Total height of the corresponding bin.doublebinMean(int index)Get the mean of a bin.AbstractBinner1Dbinner()doublebinRms(int index)Get the RMS of a bin.intcoordToIndex(double coord)Convenience method, equivalent to axis().coordToIndex(coord).intextraEntries()Get the number of entries in the underflow and overflow bins.voidfill(double x)Fill the Histogram with unit weight.voidfill(double x, double weight)Fill the Histogram.voidinitHistogram1D(IAxis xAxis, java.lang.String options)doublemaxBinHeight()Get the maximum height of in-range bins in the Histogram.doublemean()Get the mean of the whole Histogram.doubleminBinHeight()Get the minimum height of in-range bins in the Histogram.voidreset()Reset the Histogram.doublerms()Get the RMS of the whole Histogram.voidscale(double scaleFactor)Scale the weights and the errors by a given factor.voidsetContents(double[] binCenters, double[] heights, double[] errors, int[] entries, double[] sumWW, double[] sumXW, double[] sumXXW)voidsetContents(double[] heights, double[] errors, int[] entries, double[] means, double[] rmss)Set the content of the whole Histogram at once.voidsetMeanAndRms(double otherMean, double otherRms)Set the mean of the Histogram.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.-
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
-
Histogram1D
public Histogram1D()
Create a 1-dimensional Histogram.
-
Histogram1D
public Histogram1D(java.lang.String name, java.lang.String title, IAxis axis)Create a 1-dimensional Histogram.- Parameters:
name- The name of the Histogram as a ManagedObject.title- The title of the Histogram.axis- The x-axis of the Histogram.
-
-
Method Detail
-
fill
public void fill(double x)
Fill the Histogram with unit weight.- Specified by:
fillin interfaceIHistogram1D- Parameters:
x- The value to be filled.
-
fill
public void fill(double x, double weight)Fill the Histogram.- Specified by:
fillin interfaceIHistogram1D- Parameters:
x- The 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 index)
Number of entries in the corresponding bin (ie the number of times fill was called for this bin).- Specified by:
binEntriesin interfaceIHistogram1D- Parameters:
index- the bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The number of entries for the corresponding bin.
-
binHeight
public double binHeight(int index)
Total height of the corresponding bin.- Specified by:
binHeightin interfaceIHistogram1D- Parameters:
index- The 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 index)
The error on this bin.- Specified by:
binErrorin interfaceIHistogram1D- Parameters:
index- the bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The error on the corresponding bin.
-
mean
public double mean()
Get the mean of the whole Histogram. It includes all the entries (in and out of range).- Specified by:
meanin interfaceIHistogram1D- Returns:
- The mean of the Histogram.
-
rms
public double rms()
Get the RMS of the whole Histogram. It includes all the entries (in and out of range).- Specified by:
rmsin interfaceIHistogram1D- Returns:
- The RMS of the Histogram.
-
setMeanAndRms
public void setMeanAndRms(double otherMean, double otherRms)Set the mean of the Histogram.- Parameters:
mean- The Histogram's x mean
-
axis
public IAxis axis()
Get the X axis.- Specified by:
axisin interfaceIHistogram1D- Returns:
- The x axis.
-
coordToIndex
public int coordToIndex(double coord)
Convenience method, equivalent to axis().coordToIndex(coord).- Specified by:
coordToIndexin interfaceIHistogram1D- Parameters:
coord- The coordinalte along the x axis.- Returns:
- The corresponding bin number.
- See Also:
IAxis.coordToIndex(double)
-
scale
public void scale(double scaleFactor) throws java.lang.IllegalArgumentExceptionScale the weights and the errors by a given factor.- Specified by:
scalein interfaceIHistogram- Specified by:
scalein classHistogram- Parameters:
scaleFactor- The scale factor.- Throws:
java.lang.IllegalArgumentException- If the scale factor is negative.
-
add
public void add(IHistogram1D hist) throws java.lang.IllegalArgumentException
Modifies this histogram by adding the contents of h to it.- Specified by:
addin interfaceIHistogram1D- Parameters:
hist- The histogram to be added to this histogram- Throws:
java.lang.IllegalArgumentException- if histogram binnings are incompatible
-
binMean
public double binMean(int index)
Get the mean of a bin.- Specified by:
binMeanin interfaceIHistogram1D- Parameters:
index- The bin number in the external representation: (0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The mean of the corresponding bin. If the bin has zero height, zero is returned.
-
binRms
public double binRms(int index)
Get the RMS of a bin.- Parameters:
index- the bin number in the external representation:(0...N-1) or OVERFLOW or UNDERFLOW.- Returns:
- The RMS of the corresponding bin. If the bin has zero height, zero is returned.
-
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 heightserrors- The bins errorsentries- The bin entries.means- The means of the bins.rmss- The rmss of the bins
-
setContents
public void setContents(double[] binCenters, double[] heights, double[] errors, int[] entries, double[] sumWW, double[] sumXW, double[] sumXXW)- Parameters:
binCenters- The bins centers, can be nullheights- The bins heights, can NOT be nullerrors- The bins errorsentries- The bin entries, can be nullsumWW- The sumWW of the bins, can be nullsumXW- The sumXW of the bins, can not be nullsumXXW- The sumXXW of the bins, can not be null
-
initHistogram1D
public void initHistogram1D(IAxis xAxis, java.lang.String options)
-
binner
public AbstractBinner1D binner()
-
-
DMelt 3.0 © DataMelt by jWork.ORG