Clouds are one, two or three dimensional unbinned collections of data. They are used for scatter plots or dynamically rebinnable Histograms. A Cloud can be automatically converted to an Histogram when the number of entries exceeds a given threshold, or can be manually converted by the user.
IClouds are created through a IHistogramFactory as shown in the example below:
import hep.aida.*; public class CloudCreate { public static void main(String[] argv) { IAnalysisFactory af = IAnalysisFactory.create(); ITree tree = af.createTreeFactory().create(); IHistogramFactory hf = af.createHistogramFactory(tree); ICloud1D cl1D = hf.createCloud1D( "cl1D" ); ICloud2D cl2D = hf.createCloud2D( "cl2D", "2-Dimensional Cloud" ); ICloud3D cl3D = hf.createCloud3D( "cl3D", "3-Dimensional Cloud", 1500, "autoConvert = false" ); } }
In this example the IClouds cl1D and cl2D are set by default to autoconvert when the threshold is reached. (Please note that in this case the threshold depends on the particular implementation of the AIDA package you are using). For the ICloud cl3D we set the threshold at 1500 events and we choose to switch off the autoConvert option; in this case to convert the ICloud it is necessary to invoke the convert method.
In the example below we fill a 1-Dimensional and a 2-Dimensional Cloud with random numbers. For each entry we assign a random weight. We then plot the histograms produced by the Cloud auto-conversion
import hep.aida.*; import java.util.Random; public class Cloud { public static void main(String[] argv) { IAnalysisFactory af = IAnalysisFactory.create(); ITree tree = af.createTreeFactory().create(); IHistogramFactory hf = af.createHistogramFactory(tree); ICloud1D cl1D = hf.createCloud1D( "cl1D", "1-Dimensional Cloud", 1500, "" ); ICloud2D cl2D = hf.createCloud2D( "cl2D", "2-Dimensional Cloud", 1500, "" ); int entries = 20000; Random r = new Random(); for ( int i = 0; i < entries; i++ ) { double xval = r.nextGaussian(); double yval = r.nextGaussian(); double w = r.nextDouble(); cl1D.fill( xval, w ); cl2D.fill( xval, yval, w ); } IHistogram1D cl1DHist = cl1D.histogram(); IHistogram2D cl2DHist = cl2D.histogram(); IPlotter plotter = af.createPlotterFactory().create("Plot"); plotter.createRegions(1,2,0); plotter.region(0).plot(cl1DHist); plotter.region(1).plot(cl2D); plotter.show(); } }
Table of Contents -- Next Section