Parallel Colt 0.7.2

hep.aida.tfloat.ref
Class FloatHistogram1D

java.lang.Object
  extended by hep.aida.tfloat.ref.FloatHistogram1D
All Implemented Interfaces:
FloatIHistogram, FloatIHistogram1D, Serializable

public class FloatHistogram1D
extends Object
implements FloatIHistogram1D

A reference implementation of hep.aida.IHistogram1D. The goal is to provide a clear implementation rather than the most efficient implementation. However, performance seems fine - filling 1.2 * 10^6 points/sec, both using FixedAxis or VariableAxis.

Author:
Wolfgang Hoschek, Tony Johnson, and others., Piotr Wendykier (piotr.wendykier@gmail.com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface hep.aida.tfloat.FloatIHistogram
OVERFLOW, serialVersionUID, UNDERFLOW
 
Constructor Summary
FloatHistogram1D(String title, float[] edges)
          Creates a variable-width histogram.
FloatHistogram1D(String title, FloatIAxis axis)
          Creates a histogram with the given axis binning.
FloatHistogram1D(String title, int bins, float min, float max)
          Creates a fixed-width histogram.
 
Method Summary
 int allEntries()
          Number of all entries in all (both in-range and under/overflow) bins in the histogram.
 int binEntries(int index)
          Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
 float binError(int index)
          The error on this bin.
 float binHeight(int index)
          Total height of the corresponding bin (ie the sum of the weights in this bin).
 int dimensions()
          Returns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.
 int entries()
          Number of in-range entries in the histogram.
 float equivalentBinEntries()
          Number of equivalent entries.
 int extraEntries()
          Number of under and overflow entries in the histogram.
 void fill_2D(float[] data, float[] weights, int rows, int columns, int zero, int rowStride, int columnStride)
          Fill histogram with specified data and weights.
 void fill_2D(float[] data, int rows, int columns, int zero, int rowStride, int columnStride)
          Fill histogram with specified data and weight 1.
 void fill(float x)
          Fill histogram with weight 1.
 void fill(float x, float weight)
          Fill histogram with specified weight.
 FloatHistogram1DContents getContents()
          Returns the contents of this histogram.
 float mean()
          Returns the mean of the whole histogram as calculated on filling-time.
 int[] minMaxBins()
          Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.
 void reset()
          Reset contents; as if just constructed.
 float rms()
          Returns the rms of the whole histogram as calculated on filling-time.
 void setContents(FloatHistogram1DContents contents)
          Sets the contents of this histogram
 float sumAllBinHeights()
          Sum of all (both in-range and under/overflow) bin heights in the histogram.
 float sumBinHeights()
          Sum of in-range bin heights in the histogram.
 float sumExtraBinHeights()
          Sum of under/overflow bin heights in the histogram.
 String title()
          Title of the histogram (will be set only in the constructor).
 FloatIAxis xAxis()
          Returns the X Axis.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hep.aida.tfloat.FloatIHistogram1D
minMaxBins, xAxis
 
Methods inherited from interface hep.aida.tfloat.FloatIHistogram
dimensions, entries, extraEntries, sumAllBinHeights, sumBinHeights, sumExtraBinHeights, title
 

Constructor Detail

FloatHistogram1D

public FloatHistogram1D(String title,
                        float[] edges)
Creates a variable-width histogram. 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:
title - The histogram title.
edges - the bin boundaries the axis shall have; must be sorted ascending and must not contain multiple identical elements.
Throws:
IllegalArgumentException - if edges.length < 1.

FloatHistogram1D

public FloatHistogram1D(String title,
                        FloatIAxis axis)
Creates a histogram with the given axis binning.

Parameters:
title - The histogram title.
axis - The axis description to be used for binning.

FloatHistogram1D

public FloatHistogram1D(String title,
                        int bins,
                        float min,
                        float max)
Creates a fixed-width histogram.

Parameters:
title - The histogram title.
bins - The number of bins.
min - The minimum value on the X axis.
max - The maximum value on the X axis.
Method Detail

allEntries

public int allEntries()
Description copied from interface: FloatIHistogram
Number of all entries in all (both in-range and under/overflow) bins in the histogram.

Specified by:
allEntries in interface FloatIHistogram

binEntries

public int binEntries(int index)
Description copied from interface: FloatIHistogram1D
Number of entries in the corresponding bin (ie the number of times fill was called for this bin).

Specified by:
binEntries in interface FloatIHistogram1D
Parameters:
index - the bin number (0...N-1) or OVERFLOW or UNDERFLOW.

binError

public float binError(int index)
Description copied from interface: FloatIHistogram1D
The error on this bin.

Specified by:
binError in interface FloatIHistogram1D
Parameters:
index - the bin number (0...N-1) or OVERFLOW or UNDERFLOW.

binHeight

public float binHeight(int index)
Description copied from interface: FloatIHistogram1D
Total height of the corresponding bin (ie the sum of the weights in this bin).

Specified by:
binHeight in interface FloatIHistogram1D
Parameters:
index - the bin number (0...N-1) or OVERFLOW or UNDERFLOW.

equivalentBinEntries

public float equivalentBinEntries()
Description copied from interface: FloatIHistogram
Number of equivalent entries.

Specified by:
equivalentBinEntries in interface FloatIHistogram
Returns:
SUM[ weight ] ^ 2 / SUM[ weight^2 ].

fill

public void fill(float x)
Description copied from interface: FloatIHistogram1D
Fill histogram with weight 1.

Specified by:
fill in interface FloatIHistogram1D

fill

public void fill(float x,
                 float weight)
Description copied from interface: FloatIHistogram1D
Fill histogram with specified weight.

Specified by:
fill in interface FloatIHistogram1D

fill_2D

public void fill_2D(float[] data,
                    int rows,
                    int columns,
                    int zero,
                    int rowStride,
                    int columnStride)
Description copied from interface: FloatIHistogram1D
Fill histogram with specified data and weight 1.

Specified by:
fill_2D in interface FloatIHistogram1D

fill_2D

public void fill_2D(float[] data,
                    float[] weights,
                    int rows,
                    int columns,
                    int zero,
                    int rowStride,
                    int columnStride)
Description copied from interface: FloatIHistogram1D
Fill histogram with specified data and weights.

Specified by:
fill_2D in interface FloatIHistogram1D

getContents

public FloatHistogram1DContents getContents()
Returns the contents of this histogram.

Returns:
the contents of this histogram

mean

public float mean()
Description copied from interface: FloatIHistogram1D
Returns the mean of the whole histogram as calculated on filling-time.

Specified by:
mean in interface FloatIHistogram1D

reset

public void reset()
Description copied from interface: FloatIHistogram
Reset contents; as if just constructed.

Specified by:
reset in interface FloatIHistogram

rms

public float rms()
Description copied from interface: FloatIHistogram1D
Returns the rms of the whole histogram as calculated on filling-time.

Specified by:
rms in interface FloatIHistogram1D

setContents

public void setContents(FloatHistogram1DContents contents)
Sets the contents of this histogram

Parameters:
contents -

dimensions

public int dimensions()
Description copied from interface: FloatIHistogram
Returns 1 for one-dimensional histograms, 2 for two-dimensional histograms, and so on.

Specified by:
dimensions in interface FloatIHistogram

entries

public int entries()
Description copied from interface: FloatIHistogram
Number of in-range entries in the histogram.

Specified by:
entries in interface FloatIHistogram

extraEntries

public int extraEntries()
Description copied from interface: FloatIHistogram
Number of under and overflow entries in the histogram.

Specified by:
extraEntries in interface FloatIHistogram

minMaxBins

public int[] minMaxBins()
Description copied from interface: FloatIHistogram1D
Indexes of the in-range bins containing the smallest and largest binHeight(), respectively.

Specified by:
minMaxBins in interface FloatIHistogram1D
Returns:
{minBin,maxBin}.

sumAllBinHeights

public float sumAllBinHeights()
Description copied from interface: FloatIHistogram
Sum of all (both in-range and under/overflow) bin heights in the histogram.

Specified by:
sumAllBinHeights in interface FloatIHistogram

sumBinHeights

public float sumBinHeights()
Description copied from interface: FloatIHistogram
Sum of in-range bin heights in the histogram.

Specified by:
sumBinHeights in interface FloatIHistogram

sumExtraBinHeights

public float sumExtraBinHeights()
Description copied from interface: FloatIHistogram
Sum of under/overflow bin heights in the histogram.

Specified by:
sumExtraBinHeights in interface FloatIHistogram

xAxis

public FloatIAxis xAxis()
Description copied from interface: FloatIHistogram1D
Returns the X Axis.

Specified by:
xAxis in interface FloatIHistogram1D

title

public String title()
Description copied from interface: FloatIHistogram
Title of the histogram (will be set only in the constructor).

Specified by:
title in interface FloatIHistogram

Parallel Colt 0.7.2

Jump to the Parallel Colt Homepage