示例#1
0
ROOT.gStyle.SetOptStat(False)

rfile = ROOT.TFile.Open(options.rfile)
tree = rfile.Get("DecayTree")

hist_m4 = ROOT.TH1D("hist_m4", "Mass", 100, 5300, 5440)
hist_m5 = ROOT.TH1D("hist_m5", "Mass w/ sw", 100, 5300, 5440)
hist_m6 = ROOT.TH1D("hist_m6", "Mass w/ sw+offset", 100, 5300, 5440)

# axis titles
blabel, swlabel, ylabel = "B mass [MeV]", "#it{s}-weights", "Candidates"
titles = {hist_m4: (blabel, ylabel), hist_m5: (blabel, ylabel), hist_m6: (blabel, ylabel)}

from rplot.tselect import Tselect

selector = Tselect(tree)
selector.exprs = [
    ("lab0_MM>>hist_m4", "5310<lab0_MM && lab0_MM<5430"),
    ("lab0_MM>>hist_m5", "sw*(5310<lab0_MM && lab0_MM<5430)"),
    ("lab0_MM>>hist_m6", "(sw-0.113)*(5310<lab0_MM && lab0_MM<5430)"),
]
hists = selector.fill_hists()
map(lambda h: (h.GetXaxis().SetTitle(titles[h][0]), h.GetYaxis().SetTitle(titles[h][1])), hists)

from rplot.rplot import Rplot

plotter = Rplot(1, 1, 800, 500)

legend = ROOT.TLegend(0.65, 0.5, 0.9, 0.9)
legend.SetFillStyle(0)
legend.SetLineWidth(0)
示例#2
0
        return (axis.GetXmin(), axis.GetXmax())


def annotate_mass(ymin, ymax, lo=5310, hi=5430):
    """Annotate signal mass range"""
    lo = ROOT.TLine(lo, ymin, lo, ymax)
    hi = ROOT.TLine(hi, ymin, hi, ymax)
    lo.SetLineColor(ROOT.kBlack)
    hi.SetLineColor(ROOT.kBlack)
    lo.Draw()
    hi.Draw()
    return (lo, hi)


from rplot.tselect import Tselect
selector = Tselect(tree)
selector.exprs = [
    ('lab0_MM>>hist_m0', ''),
    ('lab0_MM>>hist_m1', 'sw'),
    ('lab0_MM>>hist_m2', 'sw>0'),
    ('lab0_MM>>hist_m3', 'sw<0'),
    ('sw>>hist_w1', '5310<lab0_MM && lab0_MM<5430'),
    ('sw>>hist_w2', 'lab0_MM<5310 || 5430<lab0_MM'),
]
hists = selector.fill_hists()

canvas = ROOT.TCanvas('canvas', '', 800, 500)
canvas.Print('sweights.pdf[')

for hist in hists:
    hname = hist.GetName()
示例#3
0
tree = rfile.Get('DecayTree')

hist_m4 = ROOT.TH1D('hist_m4', 'Mass', 100, 5300, 5440)
hist_m5 = ROOT.TH1D('hist_m5', 'Mass w/ sw', 100, 5300, 5440)
hist_m6 = ROOT.TH1D('hist_m6', 'Mass w/ sw+offset', 100, 5300, 5440)

# axis titles
blabel, swlabel, ylabel = 'B mass [MeV]', '#it{s}-weights', 'Candidates'
titles = {
    hist_m4: (blabel, ylabel),
    hist_m5: (blabel, ylabel),
    hist_m6: (blabel, ylabel),
}

from rplot.tselect import Tselect
selector = Tselect(tree)
selector.exprs = [
    ('lab0_MM>>hist_m4', '5310<lab0_MM && lab0_MM<5430'),
    ('lab0_MM>>hist_m5', 'sw*(5310<lab0_MM && lab0_MM<5430)'),
    ('lab0_MM>>hist_m6', '(sw-0.113)*(5310<lab0_MM && lab0_MM<5430)'),
]
hists = selector.fill_hists()
map(
    lambda h:
    (h.GetXaxis().SetTitle(titles[h][0]), h.GetYaxis().SetTitle(titles[h][1])),
    hists)

from rplot.rplot import Rplot
plotter = Rplot(1, 1, 800, 500)

legend = ROOT.TLegend(0.65, 0.5, 0.9, 0.9)
示例#4
0
        return (axis.GetXmin(), axis.GetXmax())


def annotate_mass(ymin, ymax, lo=5310, hi=5430):
    """Annotate signal mass range"""
    lo = ROOT.TLine(lo, ymin, lo, ymax)
    hi = ROOT.TLine(hi, ymin, hi, ymax)
    lo.SetLineColor(ROOT.kBlack)
    hi.SetLineColor(ROOT.kBlack)
    lo.Draw()
    hi.Draw()
    return (lo, hi)


from rplot.tselect import Tselect
selector = Tselect(tree)
selector.exprs = [
    ('lab0_MM>>hist_m0', ''),
    ('lab0_MM>>hist_m1', 'sw'),
    ('lab0_MM>>hist_m2', 'sw>0'),
    ('lab0_MM>>hist_m3', 'sw<0'),
    ('sw>>hist_w1', '5310<lab0_MM && lab0_MM<5430'),
    ('sw>>hist_w2', 'lab0_MM<5310 || 5430<lab0_MM'),
]
hists = selector.fill_hists()

canvas = ROOT.TCanvas('canvas', '', 800, 500)
canvas.Print('sweights.pdf[')

for hist in hists:
    hname = hist.GetName()