def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle): templPrefix = inputDir+prefix MCtemplates = {} MCtemplates['TTGamma'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma', [ (templPrefix+'ttgamma.root', gSF*newTTgamma_xs/newTTgamma_num) ], varList, ROOT.kRed +1, fillStyle) MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, 't#bar{t}+jets', [ (templPrefix+'ttjets.root', gSF*TTJets_xs/TTJets_num), ], varList ,ROOT.kRed -7, fillStyle) SF_ttjets = gSF*TTJets_xs/TTJets_num print SF_ttjets MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, 'Single Top', [ (templPrefix+'st_t.root', gSF*SingTopT_xs/SingTopT_num), (templPrefix+'st_t_anti.root', gSF*SingTopTbar_xs/SingTopTbar_num), (templPrefix+'st_tW.root', gSF*SingToptW_xs/SingToptW_num), (templPrefix+'st_tW_anti.root', gSF*SingTopbartW_xs/SingTopbartW_num), (templPrefix+'st_s.root', gSF*SingTopS_xs/SingTopS_num), ], varList, ROOT.kMagenta, fillStyle) MCtemplates['WJets'] = distribution('WJets'+titleSuffix, 'W+jets', [ (templPrefix+'Wjets.root', gSF*WJets_xs/WJets_num), ], varList, ROOT.kGreen -3, fillStyle) MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, 'Z+jets', [ (templPrefix+'DYJets.root', gSF*ZJets_xs/ZJets_num)], varList, ROOT.kAzure-2, fillStyle) return MCtemplates
def saveTTgammaAccTemplates(inputDir, outFileName): varList = ['MCcategory','MCcategoryfid']#,'genPhoRegionWeight_1l_2l'] AccTemplates = {} print inputDir AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', '', [ (inputDir+'hist_1pho_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTGamma_photonSel'] = distribution('TTGamma_photonSel', '', [ (inputDir+'hist_1pho_barrel_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTGamma_photonSelSignal'] = distribution('TTGamma_photonSelSignal', '', [ (inputDir+'hist_1pho_rs_barrel_top_TTGamma.root', 1.0), ], varList, 97) # AccTemplates['TTJets1l'] = distribution('TTJets1l_presel', '', [ # (inputDir+'hist_1pho_top_TTJets1l.root', 1.0), # ], varList ,11) # AccTemplates['TTJets2l'] = distribution('TTJets2l_presel', '', [ # (inputDir+'hist_1pho_top_TTJets2l.root', 1.0), # ], varList ,11) # AccTemplates['TTJetsHad'] = distribution('TTJetsHad_presel', '', [ # (inputDir+'hist_1pho_top_TTJetsHad.root', 1.0), # ], varList ,11) saveTemplatesToFile(AccTemplates.values(), varList, outFileName)
def loadQCDTemplate(varlist, inputDir, prefix): templPrefix = inputDir+prefix QCD_sf = QCDSF QCDTempl = distribution('QCD', 'QCD', [ (templPrefix+'Data_a.root', QCD_sf), (templPrefix+'Data_b.root', QCD_sf), (templPrefix+'Data_c.root', QCD_sf), (templPrefix+'Data_d.root', QCD_sf), (templPrefix+'TTJets1l.root', -1 * QCD_sf * TopSF * gSF * TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', -1 * QCD_sf * TopSF * gSF * TTJets2l_xs/TTJets2l_num), (templPrefix+'TTJetsHad.root', -1 * QCD_sf * TopSF * gSF * TTJetsHad_xs/TTJetsHad_num), (templPrefix+'TTGamma.root', -1 * QCD_sf * TTGSF * gSF * newTTgamma_xs/newTTgamma_num), (templPrefix+'SingleT_t.root', -1 * QCD_sf * otherMCSF * gSF * SingTopT_xs/SingTopT_num), (templPrefix+'SingleT_s.root', -1 * QCD_sf * otherMCSF * gSF * SingTopS_xs/SingTopS_num), (templPrefix+'SingleT_tw.root', -1 * QCD_sf * otherMCSF * gSF * SingToptW_xs/SingToptW_num), (templPrefix+'SingleTbar_t.root', -1 * QCD_sf * otherMCSF * gSF * SingTopbarT_xs/SingTopbarT_num), (templPrefix+'SingleTbar_s.root', -1 * QCD_sf * otherMCSF * gSF * SingTopbarS_xs/SingTopbarS_num), (templPrefix+'SingleTbar_tw.root', -1 * QCD_sf * otherMCSF * gSF * SingTopbartW_xs/SingTopbartW_num), (templPrefix+'W2Jets.root', -1 * QCD_sf * WJetsSF * gSF * W2Jets_xs/W2Jets_num), (templPrefix+'W3Jets.root', -1 * QCD_sf * WJetsSF * gSF * W3Jets_xs/W3Jets_num), (templPrefix+'W4Jets.root', -1 * QCD_sf * WJetsSF * gSF * W4Jets_xs/W4Jets_num), (templPrefix+'ZJets.root', -1 * QCD_sf * ZJetsSF * otherMCSF * gSF * ZJets_xs/ZJets_num), (templPrefix+'Zgamma.root', -1 * QCD_sf * otherMCSF * gSF * Zgamma_xs/Zgamma_num), (templPrefix+'Wgamma.root', -1 * QCD_sf * otherMCSF * gSF * Wgamma_xs/Wgamma_num), ], varlist, ROOT.kYellow) return QCDTempl
def loadQCDTemplate(varlist, inputDir, prefix): templPrefix = inputDir + prefix QCD_sf = QCDSF QCDTempl = distribution( 'QCD', 'QCD', [ # (templPrefix+'data_c.root', QCD_sf), (templPrefix + 'data_d.root', QCD_sf), # (templPrefix+'data_d_PR.root', QCD_sf), (templPrefix + 'ttjets.root', -1 * QCD_sf * TopSF * gSF * TTJets_xs / TTJets_num), ######## Added in all other channels of MC, previously just ttjets 1l and 2l removed to get QCD template ######## (templPrefix + 'ttjets.root', -1 * gSF * TTJets_xs / TTJets_num), (templPrefix + 'ttgamma.root', -1 * gSF * newTTgamma_xs / newTTgamma_num), (templPrefix + 'st_t.root', -1 * gSF * SingTopT_xs / SingTopT_num), (templPrefix + 'st_t_anti.root', -1 * gSF * SingTopTbar_xs / SingTopTbar_num), (templPrefix + 'st_s.root', -1 * gSF * SingTopS_xs / SingTopS_num), (templPrefix + 'st_tW.root', -1 * gSF * SingToptW_xs / SingToptW_num), (templPrefix + 'st_tW_anti.root', -1 * gSF * SingTopbartW_xs / SingTopbartW_num), (templPrefix + 'Wjets.root', -1 * gSF * WJets_xs / WJets_num), (templPrefix + 'DYJets.root', -1 * gSF * ZJets_xs / ZJets_num), ], varlist, ROOT.kYellow) return QCDTempl
def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle): templPrefix = inputDir+prefix MCtemplates = {} #MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ # (templPrefix+'WHIZARD.root', TopSF*gSF*TTgamma_xs/WHIZARD_num) # ], varList, 98, fillStyle) MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma', [ (templPrefix+'TTGamma.root', TopSF*gSF*newTTgamma_xs/newTTgamma_num) ], varList, ROOT.kRed +1, fillStyle) MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, 't#bar{t}+jets', [ (templPrefix+'TTJets1l.root', TopSF*gSF*TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', TopSF*gSF*TTJets2l_xs/TTJets2l_num), (templPrefix+'TTJetsHad.root', TopSF*gSF*TTJetsHad_xs/TTJetsHad_num), ], varList ,ROOT.kRed -7, fillStyle) ################################### #return MCtemplates ################################### nonWJetsSF = 1.0 MCtemplates['Vgamma'] = distribution('Vgamma'+titleSuffix, 'V+#gamma', [ (templPrefix+'Zgamma.root', otherMCSF*gSF*Zgamma_xs/Zgamma_num), (templPrefix+'Wgamma.root', otherMCSF*WgammaSF*gSF*Wgamma_xs/Wgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, ROOT.kGray, fillStyle) MCtemplates['Zgamma'] = distribution('Zgamma'+titleSuffix, 'Z+#gamma', [ (templPrefix+'Zgamma.root', otherMCSF*gSF*Zgamma_xs/Zgamma_num), ], varList, ROOT.kAzure+3, fillStyle) MCtemplates['Wgamma'] = distribution('Wgamma'+titleSuffix, 'W+#gamma', [ (templPrefix+'Wgamma.root', otherMCSF*WgammaSF*gSF*Wgamma_xs/Wgamma_num), ], varList, ROOT.kGray, fillStyle) MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, 'Single Top', [ (templPrefix+'SingleT_t.root', otherMCSF*gSF*SingTopT_xs/SingTopT_num), (templPrefix+'SingleT_s.root', otherMCSF*gSF*SingTopS_xs/SingTopS_num), (templPrefix+'SingleT_tw.root', otherMCSF*gSF*SingToptW_xs/SingToptW_num), (templPrefix+'SingleTbar_t.root', otherMCSF*gSF*SingTopbarT_xs/SingTopbarT_num), (templPrefix+'SingleTbar_s.root', otherMCSF*gSF*SingTopbarS_xs/SingTopbarS_num), (templPrefix+'SingleTbar_tw.root', otherMCSF*gSF*SingTopbartW_xs/SingTopbartW_num), ], varList, ROOT.kMagenta, fillStyle) MCtemplates['WJets'] = distribution('WJets'+titleSuffix, 'W+jets', [ #(templPrefix+'WJets.root', WJetsSF*gSF*WJets_xs/WJets_num), # (templPrefix+'W2Jets.root', WJetsSF*gSF*W2Jets_xs/W2Jets_num), (templPrefix+'W3Jets.root', WJetsSF*gSF*W3Jets_xs/W3Jets_num), (templPrefix+'W4Jets.root', WJetsSF*gSF*W4Jets_xs/W4Jets_num), ], varList, ROOT.kGreen -3, fillStyle) ######## Added back in the ZJetsSF scaling ######## MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, 'Z+jets', [ (templPrefix+'ZJets.root',ZJetsSF*otherMCSF*gSF*ZJets_xs/ZJets_num)], varList, ROOT.kAzure-2, fillStyle) return MCtemplates
def loadDataTemplate(varlist, inputDir, prefix): templPrefix = inputDir+prefix DataTempl = distribution('data', 'data', [ (templPrefix+'data_c.root', 1), (templPrefix+'data_d.root', 1), (templPrefix+'data_d_PR.root',1), ], varlist) return DataTempl
def loadDataTemplate(varlist, inputDir, prefix): templPrefix = inputDir + prefix DataTempl = distribution('data', 'data', [ (templPrefix + 'data_c.root', 1), (templPrefix + 'data_d.root', 1), (templPrefix + 'data_d_PR.root', 1), ], varlist) return DataTempl
def saveTTgammaAccTemplates2(inputDir, outFileName): varList = ['MCcategory','MCcategoryfid','genPhoRegionWeight_1l_2l'] print inputDir AccTemplates = {} AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', '', [ (inputDir+'hist_1pho_top_TTGamma.root', 1.0), ], varList, 97) saveTemplatesToFile(AccTemplates.values(), varList, outFileName)
def loadQCDTemplate(varlist, inputDir, prefix): templPrefix = inputDir+prefix QCD_sf = QCDSF QCDTempl = distribution('QCD', [ (templPrefix+'Data_a.root', QCD_sf), (templPrefix+'Data_b.root', QCD_sf), (templPrefix+'Data_c.root', QCD_sf), (templPrefix+'Data_d.root', QCD_sf), (templPrefix+'TTJets1l.root', -1 * QCD_sf * gSF * TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', -1 * QCD_sf * gSF * TTJets2l_xs/TTJets2l_num), ], varlist, 46) return QCDTempl
def saveAccTemplates(inputDir, outFileName,ttjetsSyst=''): varList = ['MCcategory'] if not (ttjetsSyst=='' or ttjetsSyst=='special'): ttbarTemplPrefix = inputDir.replace('hist_bins','hist_bins_Modeling') print ttbarTemplPrefix AccTemplates = {} AccTemplates['TTGamma'] = distribution('TTGamma_signal', 'TTGamma', [ (inputDir+'hist_1pho_rs_barrel_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', 'TTGamma', [ (inputDir+'hist_1pho_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTJets1l'] = distribution('TTJets1l_presel', '', [ (inputDir+'hist_1pho_top_TTJets1l.root', 1.0), ], varList ,11) AccTemplates['TTJets2l'] = distribution('TTJets2l_presel', '', [ (inputDir+'hist_1pho_top_TTJets2l.root', 1.0), ], varList ,11) AccTemplates['TTJetsHad'] = distribution('TTJetsHad_presel', '', [ (inputDir+'hist_1pho_top_TTJetsHad.root', 1.0), ], varList ,11) if not ttjetsSyst=='': print ttbarTemplPrefix+'hist_1pho_top_TTJets'+ttjetsSyst+'.root' AccTemplates['TTJets'] = distribution('TTJets_presel', 't#bar{t}+jets', [ (ttbarTemplPrefix+'hist_1pho_top_TTJets'+ttjetsSyst+'.root', 1.0), ], varList ,11) saveTemplatesToFile(AccTemplates.values(), varList, outFileName)
def saveAccTemplates(inputDir, outFileName): varList = ['MCcategory'] AccTemplates = {} AccTemplates['TTGamma'] = distribution('TTGamma_signal', '',[ (inputDir+'hist_1pho_rs_barrel_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', '',[ (inputDir+'hist_1pho_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTJets1l'] = distribution('TTJets1l_presel', '',[ (inputDir+'hist_1pho_top_TTJets1l.root', 1.0), ], varList ,11) AccTemplates['TTJets2l'] = distribution('TTJets2l_presel', '',[ (inputDir+'hist_1pho_top_TTJets2l.root', 1.0), ], varList ,11) AccTemplates['TTJetsHad'] = distribution('TTJetsHad_presel', '',[ (inputDir+'hist_1pho_top_TTJetsHad.root', 1.0), ], varList ,11) saveTemplatesToFile(AccTemplates.values(), varList, outFileName)
def saveAccTemplates(inputDir, outFileName): varList = ['MCcategory'] AccTemplates = {} AccTemplates['TTGamma'] = distribution('TTGamma_signal', [ (inputDir+'hist_1pho_rs_barrel_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', [ (inputDir+'hist_1pho_top_TTGamma.root', 1.0), ], varList, 97) AccTemplates['TTJets1l'] = distribution('TTJets1l_presel', [ (inputDir+'hist_1pho_top_TTJets1l.root', 1.0), ], varList ,11) AccTemplates['TTJets2l'] = distribution('TTJets2l_presel', [ (inputDir+'hist_1pho_top_TTJets2l.root', 1.0), ], varList ,11) AccTemplates['TTJetsHad'] = distribution('TTJetsHad_presel', [ (inputDir+'hist_1pho_top_TTJetsHad.root', 1.0), ], varList ,11) saveTemplatesToFile(AccTemplates.values(), varList, outFileName)
def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle): templPrefix = inputDir + prefix MCtemplates = {} MCtemplates['TTGamma'] = distribution( 'TTGamma' + titleSuffix, 't#bar{t}+#gamma', [(templPrefix + 'ttgamma.root', gSF * newTTgamma_xs / newTTgamma_num)], varList, ROOT.kRed + 1, fillStyle) MCtemplates['TTJets'] = distribution( 'TTJets' + titleSuffix, 't#bar{t}+jets', [ (templPrefix + 'ttjets.root', gSF * TTJets_xs / TTJets_num), ], varList, ROOT.kRed - 7, fillStyle) SF_ttjets = gSF * TTJets_xs / TTJets_num print SF_ttjets MCtemplates['SingleTop'] = distribution( 'SingleTop' + titleSuffix, 'Single Top', [ (templPrefix + 'st_t.root', gSF * SingTopT_xs / SingTopT_num), (templPrefix + 'st_t_anti.root', gSF * SingTopTbar_xs / SingTopTbar_num), (templPrefix + 'st_tW.root', gSF * SingToptW_xs / SingToptW_num), (templPrefix + 'st_tW_anti.root', gSF * SingTopbartW_xs / SingTopbartW_num), (templPrefix + 'st_s.root', gSF * SingTopS_xs / SingTopS_num), ], varList, ROOT.kMagenta, fillStyle) MCtemplates['WJets'] = distribution('WJets' + titleSuffix, 'W+jets', [ (templPrefix + 'Wjets.root', gSF * WJets_xs / WJets_num), ], varList, ROOT.kGreen - 3, fillStyle) MCtemplates['ZJets'] = distribution( 'ZJets' + titleSuffix, 'Z+jets', [(templPrefix + 'DYJets.root', gSF * ZJets_xs / ZJets_num)], varList, ROOT.kAzure - 2, fillStyle) return MCtemplates
def loadQCDTemplate(varlist, inputDir, prefix): templPrefix = inputDir+prefix QCD_sf = QCDSF QCDTempl = distribution('QCD', 'QCD', [ (templPrefix+'Data_a.root', QCD_sf), (templPrefix+'Data_b.root', QCD_sf), (templPrefix+'Data_c.root', QCD_sf), (templPrefix+'Data_d.root', QCD_sf), (templPrefix+'TTJets1l.root', -1 * QCD_sf * TopSF * gSF * TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', -1 * QCD_sf * TopSF * gSF * TTJets2l_xs/TTJets2l_num), ######## Added in all other channels of MC, previously just ttjets 1l and 2l removed to get QCD template ######## (templPrefix+'TTJetsHad.root', -1 * QCD_sf * TopSF * gSF * TTJetsHad_xs/TTJetsHad_num), (templPrefix+'TTGamma.root', -1 * QCD_sf * TTGSF * gSF * newTTgamma_xs/newTTgamma_num), (templPrefix+'SingleT_t.root', -1 * QCD_sf * otherMCSF * gSF * SingTopT_xs/SingTopT_num), (templPrefix+'SingleT_s.root', -1 * QCD_sf * otherMCSF * gSF * SingTopS_xs/SingTopS_num), (templPrefix+'SingleT_tw.root', -1 * QCD_sf * otherMCSF * gSF * SingToptW_xs/SingToptW_num), (templPrefix+'SingleTbar_t.root', -1 * QCD_sf * otherMCSF * gSF * SingTopbarT_xs/SingTopbarT_num), (templPrefix+'SingleTbar_s.root', -1 * QCD_sf * otherMCSF * gSF * SingTopbarS_xs/SingTopbarS_num), (templPrefix+'SingleTbar_tw.root', -1 * QCD_sf * otherMCSF * gSF * SingTopbartW_xs/SingTopbartW_num), (templPrefix+'W2Jets.root', -1 * QCD_sf * WJetsSF * gSF * W2Jets_xs/W2Jets_num), (templPrefix+'W3Jets.root', -1 * QCD_sf * WJetsSF * gSF * W3Jets_xs/W3Jets_num), (templPrefix+'W4Jets.root', -1 * QCD_sf * WJetsSF * gSF * W4Jets_xs/W4Jets_num), (templPrefix+'ZJets.root', -1 * QCD_sf * ZJetsSF * otherMCSF * gSF * ZJets_xs/ZJets_num), (templPrefix+'Zgamma.root', -1 * QCD_sf * otherMCSF * gSF * Zgamma_xs/Zgamma_num), (templPrefix+'Wgamma.root', -1 * QCD_sf * otherMCSF * gSF * Wgamma_xs/Wgamma_num), ], varlist, ROOT.kYellow) for var in ['photon1ChHadSCRIso','photon1ChHadRandIso']: if not var in varlist: continue tempSum = 0. tempSumErr = 0. print '!@#$%'*20 print var print QCDTempl.histList[var].FindBin(0) for i_bin in range(QCDTempl.histList[var].FindBin(0)+1): print QCDTempl.histList[var].GetBinLowEdge(i_bin+1), QCDTempl.histList[var].GetBinContent(i_bin), tempSum print QCDTempl.histList[var].GetBinLowEdge(i_bin+1), QCDTempl.histList[var].GetBinError(i_bin), tempSumErr tempSum += QCDTempl.histList[var].GetBinContent(i_bin) tempSumErr += QCDTempl.histList[var].GetBinError(i_bin)**2 QCDTempl.histList[var].SetBinContent(i_bin,0.0) QCDTempl.histList[var].SetBinError(i_bin,0.0) QCDTempl.histList[var].SetBinContent(QCDTempl.histList[var].FindBin(0),tempSum) QCDTempl.histList[var].SetBinError(QCDTempl.histList[var].FindBin(0),tempSumErr**0.5) return QCDTempl
def loadQCDTemplate(varlist, inputDir, prefix): templPrefix = inputDir+prefix QCD_sf = QCDSF QCDTempl = distribution('QCD', 'QCD', [ # (templPrefix+'data_c.root', QCD_sf), (templPrefix+'data_d.root', QCD_sf), # (templPrefix+'data_d_PR.root', QCD_sf), (templPrefix+'ttjets.root', -1 * QCD_sf * TopSF * gSF * TTJets_xs/TTJets_num), ######## Added in all other channels of MC, previously just ttjets 1l and 2l removed to get QCD template ######## (templPrefix+'ttjets.root', -1 * gSF * TTJets_xs/TTJets_num), (templPrefix+'ttgamma.root', -1 * gSF * newTTgamma_xs/newTTgamma_num), (templPrefix+'st_t.root', -1 * gSF * SingTopT_xs/SingTopT_num), (templPrefix+'st_t_anti.root', -1 * gSF * SingTopTbar_xs/SingTopTbar_num), (templPrefix+'st_s.root', -1 * gSF * SingTopS_xs/SingTopS_num), (templPrefix+'st_tW.root', -1 * gSF * SingToptW_xs/SingToptW_num), (templPrefix+'st_tW_anti.root', -1 * gSF * SingTopbartW_xs/SingTopbartW_num), (templPrefix+'Wjets.root', -1 * gSF * WJets_xs/WJets_num), (templPrefix+'DYJets.root', -1 * gSF * ZJets_xs/ZJets_num), ], varlist, ROOT.kYellow) return QCDTempl
def saveTTgammaAccTemplates(inputDir, outFileName): varList = [ 'MCcategory', 'genPhoRegionWeight_1l_2l', 'MCcategoryfid', 'genPhoRegionWeight_1lfid' ] print inputDir AccTemplates = {} AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', '', [ (inputDir + 'hist_1pho_top_TTGamma.root', 1.0), ], varList, 97) # AccTemplates['TTJets1l'] = distribution('TTJets1l_presel', '', [ # (inputDir+'hist_1pho_top_TTJets1l.root', 1.0), # ], varList ,11) # AccTemplates['TTJets2l'] = distribution('TTJets2l_presel', '', [ # (inputDir+'hist_1pho_top_TTJets2l.root', 1.0), # ], varList ,11) # AccTemplates['TTJetsHad'] = distribution('TTJetsHad_presel', '', [ # (inputDir+'hist_1pho_top_TTJetsHad.root', 1.0), # ], varList ,11) saveTemplatesToFile(AccTemplates.values(), varList, outFileName)
def saveTTgammaAccTemplates(inputDir, outFileName, ttjetsSyst=''): varList = ['MCcategory','MCcategoryfid']#,'genPhoRegionWeight_1lfid'] print inputDir AccTemplates = {} if not ttjetsSyst=='': if isElectron: ttgammaTemplPrefix = '/uscms_data/d2/dnoonan/Electrons/testScale2/test_TTJets'+ttjetsSyst+'Invert/' if isMuon: ttgammaTemplPrefix = '/uscms_data/d2/dnoonan/TTGammaElectrons/testScale2/test_TTJets'+ttjetsSyst+'Invert/' print ttgammaTemplPrefix+'TTJets'+ttjetsSyst+'Invert.root' AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', '', [ (ttgammaTemplPrefix+'hist_1pho_top_TTJets'+ttjetsSyst+'Invert.root', 1.0), # (ttbarTemplPrefix+'hist_1pho_top_TTJets'+ttjetsSyst+'Invert.root', 1.0), ], varList ,97) AccTemplates['TTGamma_photonSel'] = distribution('TTGamma_photonSel', '', [ (ttgammaTemplPrefix+'hist_1pho_barrel_top_TTJets'+ttjetsSyst+'Invert.root', 1.0), # (ttbarTemplPrefix+'hist_1pho_barrel_top_TTJets'+ttjetsSyst+'Invert.root', 1.0), ], varList, 97) AccTemplates['TTGamma_photonSelSignal'] = distribution('TTGamma_photonSelSignal', '', [ (ttgammaTemplPrefix+'hist_1pho_rs_barrel_top_TTJets'+ttjetsSyst+'Invert.root', 1.0), # (ttbarTemplPrefix+'hist_1pho_rs_barrel_top_TTJets'+ttjetsSyst+'Invert.root', 1.0), ], varList, 97) else: if isElectron: ttgammaTemplPrefix = '/uscms_data/d2/dnoonan/Electrons/testScale2/test_TTJetsInvert/' if isMuon: ttgammaTemplPrefix = '/uscms_data/d2/dnoonan/TTGammaElectrons/testScale2/test_TTJetsInvert/' print ttgammaTemplPrefix+'hist_1pho_top_TTJets1l.root' AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', '', [ (ttgammaTemplPrefix+'hist_1pho_top_TTJets1lInvert.root', 1.0), ], varList ,97) AccTemplates['TTGamma_photonSel'] = distribution('TTGamma_photonSel', '', [ (ttgammaTemplPrefix+'hist_1pho_barrel_top_TTJets1lInvert.root', 1.0), ], varList, 97) AccTemplates['TTGamma_photonSelSignal'] = distribution('TTGamma_photonSelSignal', '', [ (ttgammaTemplPrefix+'hist_1pho_rs_barrel_top_TTJets1lInvert.root', 1.0), ], varList, 97) # else: # AccTemplates['TTGamma_presel'] = distribution('TTGamma_presel', '', [ # (inputDir+'hist_1pho_top_TTGamma.root', 1.0), # ], varList, 97) # AccTemplates['TTGamma_photonSel'] = distribution('TTGamma_photonSel', '', [ # (inputDir+'hist_1pho_barrel_top_TTGamma.root', 1.0), # ], varList, 97) # AccTemplates['TTGamma_photonSelSignal'] = distribution('TTGamma_photonSelSignal', '', [ # (inputDir+'hist_1pho_rs_barrel_top_TTGamma.root', 1.0), # ], varList, 97) # AccTemplates['TTJets1l'] = distribution('TTJets1l_presel', '', [ # (inputDir+'hist_1pho_top_TTJets1l.root', 1.0), # ], varList ,11) # AccTemplates['TTJets2l'] = distribution('TTJets2l_presel', '', [ # (inputDir+'hist_1pho_top_TTJets2l.root', 1.0), # ], varList ,11) # AccTemplates['TTJetsHad'] = distribution('TTJetsHad_presel', '', [ # (inputDir+'hist_1pho_top_TTJetsHad.root', 1.0), # ], varList ,11) saveTemplatesToFile(AccTemplates.values(), varList, outFileName)
def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle): templPrefix = inputDir+prefix MCtemplates = {} #MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ # (templPrefix+'WHIZARD.root', TopSF*gSF*TTgamma_xs/WHIZARD_num) # ], varList, 98, fillStyle) MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ (templPrefix+'TTGamma.root', TopSF*gSF*newTTgamma_xs/newTTgamma_num) ], varList, 97, fillStyle) MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, [ (templPrefix+'TTJets1l.root', TopSF*gSF*TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', TopSF*gSF*TTJets2l_xs/TTJets2l_num), (templPrefix+'TTJetsHad.root', TopSF*gSF*TTJetsHad_xs/TTJetsHad_num), ], varList ,11, fillStyle) ################################### #return MCtemplates ################################### nonWJetsSF = 1.0 MCtemplates['Vgamma'] = distribution('Vgamma'+titleSuffix, [ (templPrefix+'Zgamma.root', VgammaSF*nonWJetsSF*gSF*Zgamma_xs/Zgamma_num), (templPrefix+'Wgamma.root', VgammaSF*nonWJetsSF*gSF*Wgamma_xs/Wgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, 90, fillStyle) MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, [ (templPrefix+'SingleT_t.root', nonWJetsSF*gSF*SingTopT_xs/SingTopT_num), (templPrefix+'SingleT_s.root', nonWJetsSF*gSF*SingTopS_xs/SingTopS_num), (templPrefix+'SingleT_tw.root', nonWJetsSF*gSF*SingToptW_xs/SingToptW_num), (templPrefix+'SingleTbar_t.root', nonWJetsSF*gSF*SingTopbarT_xs/SingTopbarT_num), (templPrefix+'SingleTbar_s.root', nonWJetsSF*gSF*SingTopbarS_xs/SingTopbarS_num), (templPrefix+'SingleTbar_tw.root', nonWJetsSF*gSF*SingTopbartW_xs/SingTopbartW_num), ], varList, 8, fillStyle) MCtemplates['WJets'] = distribution('WJets'+titleSuffix, [ #(templPrefix+'WJets.root', WJetsSF*gSF*WJets_xs/WJets_num), (templPrefix+'W3Jets.root', WJetsSF*gSF*W3Jets_xs/W3Jets_num), (templPrefix+'W4Jets.root', WJetsSF*gSF*W4Jets_xs/W4Jets_num), ], varList, 7, fillStyle) MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, [ (templPrefix+'ZJets.root', ZJetsSF*nonWJetsSF*gSF*ZJets_xs/ZJets_num)], varList, 9, fillStyle) #MCtemplates['Other'] = distribution('Diboson'+titleSuffix, [ #(templPrefix+'WZ_3lnu.root', nonWJetsSF*gSF*WZ_3lnu_xs/WZ_3lnu_num), #(templPrefix+'WZ_2l2q.root', nonWJetsSF*gSF*WZ_2l2q_xs/WZ_2l2q_num), #(templPrefix+'ZZ_2e2mu.root', nonWJetsSF*gSF*ZZ_2e2mu_xs/ZZ_2e2mu_num), #(templPrefix+'ZZ_2e2tau.root', nonWJetsSF*gSF*ZZ_2e2tau_xs/ZZ_2e2tau_num), #(templPrefix+'ZZ_2mu2tau.root', nonWJetsSF*gSF*ZZ_2mu2tau_xs/ZZ_2mu2tau_num), #(templPrefix+'ZZ_4e.root', nonWJetsSF*gSF*ZZ_4e_xs/ZZ_4e_num), #(templPrefix+'ZZ_4mu.root', nonWJetsSF*gSF*ZZ_4mu_xs/ZZ_4mu_num), #(templPrefix+'ZZ_4tau.root', nonWJetsSF*gSF*ZZ_4tau_xs/ZZ_4tau_num), #(templPrefix+'WW_2l2nu.root', nonWJetsSF*gSF*WW_2l2nu_xs/WW_2l2nu_num), #(templPrefix+'TTW.root', gSF*TTW_xs/TTW_num), #(templPrefix+'TTZ.root', gSF*TTZ_xs/TTZ_num), # ], varList, 49, fillStyle) return MCtemplates
def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle,ttjetsSyst=''): templPrefix = inputDir+prefix if not ttjetsSyst=='': ttbarTemplPrefix = inputDir.replace('hist_bins','hist_bins_Modeling')+prefix else: ttbarTemplPrefix = templPrefix MCtemplates = {} #MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ # (templPrefix+'WHIZARD.root', TopSF*gSF*TTgamma_xs/WHIZARD_num) # ], varList, 98, fillStyle) # MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ ##Changed the name MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma', [ (templPrefix+'TTGamma.root', TTGSF*gSF*newTTgamma_xs/newTTgamma_num) ], varList, ROOT.kRed +1, fillStyle) # MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, [ ##Changed the name print ttbarTemplPrefix+'TTJets'+ttjetsSyst+'.root' if not ttjetsSyst=='': MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, 't#bar{t}+jets', [ (ttbarTemplPrefix+'TTJets'+ttjetsSyst+'.root', TopSF*gSF*TTJets_xs/ttjetsNum[ttjetsSyst]), ], varList ,ROOT.kRed -7, fillStyle) else: MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, 't#bar{t}+jets', [ (templPrefix+'TTJets1l.root', TopSF*gSF*TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', TopSF*gSF*TTJets2l_xs/TTJets2l_num), (templPrefix+'TTJetsHad.root', TopSF*gSF*TTJetsHad_xs/TTJetsHad_num), ], varList ,ROOT.kRed -7, fillStyle) ################################### #return MCtemplates ################################### nonWJetsSF = 1.0 # MCtemplates['Vgamma'] = distribution('Vgamma'+titleSuffix, [ ##changed MCtemplates['Vgamma'] = distribution('Vgamma'+titleSuffix, 'V+#gamma', [ (templPrefix+'Zgamma.root', otherMCSF*gSF*Zgamma_xs/Zgamma_num), (templPrefix+'Wgamma.root', otherMCSF*WgammaSF*gSF*Wgamma_xs/Wgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, ROOT.kGray, fillStyle) # MCtemplates['Zgamma'] = distribution('Zgamma'+titleSuffix, [ MCtemplates['Zgamma'] = distribution('Zgamma'+titleSuffix, 'Z+#gamma', [ (templPrefix+'Zgamma.root', otherMCSF*gSF*Zgamma_xs/Zgamma_num), ], varList, ROOT.kAzure+3, fillStyle) # MCtemplates['Wgamma'] = distribution('Wgamma'+titleSuffix, [ MCtemplates['Wgamma'] = distribution('Wgamma'+titleSuffix, 'W+#gamma', [ (templPrefix+'Wgamma.root', otherMCSF*WgammaSF*gSF*Wgamma_xs/Wgamma_num), ], varList, ROOT.kGray, fillStyle) # MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, [ MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, 'Single Top', [ (templPrefix+'SingleT_t.root', otherMCSF*gSF*SingTopT_xs/SingTopT_num), (templPrefix+'SingleT_s.root', otherMCSF*gSF*SingTopS_xs/SingTopS_num), (templPrefix+'SingleT_tw.root', otherMCSF*gSF*SingToptW_xs/SingToptW_num), (templPrefix+'SingleTbar_t.root', otherMCSF*gSF*SingTopbarT_xs/SingTopbarT_num), (templPrefix+'SingleTbar_s.root', otherMCSF*gSF*SingTopbarS_xs/SingTopbarS_num), (templPrefix+'SingleTbar_tw.root', otherMCSF*gSF*SingTopbartW_xs/SingTopbartW_num), ], varList, ROOT.kMagenta, fillStyle) # MCtemplates['WJets'] = distribution('WJets'+titleSuffix, [ MCtemplates['WJets'] = distribution('WJets'+titleSuffix, 'W+jets', [ #(templPrefix+'WJets.root', WJetsSF*gSF*WJets_xs/WJets_num), (templPrefix+'W2Jets.root', WJetsSF*gSF*W2Jets_xs/W2Jets_num), (templPrefix+'W3Jets.root', WJetsSF*gSF*W3Jets_xs/W3Jets_num), (templPrefix+'W4Jets.root', WJetsSF*gSF*W4Jets_xs/W4Jets_num), ], varList, ROOT.kGreen -3, fillStyle) ######## Added back in the ZJetsSF scaling ######## # MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, [ MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, 'Z+jets', [ (templPrefix+'ZJets.root',ZJetsSF*otherMCSF*gSF*ZJets_xs/ZJets_num)], varList, ROOT.kAzure-2, fillStyle) return MCtemplates
def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle): templPrefix = inputDir+prefix MCtemplates = {} #MCtemplates['mst_510_200'] = distribution('mst_510_200'+titleSuffix,[ # (templPrefix+'mst_510_M3_5050_M1_200.root', gSF*0.0751004/15000) # ],varList, 620,3244) #MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ # (templPrefix+'WHIZARD.root', TopSF*gSF*TTgamma_xs/WHIZARD_num) # ], varList, 98, fillStyle) MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma',[ (templPrefix+'TTGamma.root', TopSF*gSF*newTTgamma_xs/newTTgamma_num) ], varList, ROOT.kRed +1, fillStyle) MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, 't#bar{t}+jets',[ (templPrefix+'TTJets1l.root', TopSF*gSF*TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', TopSF*gSF*TTJets2l_xs/TTJets2l_num), (templPrefix+'TTJetsHad.root', TopSF*gSF*TTJetsHad_xs/TTJetsHad_num), ], varList ,ROOT.kRed-7, fillStyle) ################################### #return MCtemplates ################################### nonWJetsSF = 1.0 #nonWJetsSF = WJetsSF MCtemplates['Wgamma'] = distribution('Wgamma'+titleSuffix, 'W+#gamma', [ (templPrefix+'Wgamma.root', nonWJetsSF*gSF*Wgamma_xs/Wgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, ROOT.kGray, fillStyle) MCtemplates['Zgamma'] = distribution('Zgamma'+titleSuffix, 'Z+#gamma', [ (templPrefix+'Zgamma.root', nonWJetsSF*gSF*Zgamma_xs/Zgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, ROOT.kAzure+3, fillStyle) MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, 'Single Top', [ (templPrefix+'SingleT_t.root', nonWJetsSF*gSF*SingTopT_xs/SingTopT_num), (templPrefix+'SingleT_s.root', nonWJetsSF*gSF*SingTopS_xs/SingTopS_num), (templPrefix+'SingleT_tw.root', nonWJetsSF*gSF*SingToptW_xs/SingToptW_num), (templPrefix+'SingleTbar_t.root', nonWJetsSF*gSF*SingTopbarT_xs/SingTopbarT_num), (templPrefix+'SingleTbar_s.root', nonWJetsSF*gSF*SingTopbarS_xs/SingTopbarS_num), (templPrefix+'SingleTbar_tw.root', nonWJetsSF*gSF*SingTopbartW_xs/SingTopbartW_num), ], varList, ROOT.kMagenta, fillStyle) MCtemplates['WJets'] = distribution('WJets'+titleSuffix, 'W+jets', [ #(templPrefix+'WJets.root', WJetsSF*gSF*WJets_xs/WJets_num), (templPrefix+'W3Jets.root', WJetsSF*gSF*W3Jets_xs/W3Jets_num), (templPrefix+'W4Jets.root', WJetsSF*gSF*W4Jets_xs/W4Jets_num), ], varList, ROOT.kGreen-3, fillStyle) MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, 'Z+jets', [ (templPrefix+'ZJets.root', nonWJetsSF*gSF*ZJets_xs/ZJets_num)], varList, ROOT.kAzure-2, fillStyle) # MCtemplates['Other'] = distribution('Diboson'+titleSuffix, [ # (templPrefix+'WZ_3lnu.root', nonWJetsSF*gSF*WZ_3lnu_xs/WZ_3lnu_num), # (templPrefix+'WZ_2l2q.root', nonWJetsSF*gSF*WZ_2l2q_xs/WZ_2l2q_num), # (templPrefix+'ZZ_2e2mu.root', nonWJetsSF*gSF*ZZ_2e2mu_xs/ZZ_2e2mu_num), # (templPrefix+'ZZ_2e2tau.root', nonWJetsSF*gSF*ZZ_2e2tau_xs/ZZ_2e2tau_num), # (templPrefix+'ZZ_2mu2tau.root', nonWJetsSF*gSF*ZZ_2mu2tau_xs/ZZ_2mu2tau_num), # (templPrefix+'ZZ_4e.root', nonWJetsSF*gSF*ZZ_4e_xs/ZZ_4e_num), # (templPrefix+'ZZ_4mu.root', nonWJetsSF*gSF*ZZ_4mu_xs/ZZ_4mu_num), # (templPrefix+'ZZ_4tau.root', nonWJetsSF*gSF*ZZ_4tau_xs/ZZ_4tau_num), # (templPrefix+'WW_2l2nu.root', nonWJetsSF*gSF*WW_2l2nu_xs/WW_2l2nu_num), # #(templPrefix+'TTW.root', gSF*TTW_xs/TTW_num), # #(templPrefix+'TTZ.root', gSF*TTZ_xs/TTZ_num), # ], varList, 49, fillStyle) return MCtemplates
def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle): templPrefix = inputDir + prefix MCtemplates = {} #MCtemplates['mst_510_200'] = distribution('mst_510_200'+titleSuffix,[ # (templPrefix+'mst_510_M3_5050_M1_200.root', gSF*0.0751004/15000) # ],varList, 620,3244) #MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ # (templPrefix+'WHIZARD.root', TopSF*gSF*TTgamma_xs/WHIZARD_num) # ], varList, 98, fillStyle) MCtemplates['WHIZARD'] = distribution( 'TTGamma' + titleSuffix, 't#bar{t}+#gamma', [(templPrefix + 'TTGamma.root', TopSF * gSF * newTTgamma_xs / newTTgamma_num)], varList, ROOT.kRed + 1, fillStyle) MCtemplates['TTJets'] = distribution( 'TTJets' + titleSuffix, 't#bar{t}+jets', [ (templPrefix + 'TTJets1l.root', TopSF * gSF * TTJets1l_xs / TTJets1l_num), (templPrefix + 'TTJets2l.root', TopSF * gSF * TTJets2l_xs / TTJets2l_num), (templPrefix + 'TTJetsHad.root', TopSF * gSF * TTJetsHad_xs / TTJetsHad_num), ], varList, ROOT.kRed - 7, fillStyle) ################################### #return MCtemplates ################################### nonWJetsSF = 1.0 #nonWJetsSF = WJetsSF MCtemplates['Wgamma'] = distribution( 'Wgamma' + titleSuffix, 'W+#gamma', [ (templPrefix + 'Wgamma.root', nonWJetsSF * gSF * Wgamma_xs / Wgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, ROOT.kGray, fillStyle) MCtemplates['Zgamma'] = distribution( 'Zgamma' + titleSuffix, 'Z+#gamma', [ (templPrefix + 'Zgamma.root', nonWJetsSF * gSF * Zgamma_xs / Zgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, ROOT.kAzure + 3, fillStyle) MCtemplates['SingleTop'] = distribution( 'SingleTop' + titleSuffix, 'Single Top', [ (templPrefix + 'SingleT_t.root', nonWJetsSF * gSF * SingTopT_xs / SingTopT_num), (templPrefix + 'SingleT_s.root', nonWJetsSF * gSF * SingTopS_xs / SingTopS_num), (templPrefix + 'SingleT_tw.root', nonWJetsSF * gSF * SingToptW_xs / SingToptW_num), (templPrefix + 'SingleTbar_t.root', nonWJetsSF * gSF * SingTopbarT_xs / SingTopbarT_num), (templPrefix + 'SingleTbar_s.root', nonWJetsSF * gSF * SingTopbarS_xs / SingTopbarS_num), (templPrefix + 'SingleTbar_tw.root', nonWJetsSF * gSF * SingTopbartW_xs / SingTopbartW_num), ], varList, ROOT.kMagenta, fillStyle) MCtemplates['WJets'] = distribution( 'WJets' + titleSuffix, 'W+jets', [ #(templPrefix+'WJets.root', WJetsSF*gSF*WJets_xs/WJets_num), (templPrefix + 'W3Jets.root', WJetsSF * gSF * W3Jets_xs / W3Jets_num), (templPrefix + 'W4Jets.root', WJetsSF * gSF * W4Jets_xs / W4Jets_num), ], varList, ROOT.kGreen - 3, fillStyle) MCtemplates['ZJets'] = distribution('ZJets' + titleSuffix, 'Z+jets', [ (templPrefix + 'ZJets.root', nonWJetsSF * gSF * ZJets_xs / ZJets_num) ], varList, ROOT.kAzure - 2, fillStyle) # MCtemplates['Other'] = distribution('Diboson'+titleSuffix, [ # (templPrefix+'WZ_3lnu.root', nonWJetsSF*gSF*WZ_3lnu_xs/WZ_3lnu_num), # (templPrefix+'WZ_2l2q.root', nonWJetsSF*gSF*WZ_2l2q_xs/WZ_2l2q_num), # (templPrefix+'ZZ_2e2mu.root', nonWJetsSF*gSF*ZZ_2e2mu_xs/ZZ_2e2mu_num), # (templPrefix+'ZZ_2e2tau.root', nonWJetsSF*gSF*ZZ_2e2tau_xs/ZZ_2e2tau_num), # (templPrefix+'ZZ_2mu2tau.root', nonWJetsSF*gSF*ZZ_2mu2tau_xs/ZZ_2mu2tau_num), # (templPrefix+'ZZ_4e.root', nonWJetsSF*gSF*ZZ_4e_xs/ZZ_4e_num), # (templPrefix+'ZZ_4mu.root', nonWJetsSF*gSF*ZZ_4mu_xs/ZZ_4mu_num), # (templPrefix+'ZZ_4tau.root', nonWJetsSF*gSF*ZZ_4tau_xs/ZZ_4tau_num), # (templPrefix+'WW_2l2nu.root', nonWJetsSF*gSF*WW_2l2nu_xs/WW_2l2nu_num), # #(templPrefix+'TTW.root', gSF*TTW_xs/TTW_num), # #(templPrefix+'TTZ.root', gSF*TTZ_xs/TTZ_num), # ], varList, 49, fillStyle) return MCtemplates
def loadMCTemplates(varList, inputDir, prefix, titleSuffix, fillStyle,ttjetsSyst=''): templPrefix = inputDir+prefix if isElectron: ttgammaTemplPrefix = '/uscms_data/d2/dnoonan/Electrons/testScale2/test_TTJets'+ttjetsSyst+'Invert/'+prefix if isMuon: ttgammaTemplPrefix = '/uscms_data/d2/dnoonan/TTGammaElectrons/testScale2/test_TTJets'+ttjetsSyst+'Invert/'+prefix if not (ttjetsSyst=='' or ttjetsSyst=='special'): ttbarTemplPrefix = inputDir.replace('hist_bins','hist_bins_Modeling')+prefix # ttbarTemplPrefix = '/uscms_data/d2/dnoonan/TTGammaElectrons/testScale/test_TTJets'+ttjetsSyst+'/'+prefix # ttgammaTemplPrefix = '/uscms_data/d2/dnoonan/TTGammaElectrons/testScale/test_TTJets'+ttjetsSyst+'Invert/'+prefix else: ttbarTemplPrefix = templPrefix # ttgammaTemplPrefix = templPrefix MCtemplates = {} #MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ # (templPrefix+'WHIZARD.root', TopSF*gSF*TTgamma_xs/WHIZARD_num) # ], varList, 98, fillStyle) # MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, [ ##Changed the name if ttjetsSyst=='special': print templPrefix+'TTGamma.root' MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma', [ (templPrefix+'TTGamma.root', TTGSF*gSF*newTTgamma_xs/newTTgamma_num) ], varList, ROOT.kRed +1, fillStyle) elif not ttjetsSyst=='': print ttgammaTemplPrefix+'TTJets'+ttjetsSyst+'Invert.root' MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma', [ (ttgammaTemplPrefix+'TTJets'+ttjetsSyst+'Invert.root', TTGSF*gSF*TTJets_xs/ttjetsNum[ttjetsSyst]) # (ttgammaTemplPrefix+'TTJets'+ttjetsSyst+'Invert.root', 1.108*434.8/198.4*TTGSF*gSF*TTJets_xs/ttjetsNum[ttjetsSyst]) ], varList, ROOT.kRed +1, fillStyle) else: print ttgammaTemplPrefix+'TTJets1lInvert.root' print ttgammaTemplPrefix+'TTJets2lInvert.root' print ttgammaTemplPrefix+'TTJets0lInvert.root' # print templPrefix+'TTGamma.root' MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma', [ (ttgammaTemplPrefix+'TTJets1lInvert.root', TTGSF*gSF*TTJets1l_xs/TTJets1l_num), (ttgammaTemplPrefix+'TTJets2lInvert.root', TTGSF*gSF*TTJets2l_xs/TTJets2l_num), (ttgammaTemplPrefix+'TTJets0lInvert.root', TTGSF*gSF*TTJetsHad_xs/TTJetsHad_num), # (ttgammaTemplPrefix+'TTJets1lInvert.root', 434.8/198.4*TTGSF*gSF*TTJets1l_xs/TTJets1l_num), # (ttgammaTemplPrefix+'TTJets2lInvert.root', 434.8/198.4*TTGSF*gSF*TTJets2l_xs/TTJets2l_num), # (ttgammaTemplPrefix+'TTJets0lInvert.root', 434.8/198.4*TTGSF*gSF*TTJetsHad_xs/TTJetsHad_num), ], varList, ROOT.kRed +1, fillStyle) # MCtemplates['WHIZARD'] = distribution('TTGamma'+titleSuffix, 't#bar{t}+#gamma', [ # (templPrefix+'TTGamma.root', TTGSF*gSF*newTTgamma_xs/newTTgamma_num) # ], varList, ROOT.kRed +1, fillStyle) # MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, [ ##Changed the name if not (ttjetsSyst=='' or ttjetsSyst=='special'): print ttbarTemplPrefix+'TTJets'+ttjetsSyst+'.root' MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, 't#bar{t}+jets', [ (ttbarTemplPrefix+'TTJets'+ttjetsSyst+'.root', TopSF*gSF*TTJets_xs/ttjetsNum[ttjetsSyst]), ], varList ,ROOT.kRed -7, fillStyle) else: print templPrefix+'TTJets1l.root' MCtemplates['TTJets'] = distribution('TTJets'+titleSuffix, 't#bar{t}+jets', [ (templPrefix+'TTJets1l.root', TopSF*gSF*TTJets1l_xs/TTJets1l_num), (templPrefix+'TTJets2l.root', TopSF*gSF*TTJets2l_xs/TTJets2l_num), (templPrefix+'TTJetsHad.root', TopSF*gSF*TTJetsHad_xs/TTJetsHad_num), ], varList ,ROOT.kRed -7, fillStyle) ################################### #return MCtemplates ################################### nonWJetsSF = 1.0 # MCtemplates['Vgamma'] = distribution('Vgamma'+titleSuffix, [ ##changed MCtemplates['Vgamma'] = distribution('Vgamma'+titleSuffix, 'V+#gamma', [ (templPrefix+'Zgamma.root', otherMCSF*gSF*Zgamma_xs/Zgamma_num), (templPrefix+'Wgamma.root', otherMCSF*WgammaSF*gSF*Wgamma_xs/Wgamma_num), # (templPrefix+'WWgamma.root', gSF*WWgamma_xs/WWgamma_num), ], varList, ROOT.kGray, fillStyle) # MCtemplates['Zgamma'] = distribution('Zgamma'+titleSuffix, [ MCtemplates['Zgamma'] = distribution('Zgamma'+titleSuffix, 'Z+#gamma', [ (templPrefix+'Zgamma.root', otherMCSF*gSF*Zgamma_xs/Zgamma_num), ], varList, ROOT.kAzure+3, fillStyle) # MCtemplates['Wgamma'] = distribution('Wgamma'+titleSuffix, [ MCtemplates['Wgamma'] = distribution('Wgamma'+titleSuffix, 'W+#gamma', [ (templPrefix+'Wgamma.root', otherMCSF*WgammaSF*gSF*Wgamma_xs/Wgamma_num), ], varList, ROOT.kGray, fillStyle) # MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, [ MCtemplates['SingleTop'] = distribution('SingleTop'+titleSuffix, 'Single Top', [ (templPrefix+'SingleT_t.root', otherMCSF*gSF*SingTopT_xs/SingTopT_num), (templPrefix+'SingleT_s.root', otherMCSF*gSF*SingTopS_xs/SingTopS_num), (templPrefix+'SingleT_tw.root', otherMCSF*gSF*SingToptW_xs/SingToptW_num), (templPrefix+'SingleTbar_t.root', otherMCSF*gSF*SingTopbarT_xs/SingTopbarT_num), (templPrefix+'SingleTbar_s.root', otherMCSF*gSF*SingTopbarS_xs/SingTopbarS_num), (templPrefix+'SingleTbar_tw.root', otherMCSF*gSF*SingTopbartW_xs/SingTopbartW_num), ], varList, ROOT.kMagenta, fillStyle) # MCtemplates['WJets'] = distribution('WJets'+titleSuffix, [ MCtemplates['WJets'] = distribution('WJets'+titleSuffix, 'W+jets', [ #(templPrefix+'WJets.root', WJetsSF*gSF*WJets_xs/WJets_num), (templPrefix+'W2Jets.root', WJetsSF*gSF*W2Jets_xs/W2Jets_num), (templPrefix+'W3Jets.root', WJetsSF*gSF*W3Jets_xs/W3Jets_num), (templPrefix+'W4Jets.root', WJetsSF*gSF*W4Jets_xs/W4Jets_num), ], varList, ROOT.kGreen -3, fillStyle) ######## Added back in the ZJetsSF scaling ######## # MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, [ MCtemplates['ZJets'] = distribution('ZJets'+titleSuffix, 'Z+jets', [ (templPrefix+'ZJets.root',ZJetsSF*otherMCSF*gSF*ZJets_xs/ZJets_num)], varList, ROOT.kAzure-2, fillStyle) return MCtemplates