def main(): ### Main definitions ROOT.gROOT.SetBatch() ### canvas, c_top, c_bottom = utils.create_double_pad('plot_3lcr_2l2v') ### root_file = ROOT.TFile('inputs/MTW_all_met_tst.root') stack = utils.re_style_top( root_file.Get('c1').GetPrimitive('pad1').GetPrimitive('hs1')) stack.GetXaxis().SetTitle('#it{E}_{T}^{miss} [GeV]') stack.GetYaxis().SetTitle('Events / 30 GeV') hists = {} merging_scheme = utils.complex_merging full_stack = stack.GetStack().Last() for hist in stack.GetHists(): prev_color = hist.GetFillColor() sample_name = None for key, vals in utils.original_colors_2l2v.iteritems(): if prev_color in vals: sample_name = key if not sample_name: 'Sample Name Not Found' else: ''' for merging_key, merging_list in merging_scheme.iteritems(): if sample_name in merging_list: print sample_name, ' is supposed to be merged into ', merging_key ''' hists[sample_name] = utils.re_shape_tail(hist) ''' a = hist.GetXaxis() print print a.GetNbins() print a.GetXmin() print a.GetXmax() ''' ### Getting complicated here... loop_over_this = hists.keys() to_be_removed = utils.wjets_removal for key in loop_over_this: for merging_key, merging_list in merging_scheme.iteritems(): if key in merging_list: to_be_removed.add(key) if merging_key in hists: hists[merging_key].Add(hists[key]) else: hists[merging_key] = hists[key].Clone('another_clone_' + hists[key].GetName()) to_be_used = [] for k in hists: hist = hists[k] hist.SetFillColor(utils.get_colors(k)) hist.SetLineColor(ROOT.kBlack) hist.SetLineWidth(1) hist.SetTitle(utils.titles[k]) if not k in to_be_removed: to_be_used.append((k, hist.Integral())) sample_list = sorted(to_be_used, key=lambda x: x[1]) sample_list_r = sorted(to_be_used, key=lambda x: x[1], reverse=True) new_stack = ROOT.THStack(stack.GetName() + '_clone', '') for name, integral in sample_list: new_stack.Add(hists[name]) ### data = utils.re_style_top( utils.th1_to_tgraph( root_file.Get('c1').GetPrimitive('pad1').GetPrimitive( 'met_tst_MTW_all_Nominal'), True)) prev_error, last_bin_ratio = utils.re_shape_tail( root_file.Get('c1').GetPrimitive('pad1').GetPrimitive('h0'), True) error = utils.re_style_top(utils.th1_to_tgraph(prev_error)) error.SetMarkerStyle(1) error.SetFillColor(ROOT.kBlack) error.SetFillStyle(3345) ### ratio_axis = utils.re_style_bot( root_file.Get('c1').GetPrimitive('pad2').GetPrimitive('h3')) ratio = utils.re_style_bot( utils.th1_to_tgraph( root_file.Get('c1').GetPrimitive('pad2').GetPrimitive('h3'), True)) ratio_axis.GetXaxis().SetTitle('#it{E}_{T}^{miss} [GeV]') ratio_axis.GetYaxis().SetTitle('#frac{Data}{Prediction}') syst_band = utils.re_style_bot( utils.th1_to_tgraph( utils.change_last_bin( root_file.Get('c1').GetPrimitive('pad2').GetPrimitive('h0'), last_bin_ratio))) #ratio = utils.re_style_bot( root_file.Get( 'c1' ).GetPrimitive( 'pad2' ).GetPrimitive( 'h3' ) ) #ratio.GetXaxis().SetTitle( '#it{E}_{T}^{miss} [GeV]' ) #ratio.GetYaxis().SetTitle( '#frac{Data}{Prediction}' ) ##syst_band = utils.re_style_bot( utils.re_shape_tail( root_file.Get( 'c1' ).GetPrimitive( 'pad2' ).GetPrimitive( 'h0' ), full_stack ) ) #syst_band = utils.re_style_bot( utils.change_last_bin( root_file.Get( 'c1' ).GetPrimitive( 'pad2' ).GetPrimitive( 'h0' ), last_bin_ratio ) ) syst_band.SetMarkerStyle(1) syst_band.SetFillColor(ROOT.kBlack) syst_band.SetFillStyle(3345) ### c_top.cd() new_stack.SetMaximum(1000000) new_stack.SetMinimum(0.001) new_stack.Draw('hist') new_stack = utils.re_style_top(new_stack) new_stack.Draw('hist') new_stack.GetXaxis().SetTitle('#it{E}_{T}^{miss} [GeV]') new_stack.GetYaxis().SetTitle('Events / 30 GeV') new_stack.GetXaxis().SetRangeUser(0, 600) error.Draw('e2 same') data.Draw('pe') x_l1, y_l1, latex1 = utils.draw_latex(utils.lumi, True) latex1.DrawLatex( x_l1, y_l1 - 0.12, utils.h_to_zz_to + utils.lepp + utils.lepm + utils.nu + utils.nubar + utils.void_char + utils.inv_prime) latex1.DrawLatex(x_l1, y_l1 - 0.18, '3#it{l} Control Region') leg = utils.create_legend(len(sample_list_r), 0.3, 1) leg.AddEntry(data, 'Data', 'pe') for name, integral in sample_list_r: leg.AddEntry(hists[name], hists[name].GetTitle(), 'f') leg.AddEntry(error, 'Uncertainty', 'f') leg.Draw() #utils.patch_bar( 229. / 566., 234. / 566., 322. / 407., 322. / 407., True ) c_top.SetLogy() c_bottom.cd() ratio_axis.Draw('axis') ratio_axis.GetXaxis().SetRangeUser(0, 600) syst_band.Draw('e2 same') ratio.Draw('pe0 same') c_bottom.Update() for arrow in utils.get_arrows(ROOT.gPad.GetUymin(), ROOT.gPad.GetUymax(), ratio): arrow.Draw() Line = ROOT.TLine(ROOT.gPad.GetUxmin(), 1, ROOT.gPad.GetUxmax(), 1) Line.SetLineColor(ROOT.kBlack) Line.SetLineWidth(2) Line.SetLineStyle(2) Line.Draw() #canvas.SaveAs( canvas.GetName() + '.pdf' ) utils.save(canvas)
def make_plot( file_name, cat, title, maxYtop, minY = 0.18, maxY = 1.82 ): ### canvas, c_top, c_bottom = utils.create_double_pad( 'plot_sr_' + cat + 'vv' ) ### root_file = ROOT.TFile( 'inputs/' + file_name ) stack = utils.re_style_top( root_file.Get( 'c1' ).GetPrimitive( 'pad1' ).GetPrimitive( 'hs1' ) ) hists = {} merging_scheme = utils.complex_merging for hist in stack.GetHists(): prev_color = hist.GetFillColor() sample_name = None for key, vals in utils.original_colors_2l2v.iteritems(): if prev_color in vals: sample_name = key ''' if not sample_name: 'Sample Name Not Found' else: hist.SetFillColor( utils.get_colors( sample_name ) ) #hist.SetLineColor( utils.colors[ sample_name ] ) hist.SetLineColor( ROOT.kBlack ) hist.SetLineWidth( 1 ) hist.SetTitle( utils.titles[ sample_name ] ) ''' hists[ sample_name ] = hist ### Getting complicated here... loop_over_this = hists.keys() to_be_removed = set()#utils.wjets_removal for key in loop_over_this: for merging_key, merging_list in merging_scheme.iteritems(): if key in merging_list: to_be_removed.add( key ) if merging_key in hists: hists[ merging_key ].Add( hists[ key ] ) else: hists[ merging_key ] = hists[ key ].Clone( 'another_clone_' + hists[ key ].GetName() ) to_be_used = [] for k in hists: hist = hists[ k ] hist.SetFillColor( utils.get_colors( k ) ) hist.SetLineColor( ROOT.kBlack ) hist.SetLineWidth( 1 ) hist.SetTitle( utils.titles[ k ] ) if not k in to_be_removed: penalty = 0 if k == 'Wjets': penalty = -1 to_be_used.append( ( k, hist.Integral() + penalty ) ) sample_list = sorted( to_be_used, key = lambda x: x[ 1 ] ) sample_list_r = sorted( to_be_used, key = lambda x: x[ 1 ], reverse = True ) new_stack = ROOT.THStack( stack.GetName() + '_clone', '' ) for name, integral in sample_list: new_stack.Add( hists[ name ] ) data = utils.re_style_top( utils.th1_to_tgraph( root_file.Get( 'c1' ).GetPrimitive( 'pad1' ).GetPrimitive( 'mT_' + cat + '_Nominal' ), True ) ) utils.print_contents( root_file.Get( 'c1' ).GetPrimitive( 'pad1' ).GetPrimitive( 'mT_' + cat + '_Nominal' ) ) error = utils.re_style_top( utils.th1_to_tgraph( root_file.Get( 'c1' ).GetPrimitive( 'pad1' ).GetPrimitive( 'h0' ) ) ) error.SetMarkerStyle( 1 ) error.SetFillColor( ROOT.kBlack ) error.SetFillStyle( 3345 ) ### ratio_axis = utils.re_style_bot( root_file.Get( 'c1' ).GetPrimitive( 'pad2' ).GetPrimitive( 'h3' ), minY, maxY ) ratio = utils.re_style_bot( utils.th1_to_tgraph( root_file.Get( 'c1' ).GetPrimitive( 'pad2' ).GetPrimitive( 'h3' ), True ), minY, maxY ) ratio_axis.GetXaxis().SetTitle( '#it{m}_{T}^{' + utils.zz + '} [GeV]' ) ratio_axis.GetYaxis().SetTitle( '#frac{Data}{Prediction}' ) syst_band = utils.re_style_bot( utils.th1_to_tgraph( root_file.Get( 'c1' ).GetPrimitive( 'pad2' ).GetPrimitive( 'h0' ) ) ) for index in range( syst_band.GetN() ): X, Y = ROOT.Double( 0. ), ROOT.Double( 0. ) syst_band.GetPoint( index, X, Y ) syst_band.SetMarkerStyle( 1 ) syst_band.SetFillColor( ROOT.kBlack ) syst_band.SetFillStyle( 3345 ) syst_band.GetXaxis().SetTitle( '#it{m}_{T}^{' + utils.zz + '} [GeV]' ) syst_band.GetYaxis().SetTitle( '#frac{Data}{Prediction}' ) ### c_top.cd() new_stack.SetMinimum( 0.002 ) new_stack.Draw( 'hist' ) new_stack = utils.re_style_top( new_stack ) new_stack.Draw( 'hist' ) new_stack.GetXaxis().SetTitle( '#it{m}_{T}^{' + utils.zz + '} [GeV]' ) new_stack.GetYaxis().SetTitle( 'Events / %d GeV' % int( stack.GetXaxis().GetBinWidth( 1 ) ) ) new_stack.SetMaximum( maxYtop ) new_stack.GetXaxis().SetRangeUser( 250, 1500 ) error.Draw( '2 same' ) data.Draw( 'pe' ) x_l1, y_l1, latex1 = utils.draw_latex( utils.lumi, True ) latex1.DrawLatex( x_l1, y_l1 - 0.12, title + utils.void_char ) latex1.DrawLatex( x_l1, y_l1 - 0.18, '' ) leg = utils.create_legend( len( sample_list_r ), 0.3, 1 ) leg.AddEntry( data, 'Data', 'pe' ) for name, integral in sample_list_r: leg.AddEntry( hists[ name ], hists[ name ].GetTitle(), 'f' ) leg.AddEntry( error, 'Uncertainty', 'f' ) leg.Draw() mod_x, mod_y = 0, 0 if cat == 'ee': mod_x, mod_y = 4, -2 #utils.patch_bar( ( 228. + mod_x ) / 566., ( 233. + mod_x ) / 566., ( 324. + mod_y ) / 407., ( 324. + mod_y ) / 407., True ) c_top.SetLogy() c_bottom.cd() ratio_axis.Draw( 'axis' ) ratio_axis.GetXaxis().SetRangeUser( 250, 1500 ) syst_band.Draw( 'e2 same' ) ratio.Draw( 'pe0 same' ) c_bottom.Update() for arrow in utils.get_arrows( ROOT.gPad.GetUymin(), ROOT.gPad.GetUymax(), ratio ): arrow.Draw() Line = ROOT.TLine( ROOT.gPad.GetUxmin(), 1, ROOT.gPad.GetUxmax(), 1 ) Line.SetLineColor( ROOT.kBlack ) Line.SetLineWidth( 2 ) Line.SetLineStyle( 2 ) Line.Draw() utils.save( canvas )
def make_plot( file_name, cat, title, maxYtop, minY = 0.02, maxY = 1.98 ): #def make_plot( file_name, cat, title, maxYtop, minY = 0.18, maxY = 1.82 ): #def make_plot( file_name, cat, title, maxYtop, minY = 0., maxY = 3.4 ): ### canvas, c_top, c_bottom = utils.create_double_pad( 'plot_%s' % file_name.replace( '.root', '' ) ) ### root_file = ROOT.TFile( 'inputs/' + file_name ) stack = utils.re_style_top( root_file.Get( 'ratio' ).GetPrimitive( 'p1_ratio' ).GetPrimitive( 'combined' ) ) hists = {} merging_scheme = {} #utils.complex_merging for hist in stack.GetHists(): prev_color = hist.GetFillColor() sample_name = None for key, vals in utils.original_colors_4l.iteritems(): if prev_color in vals: sample_name = key ''' if not sample_name: 'Sample Name Not Found' else: hist.SetFillColor( utils.get_colors( sample_name ) ) #hist.SetLineColor( utils.colors[ sample_name ] ) hist.SetLineColor( ROOT.kBlack ) hist.SetLineWidth( 1 ) hist.SetTitle( utils.titles[ sample_name ] ) ''' hists[ sample_name ] = hist ### Getting complicated here... loop_over_this = hists.keys() to_be_removed = set() for key in loop_over_this: for merging_key, merging_list in merging_scheme.iteritems(): if key in merging_list: to_be_removed.add( key ) if merging_key in hists: hists[ merging_key ].Add( hists[ key ] ) else: hists[ merging_key ] = hists[ key ].Clone( 'another_clone_' + hists[ key ].GetName() ) to_be_used = [] for k in hists: hist = hists[ k ] hist.SetFillColor( utils.get_colors( k ) ) hist.SetLineColor( ROOT.kBlack ) hist.SetLineWidth( 1 ) hist.SetTitle( utils.titles[ k ] ) if not k in to_be_removed: penalty = 0 if k == 'Red': penalty = -1 to_be_used.append( ( k, hist.Integral() + penalty ) ) sample_list = sorted( to_be_used, key = lambda x: x[ 1 ] ) sample_list_r = sorted( to_be_used, key = lambda x: x[ 1 ], reverse = True ) new_stack = ROOT.THStack( stack.GetName() + '_clone', '' ) for name, integral in sample_list: new_stack.Add( hists[ name ] ) data, error = None, None for element in root_file.Get( 'ratio' ).GetPrimitive( 'p1_ratio' ).GetListOfPrimitives(): if element.GetName() == 'Graph': if not utils.is_data( element ): error = utils.re_style_top( element ) error.SetMarkerStyle( 1 ) error.SetFillColor( ROOT.kBlack ) error.SetFillStyle( 3345 ) else: data = utils.re_style_top( element ) ### ratio = utils.re_style_bot( root_file.Get( 'ratio' ).GetPrimitive( 'p2_ratio' ).GetPrimitive( 'dataRatio' ) ) syst_band = utils.re_style_bot( root_file.Get( 'ratio' ).GetPrimitive( 'p2_ratio' ).GetPrimitive( 'sysGraphRatio' ), minY, maxY ) syst_band.SetMarkerStyle( 1 ) syst_band.SetFillColor( ROOT.kBlack ) syst_band.SetFillStyle( 3345 ) syst_band.GetXaxis().SetTitle( utils.m4l ) #'#it{m}_{4l} [GeV]' ) syst_band.GetYaxis().SetTitle( '#frac{Data}{Prediction}' ) ### c_top.cd() new_stack.SetMinimum( 0.003 ) new_stack.Draw( 'hist' ) new_stack = utils.re_style_top( new_stack ) new_stack.Draw( 'hist' ) #new_stack.GetXaxis().SetRangeUser( 250, 1500 ) new_stack.GetXaxis().SetTitle( utils.m4l ) #'#it{m}_{4l} [GeV]' ) new_stack.GetYaxis().SetTitle( 'Events / %d GeV' % int( stack.GetXaxis().GetBinWidth( 1 ) ) ) new_stack.SetMaximum( maxYtop ) error.Draw( 'e2' ) data.Draw( 'p same' ) x_l1, y_l1, latex1 = utils.draw_latex( utils.lumi, True ) latex1.DrawLatex( x_l1, y_l1 - 0.12, title + utils.void_char ) latex1.DrawLatex( x_l1, y_l1 - 0.18, cat + utils.void_char ) leg = utils.create_legend( len( sample_list_r ), 0.3, 1 ) leg.AddEntry( data, 'Data', 'pe' ) for name, integral in sample_list_r: leg.AddEntry( hists[ name ], hists[ name ].GetTitle(), 'f' ) leg.AddEntry( error, 'Uncertainty', 'f' ) #leg.AddEntry( None, '', '' ) #leg.AddEntry( None, '#color[0]{' + utils.titles[ 'emu' ] + '}', '' ) leg.Draw() c_top.Update() minX, maxX = ROOT.gPad.GetUxmin(), ROOT.gPad.GetUxmax() c_top.SetLogy() c_bottom.cd() syst_band.Draw( 'ae2' ) syst_band.GetXaxis().SetRangeUser( minX, maxX ) ratio.Draw( 'pe0 same' ) c_bottom.Update() for arrow in utils.get_arrows( ROOT.gPad.GetUymin(), ROOT.gPad.GetUymax(), ratio ): arrow.Draw() Line = ROOT.TLine( ROOT.gPad.GetUxmin(), 1, ROOT.gPad.GetUxmax(), 1 ) Line.SetLineColor( ROOT.kBlack ) Line.SetLineWidth( 2 ) Line.SetLineStyle( 2 ) Line.Draw() utils.save( canvas )
def make_plot(file_name, cat, title, minX=-999., maxX=-1., minY=0.02, maxY=1.98, isLog=1): print "isLog:", isLog ### canvas, c_top, c_bottom = utils.create_double_pad( 'plot_%s' % file_name.replace('.root', '')) ### root_file = ROOT.TFile('input_offshell/' + file_name) ch_file = file_name.split('_')[1] val_file = file_name.split('_')[2] + '_' + file_name.split('_')[3] stack = utils.re_style_top( root_file.Get('c1').GetPrimitive('pad1').GetPrimitive('hs1')) hists = {} merging_scheme = {} #utils.complex_merging for hist in stack.GetHists(): prev_color = hist.GetFillColor() #print hist, prev_color sample_name = None for key, vals in utils.original_colors_2l2v.iteritems(): #print key, vals if prev_color in vals: sample_name = key ''' if not sample_name: 'Sample Name Not Found' else: hist.SetFillColor( utils.get_colors( sample_name ) ) #hist.SetLineColor( utils.colors[ sample_name ] ) hist.SetLineColor( ROOT.kBlack ) hist.SetLineWidth( 1 ) hist.SetTitle( utils.titles[ sample_name ] ) ''' hists[sample_name] = hist ### get those no stack histograms in pad1 data, error, sbi, sbi5 = None, None, None, None for element in root_file.Get('c1').GetPrimitive( 'pad1').GetListOfPrimitives(): #print element if element.GetName( ) == 'stat_sys_band_' + val_file + '_BJETVETO_' + ch_file: error = utils.re_style_top(element) error.SetMarkerStyle(1) error.SetFillColor(ROOT.kBlack) error.SetFillStyle(3345) elif element.GetName( ) == 'data_' + val_file + '_BJETVETO_' + ch_file + '_Nominal': data = utils.re_style_top(element) elif element.GetName( ) == 'SBI5_' + val_file + '_NLOIBJETVETO_' + ch_file + '_Nominal': sbi5 = utils.re_style_top(element) sbi5.SetMarkerColor(0) sbi5.SetMarkerStyle(0) sbi5.SetMarkerSize(0) sbi5.SetLineColor(616) sbi5.SetLineStyle(2) elif element.GetName( ) == 'SBI_' + val_file + '_NLOIBJETVETO_' + ch_file + '_Nominal': sbi = element prev_color = sbi.GetFillColor() #print sbi, prev_color sample_name = None for key, vals in utils.original_colors_2l2v.iteritems(): if prev_color in vals: sample_name = key for k in hists: hist = hists[k] sbi.Add(hist, -1) hists[sample_name] = sbi ### Getting complicated here... loop_over_this = hists.keys() to_be_removed = set() for key in loop_over_this: for merging_key, merging_list in merging_scheme.iteritems(): if key in merging_list: to_be_removed.add(key) if merging_key in hists: hists[merging_key].Add(hists[key]) else: hists[merging_key] = hists[key].Clone('another_clone_' + hists[key].GetName()) to_be_used = [('ZZ', 3), ('Others', 1), ('WZ', 2), ('SBI', 4)] for k in hists: hist = hists[k] hist.SetFillColor(utils.get_colors(k)) if k == 'SBI': hist.SetLineColor(ROOT.kBlue) else: hist.SetLineColor(ROOT.kBlack) hist.SetLineWidth(1) hist.SetTitle(utils.titles[k]) # if not k in to_be_removed: # penalty = 0 # to_be_used.append( ( k, hist.Integral() + penalty ) ) print "to_be_used:", to_be_used sample_list = sorted(to_be_used, key=lambda x: x[1]) sample_list_r = sorted(to_be_used, key=lambda x: x[1], reverse=True) new_stack = ROOT.THStack(stack.GetName() + '_clone', '') for name, integral in sample_list: #print name, integral new_stack.Add(hists[name]) ### ratio = utils.re_style_bot( root_file.Get('c1').GetPrimitive( 'pad2').GetPrimitive('ratio_bkg_data_' + val_file + '_BJETVETO_' + ch_file + '_Nominal')) syst_band = utils.re_style_bot( root_file.Get('c1').GetPrimitive('pad2').GetPrimitive( 'ratio_sys_band_' + val_file + '_BJETVETO_' + ch_file), minY, maxY) syst_band.SetMarkerStyle(1) syst_band.SetFillColor(ROOT.kBlack) syst_band.SetFillStyle(3345) if val_file == 'met_tst': syst_band.GetXaxis().SetTitle(utils.met) elif val_file == 'mT_ZZ': syst_band.GetXaxis().SetTitle(utils.mTZZ) syst_band.GetYaxis().SetTitle('#frac{Data}{Prediction}') ### if minX == -999. or maxX == -1.: minX, maxX = ROOT.gPad.GetUxmin(), ROOT.gPad.GetUxmax() print "minX =", minX, "maxX =", maxX c_top.cd() new_stack.SetMinimum(0.003) new_stack.Draw('hist') new_stack = utils.re_style_top(new_stack) new_stack.Draw('hist') new_stack.GetXaxis().SetRangeUser(minX, maxX) #new_stack.GetXaxis().SetTitle( utils.m4l ) new_stack.GetYaxis().SetTitle('Events / %d GeV' % stack.GetXaxis().GetBinWidth(1)) #new_stack.GetYaxis().SetTitle( 'Events / %s' % stack.GetXaxis().GetBinWidth( 1 ) ) if isLog == 1: Yscale = 1000 else: Yscale = 1.6 new_stack.SetMaximum(data.GetMaximum() * Yscale) error.Draw('e2 same') sbi5.Draw('hist same') data.Draw('p same') x_l1, y_l1, latex1 = utils.draw_latex(utils.lumi, True) latex1.DrawLatex(x_l1, y_l1 - 0.12, title + utils.void_char) latex1.DrawLatex(x_l1, y_l1 - 0.18, cat + utils.void_char) leg = utils.create_legend(len(sample_list_r), 0.3, 1) leg.AddEntry(data, 'Data', 'pe') leg.AddEntry(sbi5, 'gg+VBF#rightarrow(H*#rightarrow)ZZ(#mu_{off-shell}=5)', 'l') for name, integral in sample_list_r: leg.AddEntry(hists[name], hists[name].GetTitle(), 'f') leg.AddEntry(error, 'Uncertainty', 'f') #leg.AddEntry( None, '', '' ) #leg.AddEntry( None, '#color[0]{' + utils.titles[ 'emu' ] + '}', '' ) leg.Draw() c_top.Update() if isLog == 1: c_top.SetLogy() c_bottom.cd() syst_band.Draw('e2') syst_band.GetXaxis().SetRangeUser(minX, maxX) ratio.Draw('pe0 same') c_bottom.Update() #for arrow in utils.get_arrows( ROOT.gPad.GetUymin(), ROOT.gPad.GetUymax(), ratio ): arrow.Draw() Line = ROOT.TLine(ROOT.gPad.GetUxmin(), 1, ROOT.gPad.GetUxmax(), 1) Line.SetLineColor(ROOT.kBlack) Line.SetLineWidth(2) Line.SetLineStyle(2) Line.Draw() print "isLog:", isLog utils.save(canvas, isLog)