from java.awt import Color
from java.awt import Font
from java.util import Random
from java.lang import Thread
from jhplot import HPlot
from jhplot import H1D
c1 = HPlot("Canvas",600,400,0.12,1,2)
c1.gTitle("Global Title", Color.blue) #put title
c1.visible(1)
h1 = H1D("e^{+}e^{-} → W^+{}W^{-} → 4 jets",20, -2.0, 2.0)
h2 = H1D("e^{+}e^{-} → W^+{}W^{-} → 4 jets",20, -2.0, 2.0)
rand = Random()
# fill histogram
for i in range(5000):
h1.fill(rand.nextGaussian())
if (i<2000): h2.fill(rand.nextGaussian())
c1.cd(1,1)
c1.draw(h1);
h3=h1.oper(h2,"subtract","-")
h3.setColor(Color.red)
c1.draw(h3);
h4=h1.oper(h2,"add","+")
h4.setColor(Color.blue)
c1.draw(h4);
# it is implemented in JAIDA?
c1.cd(1,2)
h5=h1.oper(h2,"multiply","*")
c1.draw(h5)
h6=h1.oper(h2,"divide","/")
c1.draw(h6)
# jHepWork @S.Chekanov