예제 #1
0
def makeProtonSide(log):
    c = Canvas('c')
    c.cd()
    c.SetLeftMargin(0.15)
    if log: c.SetLogy()
    c.SetTicks(1,1)
    h_single = ROOT.TH1F('h_single', '', 4, 0, 4)
    h_multi = ROOT.TH1F('h_multi', '', 4, 0, 4)
    for year in years:
        for pf in protonFiles:
            if year == pf[0]: pf_single, pf_multi = pf[1], pf[2]
        h_single.Add( pf_single.Get('plots/h_proton_side') )
        h_multi.Add( pf_multi.Get('plots/h_proton_side') )
    
    denom = h_single.GetEntries()
    h_multi.Scale(1.0/denom)
    h_multi.GetYaxis().SetTitle('Fraction Of Events')
    h_multi.GetXaxis().SetBinLabel(1,'No protons'), h_multi.GetXaxis().SetBinLabel(2,'sector45 only'), h_multi.GetXaxis().SetBinLabel(3,'sector56 only'), h_multi.GetXaxis().SetBinLabel(4,'Both')
    h_multi.Draw('p')
    h_single.Scale(1.0/denom)
    h_single.Draw('p same')
    h_single.SetMarkerColor(62), h_multi.SetMarkerColor(207)
    h_single.SetLineColor(62), h_multi.SetLineColor(207)
    h_single.SetLineWidth(2), h_multi.SetLineWidth(2)
    h_single.SetMarkerStyle(20), h_multi.SetMarkerStyle(20)
    h_multi.SetMinimum(0.0), h_multi.SetMaximum( h_multi.GetMaximum()*1.5 )
    h_single.SetMarkerSize(0.9), h_multi.SetMarkerSize(0.9)
    c.SetGrid(0,1)
    legend = TLegend(0.6,0.7,0.8,0.78)
    legend.SetTextSize(0.03)
    legend.SetLineColor( 0 )
    legend.SetFillColor( 0 )
    legend.AddEntry(h_single,"singleRP",'lp')
    legend.AddEntry(h_multi,"multiRP",'lp')
    legend.Draw()
    pLabel, lLabel = prelimLabel('top',log,h_single.GetMaximum()), lumiLabel(False,years)
    pLabel.SetMargin(0.49)
    pLabel.Draw(), lLabel.Draw()
    c.SaveAs('plots/%s/h_proton_side_%s_%s.pdf' % (s_years,selection,s_years))
예제 #2
0
def makeComp(hist, label, log):
    var = hist.split('_')[-1]

    new_file = TFile("tmp/histOut_data2017D_new_HLT_multiRP.root")
    old_file = TFile("tmp/histOut_data2017D_old_HLT_multiRP.root")

    h_new = new_file.Get('plots/%s' % hist)
    h_old = old_file.Get('plots/%s' % hist)

    c1 = Canvas('c1')
    c1.SetLeftMargin(0.15)
    c1.cd()
    c1.SetTicks(1, 1)
    if log: c1.SetLogy()
    h_new.SetTitle('')
    h_new.GetYaxis().SetTitleOffset(2.1)
    h_new.GetYaxis().SetTitle('Events')
    h_new.GetXaxis().SetTitleOffset(1.2)
    h_new.GetXaxis().SetTitle(label)
    h_new.SetMarkerStyle(20)
    h_new.SetMarkerColor(r.kRed)
    h_new.GetXaxis().SetNdivisions(507)
    h_old.SetLineColor(r.kBlue)
    h_new.Rebin(4), h_old.Rebin(4)
    h_new.Draw('p')
    h_old.Draw('HIST same')
    legend = TLegend(0.69, 0.75, 0.82, 0.85)
    legend.SetBorderSize(0)
    legend.SetFillColor(0)
    legend.SetFillStyle(0)
    legend.SetTextFont(42)
    legend.SetTextSize(0.023)
    legend.AddEntry(h_old, 'Legacy data', 'l')
    legend.AddEntry(h_new, 'Reminiaod data', 'p')
    legend.Draw()
    pLabel = prelimLabel('top', False)
    pLabel.Draw()
    c1.SaveAs('plots/reMiniAOD_validation_%s.%s' % (var, extension))
예제 #3
0
def makeProComp(var, label, log):
    new_file = TFile("tmp/histOut_data2017D_new_HLT_multiRP.root")
    old_file = TFile("tmp/histOut_data2017D_old_HLT_multiRP.root")

    str_45 = 'xip' if var == 'xi' else 'thetaY_45'
    str_56 = 'xim' if var == 'xi' else 'thetaY_56'

    h_new_45 = new_file.Get('plots/h_pro_%s' % str_45)
    h_new_56 = new_file.Get('plots/h_pro_%s' % str_56)
    h_old_45 = old_file.Get('plots/h_pro_%s' % str_45)
    h_old_56 = old_file.Get('plots/h_pro_%s' % str_56)

    c1 = Canvas('c1')
    c1.SetLeftMargin(0.15)
    c1.cd()
    c1.SetTicks(1, 1)
    if log: c1.SetLogy()
    h_new_45.SetTitle('')
    h_new_45.GetYaxis().SetTitleOffset(2.1)
    h_new_45.GetYaxis().SetTitle('Events')
    h_new_45.GetXaxis().SetTitleOffset(1.2)
    h_new_45.GetXaxis().SetTitle(label)
    h_new_45.SetLineColor(r.kRed)
    h_new_45.GetXaxis().SetNdivisions(507)
    h_old_45.SetLineColor(r.kBlue)
    h_new_45.Draw('HIST')
    h_old_45.Draw('HIST same')
    text45 = TPaveText(0.72, 0.81, 0.9, 0.9, 'NB NDC')
    text45.AddText('sector 45')
    text45.SetTextSize(0.032)
    text45.SetTextFont(42)
    text45.SetFillStyle(0)
    text45.Draw()
    legend = TLegend(0.6, 0.6, 0.75, 0.7)
    legend.SetBorderSize(0)
    legend.SetFillColor(0)
    legend.SetFillStyle(0)
    legend.SetTextFont(42)
    legend.SetTextSize(0.028)
    legend.AddEntry(h_old_45, 'Legacy data', 'l')
    legend.AddEntry(h_new_45, 'Reminiaod data', 'l')
    legend.Draw()
    pLabel = prelimLabel('top', False)
    pLabel.Draw()
    c1.SaveAs('plots/reMiniAOD_validation_%s_45.%s' % (var, extension))

    c2 = Canvas('c2')
    c2.SetLeftMargin(0.15)
    c2.cd()
    c2.SetTicks(1, 1)
    if log: c2.SetLogy()
    h_new_56.SetTitle('')
    h_new_56.GetYaxis().SetTitleOffset(2.1)
    h_new_56.GetYaxis().SetTitle('Events')
    h_new_56.GetXaxis().SetTitleOffset(1.2)
    h_new_56.GetXaxis().SetTitle(label)
    h_new_56.SetLineColor(r.kRed)
    h_new_56.GetXaxis().SetNdivisions(507)
    h_old_56.SetLineColor(r.kBlue)
    h_new_56.Draw('HIST')
    h_old_56.Draw('HIST same')
    text56 = TPaveText(0.72, 0.81, 0.9, 0.9, 'NB NDC')
    text56.AddText('sector 56')
    text56.SetTextSize(0.032)
    text56.SetTextFont(42)
    text56.SetFillStyle(0)
    text56.Draw()
    pLabel.Draw()
    legend.Draw()
    c2.SaveAs('plots/reMiniAOD_validation_%s_56.%s' % (var, extension))