from hep.aida import IAnalysisFactory
from java.lang import *
from java.util import *
from jhplot import *
System.getProperties().setProperty("hep.aida.IAnalysisFactory","hep.aida.ref.AnalysisFactory")
true = Boolean("true");
false = Boolean("false");
factory = IAnalysisFactory.create();
tree = factory.createTreeFactory().create("UsingJAIDAFromJython.aida","xml",false,true);
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");
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)
r = Random()
def fill():
for i in range(500):
h1.fill(r.nextGaussian())
h2.fill(r.nextGaussian(),r.nextGaussian())
cc1.fill(r.nextGaussian())
cc2.fill(r.nextGaussian(),r.nextGaussian())
fill()
tree.commit();
Ads help maintain this website.