def main(): style = get_style('CMSTDR') style.SetTitleSize(0.07, "XYZ") style.SetPalette(54) # kBlueYellow style.SetPadLeftMargin(0.10) style.SetPadRightMargin(0.12) set_style(style) input_dir = '/home/sauvan/Documents/HEP/Projects/CMS/L1CalorimeterTrigger_Phase2HGCal/Misc/FastShower/output/' files = glob(input_dir+'*.root') for file_name in files: with root_open(file_name) as file: for object in file.objects(cls=TCanvas): if 'Event 1' in object.GetName(): plot_event(splitext(basename(file_name))[0], object)
pad.RedrawAxis() pad.Update() return pad, graphs if __name__ == '__main__': from rootpy.plotting import Canvas, Legend, get_style from rootpy.plotting.style.atlas.labels import ATLAS_label mass_points = [100,105,120,125,130,135,140,145,150] pvalues = [ [0.5, 0.25, 0.15, 0.05, 0.03, 0.01, 0.03, 0.05, 0.15, 0.25, 0.5], [0.4, 0.3, 0.17, 0.02, 0.01, 0.008, 0.08, 0.06, 0.14, 0.2, 0.2], ] names = ['A', 'B'] style = get_style('ATLAS', shape='rect') # allow space for sigma labels on right style.SetPadRightMargin(0.05) with style: c = Canvas() _, graphs = pvalue_plot( mass_points, pvalues, pad=c, xtitle='m_{H} [GeV]', linestyle=['dashed', 'solid']) for name, graph in zip(names, graphs): graph.title = name graph.legendstyle = 'L' leg = Legend(graphs, leftmargin=0.4, topmargin=0.2) leg.Draw() ATLAS_label(0.57, 0.88, text="Internal 2012", sqrts=8, pad=c, sep=0.09) c.SaveAs('pvalue_plot.png')
import os import ROOT ROOT.gROOT.SetBatch(True) from externaltools import TauTriggerCorrections base = TauTriggerCorrections.RESOURCE_PATH from rootpy.plotting import Canvas, Graph, Legend, Hist2D from rootpy.plotting.shapes import Line from rootpy.plotting import get_style, set_style from rootpy.interactive import wait import numpy as np style = get_style('ATLAS', shape='square') style.SetPadLeftMargin(0.16) style.SetTitleYOffset(1.6) style.SetHistTopMargin(0.) set_style(style) triggers = [ ('EF_tau20_medium1', 'red'), ('EF_tau20T_medium1', 'black'), ('EF_tau29_medium1', 'blue'), ('EF_tau29T_medium1', 'green'), ] pt = np.linspace(20000, 100000, 100) def draw_curve_7(_func, name, title, ylow, yhigh): """ Draw 7TeV trigger efficiency curves """ graphs = []
from rootpy.plotting import get_style import copy style_turnon = copy.deepcopy(get_style('CMSTDR')) style_turnon.SetName('Turnon') style_turnon.SetPadRightMargin(0.04) style_turnon.SetLabelSize(0.05, 'XY') style_turnon.SetTitleSize(0.06, 'XY') style_turnon.SetTitleXOffset(0.95) style_turnon.SetTitleYOffset(1.1) style_rate = copy.deepcopy(get_style('CMSTDR')) style_rate.SetName('Rate') style_rate.SetPadRightMargin(0.04) style_rate.SetLabelSize(0.05, 'XY') style_rate.SetTitleSize(0.06, 'XY') style_rate.SetTitleXOffset(0.95) style_rate.SetTitleYOffset(1.1)
pad.RedrawAxis() pad.Update() return pad, graphs if __name__ == '__main__': from rootpy.plotting import Canvas, Legend, get_style from rootpy.plotting.style.atlas.labels import ATLAS_label mass_points = [100, 105, 120, 125, 130, 135, 140, 145, 150] pvalues = [ [0.5, 0.25, 0.15, 0.05, 0.03, 0.01, 0.03, 0.05, 0.15, 0.25, 0.5], [0.4, 0.3, 0.17, 0.02, 0.01, 0.008, 0.08, 0.06, 0.14, 0.2, 0.2], ] names = ['A', 'B'] style = get_style('ATLAS', shape='rect') # allow space for sigma labels on right style.SetPadRightMargin(0.05) with style: c = Canvas() _, graphs = pvalue_plot(mass_points, pvalues, pad=c, xtitle='m_{H} [GeV]', linestyle=['dashed', 'solid']) for name, graph in zip(names, graphs): graph.title = name graph.legendstyle = 'L' leg = Legend(graphs, leftmargin=0.4, topmargin=0.2) leg.Draw() ATLAS_label(0.57, 0.88, text="Internal 2012", sqrts=8, pad=c, sep=0.09)
import os import ROOT ROOT.gROOT.SetBatch(True) from externaltools import TauTriggerCorrections base = TauTriggerCorrections.RESOURCE_PATH from rootpy.plotting import Canvas, Graph, Legend, Hist2D from rootpy.plotting.shapes import Line from rootpy.plotting import get_style, set_style from rootpy.interactive import wait import numpy as np style = get_style('ATLAS', shape='square') style.SetPadLeftMargin(0.16) style.SetTitleYOffset(1.6) style.SetHistTopMargin(0.) set_style(style) triggers = [ ('EF_tau20_medium1', 'red'), ('EF_tau20T_medium1', 'black'), ('EF_tau29_medium1', 'blue'), ('EF_tau29T_medium1', 'green'), ] pt = np.linspace(20000, 100000, 100)