FreeHEP API
Version current

hep.aida.ref.dataSet.binner
Class DefaultBinner

java.lang.Object
  extended byhep.aida.ref.dataSet.binner.DefaultBinner
All Implemented Interfaces:
Binner
Direct Known Subclasses:
EfficiencyBinner

public class DefaultBinner
extends Object
implements Binner

The default implementation of a Binner.

Author:
The FreeHEP team at SLAC
Source Code:
DefaultBinner.java

Constructor Summary
DefaultBinner(int[] bins, String options)
          Creates a new instance of Binner.
 
Method Summary
 void addContentToBin(int[] bin, int entries, double height, double[] mean, double[] rms)
          Add a set of entries to the existing content of the bin.
protected  DataStatistics binStatistics(int bin)
          Utility method to access a bin's statistical information.
 int entries(int[] bin)
          Get the number of entries in a bin.
 void fill(int[] bin, double[] x, double weight)
          Fill a bin with a new entry.
 double height(int[] bin)
          Get the height of a bin.
protected  int internalBin(int[] bin)
          Utility method to convert from the bin numbering to the internal bin representation.
 double mean(int[] bin, int coord)
          Get the mean of a bin along a given coordinate.
 double minusError(int[] bin)
          Get the minus error on a bin.
 double plusError(int[] bin)
          Get the plus error on a bin.
 void removeContentFromBin(int[] bin, int entries, double height, double[] mean, double[] rms)
          Remove a set of entries from a bin.
 void reset()
          Reset the content of the Binner.
 void resetBin(int[] bin)
          Reset the content of a bin.
 double rms(int[] bin, int coord)
          Get the rms of a bin along a given coordinate.
 void scale(double scaleFactor)
          Scale all the bins by a given scale factor.
 void setBinContent(int[] bin, int entries, double height, double[] mean, double[] rms)
          Set at once the content of a bin.
 void setBinError(BinError binError)
          Set the BinError with which the plus and minus error on the bin are calculated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBinner

public DefaultBinner(int[] bins,
                     String options)
Creates a new instance of Binner.

Parameters:
bins - The array containing the number of bins per coordinate.
options - The options.
Method Detail

internalBin

protected int internalBin(int[] bin)
Utility method to convert from the bin numbering to the internal bin representation. For a bin represented by int[] {binx, biny, binz} we use the internal numbering: binx + biny*nBinsx + binz*nBinsx*nBinsy


binStatistics

protected DataStatistics binStatistics(int bin)
Utility method to access a bin's statistical information.


fill

public void fill(int[] bin,
                 double[] x,
                 double weight)
Fill a bin with a new entry.

Specified by:
fill in interface Binner
Parameters:
bin - The array specifying the bin.
x - The coordinate's array
weight - The weight for this entry.

setBinContent

public void setBinContent(int[] bin,
                          int entries,
                          double height,
                          double[] mean,
                          double[] rms)
Set at once the content of a bin.

Specified by:
setBinContent in interface Binner
Parameters:
bin - The array specifying the bin.
entries - The entries in the bin.
height - The height of the bin.
mean - The array with the coordinate means
rms - The array with the coordinate rmss

addContentToBin

public void addContentToBin(int[] bin,
                            int entries,
                            double height,
                            double[] mean,
                            double[] rms)
Description copied from interface: Binner
Add a set of entries to the existing content of the bin. Notice that this is meant to be used instead of fill ONLY when the number of entries in the set is greater than one.

Specified by:
addContentToBin in interface Binner
Parameters:
bin - The array specifying the bin.
entries - The entries in the bin.
height - The height of the bin.
mean - The array with the coordinate means
rms - The array with the coordinate rmss

removeContentFromBin

public void removeContentFromBin(int[] bin,
                                 int entries,
                                 double height,
                                 double[] mean,
                                 double[] rms)
Description copied from interface: Binner
Remove a set of entries from a bin.

Specified by:
removeContentFromBin in interface Binner
Parameters:
bin - The array specifying the bin.
entries - The entries in the bin.
height - The height of the bin.
mean - The array with the coordinate means
rms - The array with the coordinate rmss

resetBin

public void resetBin(int[] bin)
Reset the content of a bin.

Specified by:
resetBin in interface Binner
Parameters:
bin - The array specifying the bin.

reset

public void reset()
Reset the content of the Binner.

Specified by:
reset in interface Binner

entries

public int entries(int[] bin)
Get the number of entries in a bin.

Specified by:
entries in interface Binner
Parameters:
bin - The array specifying the bin.

height

public double height(int[] bin)
Get the height of a bin.

Specified by:
height in interface Binner
Parameters:
bin - The array specifying the bin.

plusError

public double plusError(int[] bin)
Get the plus error on a bin.

Specified by:
plusError in interface Binner
Parameters:
bin - The array specifying the bin.

minusError

public double minusError(int[] bin)
Get the minus error on a bin.

Specified by:
minusError in interface Binner
Parameters:
bin - The array specifying the bin.

mean

public double mean(int[] bin,
                   int coord)
Get the mean of a bin along a given coordinate.

Specified by:
mean in interface Binner
Parameters:
bin - The array specifying the bin.
coord - The coordinate's index.

rms

public double rms(int[] bin,
                  int coord)
Get the rms of a bin along a given coordinate.

Specified by:
rms in interface Binner
Parameters:
bin - The array specifying the bin.
coord - The coordinate's index.

scale

public void scale(double scaleFactor)
Scale all the bins by a given scale factor.

Specified by:
scale in interface Binner
Parameters:
scaleFactor - The scale factor.

setBinError

public void setBinError(BinError binError)
Set the BinError with which the plus and minus error on the bin are calculated.

Parameters:
binError - The BinError.

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.