from hep.aida import IAnalysisFactory
from java.util import Random
from jhplot import *
factory = IAnalysisFactory.create();
tree = factory.createTreeFactory().create();
hf = factory.createHistogramFactory(tree);
tree.mkdir("/Histograms");
tree.cd("/Histograms");
h1 = hf.createHistogram1D("Histogram 1D",50,-3,3);
h2 = hf.createHistogram2D("Histogram 2D",40,-3,3,40,-3,3);
tree.mkdir("/Clouds");
tree.cd("/Clouds");
cc1 = hf.createCloud1D("Cloud 1D");
cc2 = hf.createCloud2D("Cloud 2D");
r = Random()
for i in range(5000):
h1.fill(r.nextGaussian())
h2.fill(r.nextGaussian(),r.nextGaussian())
cc1.fill(r.nextGaussian())
cc2.fill(r.nextGaussian(),r.nextGaussian())
c1=HPlotter("CreateAndPlotHistograms",700,600,2,2)
c1.visible()
c1.cd(1,1)
c1.draw(h1)
c1.cd(2,1)
c1.draw(h2)
c1.cd(1,2)
c1.draw(cc1)
c1.cd(2,2)
c1.draw(cc2)
Ads help maintain this website.