# WJets normalization using 2 jet category fwss, fwos, ss, os = plot_W( anaDir, selComps, weights, 15, 60, 120, cutwJ2, weight=weight, embed=options.embed) if vbf_eff is None: # QCD VBF, SS, anti-isolation, for QCD efficiency vbf_qcd_cut = '&&'.join( [inc_qcd_cut, cat_VBF, 'diTau_charge!=0'] ) vbf_qcd_ssQCD = H2TauTauDataMC(options.hist, anaDir, selComps, weights, NBINS, XMIN, XMAX, cut=vbf_qcd_cut, weight=weight, embed=embed, treeName = 'H2TauTauTreeProducerTauEle') vbf_qcd_yield = vbf_qcd_ssQCD.Hist('Data').Integral() vbf_eff = vbf_qcd_yield / inc_qcd_yield print 'VBF Efficiency = ', vbf_eff osign, osQCD = makePlot( options.hist, weights, fwss, fwos, vbf_eff * incsig_qcd_yield, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=shift); draw(osQCD, False) datacards(osQCD, 'Xcat_VBFX', shift)
200, vbf_w_cut, weight, options.embed, treeName='H2TauTauTreeProducerTauEle') # yield in high mT sideband w_high_yield_vbf = w_plot.Hist('WJets').Integral(True, 60, 120) # now normalized to the data w_high_yield_vbf *= vbf_fwos # extrapolating to low mt region w_low_yield_vbf = w_high_yield_vbf * w_lowhigh_ratio osign, osQCD = makePlot(options.hist, weights, w_low_yield_vbf, qcd_vbf_eff * incsig_qcd_yield, emb_vbf_eff * incsig_zl_yield, emb_vbf_eff * incsig_zj_yield, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=shift, VVgroup=cfg.VVgroup) drawOfficial(osQCD, False) datacards(osQCD, 'Xcat_VBFX', shift, 'eleTau')
# The following parameters are the same for a given set of samples + a cut (= category) parameters = {'cut':options.cut, 'anaDir':anaDir, 'selComps':selComps, 'weights':weights, 'shift':shift, 'VVgroup':cfg.VVgroup, 'TTgroup':cfg.TTgroup, 'replaceW':replaceW, 'antiEleIsoForQCD':antiEleIsoForQCD, 'antiEleRlxTauIsoForQCD':antiEleRlxTauIsoForQCD, 'antiEleRlxTauIsoForQCDYield':antiEleRlxTauIsoForQCDYield, 'subtractBGForQCDShape':subtractBGForQCDShape, 'embedForSS':embedForSS, 'embed':options.embed, 'wInfo':wInfo, 'relSelection':relSelection, 'osForWExtrapolation':osForWExtrapolation, 'incQCDYield':incQCDYield, 'qcdYieldInclusiveExtrapolation':qcdYieldInclusiveExtrapolation, 'dataComps':dataComps, 'cutName':options.cutName, 'isZeroB':isZeroB, 'isOneJet':isOneJet} #'blind':options.blind, if options.allPlots: drawAll(plots_All, 'Summer13StackPlotsJul19/', options.blind, parameters, isMSSM) else: if makeQCDIsoPlots: qcdIsoPlots(options.hist, NBINS, XMIN, XMAX, parameters) ssign, osign, ssQCD, osQCD = makePlot(options.hist, NBINS, XMIN, XMAX, **parameters) if blind and isMSSM: osQCD.blindxmin = 100. osQCD.blindxmax = 1000. # Without ratio # drawOfficial(osQCD, options.blind) # With ratio draw(osQCD, options.blind, channel='TauEle') datacards(osQCD, cutstring, shift, 'eleTau', prefix=options.prefix) # printDataVsQCDInfo(osQCD, ssQCD)
replaceW = True useW11 = False anaDir = args[0].rstrip('/') shift = None if anaDir.endswith('_Down'): shift = 'Down' elif anaDir.endswith('_Up'): shift = 'Up' cfgFileName = args[1] file = open( cfgFileName, 'r' ) cfg = imp.load_source( 'cfg', cfgFileName, file) embed = options.embed aliases = None selComps, weights, zComps = prepareComponents(anaDir, cfg.config, aliases, options.embed, 'TauMu', options.higgs) # can, pad, padr = buildCanvas() ocan = buildCanvasOfficial() fwss, fwos, w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio = handleW( anaDir, selComps, weights, options.cut, weight, options.embed, cfg.VVgroup ) ssign, osign, ssQCD, osQCD = makePlot( options.hist, anaDir, selComps, weights, fwss, fwos, w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=shift, replaceW=replaceW, VVgroup=cfg.VVgroup, antiMuIsoForQCD=antiMuIsoForQCD); drawOfficial(osQCD, options.blind) datacards(osQCD, cutstring, shift)
'osForWExtrapolation': osForWExtrapolation, 'incQCDYield': incQCDYield, 'qcdYieldInclusiveExtrapolation': qcdYieldInclusiveExtrapolation, 'dataComps': dataComps, 'cutName': options.cutName, 'isZeroB': isZeroB, 'isOneJet': isOneJet } #'blind':options.blind, if options.allPlots: drawAll(plots_All, 'Summer13StackPlotsJul19/', options.blind, parameters, isMSSM) else: if makeQCDIsoPlots: qcdIsoPlots(options.hist, NBINS, XMIN, XMAX, parameters) ssign, osign, ssQCD, osQCD = makePlot(options.hist, NBINS, XMIN, XMAX, **parameters) if blind and isMSSM: osQCD.blindxmin = 100. osQCD.blindxmax = 1000. # Without ratio # drawOfficial(osQCD, options.blind) # With ratio draw(osQCD, options.blind, channel='TauEle') datacards(osQCD, cutstring, shift, 'eleTau', prefix=options.prefix) # printDataVsQCDInfo(osQCD, ssQCD)
vbf_eff = vbf_qcd_yield / inc_qcd_yield vbf_eff_err = vbf_eff * math.sqrt(vbf_qcd_yield_error * vbf_qcd_yield_error / (vbf_qcd_yield * vbf_qcd_yield) + inc_qcd_yield_error * inc_qcd_yield_error / (inc_qcd_yield * inc_qcd_yield)) print 'VBF Efficiency = ', vbf_eff,' +- ',vbf_eff_err qcd_shape_before, osign, osQCD = makePlot( options.hist, weights, fwss, fwos, vbf_eff * incsig_qcd_yield, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=shift ) #PG save the sidebands to be able and get numbers for the systematics # currdir = copy(gDirectory) qcdsyst_file = TFile ('qcdsyst.root','recreate') qcdsyst_file.cd() osQCD.Hist('QCD').weighted.Write('QCD_os_QCD') qcd_shape_before.weighted.Write('QCD_ss_QCD') qcdsyst_file.Close() # currdir.cd() #PG FIXME in this way I am forgetting the systematics due to other samples subtraction #PG FIXME i.e. I should check the purities at least draw(osQCD, False, 'TauEle', 'VBF') datacards(osQCD, 'Xcat_VBFX', shift, 'eTau')
replaceW = True useW11 = False anaDir = args[0].rstrip('/') shift = None if anaDir.endswith('_Down'): shift = 'Down' elif anaDir.endswith('_Up'): shift = 'Up' cfgFileName = args[1] file = open( cfgFileName, 'r' ) cfg = imp.load_source( 'cfg', cfgFileName, file) embed = options.embed aliases = None selComps, weights, zComps = prepareComponents(anaDir, cfg.config, aliases, options.embed, channel='TauEle', higgsMass=options.higgs) # can, pad, padr = buildCanvas() ocan = buildCanvasOfficial() fwss, fwos, w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio = handleW( anaDir, selComps, weights, options.cut, weight, options.embed, cfg.VVgroup ) ssign, osign, ssQCD, osQCD = makePlot( options.hist, anaDir, selComps, weights, fwss, fwos, w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=shift, replaceW=replaceW, VVgroup=cfg.VVgroup, antiEleIsoForQCD=antiEleIsoForQCD); drawOfficial(osQCD, options.blind) datacards(osQCD, cutstring, shift, 'eleTau')
shift = 'Up' if options.shift: shift = options.shift cfgFileName = args[1] file = open( cfgFileName, 'r' ) cfg = imp.load_source( 'cfg', cfgFileName, file) embed = options.embed aliases = None selComps, weights, zComps = prepareComponents(anaDir, cfg.config, aliases, options.embed, channel=options.channel, higgsMass=options.higgs, isMSSM=isMSSM) filteredComps = filterComps(selComps, options.filter, options.embed) ocan = buildCanvasOfficial() treeName = 'H2TauTauTreeProducer' + options.channel osign = makePlot( options.hist, anaDir, filteredComps, weights, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=None, VVgroup=cfg.VVgroup, treeName=treeName); # drawOfficial(osign, options.blind) osign.Draw() dcchan = 'muTau' if options.channel == 'TauEle': dcchan = 'eleTau' datacards(osign, cutstring, shift, channel=dcchan, prefix=options.prefix)
# full VBF cut for W normalization in high mT sideband vbf_w_cut = ' && '.join([cat_Inc, cat_VBF, 'diTau_charge==0']) w_plot = buildPlot('mt', anaDir, {'WJets': selComps['WJets']}, weights, 200, 0, 200, vbf_w_cut, weight, options.embed) # yield in high mT sideband w_high_yield_vbf = w_plot.Hist('WJets').Integral(True, 60, 120) # now normalized to the data w_high_yield_vbf *= vbf_fwos # extrapolating to low mt region w_low_yield_vbf = w_high_yield_vbf * w_lowhigh_ratio osign, osQCD = makePlot(options.hist, weights, w_low_yield_vbf, qcd_vbf_eff * incsig_qcd_yield, emb_vbf_eff * incsig_zl_yield, emb_vbf_eff * incsig_zj_yield, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=shift, VVgroup=cfg.VVgroup) drawOfficial(osQCD, False) datacards(osQCD, 'Xcat_VBFX', shift)
ocan = buildCanvasOfficial() fwss, fwos, w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio = handleW( anaDir, selComps, weights, options.cut, weight, options.embed, cfg.VVgroup ) ssign, osign, ssQCD, osQCD = makePlot( options.hist, anaDir, selComps, weights, fwss, fwos, w_mt_ratio_ss, w_mt_ratio_os, w_mt_ratio, NBINS, XMIN, XMAX, options.cut, weight=weight, embed=options.embed, shift=shift, replaceW=replaceW, VVgroup=cfg.VVgroup, antiEleIsoForQCD=antiEleIsoForQCD, ) drawOfficial(osQCD, options.blind) datacards(osQCD, cutstring, shift, "eleTau")