예제 #1
0
def plotPU(category):

    MJArray = [
        200., 230., 260.0, 290.0, 320.0, 350.0, 390.0, 430.0, 470.0, 510.0,
        550.0, 590.0, 640.0, 690.0, 740.0, 790.0, 840.0, 900.0, 960.0, 1020.0,
        1090.0, 1160.0, 1250.0
    ]
    MVArray = [250, 300, 350, 400, 500, 600, 1000]

    theArray = MJArray
    if category == 'monoV':
        theArray = MVArray

    plotter.ResetWeight()
    plotter.AddWeight(cuts.cut(category, 'signal') + '* (mcWeight)')
    plotter.AddWeight(cuts.cut(category, 'signal') + '* (mcWeight * puWeight)')
    plotter.AddWeight(
        cuts.cut(category, 'signal') + '* (mcWeight * puWeightOff)')

    plotter.SetDefaultExpr('met')
    plotter.MakeCanvas('~/www/plots/160314/' + category,
                       len(theArray) - 1, array('d', theArray), 'MET [GeV]',
                       'Events/GeV', True)
    plotter.SetDefaultExpr('npv')
    plotter.MakeCanvas('~/www/plots/160314/NPV_' + category, 30, 0, 30, 'NPV',
                       'Events', False)
예제 #2
0
signal_loc = '/afs/cern.ch/work/d/dabercro/public/Summer16/74x_signal/'
cChain = TChain('events', 'events_chainc')
cChain.Add(signal_loc +
           'monojet_VectorMonoW_Mphi-2000_Mchi-50_gSM-1p0_gDM-1p0_13TeV.root')
#cChain.Add(signal_loc + 'monojet_AxialMonoW_Mphi-2000_Mchi-50_gSM-1p0_gDM-1p0_13TeV.root')
#cChain.Add(signal_loc + 'monojet_VectorMonoZ_Mphi-2000_Mchi-50_gSM-1p0_gDM-1p0_13TeV.root')

plotter.AddTree(aFile.Get('events'))
plotter.AddTree(cChain)

plotter.SetRatioIndex(0)

#plotter.SetNormalizedHists(True)

plotter.AddWeight('(fatjet1Pt > 0) * mcWeight * 2.450')
plotter.AddWeight('(fatjet1Pt > 0) * mcWeight * 2.058')

plotter.AddLegendEntry('Axial 2000 #rightarrow 50 80X', 1, 2, 1)
plotter.AddLegendEntry('Axial 2000 #rightarrow 50 74X', 2, 2, 2)

plotter.SetLegendLocation(plotter.kUpper, plotter.kRight, 0.4, 0.3)

plotter.SetDefaultExpr('fatjet1Pt')
plotter.MakeCanvas('~/www/plots/160728/compare_releases_pT', 30, 250, 1000,
                   "p_{T} [GeV]", "A.U.")
plotter.SetDefaultExpr('fatjet1PrunedM')
plotter.MakeCanvas('~/www/plots/160728/compare_releases_masspruned', 20, 0,
                   200, "m_{pruned} [GeV]", "A.U.")
plotter.SetDefaultExpr('fatjet1Mass')
plotter.MakeCanvas('~/www/plots/160728/compare_releases_mass', 25, 0, 250,
예제 #3
0
    ('cmva_jet1_nhf', 25, 0, 1.0),
    ('cmva_jet1_chf', 25, 0, 1.0),
    ('cmva_jet1_efrac', 25, 0, 1.0),
    ('cmva_jet1_hfrac', 25, 0, 1.0),
    ('cmva_jet2_nef', 25, 0, 1.0),
    ('cmva_jet2_cef', 25, 0, 1.0),
    ('cmva_jet2_nhf', 25, 0, 1.0),
    ('cmva_jet2_chf', 25, 0, 1.0),
    ('cmva_jet2_efrac', 25, 0, 1.0),
    ('cmva_jet2_hfrac', 25, 0, 1.0),
    ('jet_pt', 50, 0, 300),
    ('jet_eta', 25, -5.0, 5.0),
    ('n_bcmva_loose', 10, 0, 10),
    ]:
    plotter.ResetWeight()
    plotter.ResetExpr()

#    for weight in ['/ 35.9', '* pu_2017to2016_v2 / 41.3']:
#        plotter.AddWeight(Nminus1Cut(thecut, expr[0]) + weight)
#    plotter.AddWeight(Nminus1Cut(thecut + '* pu_2018to2016_v2 / 12.3', expr[0]).replace('cmva_', ''))
    plotter.AddWeight(Nminus1Cut(thecut + '/ 35.9', expr[0]))
    plotter.AddWeight(Nminus1Cut(thecut + '/ 41.3', expr[0]))
    plotter.AddWeight(Nminus1Cut(thecut + '/ 12.3', expr[0]).replace('cmva_', ''))

    plotter.AddExpr(expr[0])
    plotter.AddExpr(expr[0])
    plotter.AddExpr(expr[0].replace('cmva_', '').replace('bloose', 'bcmva_loose'))

    plotter.MakeCanvas(AddOutDir(expr[0]), expr[1], expr[2], expr[3], expr[0], 'Events/fb')
    plotter.MakeCanvas(AddOutDir('log_' + expr[0]), expr[1], expr[2], expr[3], expr[0], 'Events/fb', True)
예제 #4
0
           'monojet_VectorMonoW_Mphi-2000_Mchi-50_gSM-1p0_gDM-1p0_13TeV.root')
cChain.Add(signal_loc +
           'monojet_VectorMonoZ_Mphi-2000_Mchi-50_gSM-1p0_gDM-1p0_13TeV.root')

