Skip to content

Commit 1edffb7

Browse files
authored
Merge pull request #46007 from kpedro88/Phase2-WF82
FastSim premixing workflows and matrix cleanup
2 parents 14a12c2 + 1ca6072 commit 1edffb7

File tree

2 files changed

+103
-59
lines changed

2 files changed

+103
-59
lines changed

Configuration/PyReleaseValidation/python/relval_upgrade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def notForGenOnly(key,specialType):
7171
stepList[specialType].append(stepMaker(key,frag[:-4],step.replace('RecoGlobal','HLT75e33'),specialWF.suffix))
7272
# similar hacks for premixing
7373
if 'PMX' in specialType:
74-
if 'GenSim' in step:
75-
s = step.replace('GenSim','Premix')+'PU' # later processing requires to have PU here
74+
if 'GenSim' in step or 'Gen' in step:
75+
s = step.replace('GenSim','Premix').replace('Gen','Premix')+'PU' # later processing requires to have PU here
7676
if step in specialWF.PU:
7777
stepMade = stepMaker(key,'PREMIX',s,specialWF.suffix)
7878
# append for combined

Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py

Lines changed: 101 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ def workflow(self, workflows, num, fragment, stepList, key, hasHarvest):
166166
def workflow_(self, workflows, num, fragment, stepList, key):
167167
fragmentTmp = [fragment, key]
168168
if len(self.suffix)>0: fragmentTmp.append(self.suffix)
169-
workflows[num+self.offset] = [ fragmentTmp, stepList ]
169+
# avoid spurious workflows (no steps modified)
170+
if self.offset==0 or workflows[num][1]!=stepList:
171+
workflows[num+self.offset] = [ fragmentTmp, stepList ]
170172
def condition(self, fragment, stepList, key, hasHarvest):
171173
return False
172174
def preventReuse(self, stepName, stepDict, k):
@@ -562,7 +564,7 @@ def condition(self, fragment, stepList, key, hasHarvest):
562564

563565
# WeightedMeanFitter vertexing workflows
564566
class UpgradeWorkflow_weightedVertex(UpgradeWorkflow):
565-
def __init__(self, reco = {}, harvest = {}, **kwargs):
567+
def __init__(self, **kwargs):
566568
# adapt the parameters for the UpgradeWorkflow init method
567569
super(UpgradeWorkflow_weightedVertex, self).__init__(
568570
steps = [
@@ -590,8 +592,6 @@ def __init__(self, reco = {}, harvest = {}, **kwargs):
590592
'HARVESTNanoFakeHLT',
591593
],
592594
**kwargs)
593-
self.__reco = reco
594-
self.__harvest = harvest
595595

596596
def setup_(self, step, stepName, stepDict, k, properties):
597597
# temporarily remove trigger & downstream steps
@@ -2264,7 +2264,7 @@ def setup_(self, step, stepName, stepDict, k, properties):
22642264
stepDict[stepName][k] = None
22652265

22662266
def condition(self, fragment, stepList, key, hasHarvest):
2267-
return ('2021' in key or '2023' in key or '2026' in key)
2267+
return fragment=="TTbar_14TeV" and ('2021' in key or '2023' in key or '2026' in key)
22682268

