Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.sim.analysis
Class Histogram

    java.lang.Object
      uchicago.src.sim.analysis.plot.OpenGraph
          uchicago.src.sim.analysis.Histogram

All Implemented Interfaces:
  ZoomListener, MediaProducer

    public class Histogram

extends OpenGraph

A histogram plot allowing the user to histogram data from a list of objects. Histogram works on a model / view pattern where the model is the hep.aida.ref.Histogram1D from the colt package. This differs from OpenHistogram in that the xaxis interval is not dynamic, allowing for empty bins. The xaxis interval can be fixed or variable. Note that this Histogram only plots a single dataset.

Version:
  $Revision: 1.9 $ $Date: 2004/11/03 19:51:00 $
Author:
  Nick Collier
See Also:
  `Histogram1D`

Field Summary
`protected BinDataSource` | `dataSource` The data source for this Histogram
`protected java.text.NumberFormat` | `format`
`protected java.util.List` | `histList`
`protected hep.aida.ref.Histogram1D` | `histogram` The actual Histogram model of which this is the view.
`protected int` | `numBins` The number of bins in this Histogram
`protected boolean` | `showStats`
`protected boolean` | `xTickDrawn`

Fields inherited from class uchicago.src.sim.analysis.plot.OpenGraph
`CIRCLE, CROSS, DIAMOND, fileName, FILLED_CIRCLE, FILLED_DIAMOND, FILLED_SQUARE, FILLED_TRIANGLE, frame, HISTOGRAM, inNormalState, location, model, movieMaker, plot, PLUS_SIGN, SEQUENCE, SQUARE, title, TRIANGLE, xIncr, xMax, xMin, yIncr, yMax, yMin`

Fields inherited from interface uchicago.src.sim.gui.MediaProducer
`MPEG, QUICK_TIME`

Constructor Summary
`Histogram(java.lang.String title, double[] xedges)` Constructs a histogram with a variable xaxis interval.
`Histogram(java.lang.String title, double[] xedges, SimModel model)` Constructs a histogram with a variable xaxis interval.
`Histogram(java.lang.String title, int numBins, double min, double max)` Constructs a histogram with a fixed xaxis interval.
`Histogram(java.lang.String title, int numBins, double min, double max, SimModel model)` Constructs a histogram with a fixed xaxis interval.

Method Summary
`void` | `createHistogramItem(java.lang.String name, java.util.List list, BinDataSource source)` Creates an item to be histogramed by this Histogram.
`void` | `createHistogramItem(java.lang.String name, java.util.List list, BinDataSource source, int maxIntegerDigits, int maxFractionDigits)` Creates an item to be histogramed by this Histogram.
`void` | `createHistogramItem(java.lang.String name, java.util.List list, java.lang.Object bdsTarget, java.lang.String bdsMethodName)` Creates an item to be histogrammed by this Histogram.
`void` | `createHistogramItem(java.lang.String name, java.util.List list, java.lang.Object bdsTarget, java.lang.String bdsMethodName, int maxIntegerDigits, int maxFractionDigits)` Creates an item to be histogrammed by this Histogram.
`void` | `createHistogramItem(java.lang.String name, java.util.List list, java.lang.String listObjMethodName)` Creates an item to be histogrammed by this Histogram.
`void` | `createHistogramItem(java.lang.String name, java.util.List list, java.lang.String listObjMethodName, int maxIntegerDigits, int maxFractionDigits)` Creates an item to be histogrammed by this Histogram.
`hep.aida.ref.Histogram1D` | `getHistogram()` Returns the Histogram1D object of which this Histogram is a view.
`boolean` | `isStatsVisible()` Returns whether the stats are visible or not.
`void` | `record()` Histograms the data from the HistogramItems without updating the display.
`void` | `record(double[] data)` Histograms the specified data without updating the display.
`void` | `record(cern.colt.list.DoubleArrayList data)` Histograms the specified data without updating the display.
`void` | `setBarWidth(double width)` Sets the plot bar width in xaxis coordinates.
`void` | `setStatsVisible(boolean isVisible)` Sets the statistics display on the plot to visible.
`void` | `step()` Histograms the data from the histogram items and updates the displayed graph.
`void` | `step(double[] data)` Histograms the specified double array and updates the graph.
`void` | `step(cern.colt.list.DoubleArrayList data)` Histograms the specified DoubleArrayList and updates the graph.
`java.lang.String` | `toString()` Returns a String representation of the histogram.
`void` | `updateGraph()` Updates the graph.

