Skip to content

Commit

Permalink
first part of run3 pdf checks
Browse files Browse the repository at this point in the history
  • Loading branch information
efeyazgan committed Sep 19, 2024
1 parent eb81ceb commit a0b3e75
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions bin/utils/request_fragment_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,16 @@ def evtgen_check(fragment):
warn.append("Are you sure you do not want the 2014 decay dec table?")
return warn, err

def two_col_read(file,spacing):
f = open(file,"r")
lines=f.readlines()
list1 = []
list2 = []
for x in lines:
list1.append(x.split(spacing)[0])
list2.append(x.split(spacing)[1])
return list1,list2

def run3_checks(fragment,dn,pi):
err = []
fragment = fragment.replace(" ","")
Expand Down Expand Up @@ -415,6 +425,15 @@ def run3_run_card_check(filename_mggpc,pi):
err.append("The beam energy is not specified as 7000 GeV in the run_card")
return err

def run3_pdf_check(pi):
os.popen('wget -q https://raw.githubusercontent.com/cms-sw/genproductions/master/MetaData/pdflist_4f_run3.dat -O pdflist_4f_run3.dat').read()
os.popen('wget -q https://raw.githubusercontent.com/cms-sw/genproductions//master/MetaData/pdflist_5f_run3.dat -O pdflist_5f_run3.dat').read()
os.popen('wget -q https://raw.githubusercontent.com/cms-sw/genproductions/master/MetaData/npdflist_Pb_5f_run3.dat -O npdflist_Pb_5f_run3.dat').read()
pdflist_4f_run3_N,pdflist_4f_run3=two_col_read("pdflist_4f_run3.dat",' ')
pdflist_5f_run3_N,pdflist_5f_run3=two_col_read("pdflist_5f_run3.dat",' ')
pdflist_Pb_5f_run3_N,pdflist_Pb_5f_run3=two_col_read("npdflist_Pb_5f_run3.dat",' ')
return pdflist_4f_run3_N,pdflist_4f_run3,pdflist_5f_run3_N,pdflist_5f_run3,pdflist_Pb_5f_run3_N,pdflist_Pb_5f_run3

def exception_for_ul_check(datatobereplaced,cross_section_fragment):
new_data = datatobereplaced.replace(" ","")
new_data = new_data.replace(",generateConcurrently=cms.untracked.bool(True)","")
Expand Down Expand Up @@ -1204,6 +1223,10 @@ def root_requests_from_ticket(ticket_prepid, include_docs=False):
print("The PDF set used by JHUGEN is:"+ str(jhu_pdf))
if "UL" in pi and jhu_pdf not in UL_PDFs:
warnings.append("The gridpack uses PDF = "+str(jhu_pdf)+" but not the recommended sets for UL requests: "+str(UL_PDFs_N[0])+" "+str(UL_PDFs[0])+" or "+str(UL_PDFs_N[1])+" "+str(UL_PDFs[1]))
if "Run3" in pi:
pdflist_4f_run3_N,pdflist_4f_run3,pdflist_5f_run3_N,pdflist_5f_run3,pdflist_Pb_5f_run3_N,pdflist_Pb_5f_run3=run3_pdf_check(pi)
if (jhu_pdf not in pdflist_4f_run3) and (jhu_pdf not in pdflist_5f_run3):
warnings.append("The gridpack uses PDF = "+str(jhu_pdf)+" but not the recommended sets for Run3 requests: "+str(pdflist_4f_run3)+str(pdflist_5f_run3))
if os.path.isfile(jhufilename) is True and pw_gp is True:
with open(jhufilename) as f:
jhu_in = f.read()
Expand Down Expand Up @@ -1299,6 +1322,10 @@ def root_requests_from_ticket(ticket_prepid, include_docs=False):
print("Powheg PDF used is: "+str(pw_pdf))
if "UL" in pi and pw_pdf not in UL_PDFs_N:
warnings.append("The gridpack uses PDF="+str(pw_pdf)+" but not the recommended sets for UL requests: "+str(UL_PDFs_N[0])+" "+str(UL_PDFs[0])+" or "+str(UL_PDFs_N[1])+" "+str(UL_PDFs[1]))
if "Run3" in pi:
pdflist_4f_run3_N,pdflist_4f_run3,pdflist_5f_run3_N,pdflist_5f_run3,pdflist_Pb_5f_run3_N,pdflist_Pb_5f_run3=run3_pdf_check(pi)
if (pw_pdf not in pdflist_4f_run3_N) and (pw_pdf not in pdflist_5f_run3_N):
warnings.append("The gridpack uses PDF = "+str(pw_pdf)+" but not the recommended sets for Run3 requests: "+str(pdflist_4f_run3_N)+str(pdflist_5f_run3_N))
if "minlo" in line and "modlog_p" not in line:
minlo = int(re.split(r'\s+', line)[1])
print("MINLO = "+str(minlo))
Expand Down Expand Up @@ -1461,6 +1488,10 @@ def root_requests_from_ticket(ticket_prepid, include_docs=False):
print("The MG5_aMC PDF set is:"+str(mg_pdf))
if "UL" in pi and int(mg_pdf) != UL_PDFs_N[0] and int(mg_pdf) != UL_PDFs_N[1]:
warnings.append("The gridpack uses PDF="+str(mg_pdf)+" but not the recommended sets for UL requests: "+str(UL_PDFs_N[0])+" "+str(UL_PDFs[0])+" or "+str(UL_PDFs_N[1])+" "+str(UL_PDFs[1]))
if "Run3" in pi:
pdflist_4f_run3_N,pdflist_4f_run3,pdflist_5f_run3_N,pdflist_5f_run3,pdflist_Pb_5f_run3_N,pdflist_Pb_5f_run3=run3_pdf_check(pi)
if (str(mg_pdf) not in pdflist_4f_run3_N) and (str(mg_pdf) not in pdflist_5f_run3_N):
warnings.append("The gridpack uses PDF = "+str(mg_pdf)+" but not the recommended sets for Run3 requests: "+str(pdflist_4f_run3)+str(pdflist_5f_run3))
version_file = my_path+'/'+pi+'/'+'mgbasedir/VERSION'
if os.path.isfile(version_file) is True:
mgversion_tmp = os.popen('grep version '+version_file).read()
Expand Down

0 comments on commit a0b3e75

Please sign in to comment.