def returnTuples(prefix, vardir): var_tuples = [] multihists = {} for varname, var in vardir.items(): hname = prefix + '_' + varname hist_register = TH1D(hname, hname, var['nbin'], var['xmin'], var['xmax']) hist_register.GetXaxis().SetTitle(var['xtitle']) hist_register.GetYaxis().SetTitle('a.u.') hist_register.Sumw2() hist_register.SetTitle(varname) multihists[hname] = hist_register var2draw = varname if 'var' in var: var2draw = var['var'] var_tuples.append('{var} >> {hist}'.format(var=var2draw, hist=hname)) return var_tuples, multihists
from optparse import OptionParser, OptionValueError usage = "usage: python compare.py" parser = OptionParser(usage) parser.add_option("-c", "--channel", default="sr", type="string", dest="channel") #parser.add_option('-f', '--ff', action="store_true", default=False, dest='ff') (options, args) = parser.parse_args() colours = [1, 2, 4, 6, 8, 1, 46, 13, 15, 1,1,1,1,1,1] styles = [1, 2, 4, 3, 5, 2,7, 1, 1, 1,1,1,1,1,1] isxgbs = True if not isxgbs: for vkey, ivar in vardir.items(): if vkey.find('xgbs')!=-1: vardir.pop(vkey) print '-'*80 for vkey, ivar in vardir.items(): print '->', vkey.ljust(20), ivar print '-'*80 def overflow(hist): lastp1 = hist.GetBinContent(hist.GetXaxis().GetNbins()+1) last = hist.GetBinContent(hist.GetXaxis().GetNbins())