Methods inherited from class uchicago.src.sim.analysis.plot.OpenGraph
`addMovieFrame, closeMovie, createBinDataSource, createListBinDataSource, createSequence, display, dispose, getAxisTitles, getSize, getTitle, getXIncrement, getXRange, getYIncrement, getYRange, setAxisTitles, setBars, setLocation, setMovieName, setSize, setSnapshotFileName, setXIncrement, setXRange, setXTick, setYIncrement, setYRange, takeSnapshot, updateXTick, zoom`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### histogram

    protected hep.aida.ref.Histogram1D histogram

  The actual Histogram model of which this is the view.

### histList

    protected java.util.List histList

### dataSource

    protected BinDataSource dataSource

  The data source for this Histogram

### numBins

    protected int numBins

  The number of bins in this Histogram

### xTickDrawn

    protected boolean xTickDrawn

### showStats

    protected boolean showStats

### format

    protected java.text.NumberFormat format

Constructor Detail

### Histogram

    public Histogram(java.lang.String title,
                     int numBins,
                     double min,
                     double max)

  Constructs a histogram with a fixed xaxis interval. The range of the histogram is specified by min and max and the number of bins by numBins. So for example `Histogram("sample", 2, 0.0, 20.0)` contains two in-range bins and one bin for underflow and one for overflow. The bin boundaries are [Double.NEGATIVE_INFINITY,0.0), [0.0, 10.0), [10.0, 20.0), [20.0, Double.POSITIVE_INFINITY], the first and last bins being for underflow and overflow. The height of the overflow and underflow bins can be seen by setting setStatsVisible to true.

  Parameters:
    `title` - the title of the histogram
    `numBins` - the number of bins in the histogram
    `min` - the minimum value of the histogram. Anything lower than this value is put in the underflow bin.
    `max` - the maximum value of the histogram. Anything greater than or equal to this value is put in the overflow bin.

### Histogram

    public Histogram(java.lang.String title,
                     int numBins,
                     double min,
                     double max,
                     SimModel model)

  Constructs a histogram with a fixed xaxis interval. The range of the histogram is specified by min and max and the number of bins by numBins. So for example `Histogram("sample", 2, 0.0, 20.0, aModel)` contains two in-range bins and one bin for underflow and one for overflow. The bin boundaries are [Double.NEGATIVE_INFINITY,0.0), [0.0, 10.0), [10.0, 20.0), [20.0, Double.POSITIVE_INFINITY], the first and last bins being for underflow and overflow. The height of the overflow and underflow bins can be seen by setting setStatsVisible to true.

  Parameters:
    `title` - the title of the histogram
    `numBins` - the number of bins in the histogram
    `min` - the minimum value of the histogram. Anything lower than this value is put in the underflow bin.
    `max` - the maximum value of the histogram. Anything greater than or equal to this value is put in the overflow bin.
    `model` - a reference to the model associated with this histogram.

### Histogram

    public Histogram(java.lang.String title,
                     double[] xedges,
                     SimModel model)

  Constructs a histogram with a variable xaxis interval. The range of the Histogram is specified by the xedges double array. For example `Histogram("sample", new double[] { 10.0, 20.0, 22.0}, aModel)` contains two in-range bins and one bin for underflow and one bin for overflow. Its boundaries are [Double.NEGATIVE_INFINITY,10.0), [10.0, 20.0), [20.0, 22.0), [22.0, Double.POSITIVE_INFINITY], the first and last bins being for underflow and overflow. The height of the overflow and underflow bins can be seen by setting setStatsVisible to true.

  Note that this doesn't display as well as it might. The scale of plot will show the appropriate amount of distance between an xaxis value of 0 and one of 10.

  Parameters:
    `title` - the title of the histogram
    `xedges` - the xaxis bin boundaries
    `model` - a reference to the model associated with this histogram.

