Histograms using Jaida and Java
Code: "jaida_Histogram.java". Programming language: Java
DMelt Version 1. Last modified: 12/11/2015. License: Free
https://datamelt.org/code/cache/jaida_Histogram_242.java
To run this script using the DMelt IDE,
copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.
import hep.aida.*;
import java.util.Random;
public class jaida_Histogram
{
public static void main(String[] argv)
{
IAnalysisFactory af = IAnalysisFactory.create();
IHistogramFactory hf = af.createHistogramFactory(af.createTreeFactory().create());
IHistogram1D h1d = hf.createHistogram1D("test 1d",50,-3,3);
IHistogram2D h2d = hf.createHistogram2D("test 2d",50,-3,3,50,-3,3);
Random r = new Random();
for (int i=0; i<10000; i++)
{
h1d.fill(r.nextGaussian());
h2d.fill(r.nextGaussian(),r.nextGaussian());
}
IPlotter plotter = af.createPlotterFactory().create("Plot");
plotter.createRegions(1,2,0);
plotter.region(0).plot(h1d);
plotter.region(1).plot(h2d);
plotter.show();
}
}