interpolate_path = option.interpolPath #mass_points = range(4,35) #mass_points = [4,7,10,15,20,25,30] mass_points = [4.04*1.005**i for i in range(434)] # ____________________________________________________________________________________________________________________________________________ || # mass window signal_models = [ #SignalModel("Zd_MZD"+str(m),["HZZd_M"+str(m),"ppZZd4l_M"+str(m)],m) for m in mass_points SignalModel("Zd_MZD"+str(m),["HZZd_M"+str(m),],m) for m in mass_points ] bkgs = [ BaseObject("Higgs"), BaseObject("qqZZ"), BaseObject("ggZZ"), BaseObject("ZPlusX", inputDir=option.zxShapeDir, TFileName="ParaShape.root", ) ] # ____________________________________________________________________________________________________________________________________________ || # bin list binList_Mu = [ Bin("MuMu_HiggsSR_SR",signalNames=["HZZd",],sysFile=lnSystFilePathDict["MuMu"],inputBinName="MuMu_HiggsSR",width=option.muWidth), Bin("MuMu_HiggsSR_SB",signalNames=["HZZd",],sysFile=lnSystFilePathDict["MuMu"],inputBinName="MuMu_HiggsSR",width=option.muWidth), Bin("ElMu_HiggsSR_SR",signalNames=["HZZd",],sysFile=lnSystFilePathDict["MuEl"],inputBinName="ElMu_HiggsSR",width=option.muWidth), Bin("ElMu_HiggsSR_SB",signalNames=["HZZd",],sysFile=lnSystFilePathDict["MuEl"],inputBinName="ElMu_HiggsSR",width=option.muWidth),
lines1 = textFile1.readlines() foundLine1 = False for line1 in lines1: if line1.startswith(lineStr): foundLine1 = True break textFilePath2 = os.path.join(inputDir2, dirTemplate % m, textFileName) textFile2 = open(textFilePath2, "r") lines2 = textFile2.readlines() foundLine2 = False for line2 in lines2: if line2.startswith(lineStr): foundLine2 = True break if not foundLine1 or not foundLine2: continue limit1 = float(line1.split()[-1]) limit2 = float(line2.split()[-1]) point = BaseObject(dirTemplate % m, mass=m, limit1=limit1, limit2=limit2) outPoints.append(point) print "Mass %s: %4.2f %%" % (m, (1. - limit2 / limit1) * 100) if outPlotPath: c = ROOT.TCanvas() hist = ROOT.TH1D(histName, title, len(outPoints), -0.5, len(outPoints) - 0.5) for i, p in enumerate(outPoints): hist.SetBinContent(i + 1, p.limit2 / p.limit1) hist.GetXaxis().SetBinLabel(i + 1, str(p.mass)) hist.SetStats(0) hist.Draw() c.SaveAs(outPlotPath)
} outputDir = option.outputDir interpolate_path = option.interpolPath TFileName = "StatInput.root" # ____________________________________________________________________________________________________________________________________________ || # mass window #mass_points = [4.04*1.005**i for i in range(551)] mass_points = [4.20*1.005**i for i in range(541)] #mass_points = [4,5,6,7,8,9,10,15,20,25,30,35,40,45,50,55,60] signal_models = [ SignalModel("Zd_MZD"+str(m),["HToZdZd_M"+str(m),],m,) for m in mass_points ] data = [ BaseObject("Data"), ] bkgs = [ BaseObject("Higgs"), #BaseObject("qqZZ"), #BaseObject("ggZZ"), BaseObject("ZZ"), BaseObject("WWZ"), BaseObject("ttZ"), BaseObject("ZPlusX", inputDir=option.zxShapeDir, TFileName="ParaShape.root", shapeFuncPostfix="_fitFunc", normHistPostfix="_norm", #countErrorFunc=getCountAndError
import ROOT,os from StatFW.BaseObject import BaseObject # ____________________________________________________________________________________ || #inputDir = "/raid/raid7/lucien/Higgs/DarkZ/ParaInput/DarkPhotonSelection_m4l100To170_Nominal/2019-07-31_m4lSR-m4lSB_HZZd-ppZZd_Run2016/" inputDir = "/raid/raid7/lucien/Higgs/DarkZ/ParaInput/DarkPhotonSelection_m4l100To170_Nominal/2019-07-31_m4lSR-m4lSB_HZZd-ppZZd_Run2017/" #inputDir = "/raid/raid7/lucien/Higgs/DarkZ/ParaInput/DarkPhotonSelection_m4l100To170_Nominal/2019-07-31_m4lSR-m4lSB_HZZd-ppZZd_Run2018/" massPoints = [ 7, 15, 30, ] sigModelStr = "HZZd_M" TFileName = "StatInput.root" finalStates = [ BaseObject("MuMu_HiggsSR",width=0.02,lep_e_unc=0.2), BaseObject("ElMu_HiggsSR",width=0.02,lep_e_unc=0.2), BaseObject("ElEl_HiggsSR",width=0.05,lep_e_unc=0.2), BaseObject("MuEl_HiggsSR",width=0.05,lep_e_unc=0.2), ] # ____________________________________________________________________________________ || for m in massPoints: print "="*20 print "Mass point: "+sigModelStr+str(m) inputFilePath = os.path.join(inputDir,sigModelStr+str(m),TFileName) inputFile = ROOT.TFile(inputFilePath,"READ") for fs in finalStates: hist = inputFile.Get(fs.name) dnBin = hist.GetXaxis().FindBin(m*(1.-fs.width)) upBin = hist.GetXaxis().FindBin(m*(1.+fs.width))
setLogY = True method = "HybridNew" #method = "AsymptoticLimits" plot = "BrHXX_Br2Xee" y_min = 4E-7 maxFactor = 10 max_force = 4E-5 x_label = "m_{X} [GeV]" leg_pos = [0.30, 0.65, 0.90, 0.87] drawVetoBox = True drawLegend = True massCutFunc = lambda x: x < 60.2 smoothing = True graphs = [ BaseObject("g1", window_func=lambda x: x < lowBoxCut), BaseObject("g2", window_func=lambda x: x > highBoxCut), ] # ________________________________________________________________ || # Read limit from directory # ________________________________________________________________ || outDict = pickle.load(open(picklePath, "r")) # ________________________________________________________________ || # Draw limit with outDict # ________________________________________________________________ || outputDir = os.path.dirname(outputPath) if not os.path.exists(outputDir): os.makedirs(outputDir) outGraphDict = {}
# ________________________________________________________________ || # CMS style # ________________________________________________________________ || CMS_lumi.cmsText = "CMS" CMS_lumi.extraText = "" ROOT.TGaxis.SetMaxDigits(8) CMS_lumi.cmsTextSize = 0.65 CMS_lumi.outOfFrame = True CMS_lumi.lumi_13TeV = "137 fb^{-1}" tdrstyle.setTDRStyle() quantiles = [ BaseObject( "down2", asymp_file_name="higgsCombineTest.AsymptoticLimits.mH120.root", hybridnew_file_name="higgsCombineTest.HybridNew.mH120.quant0.025.root", ), BaseObject( "down1", asymp_file_name="higgsCombineTest.AsymptoticLimits.mH120.root", hybridnew_file_name="higgsCombineTest.HybridNew.mH120.quant0.160.root", ), BaseObject( "central", asymp_file_name="higgsCombineTest.AsymptoticLimits.mH120.root", hybridnew_file_name="higgsCombineTest.HybridNew.mH120.quant0.500.root", ), BaseObject( "up1", asymp_file_name="higgsCombineTest.AsymptoticLimits.mH120.root",
# ____________________________________________________________________________________________________________________________________________ || #inputDir = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-12-06_SR2D_hadd_RunII/" #zxShapeDir = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2019-12-06_SR2D_hadd_RunII/" #outputDir = "/home/lucien/public_html/Higgs/HToZdZd/WindowYield/RunII/2019-12-06_SR2D/" #mass_points = [4.04*1.005**i for i in range(551)] inputDir = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2020-02-29_SR2D_RunII_hadd/" zxShapeDir = "/raid/raid7/lucien/Higgs/HToZdZd/DarkPhotonSR/StatInput/2020-02-29_SR2D_RunII_hadd/" outputDir = "/home/lucien/public_html/Higgs/HToZdZd/WindowYield/RunII/2020-02-29_SR2D/" mass_points = [4.20*1.005**i for i in range(541)] muWidth = 0.02 elWidth = 0.05 TFileName = "StatInput.root" channels = [ BaseObject("MuMu",inputBinName="MuMu",x_width=muWidth,y_width=muWidth), BaseObject("ElMu",inputBinName="ElMu",x_width=elWidth,y_width=muWidth), BaseObject("ElEl",inputBinName="ElEl",x_width=elWidth,y_width=elWidth), BaseObject("MuEl",inputBinName="MuEl",x_width=muWidth,y_width=elWidth), ] bkgs = [ BaseObject("qqZZ",color=ROOT.kBlue+2,latexName="qqZZ",), BaseObject("Higgs",color=ROOT.kAzure-2,latexName="Higgs",), BaseObject("ggZZ",color=ROOT.kBlue,latexName="ggZZ",), BaseObject("ZPlusX", inputDir=zxShapeDir, TFileName="ParaShape.root", #countErrorFunc=getCountAndError, shapeFuncPostfix="_fitFunc", normHistPostfix="_norm", color=ROOT.kGreen,
ROOT.gROOT.SetBatch(ROOT.kTRUE) parser = argparse.ArgumentParser() parser.add_argument("--inputDir", action="store") parser.add_argument("--outputPath", action="store") parser.add_argument("--selectStr", action="store", default="") option = parser.parse_args() inputDir = option.inputDir quantiles = [ BaseObject( "central", asymp_file_name="higgsCombineTest.Significance.mH120.expected.root", entry=0, #hybridnew_file_name="higgsCombineTest.HybridNew.mH120.quant0.500.root", ), BaseObject( "obs", asymp_file_name="higgsCombineTest.Significance.mH120.observed.root", entry=0, #asymp_file_name="higgsCombineTest.Significance.mH120.root", #hybridnew_file_name="higgsCombineTest.HybridNew.mH120.root", ), ] varName = "limit" # ________________________________________________________________ || # Read limit from directory # ________________________________________________________________ ||
TFileName = "StatInput.root" channels = [ #BaseObject("MuMu_HiggsSR",inputBinName="MuMu_HiggsSR",width=0.02), #BaseObject("ElMu_HiggsSR",inputBinName="ElMu_HiggsSR",width=0.02), #BaseObject("ElEl_HiggsSR",inputBinName="ElEl_HiggsSR",width=0.05), #BaseObject("MuEl_HiggsSR",inputBinName="MuEl_HiggsSR",width=0.05), #BaseObject("MuMu_HiggsLowSB",inputBinName="MuMu_HiggsLowSB",width=0.02), #BaseObject("ElMu_HiggsLowSB",inputBinName="ElMu_HiggsLowSB",width=0.02), #BaseObject("ElEl_HiggsLowSB",inputBinName="ElEl_HiggsLowSB",width=0.05), #BaseObject("MuEl_HiggsLowSB",inputBinName="MuEl_HiggsLowSB",width=0.05), #BaseObject("MuMu_HiggsHighSB",inputBinName="MuMu_HiggsHighSB",width=0.02), #BaseObject("ElMu_HiggsHighSB",inputBinName="ElMu_HiggsHighSB",width=0.02), #BaseObject("ElEl_HiggsHighSB",inputBinName="ElEl_HiggsHighSB",width=0.05), #BaseObject("MuEl_HiggsHighSB",inputBinName="MuEl_HiggsHighSB",width=0.05), BaseObject("Mu", inputBinName="Mu", width=0.02), BaseObject("El", inputBinName="El", width=0.05), ] bkgs = [ BaseObject( "qqZZ", color=ROOT.kBlue + 2, latexName="qqZZ", ), BaseObject( "Higgs", color=ROOT.kAzure - 2, latexName="Higgs", ), BaseObject( "ggZZ",
from StatFW.BaseObject import BaseObject import math # ____________________________________________________________________________________________________________________________________________ || higgs_boson = BaseObject( "Higgs Boson", xs=48.58, total_width=4.1E-03, mass=125.18, ZZ_br=2.64E-02, llll_br=0.0002768, vev=246.33, ) z_boson = BaseObject( "Z boson", mass=91.1876, #ll_br = 0.0679, ll_br=0.06729, ) ALP = BaseObject( "ALP", ll_br=1.0, ) mass_points = range(4, 35) #mass_points = range(4,63) # ____________________________________________________________________________________________________________________________________________ || def lambda_x_y_func(x, y):
process = "Zd" #method = "AsymptoticLimits" #method = "Significance" select_entry = { "AsymptoticLimits": 2, "Significance": 0, }[method] mass_points = [ #BaseObject(process+"_MZD4" ,color=ROOT.kRed,latexName="Z_{d} = 4 GeV"), #BaseObject(process+"_MZD10",color=ROOT.kBlue,latexName="Z_{d} = 10 GeV"), #BaseObject(process+"_MZD15",color=ROOT.kViolet,latexName="Z_{d} = 15 GeV"), #BaseObject(process+"_MZD20",color=ROOT.kGreen,latexName="Z_{d} = 20 GeV"), #BaseObject(process+"_MZD25",color=ROOT.kOrange,latexName="Z_{d} = 25 GeV"), #BaseObject(process+"_MZD30",color=ROOT.kBlack,latexName="Z_{d} = 30 GeV"), BaseObject(process+"_MZD4" ,color=ROOT.kRed,latexName="Z_{d} = 4 GeV"), BaseObject(process+"_MZD10",color=ROOT.kBlue,latexName="Z_{d} = 10 GeV"), BaseObject(process+"_MZD20",color=ROOT.kViolet,latexName="Z_{d} = 20 GeV"), BaseObject(process+"_MZD30",color=ROOT.kGreen,latexName="Z_{d} = 30 GeV"), BaseObject(process+"_MZD40",color=ROOT.kOrange,latexName="Z_{d} = 40 GeV"), BaseObject(process+"_MZD50",color=ROOT.kBlack,latexName="Z_{d} = 50 GeV"), BaseObject(process+"_MZD60",color=ROOT.kYellow+2,latexName="Z_{d} = 60 GeV"), ] mass_value_func = lambda x: int(x.split("_")[1].replace("MZD","")) #x_value_func = lambda x: float(x.split("_")[0].replace("Mu","").replace("p",".")) #x_value_func = lambda x: float(x.split("_")[1].replace("El","").replace("p",".")) x_value_func = lambda x: float(x) array_type = 'd' leg_pos = [0.70,0.45,0.89,0.57] ##__________________________________________________________________||
import os,ROOT,pickle from StatFW.BaseObject import BaseObject from hepdata_lib import Submission ROOT.gROOT.SetBatch(ROOT.kTRUE) out_name = 'hig19007_hepdata' config = [ BaseObject( "BrHXX_Br2Xee", plot = "BrHXX_Br2Xee", picklePath = os.environ["BASE_PATH"]+"/pickle/XX/2020-03-17_SR2D_RunII_El/limit.pkl", outputPath = "output/210816_v1/BrHXX_Br2Xee.C", method = "HybridNew", postfix = "_smooth", window_func = lambda x: x < 8.0 or x > 11.5, ), BaseObject( "BrHXX_Br2Xmumu", plot = "BrHXX_Br2XMuMu", picklePath = os.environ["BASE_PATH"]+"/pickle/XX/2020-03-17_SR2D_RunII_Mu/limit.pkl", outputPath = "output/210816_v1/BrHXX_Br2Xmumu.C", method = "HybridNew", postfix = "_smooth", window_func = lambda x: x < 8.0 or x > 11.5, ), BaseObject( "BrHXX_Br2Xll",