Beispiel #1
0
def pid_background_fraction():
    """simplistic calculation of background contamination fraction"""
    nsig_p = hadd_interactive(histDir, runlist, 'jetpatch', 'anyspin', 'plus', 
        'away2_nSigmaPion')
    nsig_m = hadd_interactive(histDir, runlist, 'jetpatch', 'anyspin', 'minus', 
        'away2_nSigmaPion')
    
    nsig_p.SetTitle('n#sigma(#pi) for #pi^{+}')
    nsig_m.SetTitle('n#sigma(#pi) for #pi^{-}')
    
    print 'Fit summary for π+'
    pfits = pid_calibration(nsig_p)
    print 'Fit summary for π-'
    mfits = pid_calibration(nsig_m)
    c = graphics.canvas2()
    
    c.cd(1)
    nsig_m.Draw()
    [fit.Draw('same') for fit in mfits[1:]]
    
    c.cd(2)
    nsig_p.Draw()
    [fit.Draw('same') for fit in pfits[1:]]
    
    raw_input('wait here:')
    c.Print('pid_background_fraction.png')
Beispiel #2
0
def dphi():
    data = hadd_interactive(histDir, runlist, 'jetpatch', 'anyspin', 'sum', \
        'dphi')
    mgr = HistogramManager(ROOT.TFile(datamcFile), keys=['dphi'])
    simu = mgr.anyspin['jetpatch'].tracks_sum['dphi']
    c = graphics.canvas1()
    simu.SetLineColor(ROOT.kRed)
    simu.GetXaxis().SetTitle('#Delta#phi')
    simu.GetYaxis().SetTitle('normalized yield')
    simu.DrawNormalized('hist')
    
    data.SetMarkerStyle(20)
    data.DrawNormalized('same')
    raw_input('wait here:')
Beispiel #3
0
def meanpt():
    """plots mean pT in each z bin for for pions and tracks"""
    meanpt_p = hadd_interactive(histDir, runlist, 'jetpatch', 'anyspin', 
        'plus', 'meanpt')
    meanpt_m = hadd_interactive(histDir, runlist, 'jetpatch', 'anyspin', 
        'minus', 'meanpt')
    
    meanjetpt_p = hadd_interactive(histDir, runlist, 'jetpatch', 'anyspin', 
        'plus', 'meanjetpt')
    meanjetpt_m = hadd_interactive(histDir, runlist, 'jetpatch', 'anyspin', 
        'minus', 'meanjetpt')
    
    ## now get some results from simulations
    f = ROOT.TFile(datamcFile)
    mgr = HistogramManager(f, keys=['meanpt', 'meanjetpt'])
    meansim_p = mgr.anyspin['jetpatch'].tracks_plus['meanpt']
    meansim_m = mgr.anyspin['jetpatch'].tracks_minus['meanpt']
    meanjetsim_p = mgr.anyspin['jetpatch'].tracks_plus['meanjetpt']
    meanjetsim_m = mgr.anyspin['jetpatch'].tracks_minus['meanjetpt']
    
    mbsim_p = mgr.anyspin['117001'].tracks_plus['meanpt']
    mbsim_m = mgr.anyspin['117001'].tracks_minus['meanpt']
    mbjetsim_p = mgr.anyspin['117001'].tracks_plus['meanjetpt']
    mbjetsim_m = mgr.anyspin['117001'].tracks_minus['meanjetpt']
    
    meanjetpt_m.SetTitle('JP Data / Monte Carlo comparison, #pi -')
    meanjetpt_p.SetTitle('JP Data / Monte Carlo comparison, #pi +')
    
    meanjetsim_m.SetTitle('Monte Carlo #pi -')
    meanjetsim_p.SetTitle('Monte Carlo #pi +')
    
    for h in (meanjetpt_m, meanjetpt_p, meanjetsim_m, meanjetsim_p):
        h.SetMarkerStyle(21)
        h.SetXTitle('z')
        h.SetYTitle('< pT >')
    
    [h.SetMarkerStyle(20) for h in (mbjetsim_m, mbjetsim_p)]
    [h.SetMarkerStyle(24) for h in (mbsim_m, mbsim_p)]
    
    for h in (meanpt_m, meanpt_p, meansim_m, meansim_p):
        h.SetMarkerStyle(25)
    
    for h in (meansim_m, meansim_p, meanjetsim_m, meanjetsim_p):
        h.SetMarkerColor(ROOT.kRed)
        h.SetLineColor(ROOT.kRed)
    
    leg = ROOT.TLegend(.6, .7, .8, .88)
    leg.AddEntry(meanjetpt_p, 'jet')
    leg.AddEntry(meanpt_p, '#pi')
    
    ## first compare JP data/MC
    c = graphics.canvas2('Data / Monte Carlo comparison for JP')
    c.cd(1)
    meanjetpt_m.Draw()
    meanjetpt_m.GetXaxis().SetRangeUser(zbins[0], zbins[-1])
    meanjetpt_m.GetYaxis().SetRangeUser(0, 25)
    meanjetsim_m.Draw('][ hist same')
    meanpt_m.Draw('same')
    meansim_m.Draw('][ hist same')
    
    c.cd(2)
    meanjetpt_p.Draw()
    meanjetpt_p.GetXaxis().SetRangeUser(zbins[0], zbins[-1])
    meanjetpt_p.GetYaxis().SetRangeUser(0, 25)
    meanjetsim_p.Draw('][ hist same')
    meanpt_p.Draw('same')
    meansim_p.Draw('][ hist same')
    leg.Draw()
    
    raw_input('wait here:')
    c.Print('jp-means.png')
    
    ## now compare JP and MB simulations
    c2 = graphics.canvas2('Comparison of MB and JP simulations')
    
    for h in (meanjetsim_m, meanjetsim_p, meansim_m, meansim_p):
        h.SetMarkerColor(ROOT.kBlue)
        h.SetLineColor(ROOT.kBlue)
    for h in (mbjetsim_m, mbjetsim_p, mbsim_m, mbsim_p):
        h.SetMarkerColor(ROOT.kRed)
        h.SetLineColor(ROOT.kRed)
    
    c2.cd(1)
    meanjetsim_m.Draw('hist p')
    meanjetsim_m.GetXaxis().SetRangeUser(zbins[0], zbins[-1])
    meanjetsim_m.GetYaxis().SetRangeUser(0, 25)
    mbjetsim_m.Draw('hist p same')
    mbsim_m.Draw('hist p same')
    meansim_m.Draw('hist p same')
    
    c2.cd(2)
    meanjetsim_p.Draw('hist p')
    meanjetsim_p.GetXaxis().SetRangeUser(zbins[0], zbins[-1])
    meanjetsim_p.GetYaxis().SetRangeUser(0, 25)
    mbjetsim_p.Draw('hist p same')
    mbsim_p.Draw('hist p same')
    meansim_p.Draw('hist p same')
    
    leg2 = ROOT.TLegend(.68, .7, .88, .88)
    leg2.AddEntry(meanjetsim_p, 'JP')
    leg2.AddEntry(mbjetsim_p, 'MB')
    leg2.Draw()
    
    raw_input('wait here:')
    
    c.Print('jp-means.png')
    c2.Print('simu-means.png')