s = options.signalType if options.inputFile == '': inputDir = "Dc" + ("_CR" if options.region == "CR" else "") + "_" + (s if s != "" else "XWW") + "/" inputDC = inputDir + "combined_" + YEAR + ".root" else: inputDC = options.inputFile sigSF = -1. sigStr = "" sigLgd = "" sigColor = ROOT.kRed sigLabel = "" plotter = RooPlotter(inputDC) if options.fixMX is not None: plotter.fix("MH", options.fixMX) if options.fixR is not None: plotter.fix("r", options.fixR) if options.fit: data = "data_obs" plotter.prefit(verbose=VERBOSE, data=data) if s != "": plotter.addContribution(s, True, sigLgd, 2, 1, sigColor, 0, ROOT.kWhite) plotter.addContribution("res", False, "W+V/t", 1, 1, ROOT.TColor.GetColor("#0F5500"), 1001, ROOT.TColor.GetColor("#60B037"), ("", "_opt")[OPTINRESW]) #4CB319"))
inputDC = inputDir + "combined_" + YEAR + ".root" else: inputDC = options.inputFile prefix = ('PreFit_', 'PostFit_')[options.fit] + "_" directory = 'Plots_' + prefix + (s if s != "" else "Bonly") + '_' + YEAR os.system("mkdir -p " + directory) sigSF = -1. sigStr = "" sigLgd = "" sigColor = 0 sigLabel = "" sigLgd += "W" sigColor = ROOT.kRed - 3 plotter = RooPlotter(inputDC) if options.fixR is not None: plotter.fix("r", options.fixR) if options.fit: plotter.prefit(verbose=VERBOSE) if s != "": plotter.addContribution("W", True, sigLgd, 2, 1, sigColor, 0, ROOT.kWhite) plotter.addContribution("bkg", False, "Background", 1, 1, ROOT.TColor.GetColor("#0041AA"), 1001, ROOT.TColor.GetColor("#A5D2FF")) l = 'allL' pur = options.purity c = 'allC'
from CMGTools.VVResonances.plotting.RooPlotter import * from CMGTools.VVResonances.plotting.CMS_lumi import * import ROOT ROOT.gSystem.Load("libHiggsAnalysisCombinedLimit") plotter = RooPlotter("combined.root") plotter.fix("MH", 2000) plotter.fix("r", 0.0) plotter.prefit() #plotter.addContribution("XWW",True,"X #rightarrow WW",3,1,ROOT.kOrange+10,0,ROOT.kWhite) plotter.addContribution("topRes", False, " t#bar{t} (W)", 2, 1, ROOT.kBlack, 1001, ROOT.kTeal - 1) plotter.addContribution("WW", False, "SM WW", 2, 1, ROOT.kBlack, 1001, ROOT.kOrange) plotter.addContribution("WZ", False, "SM WZ", 2, 1, ROOT.kBlack, 1001, ROOT.kOrange + 10) plotter.addContribution("Wjets", False, "V+jets", 2, 1, ROOT.kBlack - 3, 1001, ROOT.kAzure - 9, "_opt") #plotter.addContribution("Wjets_quark",False,"V+jets(q)",2,1,ROOT.kBlack-3,1001,ROOT.kAzure-9) #plotter.addContribution("Wjets_gluon",False,"V+jets(g)",2,1,ROOT.kBlack-3,1001,ROOT.kBlue+1) plotter.addContribution("topNonRes", False, "t#bar{t} (other)", 2, 1, ROOT.kBlack, 1001, ROOT.kSpring - 5, "_opt") plotter.drawStack("MJ", "m_{j} [GeV]", "nob_mu_HP_13TeV") # #plotter=RooPlotter("LNuJJ_topPreFit_HP.root") #plotter.prefit() #plotter.addContribution("topRes",True,"t#bar{t}",1,1,ROOT.kRed,0,ROOT.kWhite) #plotter.addContribution("topNonRes",False,"non-resonant t#bar{t}",1,1,ROOT.kBlack,1001,ROOT.kGreen-5) #plotter.drawStack("MJ","m_{j} [GeV]","top_mu_HP_13TeV","top_mu_HP_13TeV")
def makePostFit(card, MH, slices, bkgOnly=True, cut=''): ROOT.gSystem.Load('libHiggsAnalysisCombinedLimit') plotter = RooPlotter(card) plotter.fix("MH", MH) if bkgOnly: plotter.fix("r", 0.0) else: plotter.addContribution("XWW", True, "X #rightarrow WW", 3, 1, ROOT.kOrange + 10, 0, ROOT.kWhite) plotter.prefit() plotter.addContribution("topRes", False, " t#bar{t} (W)", 2, 1, ROOT.kBlack, 1001, ROOT.kTeal - 1) plotter.addContribution("WW", False, "SM WW", 2, 1, ROOT.kBlack, 1001, ROOT.kOrange) plotter.addContribution("WZ", False, "SM WZ", 2, 1, ROOT.kBlack, 1001, ROOT.kOrange + 10) plotter.addContribution("Wjets", False, "V+jets", 2, 1, ROOT.kBlack - 3, 1001, ROOT.kAzure - 9, "_opt") plotter.addContribution("topNonRes", False, "t#bar{t} (other)", 2, 1, ROOT.kBlack, 1001, ROOT.kSpring - 5, "_opt") for s in slices: if s.find('nob') != -1: blind = 1 else: blind = 0 plotter.drawStack("MJ", "M_{j} (GeV)", s, cut, blind) cmslabel_prelim(plotter.canvas, period, 11) plotter.canvas.SaveAs(directory + "/MJ_" + s + ".png") plotter.canvas.SaveAs(directory + "/MJ_" + s + ".pdf") plotter.canvas.SaveAs(directory + "/MJ_" + s + ".root") plotter.drawStack("MLNuJ", "M_{VV} (GeV)", s, cut, blind, 1) cmslabel_prelim(plotter.canvas, period, 11) plotter.canvas.SaveAs(directory + "/MVV_" + s + ".png") plotter.canvas.SaveAs(directory + "/MVV_" + s + ".pdf") plotter.canvas.SaveAs(directory + "/MVV_" + s + ".root")
canvas.SaveAs(name + ".eps") os.system("convert -density 150 -quality 100 " + name + ".eps " + name + ".png") os.system("rm " + name + ".eps") def cmsLabel(canvas): #cmslabel_not(canvas,'2016',11) #cmslabel_prelim(canvas,'2016',11) cmslabel_final(canvas, '2016', 11) directory = 'PlotsPostFit_' + options.signalType os.system("mkdir -p " + directory) plotter = RooPlotter(options.inputFile) s = options.signalType if s == 'XWW': plotter.fix("MH", 2000) elif s == 'XWZ': plotter.fix("MH", 2000) if options.fixR is not None: plotter.fix("r", options.fixR) plotter.prefit() if options.rForWeight is not None: plotter.fix("r", options.rForWeight) if s == 'XWW':
from CMGTools.VVResonances.plotting.RooPlotter import * import ROOT ROOT.gSystem.Load("libHiggsAnalysisCombinedLimit") plotter = RooPlotter("combined.root") plotter.fix("MH", 2000) plotter.fix("r", 0.0) plotter.prefit() plotter.addContribution("XWW", True, "X #rightarrow WW", 3, 1, ROOT.kOrange + 10, 0, ROOT.kWhite) plotter.addContribution("QCD", False, "QCD", 2, 1, ROOT.kBlack, 1001, ROOT.kAzure - 9) plotter.drawStack("MVV", "m_{jj} [GeV]", "WW_dijet_HP_13TeV", "WW_dijet_HP_13TeV") #plotter=RooPlotter("LNuJJ_topPreFit_HP.root") #plotter.prefit() #plotter.addContribution("topRes",True,"t#bar{t}",1,1,ROOT.kRed,0,ROOT.kWhite) #plotter.addContribution("topNonRes",False,"non-resonant t#bar{t}",1,1,ROOT.kBlack,1001,ROOT.kGreen-5) #plotter.drawStack("MJ","m_{j} [GeV]","top_mu_HP_13TeV","top_mu_HP_13TeV")
from CMGTools.VVResonances.plotting.RooPlotter import * from CMGTools.VVResonances.plotting.CMS_lumi import * import ROOT ROOT.gSystem.Load("libHiggsAnalysisCombinedLimit") plotter = RooPlotter("combinedWZ.root") plotter.fix("MH", 1350) #plotter.fix("r",0.0) plotter.prefit() #plotter.fix("r",0.021) #plotter.addContribution("XWW",True,"X #rightarrow WW",3,1,ROOT.kOrange+10,0,ROOT.kWhite) plotter.addContribution("XWZ", True, "X #rightarrow WZ", 3, 1, ROOT.kOrange + 10, 0, ROOT.kWhite) plotter.addContribution("resW", False, " resonant (W,t)", 2, 1, ROOT.kBlack, 1001, ROOT.kSpring - 5) plotter.addContribution("nonRes", False, "non resonant", 2, 1, ROOT.kBlack, 1001, ROOT.kAzure - 9, "_opt") for c in ['nob']: if c == 'vbf': pur = ['NP'] else: pur = ['HP', 'LP'] for p in pur: for l in ['e', 'mu']: continue # plotter.drawBinned("MLNuJ","m_{VV} (GeV)",c+"_"+l+"_"+p+"_13TeV",[],0,1,"") # cmslabel_prelim(plotter.pad1,'2016',11)
elif s == "VBFWprToWZ": sigLgd += "VBF W'" + ("" if options.fixMX is None else "#scale[0.9]{(" + mx + " TeV)}") + "#rightarrowWZ" sigColor = ROOT.kViolet - 5 elif s == "VBFWprToWH": sigLgd += "VBF W'" + ("" if options.fixMX is None else "#scale[0.9]{(" + mx + " TeV)}") + "#rightarrowWH" sigColor = ROOT.kViolet + 6 sigLabel = "" if options.dispR is None else "#scale[0.9]{(#sigma #times BR = " + sx + " pb)}" doMjj = options.variable == '' or options.variable == 'mjj' doMvv = options.variable == '' or options.variable == 'mvv' if doMjj: plotter = RooPlotter(inputDC) if options.nToys > 0: plotter.load_toys(options.toysFile, options.nToys) if options.fixMX is not None: plotter.fix("MH", options.fixMX) if options.fixR is not None: plotter.fix("r", options.fixR) if options.fit: if options.fitToy < 0: data = "data_obs" else: data = "toy_" + str(options.fitToy) plotter.prefit(verbose=VERBOSE, data=data)
from CMGTools.VVResonances.plotting.RooPlotter import * import ROOT ROOT.gSystem.Load("libHiggsAnalysisCombinedLimit") plotter = RooPlotter("combined.root") plotter.fix("MH", 2000) plotter.fix("r", 0.0) plotter.prefit() plotter.addContribution("XWW", True, "X #rightarrow WW", 3, 1, ROOT.kOrange + 10, 0, ROOT.kWhite) plotter.addContribution("topRes", False, " t#bar{t} (W)", 2, 1, ROOT.kBlack, 1001, ROOT.kTeal - 1) plotter.addContribution("topNonRes", False, "t#bar{t} (other)", 2, 1, ROOT.kBlack, 1001, ROOT.kGreen - 5) plotter.addContribution("Wjets_quark", False, "V+jets(q)", 2, 1, ROOT.kBlack - 3, 1001, ROOT.kAzure - 9) plotter.addContribution("Wjets_gluon", False, "V+jets(g)", 2, 1, ROOT.kBlack - 3, 1001, ROOT.kBlue + 1) plotter.drawStack("MJ", "m_{j} [GeV]", "b_e_HP_13TeV", "b_e_HP_13TeV") #plotter=RooPlotter("LNuJJ_topPreFit_HP.root") #plotter.prefit() #plotter.addContribution("topRes",True,"t#bar{t}",1,1,ROOT.kRed,0,ROOT.kWhite) #plotter.addContribution("topNonRes",False,"non-resonant t#bar{t}",1,1,ROOT.kBlack,1001,ROOT.kGreen-5) #plotter.drawStack("MJ","m_{j} [GeV]","top_mu_HP_13TeV","top_mu_HP_13TeV")