Beispiel #1
0
rlog["/ROOT.TH1F.Add"].setLevel(rlog.ERROR)
rlog["/rootpy.compiled"].setLevel(rlog.WARNING)


from NtuplePlotter import NtuplePlotter
from ZZAnalyzer.utils import WeightStringMaker, TPFunctionManager, BkgManager

from rootpy.io import root_open
from rootpy.plotting import Hist

import os

# lots of prep things
tpVersionHash = 'v2.0-13-g36fc26c' #'v2.0-11-gafcf7cc' #'v1.1-4-ga295b14-extended'

TP = TPFunctionManager(tpVersionHash)

z1eMCWeight = '*'.join(TP.getTPString('e%d'%ne, 'TightID')+'*'+TP.getTPString('e%d'%ne, 'IsoTight') for ne in range(1,3))
z2eMCWeight = '*'.join(TP.getTPString('e%d'%ne, 'TightID')+'*'+TP.getTPString('e%d'%ne, 'IsoTight') for ne in range(3,5))
z1mMCWeight = '*'.join(TP.getTPString('m%d'%nm, 'TightID')+'*'+TP.getTPString('m%d'%nm, 'IsoTight') for nm in range(1,3))
z2mMCWeight = '*'.join(TP.getTPString('m%d'%nm, 'TightID')+'*'+TP.getTPString('m%d'%nm, 'IsoTight') for nm in range(3,5))

wts = WeightStringMaker('puWeight')

fPUScale = root_open(os.environ['zza']+'/ZZAnalyzer/data/pileupReweighting/PUScaleFactors_29Feb2016.root')
puScaleFactorHist = fPUScale.Get("puScaleFactor")
puScaleFactorStr = wts.makeWeightStringFromHist(puScaleFactorHist, 'nTruePU')

mcWeight = {
    'eeee' : '(GenWeight*{0}*{1}*{2})'.format(puScaleFactorStr, z1eMCWeight, z2eMCWeight),
    'eemm' : '(GenWeight*{0}*{1}*{2})'.format(puScaleFactorStr, z1eMCWeight, z1mMCWeight),
from ZZAnalyzer.utils.helpers import Z_MASS
from ZZAnalyzer.utils import WeightStringMaker, TPFunctionManager

from rootpy.io import root_open

from datetime import date
import os

outdir = "/afs/cern.ch/user/n/nawoods/www/ZZPlots/CR_MCData2015silver_{0}".format(
    date.today().strftime("%d%b%Y").lower()
)
link = "/afs/cern.ch/user/n/nawoods/www/ZZPlots/CR_MCData_latest"

tpVersionHash = "v2.0-13-g36fc26c"  #'v2.0-11-gafcf7cc' #'v1.1-4-ga295b14-extended'

TP = TPFunctionManager(tpVersionHash)

z1eMCWeight = "*".join(
    TP.getTPString("e%d" % ne, "TightID") + "*" + TP.getTPString("e%d" % ne, "IsoTight") for ne in range(1, 3)
)
z2eMCWeight = "*".join(
    TP.getTPString("e%d" % ne, "TightID") + "*" + TP.getTPString("e%d" % ne, "IsoTight") for ne in range(3, 5)
)
z1mMCWeight = "*".join(
    TP.getTPString("m%d" % nm, "TightID") + "*" + TP.getTPString("m%d" % nm, "IsoTight") for nm in range(1, 3)
)
z2mMCWeight = "*".join(
    TP.getTPString("m%d" % nm, "TightID") + "*" + TP.getTPString("m%d" % nm, "IsoTight") for nm in range(3, 5)
)

wts = WeightStringMaker("puWeight")