示例#1
0
def rootCanvas():
    from ROOT import TCanvas
    if globals()["canvas"] == None:
        import rootStyle
        rootStyle.applyRootStyle()
        globals()["canvas"] = TCanvas("CKCanvas", "CKCanvas", 1050, 750)
    return globals()["canvas"]
##  pyROOT macro to plot HPD image with overlaid fit result
##
##  Author: T. Blake
##
##
#############################################################

from ROOT import TFile, TH2, TEllipse, TCanvas, gStyle, TH1F, gPad
from math import sqrt

import os, sys

from pyHPDXMLParsingUtils import *

from rootStyle import applyRootStyle
applyRootStyle()

richcopydict = {'R1U': 0, 'R1D': 98, 'R2A': 196, 'R2C': 340}
richhpdsdict = {'R1U': 14, 'R1D': 14, 'R2A': 16, 'R2D': 16}


def usage(argv):
    print 'python ' + argv[
        0] + ' <root-file> <xml 0> ... <xml n> <box=R1U,R1D,R2A,R2C> <col=0 ..>'
    sys.exit(2)


def getHistogramFromFile(rootfile, hpd):
    histstr = 'RICH/RichHPDImageSummary/Rich_HPD_' + str(hpd) + '_Image'
    hist = rootfile.Get(histstr)
    return hist