# Calculate cross sections for gamma events # S.Chekanov from jhplot import * from jhplot.io import* c1=HPlot("X-cross",600,400,2,1) c1.visible() c1.setAutoRange() f=PFile("main02.pbu") print f.listEntries() # read histograms using keys h1=f.read("pT(gamma)") h2=f.read("eta(gamma)") # get number of events and lumi events=f.read("events") cross=f.read("cross") print "Tot events=",events print "Tot cross=",cross lumi=events.get(0)/cross.get(0) print "Lumi (pb-1)=",lumi # calculate scaling factors for cross sections scale1=lumi*h1.getBinSize() scale2=lumi*h2.getBinSize() print scale1,scale2 # scale to get differential cross sections h1.scale(1.0/scale1) h2.scale(1.0/scale2) # PT plot c1.cd(1,1) c1.setAutoRange() c1.setLogScale(1,1) c1.draw(h1) # eta plot c1.cd(2,1) c1.setAutoRange() c1.draw(h2) # generate EPS figure c1.export("xcross.eps")