AIDA supports 1D, 2D and 3D histograms.  Creating histograms is quite straightforward using the methods in IHistogramFactory.

Histograms support arithmetic operations, in particular add, subtract, multiply and divide. In all cases the operation is applied bin-by-bin, and the histograms involved in the operation must have the same binning. The input histograms are unchanged, and a new histogram is created as the result of the operation. All of the arithmetic operations are methods of IHistogramFactory to reflect the fact that a new histogram is always created as a result of the operation. For multi-dimensional histograms it is also possible to create slices and projections.

The following example illustrates using histograms:

Histogram Arithmetic

import hep.aida.*;
import java.util.Random;

public class HistogramArithmetic 
   public static void main(String[] argv)
      IAnalysisFactory af = IAnalysisFactory.create();
      IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
      IHistogram1D h1 = hf.createHistogram1D("test 1d",50,-3,6);
      IHistogram1D h2 = hf.createHistogram1D("test 2d",50,-3,6);
      Random r = new Random();
      for (int i=0; i<10000; i++) 
      IHistogram1D plus = hf.add("h1+h2",h1,h2);
      IHistogram1D minus = hf.subtract("h1-h2",h1,h2);
      IHistogram1D mul = hf.multiply("h1*h2",h1,h2);
      IHistogram1D div = hf.divide("h1 over h2",h1,h2);
      IPlotter plotter = af.createPlotterFactory().create("Plot");

Table of Contents -- Next Section

$Id: histograms.jsp,v 1.1 2004/06/08 18:30:40 tonyj Exp $