22692269
upgradeWFs['ECALComponent'] = UpgradeWorkflow_ECalComponent(
22702270
suffix = '_ecalComponent',
@@ -2520,58 +2520,103 @@ def setup_(self, step, stepName, stepDict, k, properties):
25202520
# just copy steps
25212521
stepDict[stepName][k] = merge([stepDict[step][k]])
25222522
def setupPU_(self, step, stepName, stepDict, k, properties):
2523-
# setup for stage 1
2524-
if "GenSim" in stepName:
2525-
stepNamePmx = stepName.replace('GenSim','Premix')
2526-
if not stepNamePmx in stepDict: stepDict[stepNamePmx] = {}
2527-
stepDict[stepNamePmx][k] = merge([
2528-
{
2529-
'-s': 'GEN,SIM,DIGI:pdigi_valid',
2530-
'--datatier': 'PREMIX',
2531-
'--eventcontent': 'PREMIX',
2532-
'--procModifiers': 'premix_stage1'
2533-
},
2534-
stepDict[stepName][k]
2535-
])
2536-
if "ProdLike" in self.suffix:
2537-
stepDict[stepNamePmx][k] = merge([{'-s': 'GEN,SIM,DIGI'},stepDict[stepNamePmx][k]])
2538-
# setup for stage 2
2539-
elif "Digi" in step or "Reco" in step:
2540-
# go back to non-PU step version
2541-
d = merge([stepDict[self.getStepName(step)][k]])
2542-
if d is None: return
2543-
if "Digi" in step:
2523+
# fastsim version
2524+
if 'FS' in k:
2525+
# setup for stage 1 fastsim
2526+
if "Gen" in stepName:
2527+
stepNamePmx = stepName.replace('Gen','Premix')
2528+
if not stepNamePmx in stepDict: stepDict[stepNamePmx] = {}
2529+
stepDict[stepNamePmx][k] = merge([
2530+
{
2531+
'-s': 'GEN,SIM,RECOBEFMIX,DIGI:pdigi_valid',
2532+
'--fast':'',
2533+
'--datatier': 'PREMIX',
2534+
'--eventcontent': 'PREMIX',
2535+
'--procModifiers': 'premix_stage1'
2536+
},
2537+
stepDict[stepName][k]
2538+
])
2539+
if "ProdLike" in self.suffix:
2540+
# todo
2541+
pass
2542+
# setup for stage 2 fastsim
2543+
elif "FastSimRun3" in step:
2544+
# go back to non-PU step version
2545+
d = merge([stepDict[self.getStepName(step)][k]])
2546+
if d is None: return
25442547
tmpsteps = []
25452548
for s in d["-s"].split(","):
25462549
if s == "DIGI" or "DIGI:" in s:
25472550
tmpsteps.extend([s, "DATAMIX"])
25482551
else:
25492552
tmpsteps.append(s)
25502553
d = merge([{"-s" : ",".join(tmpsteps),
2551-
"--datamix" : "PreMix",
2552-
"--procModifiers": "premix_stage2"},
2554+
"--datamix" : "PreMix"},
25532555
d])
2554-
# for combined stage1+stage2
2555-
if "_PMXS1S2" in self.suffix:
2556-
d = merge([digiPremixLocalPileup, d])
2557-
elif "Reco" in step:
25582556
if "--procModifiers" in d:
25592557
d["--procModifiers"] += ",premix_stage2"
25602558
else:
25612559
d["--procModifiers"] = "premix_stage2"
2562-
stepDict[stepName][k] = d
2563-
# Increase the input file step number by one for Nano in combined stage1+stage2
2564-
elif "Nano"==step:
2565-
# go back to non-PU step version
2566-
d = merge([stepDict[self.getStepName(step)][k]])
2567-
if "--filein" in d:
2568-
filein = d["--filein"]
2569-
m = re.search("step(?P<ind>\\d+)_", filein)
2570-
if m:
2571-
d["--filein"] = filein.replace(m.group(), "step%d_"%(int(m.group("ind"))+1))
2572-
stepDict[stepName][k] = d
2573-
# run2/3 WFs use Nano (not NanoPU) in PU WF
2574-
stepDict[self.getStepName(step)][k] = merge([d])
2560+
# for combined stage1+stage2
2561+
if "_PMXS1S2" in self.suffix:
2562+
d = merge([digiPremixLocalPileup, d])
2563+
stepDict[stepName][k] = d
2564+
elif "HARVESTFastRun3" in step:
2565+
# increment input step number
2566+
stepDict[stepName][k] = merge([{'--filein':'file:step3_inDQM.root'},stepDict[stepName][k]])
2567+
else:
2568+
# setup for stage 1
2569+
if "GenSim" in stepName:
2570+
stepNamePmx = stepName.replace('GenSim','Premix')
2571+
if not stepNamePmx in stepDict: stepDict[stepNamePmx] = {}
2572+
stepDict[stepNamePmx][k] = merge([
2573+
{
2574+
'-s': 'GEN,SIM,DIGI:pdigi_valid',
2575+
'--datatier': 'PREMIX',
2576+
'--eventcontent': 'PREMIX',
2577+
'--procModifiers': 'premix_stage1'
2578+
},
2579+
stepDict[stepName][k]
2580+
])
2581+
if "ProdLike" in self.suffix:
2582+
stepDict[stepNamePmx][k] = merge([{'-s': 'GEN,SIM,DIGI'},stepDict[stepNamePmx][k]])
2583+
# setup for stage 2
2584+
elif "Digi" in step or "Reco" in step:
2585+
# go back to non-PU step version
2586+
d = merge([stepDict[self.getStepName(step)][k]])
2587+
if d is None: return
2588+
if "Digi" in step:
2589+
tmpsteps = []
2590+
for s in d["-s"].split(","):
2591+
if s == "DIGI" or "DIGI:" in s:
2592+
tmpsteps.extend([s, "DATAMIX"])
2593+
else:
2594+
tmpsteps.append(s)
2595+
d = merge([{"-s" : ",".join(tmpsteps),
2596+
"--datamix" : "PreMix",
2597+
"--procModifiers": "premix_stage2"},
2598+
d])
2599+
# for combined stage1+stage2
2600+
if "_PMXS1S2" in self.suffix:
2601+
d = merge([digiPremixLocalPileup, d])
2602+
elif "Reco" in step:
2603+
if "--procModifiers" in d:
2604+
d["--procModifiers"] += ",premix_stage2"
2605+
else:
2606+
d["--procModifiers"] = "premix_stage2"
2607+
stepDict[stepName][k] = d
2608+
# separate nano step now only used in ProdLike workflows for Run3/Phase2
2609+
elif "Nano"==step:
2610+
# go back to non-PU step version
2611+
d = merge([stepDict[self.getStepName(step)][k]])
2612+
if "_PMXS1S2" in self.suffix and "--filein" in d:
2613+
filein = d["--filein"]
2614+
m = re.search("step(?P<ind>\\d+)", filein)
2615+
if m:
2616+
d["--filein"] = filein.replace(m.group(), "step%d"%(int(m.group("ind"))+1))
2617+
stepDict[stepName][k] = d
2618+
# run2/3 WFs use Nano (not NanoPU) in PU WF
2619+
stepDict[self.getStepName(step)][k] = merge([d])
25752620
def condition(self, fragment, stepList, key, hasHarvest):
25762621
if not 'PU' in key:
25772622
return False
@@ -2590,6 +2635,7 @@ def workflow_(self, workflows, num, fragment, stepList, key):
25902635
steps = [
25912636
],
25922637
PU = [
2638+
'Gen',
25932639
'GenSim',
25942640
'GenSimHLBeamSpot',
25952641
'GenSimHLBeamSpot14',
@@ -2610,6 +2656,8 @@ def workflow_(self, workflows, num, fragment, stepList, key):
26102656
'RecoNano',
26112657
'RecoNanoFakeHLT',
26122658
'Nano',
2659+
'FastSimRun3',
2660+
'HARVESTFastRun3',
26132661
],
26142662
suffix = '_PMXS2',
26152663
offset = 0.98,
@@ -2618,6 +2666,7 @@ def workflow_(self, workflows, num, fragment, stepList, key):
26182666
upgradeWFs['PMXS1S2'] = UpgradeWorkflowPremix(
26192667
steps = [],
26202668
PU = [
2669+
'Gen',
26212670
'GenSim',
26222671
'GenSimHLBeamSpot',
26232672
'GenSimHLBeamSpot14',
@@ -2630,6 +2679,8 @@ def workflow_(self, workflows, num, fragment, stepList, key):
26302679
'RecoNano',
26312680
'RecoNanoFakeHLT',
26322681
'Nano',
2682+
'FastSimRun3',
2683+
'HARVESTFastRun3',
26332684
],
26342685
suffix = '_PMXS1S2',
26352686
offset = 0.99,
@@ -2683,8 +2734,6 @@ def setup_(self, step, stepName, stepDict, k, properties):
26832734
"--eventcontent": "PREMIXRAW"},
26842735
d])
26852736
stepDict[stepName][k] = d
2686-
if 'Nano'==step:
2687-
stepDict[stepName][k] = merge([{'--filein':'file:step5.root','-s':'NANO','--datatier':'NANOAODSIM','--eventcontent':'NANOEDMAODSIM'}, stepDict[step][k]])
26882737
def condition(self, fragment, stepList, key, hasHarvest):
26892738
# use both conditions
26902739
return UpgradeWorkflowPremix.condition(self, fragment, stepList, key, hasHarvest) and UpgradeWorkflow_ProdLike.condition(self, fragment, stepList, key, hasHarvest)
@@ -2750,7 +2799,7 @@ def setup_(self, step, stepName, stepDict, k, properties):
27502799
else:
27512800
stepDict[stepName][k] = merge([stepDict[step][k]])
27522801
def condition(self, fragment, stepList, key, hasHarvest):
2753-
return ('FS' in key)
2802+
return fragment=="TTbar_14TeV" and ('FS' in key)
27542803
upgradeWFs['Run3FStrackingOnly'] = UpgradeWorkflow_Run3FStrackingOnly(
27552804
steps = [
27562805
'Gen',
@@ -2792,17 +2841,12 @@ def condition(self, fragment, stepList, key, hasHarvest):
27922841

27932842
class UpgradeWorkflow_DD4hep(UpgradeWorkflow):
27942843
def setup_(self, step, stepName, stepDict, k, properties):
2795-
if 'Run3' in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']:
2796-
if '2023' in stepDict[step][k]['--conditions']:
2797-
stepDict[stepName][k] = merge([{'--geometry': 'DD4hepExtended2023'}, stepDict[step][k]])
2798-
else:
2799-
stepDict[stepName][k] = merge([{'--geometry': 'DD4hepExtended2021'}, stepDict[step][k]])
2800-
elif 'Phase2' in stepDict[step][k]['--era']:
2844+
if 'Phase2' in stepDict[step][k]['--era']:
28012845
dd4hepGeom="DD4hep"
28022846
dd4hepGeom+=stepDict[step][k]['--geometry']
28032847
stepDict[stepName][k] = merge([{'--geometry' : dd4hepGeom, '--procModifiers': 'dd4hep'}, stepDict[step][k]])
28042848
def condition(self, fragment, stepList, key, hasHarvest):
2805-
return ('2021' in key or '2023' in key or '2026' in key) and ('FS' not in key)
2849+
return ('2026' in key) and ('FS' not in key)
28062850
upgradeWFs['DD4hep'] = UpgradeWorkflow_DD4hep(
28072851
steps = [
28082852
'GenSim',
@@ -2835,7 +2879,7 @@ def setup_(self, step, stepName, stepDict, k, properties):
28352879
if 'Run3' in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']:
28362880
stepDict[stepName][k] = merge([{'--conditions': 'auto:phase1_2022_realistic', '--geometry': 'DB:Extended'}, stepDict[step][k]])
28372881
def condition(self, fragment, stepList, key, hasHarvest):
2838-
return '2021' in key and 'FS' not in key
2882+
return fragment=="TTbar_14TeV" and '2021' in key and 'FS' not in key
28392883
upgradeWFs['DD4hepDB'] = UpgradeWorkflow_DD4hepDB(
28402884
steps = [
28412885
'GenSim',
@@ -2871,7 +2915,7 @@ def setup_(self, step, stepName, stepDict, k, properties):
28712915
tmp_eras = ','.join(tmp_eras)
28722916
stepDict[stepName][k] = merge([{'--conditions': 'auto:phase1_2022_realistic_ddd', '--geometry': 'DB:Extended', '--era': tmp_eras}, stepDict[step][k]])
28732917
def condition(self, fragment, stepList, key, hasHarvest):
2874-
return '2021' in key and 'FS' not in key
2918+
return fragment=="TTbar_14TeV" and '2021' in key and 'FS' not in key
28752919
upgradeWFs['DDDDB'] = UpgradeWorkflow_DDDDB(
28762920
steps = [
28772921
'GenSim',

0 commit comments

Comments
 (0)