import hep.aida.*;
import java.util.Random;

public class Example2 {

  public static void main(String[] args)throws Exception {
    IAnalysisFactory af = IAnalysisFactory.create();
    IHistogramFactory hf = af.createHistogramFactory(null);
    IHistogram1D h = hf.createHistogram1D("Example2", 50, -3, 3);

    Random r = new Random(1234567);
    for (int i = 0; i < 10000; i++) {
      h.fill(r.nextGaussian());
    }

    IPlotterFactory pf = af.createPlotterFactory();
    IPlotter plotter = pf.create();
    IPlotterStyle style = pf.createPlotterStyle();
    style.setParameter("showStatisticsBox","true");
    style.dataStyle().setParameter("fillHistogramBars","false");
    style.dataStyle().setParameter("showHistogramBars","false");
    style.dataStyle().setParameter("showDataPoints","true");
    style.dataStyle().setParameter("showErrorBars","true");
    style.dataStyle().markerStyle().setParameter("size","12");
    style.dataStyle().markerStyle().setParameter("shape","3");
    style.dataStyle().markerStyle().setParameter("color","blue");
    style.xAxisStyle().setLabel("Hodnota r");
    style.yAxisStyle().setLabel("Pocet eventov");
    plotter.currentRegion().plot(h,style);
    plotter.writeToFile("Example2.gif");
    plotter.writeToFile("Example2.eps");
    plotter.writeToFile("Example2.jpg");
    plotter.writeToFile("Example2.pdf");

    plotter.show();
  }
}
