Esempio n. 1
0
from cpyroot import *
from cpyroot import *
from heppy_fcc.macros.resolution import *
from heppy_fcc.macros.init import init

papas, cms = init()

xnbins, xmin, xmax = 50, 3, 20
ynbins, ymin, ymax = 20, 0.9, 1.1

papas_res_e = Resolution('papas_res_e', papas, style=sBlack)
papas_res_e.project('ptc_match_e/ptc_e:ptc_e', 'ptc_match_pdgid == ptc_pdgid',
                    xnbins, xmin, xmax, ynbins, ymin, ymax)
# papas_res_e.fit_slice(10)
# papas_res_e.draw_2d()

if cms:
    cms_res_e = Resolution('cms_res_e', cms, style=sBlue)
    cms_res_e.project('ptc_match_e/ptc_e:ptc_e',
                      'ptc_match_22_pdgid == ptc_pdgid', xnbins, xmin, xmax,
                      ynbins, ymin, ymax)
    cms_res_e.hsigma.Draw()

papas_res_e.hsigma.Draw('same')
from cpyroot import *
from cpyroot import *
from heppy_fcc.macros.resolution import *
from heppy_fcc.macros.init import init


papas, cms = init()

papas_res_e = Resolution('papas_res_e', papas, style=sBlack)
papas_res_e.project('ptc_match_e/ptc_e:ptc_e', 'ptc_match_pdgid == ptc_pdgid',
                    20, 0.3, 20, 20, 0., 2)
# papas_res_e.fit_slice(10)
# papas_res_e.draw_2d()

if cms:
    cms_res_e = Resolution('cms_res_e', cms, style=sBlue)
    cms_res_e.project('ptc_match_e/ptc_e:ptc_e', 'ptc_match_pdgid == ptc_pdgid',
                      20, 0.3, 20, 20, 0, 2)
    cms_res_e.hsigma.Draw()

    
papas_res_e.hsigma.Draw('same')
Esempio n. 3
0
from cpyroot import *
from heppy_fcc.macros.fractionstack import *
from heppy_fcc.macros.init import init

papas, cms = init('jets')

pdgids = [211, 22, 130, 11, 13]


def prepare_tree(tree):
    for pdgid in pdgids:
        tree.SetAlias("jet1_{pdgid}_frac".format(pdgid=pdgid),
                      "jet1_{pdgid}_e/jet1_e".format(pdgid=pdgid))
        tree.SetAlias("jet1_gen_{pdgid}_frac".format(pdgid=pdgid),
                      "jet1_gen_{pdgid}_e/jet1_gen_e".format(pdgid=pdgid))
    # elist = TEventList("elist")
    # tree.Draw(">>elist", "jet1_gen_211_e>0 && abs(jet1_gen_eta)<2. && abs(jet1_gen_pt>2.)")
    # tree.SetEventList(elist)


if papas:
    prepare_tree(papas)
if cms:
    prepare_tree(cms)

c1 = TCanvas()

hists = []


def process_tree(tree, name):
    pt_eff = Efficiency('_'.join([name, 'pt']), tree)
    pt_eff.project('ptc_pt', 'abs(ptc_eta)<1.4', found, 100, 0, 20)

    e_eff = Efficiency('_'.join([name, 'e']), tree)
    e_eff.project('ptc_e', 'abs(ptc_eta)<1.4', found, 100, 0, 20)

    theta_eff = Efficiency('_'.join([name, 'theta']), tree)
    theta_eff.project('ptc_theta', 'ptc_e>2.', found, 100, -3, 3)

    eta_eff = Efficiency('_'.join([name, 'eta']), tree)
    eta_eff.project('ptc_eta', 'ptc_e>2.', found, 100, -4, 4)

    return [pt_eff, e_eff, theta_eff, eta_eff]


papas, cms = init('particles')

papas_eff = efficiencies('papas', papas)
cms_eff = [None] * len(papas_eff)
if cms:
    cms_eff = efficiencies('cms', cms)

canvases = []
for pp, cm in zip(papas_eff, cms_eff):
    canvases.append(TCanvas())
    pp.eff.Draw()
    if cm:
        sBlue.formatHisto(cm.eff)
        cm.eff.Draw('same')
    pt_eff = Efficiency('_'.join([name, 'pt']), tree)
    pt_eff.project('ptc_pt', 'abs(ptc_eta)<1.4', found, 100, 0, 20)

    e_eff = Efficiency('_'.join([name, 'e']), tree)
    e_eff.project('ptc_e', 'abs(ptc_eta)<1.4', found, 100, 0, 20)

    theta_eff = Efficiency('_'.join([name, 'theta']), tree)
    theta_eff.project('ptc_theta', 'ptc_e>2.', found, 100, -3, 3 )

    eta_eff = Efficiency('_'.join([name, 'eta']), tree)
    eta_eff.project('ptc_eta', 'ptc_e>2.', found, 100, -4, 4 )

    return [pt_eff, e_eff, theta_eff, eta_eff]


papas, cms = init('particles')

papas_eff = efficiencies('papas', papas)
cms_eff = [None]*len(papas_eff)
if cms:
    cms_eff = efficiencies('cms', cms)

canvases = [] 
for pp, cm in zip(papas_eff, cms_eff):
        canvases.append(TCanvas())
        pp.eff.Draw()
        if cm:
            sBlue.formatHisto(cm.eff)
            cm.eff.Draw('same')