FreeHEP API
Version current

hep.aida.ref.histogram
Class Histogram1D

java.lang.Object
  extended byhep.aida.ref.event.AIDAObservable
      extended byhep.aida.ref.ManagedObject
          extended byhep.aida.ref.histogram.AbstractBaseHistogram
              extended byhep.aida.ref.histogram.Histogram
                  extended byhep.aida.ref.histogram.Histogram1D
All Implemented Interfaces:
Connectable, hep.aida.IBaseHistogram, hep.aida.dev.IDevManagedObject, hep.aida.IHistogram, hep.aida.IHistogram1D, hep.aida.IManagedObject, IsObservable

public class Histogram1D
extends Histogram
implements hep.aida.IHistogram1D, IsObservable

Source Code:
Histogram1D.java

Field Summary
 
Fields inherited from class hep.aida.ref.histogram.Histogram
allEntries, isFillable, sumOfWeights, sumOfWeightsSquared, validEntries, X_AXIS, Y_AXIS, Z_AXIS
 
Fields inherited from class hep.aida.ref.ManagedObject
fillable
 
Fields inherited from class hep.aida.ref.event.AIDAObservable
connectionDidChange, isConnected, isValid
 
Constructor Summary
  Histogram1D()
          Create a 1-dimensional Histogram.
  Histogram1D(String name, String title, hep.aida.IAxis axis)
          Create a 1-dimensional Histogram.
protected Histogram1D(String name, String title, hep.aida.IAxis axis, String options)
          Create a 1-dimensional Histogram.
 
Method Summary
 void add(hep.aida.IHistogram1D hist)
          Modifies this histogram by adding the contents of h to it.
 hep.aida.IAxis axis()
          Get the X axis.
 int binEntries(int index)
          Number of entries in the corresponding bin (ie the number of times fill was called for this bin).
 double binError(int index)
          The error on this bin.
 double binHeight(int index)
          Total height of the corresponding bin.
 double binMean(int index)
          Get the mean of a bin.
 double binRms(int index)
          Get the RMS of a bin.
 int coordToIndex(double coord)
          Convenience method, equivalent to axis().coordToIndex(coord).
 int extraEntries()
          Get the number of entries in the underflow and overflow bins.
 void fill(double x)
          Fill the Histogram with unit weight.
 void fill(double x, double weight)
          Fill the Histogram.
 void initHistogram1D(hep.aida.IAxis xAxis, String options)
           
 double maxBinHeight()
          Get the maximum height of in-range bins in the Histogram.
 double mean()
          Get the mean of the whole Histogram.
 double minBinHeight()
          Get the minimum height of in-range bins in the Histogram.
 void reset()
          Reset the Histogram.
 double rms()
          Get the RMS of the whole Histogram.
 void scale(double scaleFactor)
          Scale the weights and the errors by a given factor.
 void setBinError(int bin, double error)
           
 void setContents(double[] heights, double[] errors, int[] entries, double[] means, double[] rmss)
          Set the content of the whole Histogram at once.
 void setMean(double mean)
          Set the mean of the Histogram.
 void setRms(double rms)
          Set the rms of the Histogram.
 double sumAllBinHeights()
          Get the sum of the bin heights for all the entries, in-range and out-range ones.
 double sumExtraBinHeights()
          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, createEvent, entries, equivalentBinEntries, mapBinNumber, nanEntries, options, setNEntries, setUseOutflows, setValidEntries, sumBinHeights, useOutflows
 
Methods inherited from class hep.aida.ref.histogram.AbstractBaseHistogram
annotation, dimension, setAnnotation, setTitle, title
 
Methods inherited from class hep.aida.ref.ManagedObject
isFillable, name, setFillable, setName, type
 
Methods inherited from class hep.aida.ref.event.AIDAObservable
addListener, fireStateChanged, fireStateChanged, fireStateChanged, isConnected, removeAllListeners, removeListener, setConnected, setIsValidAfterNotify, setValid, setValidForAll
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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(String name,
                   String title,
                   hep.aida.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.

Histogram1D

protected Histogram1D(String name,
                      String title,
                      hep.aida.IAxis axis,
                      String options)
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.
options - options of the Histogram.
Method Detail

fill

public void fill(double x)
Fill the Histogram with unit weight.

Specified by:
fill in interface hep.aida.IHistogram1D
Parameters:
x - The value to be filled.

fill

public void fill(double x,
                 double weight)
Fill the Histogram.

Specified by:
fill in interface hep.aida.IHistogram1D
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:
reset in interface hep.aida.IBaseHistogram
Overrides:
reset in class Histogram

extraEntries

public int extraEntries()
Get the number of entries in the underflow and overflow bins.

Specified by:
extraEntries in interface hep.aida.IHistogram
Specified by:
extraEntries in class Histogram
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:
sumAllBinHeights in interface hep.aida.IHistogram
Specified by:
sumAllBinHeights in class Histogram
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:
sumExtraBinHeights in interface hep.aida.IHistogram
Specified by:
sumExtraBinHeights in class Histogram
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:
minBinHeight in interface hep.aida.IHistogram
Specified by:
minBinHeight in class Histogram
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:
maxBinHeight in interface hep.aida.IHistogram
Specified by:
maxBinHeight in class Histogram
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:
binEntries in interface hep.aida.IHistogram1D
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:
binHeight in interface hep.aida.IHistogram1D
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:
binError in interface hep.aida.IHistogram1D
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:
mean in interface hep.aida.IHistogram1D
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:
rms in interface hep.aida.IHistogram1D
Returns:
The RMS of the Histogram.

axis

public hep.aida.IAxis axis()
Get the X axis.

Specified by:
axis in interface hep.aida.IHistogram1D
Returns:
The x axis.

coordToIndex

public int coordToIndex(double coord)
Convenience method, equivalent to axis().coordToIndex(coord).

Specified by:
coordToIndex in interface hep.aida.IHistogram1D
See Also:
IAxis.coordToIndex(double)

scale

public void scale(double scaleFactor)
           throws IllegalArgumentException
Scale the weights and the errors by a given factor.

Specified by:
scale in interface hep.aida.IHistogram
Specified by:
scale in class Histogram
Parameters:
scaleFactor - The scale factor.
Throws:
IllegalArgumentException

add

public void add(hep.aida.IHistogram1D hist)
         throws IllegalArgumentException
Modifies this histogram by adding the contents of h to it.

Specified by:
add in interface hep.aida.IHistogram1D
Parameters:
hist - The histogram to be added to this histogram
Throws:
IllegalArgumentException - if histogram binnings are incompatible

setRms

public void setRms(double rms)
Set the rms of the Histogram.

Parameters:
rms - The Historam's x rms

setMean

public void setMean(double mean)
Set the mean of the Histogram.

Parameters:
mean - The Histogram's x mean

binMean

public double binMean(int index)
Get the mean of a bin.

Specified by:
binMean in interface hep.aida.IHistogram1D
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.

setBinError

public void setBinError(int bin,
                        double error)

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 heights
errors - The bins errors
entries - The bin entries.
means - The means of the bins.
rmss - The rmss of the bins

initHistogram1D

public void initHistogram1D(hep.aida.IAxis xAxis,
                            String options)

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.