From fb3c78cfb4f92cf6d35ed3b859ec4346956b7760 Mon Sep 17 00:00:00 2001 From: Congqiao Li Date: Fri, 13 Aug 2021 08:56:46 +0200 Subject: [PATCH 1/2] Fix the regex to match the LHE tags in mergeLHE.py Backport of #34804 --- .../LHEInterface/scripts/mergeLHE.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/GeneratorInterface/LHEInterface/scripts/mergeLHE.py b/GeneratorInterface/LHEInterface/scripts/mergeLHE.py index 89ad68233755c..7810f8d6b7a78 100755 --- a/GeneratorInterface/LHEInterface/scripts/mergeLHE.py +++ b/GeneratorInterface/LHEInterface/scripts/mergeLHE.py @@ -196,7 +196,7 @@ def merge(self): for i in range(len(self._f)): header = [] line = next(self._f[i]) - while not line.startswith('') and not line.startswith('|\s)', line): header.append(line) line = next(self._f[i]) # 'header' includes all contents before reaches @@ -207,7 +207,7 @@ def merge(self): for i in range(len(self._f)): init = [] line = next(self._f[i]) - while not line.startswith(''): + while not re.search('\s*', line): init.append(line) line = next(self._f[i]) # 'init_str' includes all contents inside ... @@ -220,9 +220,9 @@ def merge(self): nevent = 0 while True: line = next(self._f[i]) - if line.startswith(''): + if re.search('\s*', line): nevent += 1 - if line.startswith(''): + if re.search('\s*', line): break _fwtmp.write(line) self._nevent.append(nevent) @@ -253,7 +253,7 @@ def merge(self): sign = lambda x: -1 if x < 0 else 1 for line in ftmp: event_line += 1 - if line.startswith('', line): event_line = 0 if event_line == 1: # modify the XWGTUP appeared in the first line of the @@ -261,8 +261,8 @@ def merge(self): orig_wgt = float(line.split()[2]) fw.write(re.sub(r'(^\s*\S+\s+\S+\s+)\S+(.+)', r'\g<1>%+.7E\g<2>' \ % (sign(orig_wgt) * self._uwgt), line)) - elif line.startswith('\s*(\S+)\s*\<\/wgt\>', line).group(1) + elif re.search('\s*.*', line): + addi_wgt_str = re.search(r'\\s*(\S+)\s*\<\/wgt\>', line).group(1) fw.write(line.replace( addi_wgt_str, '%+.7E' % (float(addi_wgt_str) / orig_wgt * self._uwgt))) else: From b001a8cced12cb68134e6ec8c9fb6592cca30196 Mon Sep 17 00:00:00 2001 From: Congqiao Li Date: Fri, 13 Aug 2021 09:15:06 +0200 Subject: [PATCH 2/2] Change event number to 12 for workflow 537 Backport from 2e7e1c0ca67865630b9aae21948cf75b6ffad0e5 in #34710 --- Configuration/PyReleaseValidation/python/relval_steps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/PyReleaseValidation/python/relval_steps.py b/Configuration/PyReleaseValidation/python/relval_steps.py index 4d8154a57b5bf..7b03712fafc39 100644 --- a/Configuration/PyReleaseValidation/python/relval_steps.py +++ b/Configuration/PyReleaseValidation/python/relval_steps.py @@ -1542,7 +1542,7 @@ def gen2018RD(fragment,howMuch): #Herwig7 steps['TTbar_13TeV_Pow_herwig7']=genvalid('Configuration/Generator/python/TT_13TeV_Pow_Herwig7_cff',step1LHEGenDQM) -steps['DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7']=genvalid('Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff',step1LHEGenDQM) +steps['DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7']=genvalid('Configuration/Generator/python/DYToLL012Jets_5FS_TuneCH3_13TeV_amcatnloFxFx_herwig7_cff',merge([{'-n':'12'},step1LHEGenDQM])) steps['DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7']=genvalid('Configuration/Generator/python/DYToLL01234Jets_5FS_TuneCH3_13TeV_madgraphMLM_herwig7_cff',step1LHEGenDQM)