diff --git a/Tests/Rivet/LHC/LHC-13-Z-e.in b/Tests/Rivet/LHC/LHC-13-Z-e.in --- a/Tests/Rivet/LHC/LHC-13-Z-e.in +++ b/Tests/Rivet/LHC/LHC-13-Z-e.in @@ -1,14 +1,16 @@ # -*- ThePEG-repository -*- ################################################## # select the analyses ################################################## # ATLAS Z insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2015_CONF_2015_041_EL insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2017_I1514251 insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2019_I1753680:LMODE=EL insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2019_I1753680:LMODE=EMU insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2018_I1667854:LMODE=EMU # ATLAS Z+b jets insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2020_I1788444 # CMS mass spectrum insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2018_I1711625 +# ATLAS high pt jets +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2022_I2077570 diff --git a/Tests/Rivet/LHC/LHC-13-Z-mu.in b/Tests/Rivet/LHC/LHC-13-Z-mu.in --- a/Tests/Rivet/LHC/LHC-13-Z-mu.in +++ b/Tests/Rivet/LHC/LHC-13-Z-mu.in @@ -1,17 +1,22 @@ # -*- ThePEG-repository -*- ################################################## # select the analyses ################################################## # ATLAS Z insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2015_CONF_2015_041_MU insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2019_I1768911:LMODE=MU # ATLAS Z UE insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2019_I1736531 # CMS Z UE insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2017_I1635889 # CMS Z insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2019_I1753680:LMODE=MU insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2019_I1753680:LMODE=EMU insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2018_I1667854:LMODE=EMU # CMS mass spectrum insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2018_I1711625 +# ATLAS high pt jets +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2022_I2077570 +# CMS substructure +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2021_I1920187_ZJET + diff --git a/Tests/Rivet/LHC/LHC-8-Z-e.in b/Tests/Rivet/LHC/LHC-8-Z-e.in --- a/Tests/Rivet/LHC/LHC-8-Z-e.in +++ b/Tests/Rivet/LHC/LHC-8-Z-e.in @@ -1,14 +1,16 @@ # -*- ThePEG-repository -*- ################################################## # select the analyses ################################################## # ATLAS Z pT and phi* insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2015_I1408516:LMODE=EL # ATLAS high mass drell-yan insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2016_I1467454:LMODE=EL # ATLAS splittings insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2017_I1589844:LMODE=EL # CMS Z+b insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2017_I1499471 # ATLAS Z+jets insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2019_I1744201 +# CMS Z + jets +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2017_I1497519 \ No newline at end of file diff --git a/Tests/Rivet/LHC/LHC-8-Z-mu.in b/Tests/Rivet/LHC/LHC-8-Z-mu.in --- a/Tests/Rivet/LHC/LHC-8-Z-mu.in +++ b/Tests/Rivet/LHC/LHC-8-Z-mu.in @@ -1,16 +1,18 @@ # -*- ThePEG-repository -*- ################################################## # select the analyses ################################################## # ATLAS Z + dijets insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2014_I1279489 # ATLAS Z pT and phi* insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2015_I1408516:LMODE=MU # ATLAS high mass drell-yan insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2016_I1467454:LMODE=MU # ATLAS splittings rivet problem with this at the moment) insert /Herwig/Analysis/RivetAnalysis:Analyses 0 ATLAS_2017_I1589844:LMODE=MU # LHCb W/Z analysis insert /Herwig/Analysis/RivetAnalysis:Analyses 0 LHCB_2016_I1454404:MODE=ZJET # LHC W/Z spectrum insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2016_I1471281 +# CMS Z + jets +insert /Herwig/Analysis/RivetAnalysis:Analyses 0 CMS_2017_I1497519 diff --git a/Tests/python/merge-LHC-EW.in b/Tests/python/merge-LHC-EW.in --- a/Tests/python/merge-LHC-EW.in +++ b/Tests/python/merge-LHC-EW.in @@ -1,419 +1,425 @@ #! @PYTHON@ +# -*- mode: python -*- from __future__ import print_function import logging, sys, os, yoda, math, subprocess, time """%prog Script for merging yoda files """ def fillAbove(scale,desthisto, sourcehistosbyptmin) : pthigh= 1e100 ptlow =-1e100 for pt, h in sorted(sourcehistosbyptmin.items(),reverse=True): ptlow=pt if(type(desthisto)==yoda.core.Scatter2D) : for i in range(0,h.numPoints()) : xMin = h.points()[i].x()-h.points()[i].xErrs().minus if( xMin*scale >= ptlow and xMin*scale < pthigh ) : desthisto.addPoint(h.points()[i]) elif(type(desthisto)==yoda.core.Profile1D) : for i in range(0,h.numBins()) : if(h.bins()[i].xMin()*scale >= ptlow and h.bins()[i].xMin()*scale < pthigh ) : desthisto.bins()[i] += h.bins()[i] elif(type(desthisto)==yoda.core.Histo1D) : for i in range(0,h.numBins()) : if(h.bins()[i].xMin()*scale >= ptlow and h.bins()[i].xMin()*scale < pthigh ) : desthisto.bins()[i] += h.bins()[i] else : logging.error("Can't merge %s, unknown type" % desthisto.path()) sys.exit(1) pthigh=pt import sys if sys.version_info[:3] < (2,4,0): print ("rivet scripts require Python version >= 2.4.0... exiting") sys.exit(1) if __name__ == "__main__": import logging from optparse import OptionParser, OptionGroup parser = OptionParser(usage="%prog base") verbgroup = OptionGroup(parser, "Verbosity control") verbgroup.add_option("-v", "--verbose", action="store_const", const=logging.DEBUG, dest="LOGLEVEL", default=logging.INFO, help="print debug (very verbose) messages") verbgroup.add_option("-q", "--quiet", action="store_const", const=logging.WARNING, dest="LOGLEVEL", default=logging.INFO, help="be very quiet") parser.add_option_group(verbgroup) (opts, args) = parser.parse_args() logging.basicConfig(level=opts.LOGLEVEL, format="%(message)s") ## Check args if len(args) < 1: logging.error("Must specify at least the name of the files") sys.exit(1) # merge the mass hists yodafiles=["-13-Z-nu","-W-e","-W-mu","-Z-mu-Short","-8-W-e","-8-W-mu", "-WW-emu","-WW-ll","-13-WW-ll","-WZ","-ZZ-ll","-ZZ-lv","-13-ZZ-ll", "-8-WZ","-13-WZ","-8-ZZ-lv","-8-WW-ll", "-7-W-Jet-1-e","-7-W-Jet-2-e","-7-W-Jet-3-e","-7-Z-Jet-1-e","-7-Z-Jet-2-e","-7-Z-Jet-3-e", "-7-WGamma-e","-7-WGamma-mu","-7-ZGamma-e","-7-ZGamma-mu"] for energy in ["","8-","13-"] : for ll in ["e","mu"] : mergeargs=["rivet-merge"] for mass in range(1,6) : fname = "Rivet-%s-%sZ-%s-Mass%s.yoda" % (args[0], energy , ll,mass) if(os.path.isfile(fname)) : mergeargs.append(fname) if len(mergeargs)==1 : continue mergeargs.append("-o") mergeargs.append("Rivet-%s-%sZ-%s.yoda"% (args[0], energy ,ll)) yodafiles.append("-%sZ-%s"% (energy ,ll)) p = subprocess.Popen(mergeargs) time.sleep(5) ## Get histos outhistos={} for f in yodafiles: fname='Rivet-'+args[0]+f+".yoda" if not os.access(fname, os.R_OK): logging.error("%s can not be read" % fname) continue try: aos = yoda.read(fname) except: logging.error("%s can not be parsed as yoda" % fname) continue ## Get histos from this YODA file for aopath, ao in aos.items() : if "RAW" in aopath or "XSEC" in aopath or "EVTCOUNT" in aopath : continue if(aopath.find("ATLAS_2010_S8919674")>0) : if ("d01" in aopath or "d05" in aopath or "d07" in aopath) and "-e" in fname: outhistos[aopath] = ao elif ("d02" in aopath or "d06" in aopath or "d08" in aopath) and "-mu" in fname: outhistos[aopath] = ao elif (aopath.find("ATLAS_2011_S9131140")>0) : if("d01" in aopath and "-e" in fname) : outhistos[aopath] = ao elif("d02" in aopath and "-mu" in fname) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2011_I925932")>0) : if("d01" in aopath and "-e" in fname) : outhistos[aopath] = ao elif("d02" in aopath and "-mu" in fname) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2011_I945498")>0) : if(aopath.find("y01")>0 and "-e" in fname) : outhistos[aopath] = ao elif(aopath.find("y02")>0 and "-mu" in fname) : outhistos[aopath] = ao elif(aopath.find("y03")>0 and "-mu" in fname) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2013_I1217867")>0) : if(aopath.find("y01")>0 and "-e" in fname) : outhistos[aopath] = ao elif(aopath.find("y02")>0 and "-mu" in fname) : outhistos[aopath] = ao elif (aopath.find("CMS_2012_I941555")>0) : if((aopath.find("y01")>0 or aopath.find("y03")>0 ) and "-mu" in fname) : outhistos[aopath] = ao elif(aopath.find("y02")>0 and "-e" in fname) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2014_I1300647" )>0) : if(aopath.find("y01")>0 and "-e" in fname) : outhistos[aopath] = ao elif((not aopath.find("y01")>0) and "-mu" in fname) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2014_I1288706" )>0) : if(aopath.find("y02")>0 and "-e" in fname) : outhistos[aopath] = ao elif(aopath.find("y01")>0 and "-mu" in fname) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2012_I1204784" )>0) : if( "-e" in fname and ( "d03" in aopath or (("d01" in aopath or "d02" in aopath) and aopath.find("y01")>0))) : outhistos[aopath] = ao elif("-mu" in fname and ( "d04" in aopath or (("d01" in aopath or "d02" in aopath) and aopath.find("y02")>0))) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2014_I1312627")>0) : if("EL" in aopath) : if(fname.find("W")>0 and aopath.find("x02")>0) : outhistos[aopath] = ao elif(fname.find("Z")>0 and aopath.find("x03")>0) : outhistos[aopath] = ao elif ("MU" in aopath) : if(fname.find("W")>0 and aopath.find("x02")>0) : outhistos[aopath] = ao elif(fname.find("Z")>0 and aopath.find("x03")>0) : outhistos[aopath] = ao else : if(fname.find("W")>0 and aopath.find("x02")>0) : outhistos[aopath] = ao elif(fname.find("Z")>0 and aopath.find("x03")>0) : outhistos[aopath] = ao elif (aopath.find("CMS_2018_I1711625")>0) : if( "-e" in fname and aopath.find("d06-x01-y01") > 0 ): if aopath in outhistos : outhistos[aopath] += ao else : outhistos[aopath] = ao elif( "-mu" in fname and (aopath.find("d03-x01-y01") > 0 or aopath.find("d05-x01-y01") > 0) ): if aopath in outhistos : outhistos[aopath] += ao else : outhistos[aopath] = ao elif (aopath.find("CMS_2013_I1224539_WJET" )>0) : if(fname.find("-1-e")>0 and (aopath.find("d52")>0 or aopath.find("d53")>0 or aopath.find("d56")>0 or aopath.find("d57")>0 or aopath.find("d60")>0 or aopath.find("d61")>0 or aopath.find("d64")>0 or aopath.find("d65")>0 or aopath.find("d68")>0 or aopath.find("d69")>0 or aopath.find("d72")>0)) : outhistos[aopath] = ao elif(fname.find("-2-e")>0 and (aopath.find("d54")>0 or aopath.find("d58")>0 or aopath.find("d62")>0 or aopath.find("d66")>0 or aopath.find("d70")>0 or aopath.find("d73")>0)) : outhistos[aopath] = ao elif(fname.find("-3-e")>0 and (aopath.find("d55")>0 or aopath.find("d59")>0 or aopath.find("d63")>0 or aopath.find("d67")>0 or aopath.find("d71")>0 or aopath.find("d74")>0)) : outhistos[aopath] = ao elif (aopath.find("CMS_2013_I1224539_ZJET" )>0) : if(fname.find("-1-e")>0 and (aopath.find("d29")>0 or aopath.find("d30")>0 or aopath.find("d33")>0 or aopath.find("d34")>0 or aopath.find("d37")>0 or aopath.find("d38")>0 or aopath.find("d41")>0 or aopath.find("d42")>0 or aopath.find("d45")>0 or aopath.find("d46")>0 or aopath.find("d49")>0)) : outhistos[aopath] = ao elif(fname.find("-2-e")>0 and (aopath.find("d31")>0 or aopath.find("d35")>0 or aopath.find("d39")>0 or aopath.find("d43")>0 or aopath.find("d47")>0 or aopath.find("d50")>0)) : outhistos[aopath] = ao elif(fname.find("-3-e")>0 and (aopath.find("d32")>0 or aopath.find("d36")>0 or aopath.find("d40")>0 or aopath.find("d44")>0 or aopath.find("d48")>0 or aopath.find("d51")>0)) : outhistos[aopath] = ao elif (aopath.find("CMS_2013_I1258128")>0) : if("d01" in aopath or "d02" in aopath or "d03" in aopath or "d04" in aopath) : outhistos[aopath] = ao elif (aopath.find("CMS_2013_I1209721" )>0 and fname.find("-0")>0 ) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2011_I928289")>0) : if(fname.find("-e")>=0 and (aopath.find("y01")>=0 or aopath.find("y02")>=0)) : outhistos[aopath] = ao elif(fname.find("-mu")>=0 and (aopath.find("y03")>=0 or aopath.find("y04")>=0)) : outhistos[aopath] = ao elif (aopath.find("CMS_2013_I1122847")>0) : if(fname.find("-mu")>=0 and aopath.find("d01")>=0 ) : outhistos[aopath] = ao elif(fname.find("-e")>=0 and (aopath.find("d02")>=0 or aopath.find("d03")>=0)) : outhistos[aopath] = ao elif (aopath.find("ATLAS_2016_I1424838")>0) : ihist = int(aopath.split("/")[2].split("-")[0].replace("d","")) if(fname.find("-mu")>=0 and ihist>30 ) : outhistos[aopath] = ao elif(fname.find("-e")>=0 and ihist<=30) : outhistos[aopath] = ao elif "ATLAS_2016_I1502620" in aopath : newPath = aopath.split(":")[0]+"/"+aopath.split("/")[-1] if newPath in outhistos : continue else : outhistos[newPath] = ao ao.setPath(newPath) elif ("CMS_2015_I1310737" in aopath or "ATLAS_2013_I1219109" in aopath or ("ATLAS_2014_I1319490" in aopath and "y01" in aopath )) : if aopath in outhistos : outhistos[aopath] += ao else : outhistos[aopath] = ao elif (aopath.find("CMS_2016_I1471281")>=0) : if fname.find("W")>0 and "d08" in aopath : outhistos[aopath] = ao elif fname.find("Z")>0 and "d09" in aopath : outhistos[aopath] = ao elif (aopath.find("ATLAS_2015_I1351916")>=0) : if(aopath.find("-y02")>=0) : pathBase = "/%s/" % aopath.split("/")[1] if("d03" in aopath) : hp = aos[pathBase+"_ncf_pos"] hm = aos[pathBase+"_ncf_neg"] else : hp = aos[pathBase+"_ncc_pos"] hm = aos[pathBase+"_ncc_neg"] ratio = (hp-hm)/(hp+hm) title="" if hasattr(ao, 'title'): title=ao.title() hnew = yoda.core.Scatter2D(aopath,title) hnew.combineWith(ratio) outhistos[aopath] = hnew else : continue elif (aopath.find("ATLAS_2014_I1282447")>=0) : if((aopath.find("/ATLAS_2014_I1282447/d02-x01-y01")>=0 or aopath.find("/ATLAS_2014_I1282447/d08-x01-y01")>=0 or aopath.find("/ATLAS_2014_I1282447/d02-x01-y02")>=0 or aopath.find("/ATLAS_2014_I1282447/d02-x01-y01")>=0 or aopath.find("/ATLAS_2014_I1282447/d05-x01-y02")>=0 or aopath.find("/ATLAS_2014_I1282447/d05-x01-y03")>=0 or aopath.find("/ATLAS_2014_I1282447/d06-x01-y01")>=0 or aopath.find("/ATLAS_2014_I1282447/d06-x01-y02")>=0 or aopath.find("/ATLAS_2014_I1282447/d06-x01-y03")>=0 or aopath.find("/ATLAS_2014_I1282447/d06-x01-y04")>=0) and not (aopath.find("plus")>=0 or aopath.find("minus")>=0 or aopath.find("inc")>=0)) : continue if aopath in outhistos : outhistos[aopath] += ao else : outhistos[aopath] = ao elif (aopath.find("ATLAS_2017_I1514251")>=0) : outhistos[aopath] = ao if(type(ao)==yoda.core.Scatter2D) : ao.scaleY(2.) elif(type(ao)==yoda.core.Histo1D) : ao.scaleW(2.) elif ( "2015_041_" in aopath) : aopath=aopath.replace("_EL","").replace("_MU","") ao.setPath(aopath) outhistos[aopath] = ao elif "CMS_2019_I1753680" in aopath : if("d26" in aopath or "d27" in aopath or "d28" in aopath) : if ("y01" in aopath and "=MU" in aopath) or ("y02" in aopath and "=EL" in aopath) : outhistos[aopath] = ao elif ("y03" in aopath and "=EMU" in aopath) : if aopath in outhistos : outhistos[aopath] += ao else : outhistos[aopath] = ao elif "=EMU" in aopath: if aopath in outhistos : outhistos[aopath] += ao if "d29" not in aopath : outhistos[aopath].scaleW(0.5) else : outhistos[aopath] = ao elif "CMS_2018_I1667854" in aopath : if "=EMU" in aopath: if aopath in outhistos : outhistos[aopath] += ao else : outhistos[aopath] = ao + elif "ATLAS_2022_I2077570" in aopath or "CMS_2017_I1497519" in aopath : + if aopath in outhistos : + outhistos[aopath] += ao + else : + outhistos[aopath] = ao else : outhistos[aopath] = ao # sort out ratios for ATLAS W+c if("/ATLAS_2014_I1282447/d02-x01-y01_plus" in outhistos and "/ATLAS_2014_I1282447/d02-x01-y01_minus" in outhistos) : d02y01_plus = outhistos["/ATLAS_2014_I1282447/d02-x01-y01_plus"] d02y01_minus = outhistos["/ATLAS_2014_I1282447/d02-x01-y01_minus"] ratio_d02y01 = d02y01_plus/d02y01_minus ratio_d02y01.setPath("/ATLAS_2014_I1282447/d02-x01-y01") del outhistos["/ATLAS_2014_I1282447/d02-x01-y01_plus"] del outhistos["/ATLAS_2014_I1282447/d02-x01-y01_minus"] outhistos["/ATLAS_2014_I1282447/d02-x01-y01"] = ratio_d02y01 if("/ATLAS_2014_I1282447/d02-x01-y02_plus" in outhistos and "/ATLAS_2014_I1282447/d02-x01-y02_minus" in outhistos) : d02y02_plus = outhistos["/ATLAS_2014_I1282447/d02-x01-y02_plus"] d02y02_minus = outhistos["/ATLAS_2014_I1282447/d02-x01-y02_minus"] ratio_d02y02 = d02y02_plus/d02y02_minus ratio_d02y02.setPath("/ATLAS_2014_I1282447/d02-x01-y02") del outhistos["/ATLAS_2014_I1282447/d02-x01-y02_plus"] del outhistos["/ATLAS_2014_I1282447/d02-x01-y02_minus"] outhistos["/ATLAS_2014_I1282447/d02-x01-y02"] = ratio_d02y02 if("/ATLAS_2014_I1282447/d08-x01-y01_plus" in outhistos and "/ATLAS_2014_I1282447/d08-x01-y01_minus" in outhistos) : d08y01_plus = outhistos["/ATLAS_2014_I1282447/d08-x01-y01_plus"] d08y01_minus = outhistos["/ATLAS_2014_I1282447/d08-x01-y01_minus"] ratio_d08y01 = d08y01_plus/d08y01_minus ratio_d08y01.setPath("/ATLAS_2014_I1282447/d08-x01-y01") del outhistos["/ATLAS_2014_I1282447/d08-x01-y01_plus"] del outhistos["/ATLAS_2014_I1282447/d08-x01-y01_minus"] outhistos["/ATLAS_2014_I1282447/d08-x01-y01"] = ratio_d08y01 if ("/ATLAS_2014_I1282447/d05-x01-y01" in outhistos and "/ATLAS_2014_I1282447/d01-x01-y02" in outhistos) : h_winc = outhistos["/ATLAS_2014_I1282447/d05-x01-y01"] h_d = outhistos["/ATLAS_2014_I1282447/d01-x01-y02"] ratio_wd = h_d/h_winc ratio_wd.setPath("/ATLAS_2014_I1282447/d05-x01-y02") outhistos["/ATLAS_2014_I1282447/d05-x01-y02"] = ratio_wd if ("/ATLAS_2014_I1282447/d05-x01-y01" in outhistos and "/ATLAS_2014_I1282447/d01-x01-y03" in outhistos) : h_winc = outhistos["/ATLAS_2014_I1282447/d05-x01-y01"] h_dstar= outhistos["/ATLAS_2014_I1282447/d01-x01-y03"] ratio_wdstar = h_dstar/h_winc ratio_wdstar.setPath("/ATLAS_2014_I1282447/d05-x01-y03") outhistos["/ATLAS_2014_I1282447/d05-x01-y03"] = ratio_wdstar if("/ATLAS_2014_I1282447/d06-x01-y01_winc" in outhistos and "/ATLAS_2014_I1282447/d06-x01-y02_winc" in outhistos) : h_winc_plus = outhistos["/ATLAS_2014_I1282447/d06-x01-y01_winc"] h_winc_minus = outhistos["/ATLAS_2014_I1282447/d06-x01-y02_winc"] if( "/ATLAS_2014_I1282447/d06-x01-y01_wplus" in outhistos ) : h_wd_plus = outhistos["/ATLAS_2014_I1282447/d06-x01-y01_wplus"] ratio_wd_plus = h_wd_plus/h_winc_plus ratio_wd_plus.setPath("/ATLAS_2014_I1282447/d06-x01-y01") outhistos["/ATLAS_2014_I1282447/d06-x01-y01"] = ratio_wd_plus del outhistos["/ATLAS_2014_I1282447/d06-x01-y01_wplus"] if( "/ATLAS_2014_I1282447/d06-x01-y02_wminus" in outhistos ) : h_wd_minus = outhistos["/ATLAS_2014_I1282447/d06-x01-y02_wminus"] ratio_wd_minus = h_wd_minus/h_winc_minus ratio_wd_minus.setPath("/ATLAS_2014_I1282447/d06-x01-y02") outhistos["/ATLAS_2014_I1282447/d06-x01-y02"] = ratio_wd_minus del outhistos["/ATLAS_2014_I1282447/d06-x01-y02_wminus"] if ( "/ATLAS_2014_I1282447/d06-x01-y03_wplus" in outhistos) : h_wdstar_plus = outhistos["/ATLAS_2014_I1282447/d06-x01-y03_wplus"] ratio_wdstar_plus = h_wdstar_plus/h_winc_plus ratio_wdstar_plus.setPath("/ATLAS_2014_I1282447/d06-x01-y03") outhistos["/ATLAS_2014_I1282447/d06-x01-y03"] = ratio_wdstar_plus del outhistos["/ATLAS_2014_I1282447/d06-x01-y03_wplus"] if ( "/ATLAS_2014_I1282447/d06-x01-y04_wminus" in outhistos) : h_wdstar_minus = outhistos["/ATLAS_2014_I1282447/d06-x01-y04_wminus"] ratio_wdstar_minus = h_wdstar_minus/h_winc_minus ratio_wdstar_minus.setPath("/ATLAS_2014_I1282447/d06-x01-y04") outhistos["/ATLAS_2014_I1282447/d06-x01-y04"] = ratio_wdstar_minus del outhistos["/ATLAS_2014_I1282447/d06-x01-y04_wminus"] del outhistos["/ATLAS_2014_I1282447/d06-x01-y01_winc"] del outhistos["/ATLAS_2014_I1282447/d06-x01-y02_winc"] # ATLAS W/Z ratios iy=0 for suffix in ["",":LMODE=EL",":LMODE=MU"] : iy+=1 basePath = "/ATLAS_2014_I1312627%s/" % suffix for ihist in range(1,21) : num = "%sd%02d-x02-y%02d" % (basePath,ihist,iy) den = "%sd%02d-x03-y%02d" % (basePath,ihist,iy) if(den in outhistos and num in outhistos) : ratio = outhistos[num]/outhistos[den] ratio.setPath("%sd%02d-x01-y%02d" % (basePath,ihist,iy)) del outhistos[num] del outhistos[den] outhistos[ "%sd%02d-x01-y%02d" % (basePath,ihist,iy)]=ratio elif den in outhistos : del outhistos[den] elif num in outhistos : del outhistos[num] # LHCB W/Z + jets if("/LHCB_2016_I1454404:MODE=WJET/d01-x01-y01" in outhistos and "/LHCB_2016_I1454404:MODE=WJET/d01-x01-y02" in outhistos and "/LHCB_2016_I1454404:MODE=ZJET/d01-x01-y03" in outhistos) : hZ = outhistos["/LHCB_2016_I1454404:MODE=ZJET/d01-x01-y03"] hWp= outhistos["/LHCB_2016_I1454404:MODE=WJET/d01-x01-y01"] hWm= outhistos["/LHCB_2016_I1454404:MODE=WJET/d01-x01-y02"] hsum=hWp+hWm r1=hsum/hZ r1.setPath("/LHCB_2016_I1454404/d02-x01-y01") outhistos["/LHCB_2016_I1454404/d02-x01-y01"]=r1 r1=hWp/hZ r1.setPath("/LHCB_2016_I1454404/d02-x01-y02") outhistos["/LHCB_2016_I1454404/d02-x01-y02"]=r1 r1=hWm/hZ r1.setPath("/LHCB_2016_I1454404/d02-x01-y03") outhistos["/LHCB_2016_I1454404/d02-x01-y03"]=r1 # Choose output file name = args[0]+"-EW.yoda" # remove any scatters with nans, causes yoda to crash remove = [] for key in outhistos.keys() : ao = outhistos[key] if type(ao)==yoda.core.Scatter2D : skip=False for p in ao.points() : if math.isnan(p.y()) : skip=True if(skip) : remove.append(key) for key in remove : del outhistos[key] # output the yoda file yoda.writeYODA(outhistos,name) sys.exit(0)