dFile = TFile(directory +
              'wscale_TTJets_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8.root')

plotter.AddTree(aChain)
plotter.AddTree(bChain)
plotter.AddTree(cChain)
plotter.AddTree(dFile.Get('events'))

plotter.SetNormalizedHists(True)

plotter.AddExpr('fatjet1Pt')
plotter.AddExpr('fatjet1Pt')
plotter.AddExpr('fatjet1Pt')
plotter.AddExpr('fatjetPt')
plotter.AddWeight('mcWeight')
plotter.AddWeight('mcWeight')
plotter.AddWeight('mcWeight')
plotter.AddWeight('(' + cuts.cut('semilep', 'full') + ')*(mcWeight)')

plotter.AddLegendEntry('VH Signal', 1, 2, 1)
plotter.AddLegendEntry('m_{#phi} = 500 GeV Signal', 2, 2, 2)
plotter.AddLegendEntry('m_{#phi} = 2000 GeV Signal', 3, 2, 3)
plotter.AddLegendEntry('W in tt', 4, 2, 4)

plotter.MakeCanvas('~/www/plots/160707/WPt_comparison', 17, 275, 700,
                   "p_{T} [GeV]", "A.U.")
예제 #5
0
#!/usr/bin/env python

from CrombieTools.PlotTools.PlotHists import plotter

from ROOT import TFile

theFile = TFile('signalTest.root')

plotter.SetDefaultTree(theFile.Get('events'))
plotter.SetDefaultExpr('fatjetPrunedML2L3')

weight = 'fatjetPt > 250 && n_looselep == 0 && n_loosepho == 0 && n_bjetsLoose == 0 && met > 250'

plotter.AddWeight(weight)
plotter.AddWeight(weight + ' && fatjetDRWq2 > 0 && fatjetDRWq1 > 0.8')
plotter.AddWeight(weight + ' && fatjetDRWq2 > 0.8 && fatjetDRWq1 > 0.8')

plotter.AddLegendEntry('All',1)
plotter.AddLegendEntry('Part of W',2)
plotter.AddLegendEntry('Not Matching W',4)

plotter.MakeCanvas("plots/fatjetPrunedMx",25,0,150,"m_{pruned} [GeV]","A.U.")
예제 #6
0
    ('jet2_pt', 25, 0, 300),
    ('jet1_eta', 25, -2.5, 2.5),
    ('jet2_eta', 25, -2.5, 2.5),
    ('jet1_nef', 25, 0, 1.0),
    ('jet1_cef', 25, 0, 1.0),
    ('jet1_nhf', 25, 0, 1.0),
    ('jet1_chf', 25, 0, 1.0),
    ('jet1_efrac', 25, 0, 1.0),
    ('jet1_hfrac', 25, 0, 1.0),
    ('jet2_nef', 25, 0, 1.0),
    ('jet2_cef', 25, 0, 1.0),
    ('jet2_nhf', 25, 0, 1.0),
    ('jet2_chf', 25, 0, 1.0),
    ('jet2_efrac', 25, 0, 1.0),
    ('jet2_hfrac', 25, 0, 1.0),
    ('jet_pt', 50, 0, 300),
    ('jet_eta', 25, -5.0, 5.0),
    ('n_bcmva_loose', 10, 0, 10),
    ]:
    plotter.ResetWeight()
    plotter.ResetExpr()

    plotter.AddWeight(Nminus1Cut(thecut + '/ 41.3', expr[0]))
    plotter.AddWeight(Nminus1Cut(thecut + '/ 12.3', expr[0]))

    plotter.AddExpr(expr[0])
    plotter.AddExpr(expr[0])

    plotter.MakeCanvas(AddOutDir(expr[0]), expr[1], expr[2], expr[3], expr[0], 'Events/fb')
    plotter.MakeCanvas(AddOutDir('log_' + expr[0]), expr[1], expr[2], expr[3], expr[0], 'Events/fb', True)
예제 #7
0
#!/usr/bin/env python

from CrombieTools.PlotTools.PlotHists import plotter

from ROOT import TFile

directory = '/Users/dabercro/GradSchool/Summer16/Skim_160622/'
theFile = TFile(directory + 'wscale_TTJets_SingleLeptFromT.root')

plotter.SetDefaultExpr('topPtReweighting')
plotter.SetDefaultTree(theFile.Get('events'))

plotter.AddWeight(
    'fatjetPt > 250 && thirdFatMass < 50 && n_tightlep == 1 && n_looselep == 1 && n_bjetsLoose > 0 && fatjetDRLooseB > 0.8 && fatjetDRLooseB < 1.2 && fatjetDPhiLep1 > 2.0 && ((n_jetsNotFat == 3 && fatjet2Pt < 0) || (n_jetsNotFat == 2)) && n_tightlep == 1 && n_looselep == 1 && fatjet1DRGenW < 0.2'
)
plotter.AddWeight(
    'fatjetPt > 250 && thirdFatMass < 50 && n_tightlep == 1 && n_looselep == 1 && n_bjetsLoose > 0 && fatjetDRLooseB > 0.8 && fatjetDRLooseB < 1.2 && fatjetDPhiLep1 > 2.0 && n_tightlep == 1 && n_looselep == 1 && fatjet1DRGenW < 0.2'
)

plotter.AddLegendEntry('With n_{jets} cut', 1)
plotter.AddLegendEntry('Without that cut', 2)

plotter.SetRatioIndex(1)

plotter.MakeCanvas("topPtWeight", 50, 0.75, 1.2, "top p_{T} reweighting",
                   "A.U.")