diff --git a/producePlots.py b/producePlots.py index 06839bf..f519fb7 100644 --- a/producePlots.py +++ b/producePlots.py @@ -69,10 +69,12 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): if(opt.YEAR=='Full'): _temp = __import__('inputs_sig_extrap_'+obsName+'_NNLOPS_Full', globals(), locals(), ['acc'], -1) acc_NNLOPS = _temp.acc + acc_aMC = _temp.acc + acc_QCD = _temp.acc else: _temp = __import__('inputs_sig_extrap_'+obsName+'_NNLOPS_'+opt.YEAR, globals(), locals(), ['acc'], -1) acc_NNLOPS = _temp.acc - + acc_aMC = _temp.acc if(acFlag): _temp = __import__('inputs_sig_ACggH_'+acSample+'_'+obsName+'_Full', globals(), locals(), ['acc'], -1) acc_AC = _temp.acc @@ -135,11 +137,19 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): _temp = __import__('accUnc_'+obsName+'_NNLOPS', globals(), locals(), ['pdfUncert','qcdUncert'], -1) pdfunc_ggH_nnlops = _temp.pdfUncert qcdunc_ggH_nnlops = _temp.qcdUncert + + _temp = __import__('accUnc_'+obsName+'_aMCNLO', globals(), locals(), ['pdfUncert','qcdUncert'], -1) + pdfunc_ggH_amcnlo = _temp.pdfUncert + qcdunc_ggH_amcnlo = _temp.qcdUncert else: _temp = __import__('accUnc_'+obsName+'_NNLOPS', globals(), locals(), ['pdfUncert','qcdUncert'], -1) pdfunc_ggH_nnlops = _temp.pdfUncert qcdunc_ggH_nnlops = _temp.qcdUncert + _temp = __import__('accUnc_'+obsName+'_aMCNLO', globals(), locals(), ['pdfUncert','qcdUncert'], -1) + pdfunc_ggH_amcnlo = _temp.pdfUncert + qcdunc_ggH_amcnlo = _temp.qcdUncert + # cross sections ggH_powheg = [] ggH_powheg_unc_hi = [] @@ -162,6 +172,9 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): ggH_powheg_NLOunc_lo = [] ggH_minloHJ_NLOunc_hi = [] ggH_minloHJ_NLOunc_lo = [] + ggH_aMC = [] + ggH_aMC_NNLOunc_hi = [] + ggH_aMC_NNLOunc_lo = [] # AC predictions if(acFlag): ggH_AC = [] @@ -261,6 +274,9 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): ggH_powheg_NNLOunc_lo.append(0.0) ggH_minloHJ_NNLOunc_hi.append(0.0) ggH_minloHJ_NNLOunc_lo.append(0.0) + ggH_aMC.append(0.0) + ggH_aMC_NNLOunc_hi.append(0.0) + ggH_aMC_NNLOunc_lo.append(0.0) # ggH_HRes_NNLOunc_hi.append(0.0) # ggH_HRes_NNLOunc_lo.append(0.0) # NLO theory unc @@ -419,6 +435,7 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): ggH_powheg[obsBin]+=ggH_xsBR*acc['ggH125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)] #ggH_minloHJ[obsBin]+=ggH_xsBR*acc_ggH_powheg['ggH_powheg_JHUgen_125_'+channel+'_'+obsName+'_genbin'+str(obsBin)] ggH_minloHJ[obsBin]+=ggH_xsBR*acc_NNLOPS['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)] + ggH_aMC[obsBin]+=ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)] # AC if(acFlag): ggH_AC[obsBin]+=ggH_xsBR*acc_AC['ggH'+acSample+'_M125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)] @@ -436,6 +453,11 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): total_NNLOunc_fs_minloHJ_hi += (unc_acc*(XH_fs+ggH_xsBR*acc_NNLOPS['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 total_NNLOunc_fs_minloHJ_lo += (unc_acc*(XH_fs+ggH_xsBR*acc_NNLOPS['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 + total_aMCunc_fs_minloHJ_hi = (unc_br*(XH_fs+ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 + total_aMCunc_fs_minloHJ_lo = (unc_br*(XH_fs+ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 + total_aMCunc_fs_minloHJ_hi += (unc_acc*(XH_fs+ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 + total_aMCunc_fs_minloHJ_lo += (unc_acc*(XH_fs+ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 + # NLO and NNLO are the same at this point total_NLOunc_fs_powheg_hi = total_NNLOunc_fs_powheg_hi total_NLOunc_fs_powheg_lo = total_NNLOunc_fs_powheg_lo @@ -449,12 +471,12 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): total_NLOunc_fs_ACbis_lo = (unc_br*(XH_ACbis_fs+ggH_xsBR*acc_ACbis['ggH'+acSampleBis+'_M125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 total_NLOunc_fs_ACbis_hi += (unc_acc*(XH_ACbis_fs+ggH_xsBR*acc_ACbis['ggH'+acSampleBis+'_M125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 total_NLOunc_fs_ACbis_lo += (unc_acc*(XH_ACbis_fs+ggH_xsBR*acc_ACbis['ggH'+acSampleBis+'_M125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)]))**2 - #total_NLOunc_fs_powheg_hi = 0.0 - #total_NLOunc_fs_powheg_lo = 0.0 total_NLOunc_fs_minloHJ_hi = total_NNLOunc_fs_minloHJ_hi total_NLOunc_fs_minloHJ_lo = total_NNLOunc_fs_minloHJ_lo + total_aMCunc_fs_minloHJ_hi = total_aMCunc_fs_minloHJ_hi + total_aMCunc_fs_minloHJ_lo = total_aMCunc_fs_minloHJ_lo # add ggH qcd uncertainties (uncorrelated with anything else) #NNLO @@ -466,6 +488,10 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): total_NNLOunc_fs_minloHJ_hi += XH_qcdunc_fs total_NNLOunc_fs_minloHJ_lo += XH_qcdunc_fs + + total_aMCunc_fs_minloHJ_hi += XH_qcdunc_fs + total_aMCunc_fs_minloHJ_lo += XH_qcdunc_fs + if (obsName.startswith("mass4l")): total_NNLOunc_fs_minloHJ_hi += (unc_qcd_ggH_hi *ggH_xsBR*acc_NNLOPS['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)])**2 @@ -477,6 +503,10 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): total_NNLOunc_fs_minloHJ_lo += (qcdunc_ggH_nnlops["ggH125_NNLOPS_"+channel+"_"+obsName.replace('_reco','_gen')+"_genbin"+str(obsBin)]['uncerDn'] *ggH_xsBR*acc_NNLOPS['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)])**2 + total_aMCunc_fs_minloHJ_hi += (qcdunc_ggH_amcnlo["ggH125_aMCNLO_"+channel+"_"+obsName.replace('_reco','_gen')+"_genbin"+str(obsBin)]['uncerUp'] + *ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)])**2 + total_aMCunc_fs_minloHJ_lo += (qcdunc_ggH_amcnlo["ggH125_aMCNLO_"+channel+"_"+obsName.replace('_reco','_gen')+"_genbin"+str(obsBin)]['uncerDn'] + *ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)])**2 #NLO total_NLOunc_fs_powheg_hi += XH_qcdunc_fs total_NLOunc_fs_powheg_lo += XH_qcdunc_fs @@ -573,12 +603,25 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): *ggH_xsBR*acc_NNLOPS['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)] -unc_pdf_ttH*higgs_xs['ttH_'+opt.THEORYMASS]*higgs4l_br[opt.THEORYMASS+'_'+channel]*acc['ttH125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)])**2 + + total_aMCunc_fs_minloHJ_hi += XH_qqpdfunc_fs + total_aMCunc_fs_minloHJ_lo += XH_qqpdfunc_fs + total_aMCunc_fs_minloHJ_hi += (pdfunc_ggH_amcnlo["ggH125_aMCNLO_"+channel+"_"+obsName.replace('_reco','_gen')+"_genbin"+str(obsBin)]['uncerUp'] + *ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)] + -unc_pdf_ttH*higgs_xs['ttH_'+opt.THEORYMASS]*higgs4l_br[opt.THEORYMASS+'_'+channel]*acc['ttH125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)])**2 + total_aMCunc_fs_minloHJ_lo += (pdfunc_ggH_amcnlo["ggH125_aMCNLO_"+channel+"_"+obsName.replace('_reco','_gen')+"_genbin"+str(obsBin)]['uncerDn'] + *ggH_xsBR*acc_aMC['ggH125_NNLOPS_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)] + -unc_pdf_ttH*higgs_xs['ttH_'+opt.THEORYMASS]*higgs4l_br[opt.THEORYMASS+'_'+channel]*acc['ttH125_'+channel+'_'+obsName+'_genbin'+str(obsBin)+'_recobin'+str(obsBin)])**2 + + # finally total uncertainty (different final states are correlated) # NNLO ggH_powheg_NNLOunc_hi[obsBin]+=sqrt(total_NNLOunc_fs_powheg_hi) ggH_powheg_NNLOunc_lo[obsBin]+=sqrt(total_NNLOunc_fs_powheg_lo) ggH_minloHJ_NNLOunc_hi[obsBin]+=sqrt(total_NNLOunc_fs_minloHJ_hi) ggH_minloHJ_NNLOunc_lo[obsBin]+=sqrt(total_NNLOunc_fs_minloHJ_lo) + ggH_aMC_NNLOunc_hi[obsBin]+=sqrt(total_aMCunc_fs_minloHJ_hi) + ggH_aMC_NNLOunc_lo[obsBin]+=sqrt(total_aMCunc_fs_minloHJ_lo) # NLO ggH_powheg_NLOunc_hi[obsBin]+=sqrt(total_NLOunc_fs_powheg_hi) ggH_powheg_NLOunc_lo[obsBin]+=sqrt(total_NLOunc_fs_powheg_lo) @@ -596,6 +639,7 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): ggH_AC[obsBin]+=XH_AC[obsBin] if(acFlagBis): ggH_ACbis[obsBin]+=XH_ACbis[obsBin] ggH_minloHJ[obsBin]+=XH[obsBin] + ggH_aMC[obsBin]+=XH[obsBin] if (opt.UNBLIND): data[obsBin] = resultsXS[datamodel+"_"+obsName+"_genbin"+str(obsBin)]["central"] @@ -871,7 +915,6 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): print 'a_ggH_powheg_hi',a_ggH_powheg_unc_hi print 'a_ggH_powheg_lo',a_ggH_powheg_unc_lo - a_ggH_minloHJ = array('d',[ggH_minloHJ[i] for i in range(len(ggH_minloHJ))]) v_ggH_minloHJ = TVectorD(len(a_ggH_minloHJ),a_ggH_minloHJ) a_ggH_minloHJ_unc_hi = array('d',[ggH_minloHJ_NNLOunc_hi[i] for i in range(len(ggH_minloHJ_unc_hi))]) @@ -883,6 +926,17 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): print 'a_ggH_minloHJ_hi',a_ggH_minloHJ_unc_hi print 'a_ggH_minloHJ_lo',a_ggH_minloHJ_unc_lo + a_ggH_aMC = array('d',[ggH_aMC[i] for i in range(len(ggH_aMC))]) + v_ggH_aMC = TVectorD(len(a_ggH_aMC),a_ggH_aMC) + a_ggH_aMC_unc_hi = array('d',[ggH_aMC_NNLOunc_hi[i] for i in range(len(ggH_aMC_NNLOunc_hi))]) + a_ggH_aMC_unc_lo = array('d',[ggH_aMC_NNLOunc_lo[i] for i in range(len(ggH_aMC_NNLOunc_lo))]) + v_ggH_aMC_unc_hi = TVectorD(len(a_ggH_aMC_unc_hi),a_ggH_aMC_unc_hi) + v_ggH_aMC_unc_lo = TVectorD(len(a_ggH_aMC_unc_lo),a_ggH_aMC_unc_lo) + + print 'a_ggH_aMC',a_ggH_aMC + print 'a_ggH_aMC_hi',a_ggH_aMC_unc_hi + print 'a_ggH_aMC_lo',a_ggH_aMC_unc_lo + ''' a_ggH_HRes = array('d',[ggH_HRes[i] for i in range(len(ggH_HRes))]) @@ -954,7 +1008,6 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): v_ggH_powheg_unc_hi = TVectorD(len(a_ggH_powheg_unc_hi),a_ggH_powheg_unc_hi) v_ggH_powheg_unc_lo = TVectorD(len(a_ggH_powheg_unc_lo),a_ggH_powheg_unc_lo) - a_ggH_minloHJ = array('d',[ggH_minloHJ[i]/((float(obs_bins_boundaries[i][1])-float(obs_bins_boundaries[i][0]))*(float(obs_bins_boundaries[i][3])-float(obs_bins_boundaries[i][2]))) for i in range(len(ggH_minloHJ))]) v_ggH_minloHJ = TVectorD(len(a_ggH_minloHJ),a_ggH_minloHJ) a_ggH_minloHJ_unc_hi = array('d',[ggH_minloHJ_NNLOunc_hi[i]/((float(obs_bins_boundaries[i][1])-float(obs_bins_boundaries[i][0]))*(float(obs_bins_boundaries[i][3])-float(obs_bins_boundaries[i][2]))) for i in range(len(ggH_minloHJ_unc_hi))]) @@ -962,7 +1015,6 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): v_ggH_minloHJ_unc_hi = TVectorD(len(a_ggH_minloHJ_unc_hi),a_ggH_minloHJ_unc_hi) v_ggH_minloHJ_unc_lo = TVectorD(len(a_ggH_minloHJ_unc_lo),a_ggH_minloHJ_unc_lo) - ''' a_ggH_HRes = array('d',[ggH_HRes[i]/((float(obs_bins_boundaries[i][1])-float(obs_bins_boundaries[i][0]))*(float(obs_bins_boundaries[i][3])-float(obs_bins_boundaries[i][2]))) for i in range(len(ggH_HRes))]) v_ggH_HRes = TVectorD(len(a_ggH_HRes),a_ggH_HRes) @@ -1014,8 +1066,9 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): elif (obsName=="massZ2"): offset=20.0 elif (obsName=="massZ1"): offset=20.0 elif (obsName=="rapidity4l"): offset=20.0 + elif (obsName=="pTj1jet_pt30_eta2p5"): offset=30.0 elif (obsName=="pTj1"): offset=30.0 - elif (obsName=="njets_pt30_eta4p7"): offset=999.0 + elif (obsName=="njets_pt30_eta2p5"): offset=999.0 else: offset = 20.0 a_observable = array('d',[0.5*(float(obs_bins[i])+float(obs_bins[i+1])) for i in range(len(obs_bins)-1)]) v_observable = TVectorD(len(a_observable),a_observable) @@ -1024,14 +1077,19 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): a_observable_1 = array('d',[(0.5*(float(obs_bins[i])+float(obs_bins[i+1]))+min(offset,0.25*(float(obs_bins[i+1])-float(obs_bins[i])))) for i in range(len(obs_bins)-1)]) v_observable_1 = TVectorD(len(a_observable_1),a_observable_1) - a_dobservable_1 = array('d',[0.125*(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(obs_bins)-1)]) + a_dobservable_1 = array('d',[0.05*(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(obs_bins)-1)]) v_dobservable_1 = TVectorD(len(a_dobservable_1),a_dobservable_1) - a_observable_2 = array('d',[(0.5*(float(obs_bins[i])+float(obs_bins[i+1]))-min(offset,0.25*(float(obs_bins[i+1])-float(obs_bins[i])))) for i in range(len(obs_bins)-1)]) + a_observable_2 = array('d',[(0.5*(float(obs_bins[i])+float(obs_bins[i+1]))-min(offset,0.34*(float(obs_bins[i+1])-float(obs_bins[i])))) for i in range(len(obs_bins)-1)]) v_observable_2 = TVectorD(len(a_observable_2),a_observable_2) - a_dobservable_2 = array('d',[0.125*(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(obs_bins)-1)]) + a_dobservable_2 = array('d',[0.05*(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(obs_bins)-1)]) v_dobservable_2 = TVectorD(len(a_dobservable_2),a_dobservable_2) + a_observable_3 = array('d',[(0.5*(float(obs_bins[i])+float(obs_bins[i+1]))-min(offset,0.13*(float(obs_bins[i+1])-float(obs_bins[i])))) for i in range(len(obs_bins)-1)]) + v_observable_3 = TVectorD(len(a_observable_3),a_observable_3) + a_dobservable_3 = array('d',[0.05*(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(obs_bins)-1)]) + v_dobservable_3 = TVectorD(len(a_dobservable_3),a_dobservable_3) + a_zeros = array('d',[0.0 for i in range(len(obs_bins)-1)]) v_zeros = TVectorD(len(a_zeros),a_zeros) a_twos = array('d',[0.015*(float(obs_bins[len(obs_bins)-1])-float(obs_bins[0])) for i in range(len(obs_bins)-1)]) @@ -1066,6 +1124,16 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): v_ggH_minloHJ_unc_hi = TVectorD(len(a_ggH_minloHJ_unc_hi),a_ggH_minloHJ_unc_hi) v_ggH_minloHJ_unc_lo = TVectorD(len(a_ggH_minloHJ_unc_lo),a_ggH_minloHJ_unc_lo) + a_ggH_aMC = array('d',[ggH_aMC[i]/(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(ggH_aMC))]) + v_ggH_aMC = TVectorD(len(a_ggH_aMC),a_ggH_aMC) + a_ggH_aMC_unc_hi = array('d',[ggH_aMC_NNLOunc_hi[i]/(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(ggH_aMC_NNLOunc_hi))]) + a_ggH_aMC_unc_lo = array('d',[ggH_aMC_NNLOunc_lo[i]/(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(ggH_aMC_NNLOunc_lo))]) + v_ggH_aMC_unc_hi = TVectorD(len(a_ggH_aMC_unc_hi),a_ggH_aMC_unc_hi) + v_ggH_aMC_unc_lo = TVectorD(len(a_ggH_aMC_unc_lo),a_ggH_aMC_unc_lo) + + print 'a_ggH_aMC',a_ggH_aMC + print 'a_ggH_aMC_hi',a_ggH_aMC_unc_hi + print 'a_ggH_aMC_lo',a_ggH_aMC_unc_lo ''' a_ggH_HRes = array('d',[ggH_HRes[i]/(float(obs_bins[i+1])-float(obs_bins[i])) for i in range(len(ggH_HRes))]) v_ggH_HRes = TVectorD(len(a_ggH_HRes),a_ggH_HRes) @@ -1113,24 +1181,24 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): v_data_lo_allunc = TVectorD(len(data_lo_allunc), array('d',[data_lo_allunc[i] for i in range(len(data_lo_allunc))])) - # g_ggH_powheg = TGraphAsymmErrors(v_observable_1,v_ggH_powheg,v_dobservable_1,v_dobservable_1,v_ggH_powheg_unc_lo,v_ggH_powheg_unc_hi) - # g_ggH_powheg.SetFillStyle(3254); - # g_ggH_powheg.SetFillColor(ROOT.kAzure+2) - # g_ggH_powheg.SetLineColor(ROOT.kAzure+2) - # g_ggH_powheg.SetLineWidth(2) - # g_ggH_powheg.SetMarkerColor(ROOT.kAzure+2) - # - # g_ggH_powhegBorder = TGraphAsymmErrors(v_observable_1,v_ggH_powheg,v_dobservable_1,v_dobservable_1,v_ggH_powheg_unc_lo,v_ggH_powheg_unc_hi) - # g_ggH_powhegBorder.SetFillStyle(0) - # g_ggH_powhegBorder.SetFillColor(ROOT.kAzure+2) - # g_ggH_powhegBorder.SetLineColor(ROOT.kAzure+2) - # g_ggH_powhegBorder.SetMarkerColor(ROOT.kAzure+2) - # - # g_ggH_powhege0 = TGraphAsymmErrors(v_observable,v_ggH_powheg,v_dobservable,v_dobservable,v_zeros,v_zeros) - # g_ggH_powhege0.SetFillStyle(3254); - # g_ggH_powhege0.SetFillColor(ROOT.kAzure+2) - # g_ggH_powhege0.SetLineColor(ROOT.kAzure+2) - # g_ggH_powhege0.SetMarkerColor(ROOT.kAzure+2) + g_ggH_powheg = TGraphAsymmErrors(v_observable_1,v_ggH_powheg,v_dobservable_1,v_dobservable_1,v_ggH_powheg_unc_lo,v_ggH_powheg_unc_hi) + g_ggH_powheg.SetFillStyle(3254); + g_ggH_powheg.SetFillColor(ROOT.kAzure+2) + g_ggH_powheg.SetLineColor(ROOT.kAzure+2) + g_ggH_powheg.SetLineWidth(2) + g_ggH_powheg.SetMarkerColor(ROOT.kAzure+2) + + g_ggH_powhegBorder = TGraphAsymmErrors(v_observable_1,v_ggH_powheg,v_dobservable_1,v_dobservable_1,v_ggH_powheg_unc_lo,v_ggH_powheg_unc_hi) + g_ggH_powhegBorder.SetFillStyle(0) + g_ggH_powhegBorder.SetFillColor(ROOT.kAzure+2) + g_ggH_powhegBorder.SetLineColor(ROOT.kAzure+2) + g_ggH_powhegBorder.SetMarkerColor(ROOT.kAzure+2) + + g_ggH_powhege0 = TGraphAsymmErrors(v_observable,v_ggH_powheg,v_dobservable,v_dobservable,v_zeros,v_zeros) + g_ggH_powhege0.SetFillStyle(3254); + g_ggH_powhege0.SetFillColor(ROOT.kAzure+2) + g_ggH_powhege0.SetLineColor(ROOT.kAzure+2) + g_ggH_powhege0.SetMarkerColor(ROOT.kAzure+2) if (obsName.startswith("mass4l")): @@ -1158,16 +1226,14 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): g_ggH_powheg.SetLineWidth(2) g_ggH_powheg.SetMarkerColor(ROOT.kAzure+2) - g_ggH_powhegBorder = TGraphAsymmErrors(v_observable_1,v_ggH_powheg,v_dobservable_1,v_dobservable_1,v_ggH_powheg_unc_lo,v_ggH_powheg_unc_hi) g_ggH_powhegBorder.SetFillStyle(0) g_ggH_powhegBorder.SetFillColor(ROOT.kAzure+2) g_ggH_powhegBorder.SetLineColor(ROOT.kAzure+2) g_ggH_powhegBorder.SetMarkerColor(ROOT.kAzure+2) - # h_ggH_powheg = TH1D("h_ggH_powheg","h_ggH_powheg",4, 0, 4) - h_ggH_powheg = TH1D("h_ggH_powheg","h_ggH_powheg",nBins-1, 0, nBins-1) - for i in range(nBins-1): + h_ggH_powheg = TH1D("h_ggH_powheg","h_ggH_powheg",4, 0, 4) + for i in range(4): h_ggH_powheg.SetBinContent(i+1,v_ggH_powheg[i]) else: g_ggH_powheg = TGraphAsymmErrors(v_observable_1,v_ggH_powheg,v_dobservable_1,v_dobservable_1,v_ggH_powheg_unc_lo,v_ggH_powheg_unc_hi) @@ -1186,16 +1252,16 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): if acFlag: g_ggH_AC = TGraphAsymmErrors(v_observable_2,v_ggH_AC,v_dobservable_2,v_dobservable_2,v_ggH_AC_unc_lo,v_ggH_AC_unc_hi) g_ggH_AC.SetFillStyle(3254); - g_ggH_AC.SetFillColor(ROOT.kRed+2) - g_ggH_AC.SetLineColor(ROOT.kRed+2) + g_ggH_AC.SetFillColor(ROOT.kPink+2) + g_ggH_AC.SetLineColor(ROOT.kPink+2) g_ggH_AC.SetLineWidth(2) - g_ggH_AC.SetMarkerColor(ROOT.kRed+2) + g_ggH_AC.SetMarkerColor(ROOT.kPink+2) g_ggH_ACBorder = TGraphAsymmErrors(v_observable_2,v_ggH_AC,v_dobservable_2,v_dobservable_2,v_ggH_AC_unc_lo,v_ggH_AC_unc_hi) g_ggH_ACBorder.SetFillStyle(0) - g_ggH_ACBorder.SetFillColor(ROOT.kRed+2) - g_ggH_ACBorder.SetLineColor(ROOT.kRed+2) - g_ggH_ACBorder.SetMarkerColor(ROOT.kRed+2) + g_ggH_ACBorder.SetFillColor(ROOT.kPink+2) + g_ggH_ACBorder.SetLineColor(ROOT.kPink+2) + g_ggH_ACBorder.SetMarkerColor(ROOT.kPink+2) if acFlagBis: g_ggH_ACbis = TGraphAsymmErrors(v_observable_2,v_ggH_ACbis,v_dobservable_2,v_dobservable_2,v_ggH_ACbis_unc_lo,v_ggH_ACbis_unc_hi) @@ -1229,11 +1295,12 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): h_ggH_ACbis = TH1D("h_ggH_ACbis","h_ggH_ACbis",nBins-1, array('d',[float(obs_bins[i]) for i in range(len(obs_bins))]) ) for i in range(nBins-1): h_ggH_ACbis.SetBinContent(i+1,v_ggH_ACbis[i]) + h_ggH_powheg.SetLineColor(ROOT.kAzure+2) h_ggH_powheg.SetLineWidth(2) if acFlag: - h_ggH_AC.SetLineColor(ROOT.kRed+2) + h_ggH_AC.SetLineColor(ROOT.kPink+2) h_ggH_AC.SetLineWidth(2) if acFlagBis: h_ggH_ACbis.SetLineColor(ROOT.kViolet+2) @@ -1253,12 +1320,6 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): g_ggH_minloHJBorder.SetLineColor(ROOT.kOrange+2) g_ggH_minloHJBorder.SetMarkerColor(ROOT.kOrange+2) - g_ggH_minloHJe0 = TGraphAsymmErrors(v_observable,v_ggH_minloHJ,v_dobservable,v_dobservable,v_zeros,v_zeros) - g_ggH_minloHJe0.SetFillStyle(3245); - g_ggH_minloHJe0.SetFillColor(ROOT.kOrange+2) - g_ggH_minloHJe0.SetLineColor(ROOT.kOrange+2) - g_ggH_minloHJe0.SetMarkerColor(ROOT.kOrange+2) - if (obsName.startswith("mass4l")): h_ggH_minloHJ = TH1D("h_ggH_minloHJ","h_ggH_minloHJ",4, 0, 4) for i in range(4): @@ -1291,11 +1352,57 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): for i in range(nBins-1): h_ggH_minloHJ.SetBinContent(i+1,v_ggH_minloHJ[i]) - h_ggH_minloHJ.SetLineColor(ROOT.kOrange+2) h_ggH_minloHJ.SetLineWidth(2) + g_ggH_aMC = TGraphAsymmErrors(v_observable_3,v_ggH_aMC,v_dobservable_3,v_dobservable_3,v_ggH_aMC_unc_lo,v_ggH_aMC_unc_hi) + g_ggH_aMC.SetFillStyle(3245); + g_ggH_aMC.SetFillColor(ROOT.kPink+2) + g_ggH_aMC.SetLineColor(ROOT.kPink+2) + g_ggH_aMC.SetLineWidth(2) + g_ggH_aMC.SetMarkerColor(ROOT.kPink+2) + + g_ggH_aMCBorder = TGraphAsymmErrors(v_observable_3,v_ggH_aMC,v_dobservable_3,v_dobservable_3,v_ggH_aMC_unc_lo,v_ggH_aMC_unc_hi) + g_ggH_aMCBorder.SetFillStyle(0) + g_ggH_aMCBorder.SetFillColor(ROOT.kPink+2) + g_ggH_aMCBorder.SetLineColor(ROOT.kPink+2) + g_ggH_aMCBorder.SetMarkerColor(ROOT.kPink+2) + + if (obsName.startswith("mass4l")): + h_ggH_aMC = TH1D("h_ggH_aMC","h_ggH_aMC",4, 0, 4) + for i in range(4): + h_ggH_aMC.SetBinContent(i+1,v_ggH_aMC[i]) + elif doubleDiff: + h_ggH_aMC = TH1D("h_ggH_aMC","h_ggH_aMC",nBins-1, 0, nBins-1) + for i in range(nBins-1): + h_ggH_aMC.SetBinContent(i+1,v_ggH_aMC[i]) + + g_ggH_aMC = TGraphAsymmErrors(v_observable_3,v_ggH_aMC,v_dobservable_3,v_dobservable_3,v_ggH_aMC_unc_lo,v_ggH_aMC_unc_hi) + g_ggH_aMC.SetFillStyle(3245); + g_ggH_aMC.SetFillColor(ROOT.kPink+2) + g_ggH_aMC.SetLineColor(ROOT.kPink+2) + g_ggH_aMC.SetLineWidth(2) + g_ggH_aMC.SetMarkerColor(ROOT.kPink+2) + + g_ggH_aMCBorder = TGraphAsymmErrors(v_observable_3,v_ggH_aMC,v_dobservable_3,v_dobservable_3,v_ggH_aMC_unc_lo,v_ggH_aMC_unc_hi) + g_ggH_aMCBorder.SetFillStyle(0) + g_ggH_aMCBorder.SetFillColor(ROOT.kPink+2) + g_ggH_aMCBorder.SetLineColor(ROOT.kPink+2) + g_ggH_aMCBorder.SetMarkerColor(ROOT.kPink+2) + + if (not obsName.startswith("mass4l") and not doubleDiff): + if ("jet" in obsName and (not obsName.startswith("njets"))): + h_ggH_aMC = TH1D("h_ggH_aMC","h_ggH_aMC",nBins-2, array('d',[float(obs_bins[i]) for i in range(1,len(obs_bins))]) ) + for i in range(1,nBins-1): + h_ggH_aMC.SetBinContent(i,v_ggH_aMC[i]) + else: + h_ggH_aMC = TH1D("h_ggH_aMC","h_ggH_aMC",nBins-1, array('d',[float(obs_bins[i]) for i in range(len(obs_bins))]) ) + for i in range(nBins-1): + h_ggH_aMC.SetBinContent(i+1,v_ggH_aMC[i]) + + h_ggH_aMC.SetLineColor(ROOT.kPink+2) + h_ggH_aMC.SetLineWidth(2) ''' g_ggH_HRes = TGraphAsymmErrors(v_observable,v_ggH_HRes,v_dobservable,v_dobservable,v_ggH_HRes_unc_lo,v_ggH_HRes_unc_hi) @@ -1337,6 +1444,10 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): v_ratio_minloHJ_hi = TVectorD(len(ggH_minloHJ), array('d',[ggH_minloHJ_NNLOunc_hi[i]/ggH_minloHJ[i] for i in range(len(ggH_minloHJ))])) v_ratio_minloHJ_lo = TVectorD(len(ggH_minloHJ), array('d',[ggH_minloHJ_NNLOunc_lo[i]/ggH_minloHJ[i] for i in range(len(ggH_minloHJ))])) + v_ratio_aMC = TVectorD(len(ggH_aMC), array('d',[ggH_aMC[i]/ggH_minloHJ[i] for i in range(len(ggH_aMC))])) + v_ratio_aMC_hi = TVectorD(len(ggH_aMC), array('d',[ggH_aMC_NNLOunc_hi[i]/ggH_minloHJ[i] for i in range(len(ggH_aMC))])) + v_ratio_aMC_lo = TVectorD(len(ggH_aMC), array('d',[ggH_aMC_NNLOunc_lo[i]/ggH_minloHJ[i] for i in range(len(ggH_aMC))])) + v_ratio_powheg = TVectorD(len(ggH_powheg), array('d',[ggH_powheg[i]/ggH_minloHJ[i] for i in range(len(ggH_powheg))])) v_ratio_powheg_hi = TVectorD(len(ggH_powheg), array('d',[ggH_powheg_NLOunc_hi[i]/ggH_minloHJ[i] for i in range(len(ggH_powheg))])) v_ratio_powheg_lo = TVectorD(len(ggH_powheg), array('d',[ggH_powheg_NLOunc_lo[i]/ggH_minloHJ[i] for i in range(len(ggH_powheg))])) @@ -1416,24 +1527,11 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): g_ratio_datae0.SetMarkerSize(1.4) g_ratio_sys = TGraphAsymmErrors(v_observable,v_ratio_data,v_zeros,v_zeros,v_ratio_sys_lo,v_ratio_sys_hi) - g_ratio_sys.SetMarkerColor(ROOT.kRed+2) - g_ratio_sys.SetLineColor(ROOT.kRed+2) - g_ratio_sys.SetFillColor(ROOT.kRed+2) + g_ratio_sys.SetMarkerColor(ROOT.kPink+2) + g_ratio_sys.SetLineColor(ROOT.kPink+2) + g_ratio_sys.SetFillColor(ROOT.kPink+2) g_ratio_sys.SetLineWidth(5) - # g_ratio_powheg = TGraphAsymmErrors(v_observable_1,v_ratio_powheg,v_dobservable_1,v_dobservable_1,v_ratio_powheg_lo,v_ratio_powheg_hi) - # g_ratio_powheg.SetFillStyle(3254); - # g_ratio_powheg.SetFillColor(ROOT.kAzure+2) - # g_ratio_powheg.SetLineColor(ROOT.kAzure+2) - # g_ratio_powheg.SetLineWidth(2) - # g_ratio_powheg.SetMarkerColor(ROOT.kAzure+2) - # - # g_ratio_powhegBorder = TGraphAsymmErrors(v_observable_1,v_ratio_powheg,v_dobservable_1,v_dobservable_1,v_ratio_powheg_lo,v_ratio_powheg_hi) - # g_ratio_powhegBorder.SetFillStyle(0); - # g_ratio_powhegBorder.SetFillColor(ROOT.kAzure+2) - # g_ratio_powhegBorder.SetLineColor(ROOT.kAzure+2) - # g_ratio_powhegBorder.SetMarkerColor(ROOT.kAzure+2) - g_ratio_powhege0 = TGraphAsymmErrors(v_observable,v_ratio_powheg,v_dobservable,v_dobservable,v_zeros,v_zeros) g_ratio_powhege0.SetFillStyle(3254); g_ratio_powhege0.SetFillColor(ROOT.kAzure+2) @@ -1472,8 +1570,8 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): g_ratio_powhegBorder.SetLineColor(ROOT.kAzure+2) g_ratio_powhegBorder.SetMarkerColor(ROOT.kAzure+2) - h_ratio_powheg = TH1D("h_ratio_powheg","h_ratio_powheg",nBins-1, 0, nBins-1) - for i in range(nBins-1): + h_ratio_powheg = TH1D("h_ratio_powheg","h_ratio_powheg",4, 0, 4) + for i in range(4): h_ratio_powheg.SetBinContent(i+1,v_ratio_powheg[i]) else: g_ratio_powheg = TGraphAsymmErrors(v_observable_1,v_ratio_powheg,v_dobservable_1,v_dobservable_1,v_ratio_powheg_lo,v_ratio_powheg_hi) @@ -1501,26 +1599,6 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): h_ratio_powheg.SetLineColor(ROOT.kAzure+2) h_ratio_powheg.SetLineWidth(2) - # g_ratio_minloHJ = TGraphAsymmErrors(v_observable_2,v_ratio_minloHJ,v_dobservable_2,v_dobservable_2,v_ratio_minloHJ_lo,v_ratio_minloHJ_hi) - # g_ratio_minloHJ.SetFillStyle(3245); - # g_ratio_minloHJ.SetFillColor(ROOT.kOrange+2) - # g_ratio_minloHJ.SetLineColor(ROOT.kOrange+2) - # g_ratio_minloHJ.SetLineWidth(2) - # g_ratio_minloHJ.SetMarkerColor(ROOT.kOrange+2) - # - # g_ratio_minloHJBorder = TGraphAsymmErrors(v_observable_2,v_ratio_minloHJ,v_dobservable_2,v_dobservable_2,v_ratio_minloHJ_lo,v_ratio_minloHJ_hi) - # g_ratio_minloHJBorder.SetFillStyle(0); - # g_ratio_minloHJBorder.SetFillColor(ROOT.kOrange+2) - # g_ratio_minloHJBorder.SetLineColor(ROOT.kOrange+2) - # g_ratio_minloHJBorder.SetMarkerColor(ROOT.kOrange+2) - - # g_ratio_minloHJe0 = TGraphAsymmErrors(v_observable,v_ratio_minloHJ,v_dobservable,v_dobservable,v_zeros,v_zeros) - # g_ratio_minloHJe0.SetFillStyle(3245); - # g_ratio_minloHJe0.SetFillColor(ROOT.kOrange+2) - # g_ratio_minloHJe0.SetLineColor(ROOT.kOrange+2) - # g_ratio_minloHJe0.SetLineWidth(2) - # g_ratio_minloHJe0.SetMarkerColor(ROOT.kOrange+2) - if (obsName.startswith("mass4l")): g_ratio_minloHJ = TGraphAsymmErrors(v_observable_2,v_ratio_minloHJ,v_dobservable_2,v_dobservable_2,v_ratio_minloHJ_lo,v_ratio_minloHJ_hi) @@ -1554,22 +1632,22 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): g_ratio_minloHJBorder.SetLineColor(ROOT.kOrange+2) g_ratio_minloHJBorder.SetMarkerColor(ROOT.kOrange+2) - h_ratio_minloHJ = TH1D("h_ratio_minloHJ","h_ratio_minloHJ",nBins-1, 0, nBins-1) - for i in range(nBins-1): + h_ratio_minloHJ = TH1D("h_ratio_minloHJ","h_ratio_minloHJ",4, 0, 4) + for i in range(4): h_ratio_minloHJ.SetBinContent(i+1,v_ratio_minloHJ[i]) elif acFlag: # We keep the same names as in the last else (just to reduce entropy with if statements) g_ratio_minloHJ = TGraphAsymmErrors(v_observable_2,v_ratio_AC,v_dobservable_2,v_dobservable_2,v_ratio_AC_lo,v_ratio_AC_hi) g_ratio_minloHJ.SetFillStyle(3245); - g_ratio_minloHJ.SetFillColor(ROOT.kRed+2) - g_ratio_minloHJ.SetLineColor(ROOT.kRed+2) + g_ratio_minloHJ.SetFillColor(ROOT.kPink+2) + g_ratio_minloHJ.SetLineColor(ROOT.kPink+2) g_ratio_minloHJ.SetLineWidth(2) - g_ratio_minloHJ.SetMarkerColor(ROOT.kRed+2) + g_ratio_minloHJ.SetMarkerColor(ROOT.kPink+2) g_ratio_minloHJBorder = TGraphAsymmErrors(v_observable_2,v_ratio_AC,v_dobservable_2,v_dobservable_2,v_ratio_AC_lo,v_ratio_AC_hi) g_ratio_minloHJBorder.SetFillStyle(0); - g_ratio_minloHJBorder.SetFillColor(ROOT.kRed+2) - g_ratio_minloHJBorder.SetLineColor(ROOT.kRed+2) - g_ratio_minloHJBorder.SetMarkerColor(ROOT.kRed+2) + g_ratio_minloHJBorder.SetFillColor(ROOT.kPink+2) + g_ratio_minloHJBorder.SetLineColor(ROOT.kPink+2) + g_ratio_minloHJBorder.SetMarkerColor(ROOT.kPink+2) if acFlagBis: g_ratioBis_minloHJ = TGraphAsymmErrors(v_observable_2,v_ratio_ACbis,v_dobservable_2,v_dobservable_2,v_ratio_ACbis_lo,v_ratio_ACbis_hi) @@ -1620,9 +1698,34 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): for i in range(nBins-1): h_ratio_minloHJ.SetBinContent(i+1,v_ratio_minloHJ[i]) - if not acFlag: h_ratio_minloHJ.SetLineColor(ROOT.kOrange+2) + g_ratio_aMC = TGraphAsymmErrors(v_observable_3,v_ratio_aMC,v_dobservable_3,v_dobservable_3,v_ratio_aMC_lo,v_ratio_aMC_hi) + g_ratio_aMC.SetFillStyle(3245); + g_ratio_aMC.SetFillColor(ROOT.kPink+2) + g_ratio_aMC.SetLineColor(ROOT.kPink+2) + g_ratio_aMC.SetLineWidth(2) + g_ratio_aMC.SetMarkerColor(ROOT.kPink+2) + + g_ratio_aMCBorder = TGraphAsymmErrors(v_observable_3,v_ratio_aMC,v_dobservable_3,v_dobservable_3,v_ratio_aMC_lo,v_ratio_aMC_hi) + g_ratio_aMCBorder.SetFillStyle(0); + g_ratio_aMCBorder.SetFillColor(ROOT.kPink+2) + g_ratio_aMCBorder.SetLineColor(ROOT.kPink+2) + g_ratio_aMCBorder.SetMarkerColor(ROOT.kPink+2) + + if ("jet" in obsName and (not obsName.startswith("njets"))): + h_ratio_aMC = TH1D("h_ratio_aMC","h_ratio_aMC",nBins-2, array('d',[float(obs_bins[i]) for i in range(1,len(obs_bins))]) ) + for i in range(1,nBins-1): + h_ratio_aMC.SetBinContent(i,v_ratio_aMC[i]) + else: + h_ratio_aMC = TH1D("h_ratio_aMC","h_ratio_aMC",nBins-1, array('d',[float(obs_bins[i]) for i in range(len(obs_bins))]) ) + for i in range(nBins-1): + h_ratio_aMC.SetBinContent(i+1,v_ratio_aMC[i]) + + if not acFlag: + h_ratio_minloHJ.SetLineColor(ROOT.kOrange+2) + h_ratio_aMC.SetLineColor(ROOT.kPink+2) else: - h_ratio_minloHJ.SetLineColor(ROOT.kRed+2) + h_ratio_minloHJ.SetLineColor(ROOT.kPink+2) + h_ratio_aMC.SetLineColor(ROOT.kPink+2) if acFlagBis: h_ratioBis_minloHJ.SetLineColor(ROOT.kViolet+2) h_ratioBis_minloHJ.SetLineWidth(2) @@ -1649,7 +1752,6 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): g_data_allunc.SetMarkerStyle(20) g_data_allunc.SetMarkerSize(1.2) - if (obsName=="pT4l"): label="p_{T}(H)" unit="GeV" @@ -1662,7 +1764,7 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): elif (obsName=="nJets" or obsName=="njets_pt30_eta4p7"): label = "N(jets)" unit = "" - elif (obsName=="njets_pt30_eta4p7"): + elif (obsName=="njets_pt30_eta2p5"): label = "N(jets)" unit = "" elif (obsName=="pTj1"): @@ -1724,24 +1826,13 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): elif obsName=="DL1": label = "D_{#Lambda 1}^{dec}" unit = "" - elif obsName=="DL1Zg": - label = "D_{#Lambda 1Zg}^{dec}" - unit = "" - elif obsName=="njets_pt30_eta4p7_pT4l": - label = "N_{j}" - label_2nd = "p_{T}(H)" - unit = "" - unit_2nd = "GeV" else: label = obsName - label_2nd = "" unit = "" - unit_2nd = "" c = TCanvas("c",obsName, 1400, 1400) if(opt.SETLOG): c.SetLogy() - # if (not obsName.startswith("mass4l")): - c.SetBottomMargin(0.35) + if (not obsName.startswith("mass4l")): c.SetBottomMargin(0.35) c.SetRightMargin(0.04) c.SetTopMargin(0.07) c.SetLeftMargin(0.18) @@ -1789,10 +1880,9 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): elif (obsName=="Dcp"): dummy.SetMaximum(1100*max(max(a_data),(max(a_ggH_powheg)))) elif (obsName=="D0hp"): dummy.SetMaximum(1100*max(max(a_data),(max(a_ggH_powheg)))) elif (obsName=="DL1"): dummy.SetMaximum(1100*max(max(a_data),(max(a_ggH_powheg)))) - elif (obsName=="DL1Zg"): dummy.SetMaximum(1100*max(max(a_data),(max(a_ggH_powheg)))) else: dummy.SetMaximum(55.0*max(max(a_data),(max(a_ggH_powheg)))) else: - if doubleDiff: dummy.SetMaximum(1.6*(max(max(a_data),(max(a_ggH_powheg)))+max(a_data_hi))) + if (obsName.startswith("mass4l")) or doubleDiff: dummy.SetMaximum(1.6*(max(max(a_data),(max(a_ggH_powheg)))+max(a_data_hi))) if doubleDiff: dummy.SetMaximum(2.0*(max(max(a_data),(max(a_ggH_powheg)))+max(a_data_hi))) elif (obsName=="massZ2"): dummy.SetMaximum(2.0*(max(max(a_data),(max(a_ggH_powheg)))+max(a_data_hi))) #AT elif (obsName=="massZ1"): dummy.SetMaximum(2.0*(max(max(a_data),(max(a_ggH_powheg)))+max(a_data_hi))) #AT @@ -1800,8 +1890,7 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): elif (obsName=="Dcp"): dummy.SetMaximum(2.0*(max(max(a_data),(max(a_ggH_powheg)))+max(a_data_hi))) #AT elif (obsName=="D0hp"): dummy.SetMaximum(2.5*(max(max(a_data),(max(a_ggH_powheg)))+max(a_data_hi))) #AT elif (obsName=="DL1"): dummy.SetMaximum(2.8*max(max(a_data),(max(a_ggH_powheg)))) - elif (obsName=="DL1Zg"): dummy.SetMaximum(2.8*max(max(a_data),(max(a_ggH_powheg)))) - else: dummy.SetMaximum(1.7*(max(max(a_ggH_powheg),(max(a_data)+max(a_data_hi))))) + else: dummy.SetMaximum(1.5*(max(max(a_ggH_powheg),(max(a_data)+max(a_data_hi))))) if (opt.SETLOG): dummy.SetMinimum(0.0601*max(min(a_data),(min(a_ggH_powheg)))) if (obsName.startswith("pTj1")): dummy.SetMinimum(0.0801*max(min(a_data),(min(a_ggH_powheg)))) @@ -1812,12 +1901,12 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): dummy.SetMarkerSize(0) dummy.GetXaxis().SetLabelSize(0.0) dummy.GetYaxis().SetLabelSize(0.04) - if (opt.SETLOG and (obsName.startswith('njets') or obsName.startswith('pTj1')) and not doubleDiff): + if (opt.SETLOG and (obsName.startswith('njets') or obsName.startswith('pTj1'))): dummy.SetMaximum(200.0*max(max(a_data),(max(a_ggH_powheg)))) dummy.GetXaxis().SetTitle("") else: dummy.GetXaxis().SetTitle("") - if (obsName.startswith('njets') and not doubleDiff): + if (obsName.startswith('njets')): dummy.GetXaxis().SetTitle('') dummy.GetXaxis().SetLabelSize(0.0) dummy.GetXaxis().SetBinLabel(1,'') @@ -1825,14 +1914,12 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): dummy.GetXaxis().SetBinLabel(3,'') dummy.GetXaxis().SetBinLabel(4,'') if (obsName.startswith("mass4l")): - dummy.GetXaxis().SetLabelSize(0.0) + dummy.GetXaxis().SetLabelSize(0.08) dummy.GetXaxis().SetBinLabel(1,'4l') dummy.GetXaxis().SetBinLabel(2,'2e2#mu') dummy.GetXaxis().SetBinLabel(3,'4#mu') dummy.GetXaxis().SetBinLabel(4,'4e') if doubleDiff: - if opt.SETLOG: - dummy.SetMaximum(1000000.0*max(max(a_data),(max(a_ggH_powheg)))) dummy.GetXaxis().SetLabelSize(0.08) dummy.GetXaxis().SetTitle('') for i in range(1,nBins-1): @@ -1844,24 +1931,24 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): # dummy.GetXaxis().SetBinLabel(5,'') dummy.GetXaxis().SetTitleSize(0.0) - # dummy.GetXaxis().SetRangeUser(-3.14,3.14) if (label=="inclusive"): dummy.GetYaxis().SetTitle("#sigma_{fid} (fb)") + elif (unit==''): + dummy.GetYaxis().SetTitle("d#sigma_{fid }/d"+label+" (fb)") elif doubleDiff: if unit==unit_2nd: dummy.GetYaxis().SetTitle("d^{2}#sigma_{fid }/d"+label+"d"+label_2nd+" (fb/"+unit+"^{2})") else: dummy.GetYaxis().SetTitle("d^{2}#sigma_{fid }/d"+label+"d"+label_2nd+" (fb/"+unit+unit_2nd+")") dummy.GetYaxis().SetTitleSize(0.04) - elif (unit==''): - dummy.GetYaxis().SetTitle("d#sigma_{fid }/d"+label+" (fb)") else: dummy.GetYaxis().SetTitle("d#sigma_{fid }/d"+label+" (fb/"+unit+")") - if (obsName.startswith('njets') and not doubleDiff): + if (obsName.startswith('njets')): dummy.GetYaxis().SetTitle("#sigma_{fid} (fb)") - dummy.GetYaxis().SetTitleOffset(1.2) + dummy.GetYaxis().SetTitleOffset(1.4) + #dummy.GetYaxis().SetTitleOffset(1.8) dummy.Draw("hist") h_XH.SetFillColor(kGreen-8) @@ -1878,20 +1965,18 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): legend . AddEntry(g_systematics,"Systematic uncertainty","l") # legend . AddEntry(g_modeldep,"Model dependence","f") if not acFlag: + legend . AddEntry(g_ggH_aMC , "gg#rightarrowH (aMC@NLO + JHUGen) + XH", "lf") legend . AddEntry(g_ggH_minloHJ , "gg#rightarrowH (NNLOPS + JHUGen) + XH", "lf") legend . AddEntry(g_ggH_powheg , "gg#rightarrowH (POWHEG + JHUGen) + XH", "lf") else: legend . AddEntry(g_ggH_powheg , "SM (POWHEG + JHUGen + Pythia)", "lf") - if (obsName=="D0m"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen f_{a3}=1 + Pythia)", "lf") - if (obsName=="Dcp"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen f_{a3}=0.5 + Pythia)", "lf") - if (obsName=="Dint"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen f_{a2}=0.5 + Pythia)", "lf") - if (obsName=="D0hp"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen f_{a2}=1 + Pythia)", "lf") + if (obsName=="D0m"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen fa3=1 + Pythia)", "lf") + if (obsName=="Dcp"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen fa3=0.5 + Pythia)", "lf") + if (obsName=="Dint"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen fa2=0.5 + Pythia)", "lf") + if (obsName=="D0hp"): legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen fa2=1 + Pythia)", "lf") if (obsName=="DL1"): - legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen f_{#Lambda 1}=1 + Pythia)", "lf") - legend . AddEntry(g_ggH_ACbis , "AC (POWHEG + JHUGen f_{#Lambda 1}=0.5 + Pythia)", "lf") - if (obsName=="DL1Zg"): - legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen f_{#Lambda 1}^{Z#gamma}=1 + Pythia)", "lf") - legend . AddEntry(g_ggH_ACbis , "AC (POWHEG + JHUGen f_{#Lambda 1}^{Z#gamma}=0.5 + Pythia)", "lf") + legend . AddEntry(g_ggH_AC , "AC (POWHEG + JHUGen faL1=1 + Pythia)", "lf") + legend . AddEntry(g_ggH_ACbis , "AC (POWHEG + JHUGen faL1=0.5 + Pythia)", "lf") #legend . AddEntry(g_XH , "XH = VBF + VH + ttH", "l") if not acFlag: legend . AddEntry(h_XH , "XH = VBF + VH + ttH (POWHEG + JHUGen)", "f") legend . AddEntry(dummy, "(LHCHWG YR4, m_{H}="+opt.THEORYMASS+" GeV)", "") @@ -1907,7 +1992,9 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): h_ggH_AC.Draw("histsame") if acFlagBis: h_ggH_ACbis.Draw("histsame") - else: h_ggH_minloHJ.Draw("histsame") + else: + h_ggH_minloHJ.Draw("histsame") + h_ggH_aMC.Draw("histsame") g_ggH_powheg.Draw("5same") g_ggH_powhegBorder.Draw("5same") #g_ggH_powhege0.Draw("epsame") @@ -1920,10 +2007,10 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): else: g_ggH_minloHJ.Draw("5same") g_ggH_minloHJBorder.Draw("5same") - #g_ggH_minloHJe0.Draw("epsame") - #g_XH.Draw("2same") - #g_XH.Draw("fsame") + g_ggH_aMC.Draw("5same") + g_ggH_aMCBorder.Draw("5same") + if not acFlag: h_XH.Draw("histsame") # g_modeldep.Draw("2same0") # g_modeldep.Draw("psame") @@ -1936,11 +2023,7 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): latex2.SetTextSize(0.5*c.GetTopMargin()) latex2.SetTextFont(42) latex2.SetTextAlign(31) # align right - # print opt.LUMISCALE - # if (not opt.LUMISCALE=="1.0"): - # lumi = round(137.1*float(opt.LUMISCALE),1) - # latex2.DrawLatex(0.94, 0.94,str(lumi)+" fb^{-1} (13 TeV)") - # else: + if(opt.YEAR=='2016'): latex2.DrawLatex(0.92, 0.95,"36.3 fb^{-1} (13 TeV)") if(opt.YEAR=='2017'): @@ -1986,118 +2069,121 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): dummy.Draw("axissame") - # if (not obsName.startswith("mass4l")): - pad = TPad("pad", "pad", 0.0, 0.0, 1.0, 1.0) - pad.SetTopMargin(0.65) - pad.SetRightMargin(0.04) - pad.SetLeftMargin(0.18) - pad.SetFillColor(0) - pad.SetGridy(1) - pad.SetFillStyle(0) - pad.Draw() - pad.cd(0) - - if (obsName.startswith("mass4l")): - dummy2 = TH1D("dummy2","dummy2", 4, 0, 4) - for i in range(1,5): - dummy2.SetBinContent(i,1.02) - dummy2.GetXaxis().SetLabelSize(0.06) - dummy2.GetXaxis().SetBinLabel(1,'4l') - dummy2.GetXaxis().SetBinLabel(2,'2e2#mu') - dummy2.GetXaxis().SetBinLabel(3,'4#mu') - dummy2.GetXaxis().SetBinLabel(4,'4e') - elif doubleDiff: - dummy2 = TH1D("dummy2","dummy2", nBins-1, 0, nBins-1) - for i in range(1,nBins-1): - dummy2.SetBinContent(i,1.02) - dummy2.GetXaxis().SetTitle("") - dummy2.GetXaxis().SetLabelSize(0.035) - for i in range(1,nBins): - dummy2.GetXaxis().SetBinLabel(i,'Bin '+str(i-1)) - # dummy2.GetXaxis().SetBinLabel(1,'0') - # dummy2.GetXaxis().SetBinLabel(2,'1') - # dummy2.GetXaxis().SetBinLabel(3,'2') - # dummy2.GetXaxis().SetBinLabel(4,'3') - # dummy2.GetXaxis().SetBinLabel(5,'4') - else: - if ("jet" in obsName and (not obsName.startswith("njets"))): - dummy2 = TH1D("dummy2","dummy2", int(float(obs_bins[nBins-1])-float(obs_bins[1])), float(obs_bins[1]), float(obs_bins[nBins-1])) - for i in range(int(float(obs_bins[nBins-1])-float(obs_bins[1]))): + if (not obsName.startswith("mass4l")): + pad = TPad("pad", "pad", 0.0, 0.0, 1.0, 1.0) + pad.SetTopMargin(0.65) + pad.SetRightMargin(0.04) + pad.SetLeftMargin(0.18) + pad.SetFillColor(0) + pad.SetGridy(1) + pad.SetFillStyle(0) + pad.Draw() + pad.cd(0) + + if (obsName.startswith("mass4l")): + dummy2 = TH1D("dummy2","dummy2", 4, 0, 4) + for i in range(1,5): + dummy2.SetBinContent(i,1.02) + dummy2.GetXaxis().SetLabelSize(0.08) + dummy2.GetXaxis().SetBinLabel(1,'4l') + dummy2.GetXaxis().SetBinLabel(2,'2e2#mu') + dummy2.GetXaxis().SetBinLabel(3,'4#mu') + dummy2.GetXaxis().SetBinLabel(4,'4e') + elif doubleDiff: + dummy2 = TH1D("dummy2","dummy2", nBins-1, 0, nBins-1) + for i in range(1,nBins-1): dummy2.SetBinContent(i,1.02) + dummy2.GetXaxis().SetTitle("") + dummy2.GetXaxis().SetLabelSize(0.08) + for i in range(1,nBins): + dummy2.GetXaxis().SetBinLabel(i,'Bin '+str(i-1)) + # dummy2.GetXaxis().SetBinLabel(1,'0') + # dummy2.GetXaxis().SetBinLabel(2,'1') + # dummy2.GetXaxis().SetBinLabel(3,'2') + # dummy2.GetXaxis().SetBinLabel(4,'3') + # dummy2.GetXaxis().SetBinLabel(5,'4') else: - if (obsName=="pT4l"): - dummy2 = TH1D("dummy2","dummy2", int(float(obs_bins[nBins-1])-float(obs_bins[0])), float(obs_bins[0]), float(obs_bins[nBins-1])) + if ("jet" in obsName and (not obsName.startswith("njets"))): + dummy2 = TH1D("dummy2","dummy2", int(float(obs_bins[nBins-1])-float(obs_bins[1])), float(obs_bins[1]), float(obs_bins[nBins-1])) + for i in range(int(float(obs_bins[nBins-1])-float(obs_bins[1]))): + dummy2.SetBinContent(i,1.02) else: - dummy2 = TH1D("dummy2","dummy2", int(float(obs_bins[nBins-1])-float(obs_bins[0])), float(obs_bins[0]), float(obs_bins[nBins-1])) - for i in range(int(float(obs_bins[nBins-1])-float(obs_bins[0]))): - dummy2.SetBinContent(i,1.02) - dummy2.GetXaxis().SetLabelSize(0.04) - - dummy2.SetLineColor(0) - dummy2.SetMarkerColor(0) - dummy2.SetLineWidth(0) - dummy2.SetMarkerSize(0) - if (obsName.startswith('njets') and not doubleDiff): - dummy2.GetXaxis().SetTitle(label) - dummy2.GetXaxis().SetLabelSize(0.08) - dummy2.GetXaxis().SetBinLabel(1,'0') - dummy2.GetXaxis().SetBinLabel(2,'1') - dummy2.GetXaxis().SetBinLabel(3,'2') - dummy2.GetXaxis().SetBinLabel(4,' 3') - dummy2.GetXaxis().SetBinLabel(5,'#geq 4') - elif (label=="inclusive"): - dummy2.GetXaxis().SetTitle("") - elif doubleDiff: - dummy2.GetXaxis().SetTitle("") - elif (unit==""): - dummy2.GetXaxis().SetTitle(label) - else: - dummy2.GetXaxis().SetTitle(label+" ("+unit+")") - - dummy2.GetYaxis().SetLabelSize(0.03) - dummy2.GetYaxis().SetNdivisions(10); - if (obsName.startswith("pTj1")): dummy2.GetYaxis().SetNdivisions(8); - dummy2.GetXaxis().SetNdivisions(510) - ratiomax=1.0 - for i in range(len(data_hi)): - if ((data[i]+data_hi[i])/ggH_minloHJ[i]>ratiomax): ratiomax=(data[i]+data_hi[i])/ggH_minloHJ[i] - dummy2.SetMaximum(ratiomax*1.1) - if (obsName=="pT4l"): - dummy2.SetMaximum(ratiomax*1.04) - dummy2.GetYaxis().SetNdivisions(508) - dummy2.SetMinimum(0.0) - dummy2.Draw("hist") - dummy2.GetYaxis().CenterTitle() - dummy2.GetYaxis().SetTitleSize(0.04) - dummy2.GetYaxis().SetTitleOffset(1.5) - dummy2.GetYaxis().SetTitleSize(0.03) - dummy2.GetYaxis().SetTitleOffset(2.0) - if acFlag: dummy2.GetYaxis().SetTitle('Ratio to SM') - else: dummy2.GetYaxis().SetTitle('Ratio to NNLOPS') - - - h_ratio_powheg.Draw("histsame") - h_ratio_minloHJ.Draw("histsame") - if acFlagBis: h_ratioBis_minloHJ.Draw("histsame") - - g_ratio_minloHJ.Draw("5same") - g_ratio_minloHJBorder.Draw("5same") - if acFlagBis: - g_ratioBis_minloHJ.Draw("5same") - g_ratioBis_minloHJBorder.Draw("5same") - #g_ratio_minloHJe0.Draw("epsame") - - g_ratio_powheg.Draw("5same") - g_ratio_powhegBorder.Draw("5same") - #g_ratio_powhege0.Draw("epsame") - - g_ratio_data.Draw("psameZ0") - g_ratio_sys.Draw("psameZ0") - g_ratio_datae0.Draw("psame") - - dummy2.GetYaxis().SetRangeUser(0,3) - # dummy2.GetXaxis().SetRangeUser(-3.14,3.14) - dummy2.Draw("axissame") + if (obsName=="pT4l"): + dummy2 = TH1D("dummy2","dummy2", int(float(obs_bins[nBins-1])-float(obs_bins[0])), float(obs_bins[0]), float(obs_bins[nBins-1])) + else: + dummy2 = TH1D("dummy2","dummy2", int(float(obs_bins[nBins-1])-float(obs_bins[0])), float(obs_bins[0]), float(obs_bins[nBins-1])) + for i in range(int(float(obs_bins[nBins-1])-float(obs_bins[0]))): + dummy2.SetBinContent(i,1.02) + if doubleDiff:dummy2.GetXaxis().SetLabelSize(0.08) + else: dummy2.GetXaxis().SetLabelSize(0.04) + + dummy2.SetLineColor(0) + dummy2.SetMarkerColor(0) + dummy2.SetLineWidth(0) + dummy2.SetMarkerSize(0) + if (obsName.startswith('njets')): + dummy2.GetXaxis().SetTitle(label) + dummy2.GetXaxis().SetLabelSize(0.08) + dummy2.GetXaxis().SetBinLabel(1,'0') + dummy2.GetXaxis().SetBinLabel(2,'1') + dummy2.GetXaxis().SetBinLabel(3,'2') + dummy2.GetXaxis().SetBinLabel(4,' 3') + dummy2.GetXaxis().SetBinLabel(5,'#geq 4') + elif (label=="inclusive"): + dummy2.GetXaxis().SetTitle("") + elif (unit==""): + dummy2.GetXaxis().SetTitle(label) + elif doubleDiff: + dummy2.GetXaxis().SetTitle("") + else: + dummy2.GetXaxis().SetTitle(label+" ("+unit+")") + + dummy2.GetYaxis().SetLabelSize(0.03) + dummy2.GetYaxis().SetNdivisions(10); + if (obsName.startswith("pTj1")): dummy2.GetYaxis().SetNdivisions(8); + dummy2.GetXaxis().SetNdivisions(510) + ratiomax=1.0 + for i in range(len(data_hi)): + if ((data[i]+data_hi[i])/ggH_minloHJ[i]>ratiomax): ratiomax=(data[i]+data_hi[i])/ggH_minloHJ[i] + dummy2.SetMaximum(ratiomax*1.1) + if (obsName=="pT4l"): + dummy2.SetMaximum(ratiomax*1.04) + dummy2.GetYaxis().SetNdivisions(508) + dummy2.SetMinimum(0.0) + dummy2.Draw("hist") + dummy2.GetYaxis().CenterTitle() + dummy2.GetYaxis().SetTitleSize(0.04) + dummy2.GetYaxis().SetTitleOffset(1.5) + dummy2.GetYaxis().SetTitleSize(0.03) + dummy2.GetYaxis().SetTitleOffset(2.0) + if acFlag: dummy2.GetYaxis().SetTitle('Ratio to SM') + else: dummy2.GetYaxis().SetTitle('Ratio to NNLOPS') + + + h_ratio_powheg.Draw("histsame") + h_ratio_minloHJ.Draw("histsame") + h_ratio_aMC.Draw("histsame") + if acFlagBis: h_ratioBis_minloHJ.Draw("histsame") + + g_ratio_minloHJ.Draw("5same") + g_ratio_minloHJBorder.Draw("5same") + g_ratio_aMC.Draw("5same") + g_ratio_aMCBorder.Draw("5same") + if acFlagBis: + g_ratioBis_minloHJ.Draw("5same") + g_ratioBis_minloHJBorder.Draw("5same") + #g_ratio_minloHJe0.Draw("epsame") + + g_ratio_powheg.Draw("5same") + g_ratio_powhegBorder.Draw("5same") + #g_ratio_powhege0.Draw("epsame") + + g_ratio_data.Draw("psameZ0") + g_ratio_sys.Draw("psameZ0") + g_ratio_datae0.Draw("psame") + + dummy2.GetYaxis().SetRangeUser(0,3) + dummy2.Draw("axissame") if (obsName=="pT4l"): box = TPaveText(240,-0.4,260,-0.1) @@ -2193,21 +2279,12 @@ def plotXS(obsName, obs_bins, obs_bins_boundaries = False): acFlagBis = True acSample = '0L1' acSampleBis = '0L1f05ph0' -elif obs_name == 'DL1Zg': - acFlag = True - acFlagBis = True - acSample = '0L1Zg' - acSampleBis = '0L1Zgf05ph0' else: acFlag = False acFlagBis = False if not doubleDiff: - if obs_name == 'TBjmax' or obs_name == 'mjj': - obs_bins[len(obs_bins)-1]='500.0' - elif obs_name == 'absdetajj': - obs_bins[0]='-1.0' - elif float(obs_bins[len(obs_bins)-1])>300.0: + if float(obs_bins[len(obs_bins)-1])>300.0: obs_bins[len(obs_bins)-1]='250.0' if (opt.OBSNAME=="nJets" or opt.OBSNAME.startswith("njets")): obs_bins[len(obs_bins)-1]='5'