### Histogram

    public Histogram(java.lang.String title,
                     double[] xedges)

  Constructs a histogram with a variable xaxis interval. The range of the Histogram is specified by the xedges double array. For example `Histogram("sample", new double[] { 10.0, 20.0, 22.0})` contains two in-range bins and one bin for underflow and one bin for overflow. Its boundaries are [Double.NEGATIVE_INFINITY,10.0), [10.0, 20.0), [20.0, 22.0), [22.0, Double.POSITIVE_INFINITY], the first and last bins being for underflow and overflow. The height of the overflow and underflow bins can be seen by setting setStatsVisible to true. Note that this doesn't display as well as it might. The scale of plot will show the appropriate amount of distance between an xaxis value of 0 and one of 10.

  Parameters:
    `title` - the title of the histogram
    `xedges` - the xaxis bin boundaries

Method Detail

### setBarWidth

    public void setBarWidth(double width)

  Sets the plot bar width in xaxis coordinates.

  Parameters:
    `width` - the width in xaxis coordinates.

### setStatsVisible

    public void setStatsVisible(boolean isVisible)

  Sets the statistics display on the plot to visible. The statistics display will display the total number of entries, the bin height of the overflow and underflow bin, the mean of the whole histogram as calculated on filling time, and the rms of the whole histogram as calculated on filling time. These stats are retrieved from method calls on a help.aida.ref.Histogram1D in the colt library. See that for more info.

  Parameters:
    `isVisible` - if true the stats will be visible, if not then they won't be visible

### isStatsVisible

    public boolean isStatsVisible()

  Returns whether the stats are visible or not.

### getHistogram

    public hep.aida.ref.Histogram1D getHistogram()

  Returns the Histogram1D object of which this Histogram is a view. See the help.aida.ref.Histogram1D in the colt library for more info.

### createHistogramItem

    public void createHistogramItem(java.lang.String name,
                                    java.util.List list,
                                    BinDataSource source)

  Creates an item to be histogramed by this Histogram. The HistogramItem iterates over the specified list passing each Object in the list as argument to the getBinValue method of the BinDataSource. This getBinValue method returns a double. All these doubles are then distributed across the bins accordingly.

  Parameters:
    `name` - the name of the item
    `list` - the list of objects that provided the data for the item
    `source` - the BinDataSource used to get the data from the objects in the list.

### createHistogramItem

    public void createHistogramItem(java.lang.String name,
                                    java.util.List list,
                                    BinDataSource source,
                                    int maxIntegerDigits,
                                    int maxFractionDigits)

  Creates an item to be histogramed by this Histogram. The HistogramItem iterates over the specified list passing each Object in the list as argument to the getBinValue method of the BinDataSource. This getBinValue method returns a double. All these doubles are then distributed across the bins accordingly.

  Parameters:
    `name` - the name of the item
    `list` - the list of objects that provided the data for the item
    `source` - the BinDataSource used to get the data from the objects in the list.
    `maxIntegerDigits` - the maximum number of digits before the decimal point in the bin labels. A value of -1 will record all the digits.
    `maxFractionDigits` - the maximum number of digits after the decimal point in the bin labels. A value of -1 will record all the digits.

### createHistogramItem

    public void createHistogramItem(java.lang.String name,
                                    java.util.List list,
                                    java.lang.Object bdsTarget,
                                    java.lang.String bdsMethodName)

  Creates an item to be histogrammed by this Histogram. The HistogramItem iterates over the specified list passing each Object in the list as an argument to the name method called on the specified object. This method returns a double and all these doubles are then distributed across the bins accordingly.

  Parameters:
    `name` - the name of the item
    `list` - the list of objects that provided the data for the item
    `bdsTarget` - the target of the named method
    `bdsMethodName` - the name of the method to call on the target

