Esempio n. 1
0
        print 'arg should be "data" or the shift value (a float)'
        sys.exit(1)


chain = Chain(None, "Prod_Rochester_29Nov/{comp}/ZJetsTreeProducer/ZJetsTreeProducer_tree.root".format(comp=comp))
# chain = Chain(None, 'higgsvbf125.root')

name = "{prefix}_{postfix}".format(prefix=prefix, postfix=postfix)

print shift, name, comp

file = TFile(name + ".root", "recreate")

tree = TreeNumpy(chain.GetName(), ", ".join([chain.GetTitle(), "corrected"]))

tree.copyStructure(chain)

toShift = ["jet1_pt", "jet2_pt"]

shift_factor = shift / 100.0


def correct(tree, entry, jetname, shift):
    eta = getattr(ie, "_".join([jetname, "eta"]))
    pt = getattr(ie, "_".join([jetname, "pt"]))
    corpt = pt
    if shift < 0:
        etabin = h_cor.FindBin(eta)
        shift = h_cor.GetBinContent(etabin) / 100.0
    corpt *= shift
    if pt > 0:
Esempio n. 2
0
chain = Chain(
    None,
    'Prod_Rochester_29Nov/{comp}/ZJetsTreeProducer/ZJetsTreeProducer_tree.root'
    .format(comp=comp))
# chain = Chain(None, 'higgsvbf125.root')

name = '{prefix}_{postfix}'.format(prefix=prefix, postfix=postfix)

print shift, name, comp

file = TFile(name + '.root', 'recreate')

tree = TreeNumpy(chain.GetName(), ', '.join([chain.GetTitle(), 'corrected']))

tree.copyStructure(chain)

toShift = ['jet1_pt', 'jet2_pt']

shift_factor = shift / 100.


def correct(tree, entry, jetname, shift):
    eta = getattr(ie, '_'.join([jetname, 'eta']))
    pt = getattr(ie, '_'.join([jetname, 'pt']))
    corpt = pt
    if shift < 0:
        etabin = h_cor.FindBin(eta)
        shift = h_cor.GetBinContent(etabin) / 100.
    corpt *= shift
    if pt > 0: