hep.analysis.partition
Class AutoPartition

java.lang.Object
  |
  +--java.util.Observable
        |
        +--hep.analysis.Partition
              |
              +--hep.analysis.partition.Abstract1DPartition
                    |
                    +--hep.analysis.partition.OneDDelegatingPartition
                          |
                          +--hep.analysis.partition.AutoPartition
All Implemented Interfaces:
OneDDataSource, OneDFillable, RangeChangeListener, java.io.Serializable, StatisticsProvider, ThresholdListener, TwoDFillable

public class AutoPartition
extends OneDDelegatingPartition
implements ThresholdListener

At first, an automatic partition acts like a simple partition, filling within any range. After a fixed number of entries, the partition fixes a range and bins within that range.

See Also:
Serialized Form

Field Summary
protected  int m_autoCutoff
           
protected  boolean m_autoRange
           
protected  int m_defaultBins
           
protected  double m_max
           
protected  double m_min
           
protected  boolean m_thresholdReached
           
 
Fields inherited from class hep.analysis.Partition
DATE, DELTATIME, DOUBLE, HORIZONTAL_AXIS, INTEGER, m_owner, STRING, VERTICAL_AXIS
 
Constructor Summary
AutoPartition()
          Creates an automatic partition, using automatic range and the default values: auto binning cutoff = 2000 number of bins = 40
AutoPartition(double min, double max)
          Creates an automatic partition, using a given range with the default values: auto binning cutoff = 2000 number of bins = 40 When the binning cutoff is reached, the given range will be used unless setBinning(int, double, double) is called.
AutoPartition(int autoCutoff, BinType type)
           
AutoPartition(int autoCutoff, BinType type, double min, double max)
           
AutoPartition(int autoCutoff, int bins)
          Created an automatic partition, with automatic range and the given values for the auto binning cutoff and number of bins.
AutoPartition(int autoCutoff, int bins, double min, double max)
          Created an automatic partition, with the given range and the given values for the auto binning cutoff and number of bins.
 
Method Summary
 double getMax()
          Return the maximum in the distribution.
 double getMin()
          Return the minimum in the distribution.
 int getNumberOfBins()
          Return the number of bins.
 Statistics getStatistics()
           
 boolean isRebinnable()
          Returns false by default.
 Partition makeCopy()
          Make a copy of this partition, maintaining the partition class and initial state, but not the data stored in the partition.
 void setBinning(int bins, double min, double max)
          Override to allow binning to be set.
 void thresholdReached()
           
 
Methods inherited from class hep.analysis.partition.OneDDelegatingPartition
clear, fill, fill, fill, fill, fillW, fillW, fillW, fillW, getAxisLabels, getAxisType, getBins, getMinusErrors, getPlusErrors, hasAsymmetricErrorBars, hasSimpleQuadraticErrorBars, setBinInfo, setDataSource, setFillable, setStatisticsProvider
 
Methods inherited from class hep.analysis.partition.Abstract1DPartition
clearDataChanged, clearRangeChanged, done, fill, fill, fillW, fillW, getBin, getBinAt, getBinAt, getBinAt, getBinAt, getError, getMinusError, getPlusError, notifyObservers, rangeChanged, setDataAndRangeChanged, setDataAndRangeChangedNow, setDataChanged, setRangeChanged
 
Methods inherited from class hep.analysis.Partition
destroy, getStyle, setStyle
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_min

protected double m_min

m_max

protected double m_max

m_autoRange

protected boolean m_autoRange

m_thresholdReached

protected boolean m_thresholdReached

m_defaultBins

protected int m_defaultBins

m_autoCutoff

protected int m_autoCutoff
Constructor Detail

AutoPartition

public AutoPartition()
Creates an automatic partition, using automatic range and the default values:

AutoPartition

public AutoPartition(int autoCutoff,
                     int bins)
Created an automatic partition, with automatic range and the given values for the auto binning cutoff and number of bins.
Parameters:
autoCutoff - after this many entries, the partition will fix a range and always bin within that range (value must be greater than zero)
nBins - the partition will use this many bins (value must be greater than zero)
Throws:
java.lang.IllegalArgumentException - if autoCutoff <= 0 or if nBins <= 0

AutoPartition

public AutoPartition(int autoCutoff,
                     BinType type)

AutoPartition

public AutoPartition(double min,
                     double max)
Creates an automatic partition, using a given range with the default values: When the binning cutoff is reached, the given range will be used unless setBinning(int, double, double) is called.
Parameters:
min - the initial minimum for the range (will change if setBinning(int, double, double) is called)
max - the initial maximum for the range (will change if setBinning(int, double, double) is called)
See Also:
setBinning(int, double, double)

AutoPartition

public AutoPartition(int autoCutoff,
                     int bins,
                     double min,
                     double max)
Created an automatic partition, with the given range and the given values for the auto binning cutoff and number of bins. When the binning cutoff is reached, the given range will be used unless setBinning(int, double, double) is called.
Parameters:
autoCutoff - after this many entries, the partition will fix a range and always bin within that range (value must be greater than zero)
nBins - the partition will use this many bins (value must be greater than zero)
min - the initial minimum for the range (will change if setBinning(int, double, double) is called)
max - the initial maximum for the range (will change if setBinning(int, double, double) is called)
Throws:
java.lang.IllegalArgumentException - if autoCutoff <= 0 or if nBins <= 0
See Also:
setBinning(int, double, double)

AutoPartition

public AutoPartition(int autoCutoff,
                     BinType type,
                     double min,
                     double max)
Method Detail

setBinning

public void setBinning(int bins,
                       double min,
                       double max)
Description copied from class: Abstract1DPartition
Override to allow binning to be set. Throws an UnsupportedPartitionMethodException by default.
Overrides:
setBinning in class OneDDelegatingPartition
Following copied from class: hep.analysis.partition.Abstract1DPartition
Parameters:
bins - the number of bins to have
min - the minimum of the partition range
max - the maximum of the partition range
Throws:
UnsupportedPartitionMethodException - if not overridden.

thresholdReached

public void thresholdReached()
Specified by:
thresholdReached in interface ThresholdListener

getNumberOfBins

public int getNumberOfBins()
Description copied from class: Abstract1DPartition
Return the number of bins.
Overrides:
getNumberOfBins in class OneDDelegatingPartition

getMin

public double getMin()
Description copied from class: Abstract1DPartition
Return the minimum in the distribution.
Overrides:
getMin in class OneDDelegatingPartition

getMax

public double getMax()
Description copied from class: Abstract1DPartition
Return the maximum in the distribution.
Overrides:
getMax in class OneDDelegatingPartition

getStatistics

public Statistics getStatistics()
Overrides:
getStatistics in class OneDDelegatingPartition

isRebinnable

public boolean isRebinnable()
Description copied from class: Abstract1DPartition
Returns false by default. Override to have a rebinnable partition.
Overrides:
isRebinnable in class OneDDelegatingPartition

makeCopy

public Partition makeCopy()
Description copied from class: Partition
Make a copy of this partition, maintaining the partition class and initial state, but not the data stored in the partition.
Overrides:
makeCopy in class Partition