### createHistogramItem

    public void createHistogramItem(java.lang.String name,
                                    java.util.List list,
                                    java.lang.Object bdsTarget,
                                    java.lang.String bdsMethodName,
                                    int maxIntegerDigits,
                                    int maxFractionDigits)

  Creates an item to be histogrammed by this Histogram. The HistogramItem iterates over the specified list passing each Object in the list as an argument to the name method called on the specified object. This method returns a double and all these doubles are then distributed across the bins accordingly.

  Parameters:
    `name` - the name of the item
    `list` - the list of objects that provided the data for the item
    `bdsTarget` - the target of the named method
    `bdsMethodName` - the name of the method to call on the target
    `maxIntegerDigits` - the maximum number of digits before the decimal point in the bin labels. A value of -1 will record all the digits.
    `maxFractionDigits` - the maximum number of digits after the decimal point in the bin labels. A value of -1 will record all the digits.

### createHistogramItem

    public void createHistogramItem(java.lang.String name,
                                    java.util.List list,
                                    java.lang.String listObjMethodName)

  Creates an item to be histogrammed by this Histogram. The HistogramItem iterates over the specified list calling the specified method on each object in the list. This method must return a double or a primitive value that can be cast to a double. All these doubles are then distributed across the bins accordingly.

  Note this method assumes that the specified list is not empty when this method is called.

  Parameters:
    `name` - the name of the item
    `list` - the list of objects that provided the data for the item
    `listObjMethodName` - the name of the method to be called on each object in the list, the results of which are then histogrammed

### createHistogramItem

    public void createHistogramItem(java.lang.String name,
                                    java.util.List list,
                                    java.lang.String listObjMethodName,
                                    int maxIntegerDigits,
                                    int maxFractionDigits)

  Creates an item to be histogrammed by this Histogram. The HistogramItem iterates over the specified list calling the specified method on each object in the list. This method must return a double or a primitive value that can be cast to a double. All these doubles are then distributed across the bins accordingly.

  Note this method assumes that the specified list is not empty when this method is called.

  Parameters:
    `name` - the name of the item
    `list` - the list of objects that provided the data for the item
    `listObjMethodName` - the name of the method to be called on each object in the list, the results of which are then histogrammed
    `maxIntegerDigits` - the maximum number of digits before the decimal point in the bin labels. A value of -1 will record all the digits.
    `maxFractionDigits` - the maximum number of digits after the decimal point in the bin labels. A value of -1 will record all the digits.

### record

    public void record()

  Histograms the data from the HistogramItems without updating the display.

  Specified by:
    `record` in class `OpenGraph`

### record

    public void record(double[] data)

  Histograms the specified data without updating the display.

  Parameters:
    `data` - the double-s to histogram

### record

    public void record(cern.colt.list.DoubleArrayList data)

  Histograms the specified data without updating the display.

  Parameters:
    `data` - the double-s to histogram

### step

    public void step()

  Histograms the data from the histogram items and updates the displayed graph.

  Overrides:
    `step` in class `OpenGraph`

### step

    public void step(double[] data)

  Histograms the specified double array and updates the graph.

  Parameters:
    `data` - the array of doubles to histogram

### step

    public void step(cern.colt.list.DoubleArrayList data)

  Histograms the specified DoubleArrayList and updates the graph.

  Parameters:
    `data` - the DoubleList of doubles to histogram

### toString

    public java.lang.String toString()

  Returns a String representation of the histogram. This includes a tabular represenation of the bin heights.

  Overrides:
    `toString` in class `java.lang.Object`

### updateGraph

    public void updateGraph()

  Updates the graph.

  Specified by:
    `updateGraph` in class `OpenGraph`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD