hep.aida.ref.histogram
Class VariableAxis
- java.lang.Object
-
- hep.aida.ref.histogram.VariableAxis
-
-
Field Summary
-
Fields inherited from interface hep.aida.IAxis
OVERFLOW_BIN, UNDERFLOW_BIN
-
-
Constructor Summary
Constructors Constructor and Description VariableAxis(double[] edges)Constructs and returns an axis with the given bin edges.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublebinCenter(int index)Get the center of the specified bin.doublebinLowerEdge(int index)Get the lower edge of the specified bin.intbins()The number of bins (excluding underflow and overflow) on the IAxis.doublebinUpperEdge(int index)Get the upper edge of the specified bin.doublebinWidth(int index)Get the width of the specified bin.intcoordToIndex(double coord)Convert a coordinate on the axis to a bin number.booleanequals(java.lang.Object o)Check if two Axis are equal.booleanisFixedBinning()Check if the IAxis has fixed binning, i.e.doublelowerEdge()Get the lower edge of the IAxis.doubleupperEdge()Get the upper edge of the IAxis.
-
-
-
Constructor Detail
-
VariableAxis
public VariableAxis(double[] edges)
Constructs and returns an axis with the given bin edges. Example: edges = (0.2, 1.0, 5.0) yields an axis with 2 in-range bins [0.2,1.0), [1.0,5.0) and 2 extra bins [-inf,0.2), [5.0,inf].- Parameters:
edges- the bin boundaries the partition shall have; must be sorted ascending and must not contain multiple identical elements.- Throws:
java.lang.IllegalArgumentException- if edges.length < 1.
-
-
Method Detail
-
binCenter
public double binCenter(int index)
Description copied from interface:IAxisGet the center of the specified bin.- Specified by:
binCenterin interfaceIAxis- Parameters:
index- The bin number: 0 to bins()-1) for the in-range bins or OVERFLOW or UNDERFLOW.- Returns:
- The center of the corresponding bin. For in-range bins the middle of the upper and lower edge of the bin is returned; for out-of-range bins +/- infinity is returned.
-
binLowerEdge
public double binLowerEdge(int index)
Description copied from interface:IAxisGet the lower edge of the specified bin.- Specified by:
binLowerEdgein interfaceIAxis- Parameters:
index- The bin number: 0 to bins()-1 for the in-range bins or OVERFLOW or UNDERFLOW.- Returns:
- The lower edge of the corresponding bin; for the underflow bin this is Double.NEGATIVE_INFINITY.
-
bins
public int bins()
Description copied from interface:IAxisThe number of bins (excluding underflow and overflow) on the IAxis.
-
binUpperEdge
public double binUpperEdge(int index)
Description copied from interface:IAxisGet the upper edge of the specified bin.- Specified by:
binUpperEdgein interfaceIAxis- Parameters:
index- The bin number: 0 to bins()-1 for the in-range bins or OVERFLOW or UNDERFLOW.- Returns:
- The upper edge of the corresponding bin; for the overflow bin this is Double.POSITIVE_INFINITY.
-
binWidth
public double binWidth(int index)
Description copied from interface:IAxisGet the width of the specified bin.
-
coordToIndex
public int coordToIndex(double coord)
Description copied from interface:IAxisConvert a coordinate on the axis to a bin number. If the coordinate is less than the lowerEdge UNDERFLOW is returned; if the coordinate is greater or equal to the upperEdge OVERFLOW is returned.- Specified by:
coordToIndexin interfaceIAxis- Parameters:
coord- The coordinate to be converted.- Returns:
- The corresponding bin number.
-
lowerEdge
public double lowerEdge()
Description copied from interface:IAxisGet the lower edge of the IAxis.
-
upperEdge
public double upperEdge()
Description copied from interface:IAxisGet the upper edge of the IAxis.
-
isFixedBinning
public boolean isFixedBinning()
Description copied from interface:IAxisCheck if the IAxis has fixed binning, i.e. if all the bins have the same width.- Specified by:
isFixedBinningin interfaceIAxis- Returns:
trueif the binning is fixed,falseotherwise.
-
equals
public boolean equals(java.lang.Object o)
Check if two Axis are equal.- Overrides:
equalsin classjava.lang.Object- Parameters:
o- the Object to check- Returns:
trueifois an instance of FixedAxis and it has the same number of bins, minimum and bin width.
-
-
DMelt 3.0 © DataMelt by jWork.ORG