CMS 3D CMS Logo

relval_upgrade.py
Go to the documentation of this file.
1 
2 # import the definition of the steps and input files:
4 
5 # here only define the workflows as a combination of the steps defined above:
6 workflows = Matrix()
7 
8 # each workflow defines a name and a list of steps to be done.
9 # if no explicit name/label given for the workflow (first arg),
10 # the name of step1 will be used
11 
12 def makeStepNameSim(key,frag,step,suffix):
13  return frag+'_'+key+'_'+step+suffix
14 
15 def makeStepName(key,frag,step,suffix):
16  return step+suffix+'_'+key
17 
18 neutronKeys = ['2023D17','2023D19','2023D21','2023D24','2023D25','2023D28','2023D29','2023D30','2023D31','2023D33','2023D34','2023D35','2023D38','2023D39','2023D40','2023D41','2023D42']
19 neutronFrags = ['ZMM_14','MinBias_14TeV']
20 
21 tbmFrags = ['TTbar_13','ZMM_13']
22 
23 #just define all of them
24 
25 for year in upgradeKeys:
26  for i,key in enumerate(upgradeKeys[year]):
27  numWF=numWFAll[year][i]
28  for frag in upgradeFragments:
29  stepList={}
30  for stepType in upgradeSteps.keys():
31  stepList[stepType] = []
32  hasHarvest = False
33  for step in upgradeProperties[year][key]['ScenToRun']:
34  stepMaker = makeStepName
35  if 'Sim' in step:
36  if 'HLBeamSpotFull' in step and '14TeV' in frag:
37  step = 'GenSimHLBeamSpotFull14'
38  stepMaker = makeStepNameSim
39 
40  if 'HARVEST' in step: hasHarvest = True
41 
42  for stepType in upgradeSteps.keys():
43  # use variation only when available
44  if stepType == 'Premix':
45  # Premixing stage1
46  #
47  # This is a hack which should be placed somewhere else, but likely requires more massive changes for "proper" PUPRMX treatment
48  #
49  # On one hand the place where upgradeWorkflowComponents.upgradeProperties[year][...PU]
50  # are defined from the noPU workflows would be a logical place. On the other hand, that
51  # would need the premixing workflows to be defined in upgradeWorkflowComponents.upgradeKeys[year]
52  # dictionary, which would further mean that we would get full set of additional workflows for
53  # premixing, while the preferred solution would be to define the premixing workflows as variations of the PU workflows.
54  s = step.replace('GenSim', 'Premix')
55  if not s in upgradeSteps[stepType]['PU']:
56  continue
57  s = s + 'PU' # later processing requires to have PU here
58  # Hardcode nu gun fragment below in order to use it for combined stage1+stage2
59  # Anyway all other fragments are irrelevant for premixing stage1
60  stepList[stepType].append(stepMaker(key,"SingleNuE10_cf",s,upgradeSteps[stepType]['suffix']))
61  elif (stepType is not 'baseline') and ( ('PU' in step and step.replace('PU','') in upgradeSteps[stepType]['PU']) or (step in upgradeSteps[stepType]['steps']) ):
62  stepList[stepType].append(stepMaker(key,frag[:-4],step,upgradeSteps[stepType]['suffix']))
63  # hack to add an extra step
64  if stepType == 'ProdLike' and 'RecoFullGlobal' in step:
65  stepList[stepType].append(stepMaker(key,frag[:-4],step.replace('RecoFullGlobal','MiniAODFullGlobal'),upgradeSteps[stepType]['suffix']))
66  else:
67  stepList[stepType].append(stepMaker(key,frag[:-4],step,upgradeSteps['baseline']['suffix']))
68 
69  workflows[numWF] = [ upgradeDatasetFromFragment[frag], stepList['baseline']]
70 
71  # only keep some special workflows for timing
72  if upgradeDatasetFromFragment[frag]=="TTbar_14TeV" and '2023' in key:
73  workflows[numWF+upgradeSteps['Timing']['offset']] = [ upgradeDatasetFromFragment[frag]+"_Timing", stepList['Timing']]
74 
75  # special workflows for neutron bkg sim
76  if any(upgradeDatasetFromFragment[frag]==nfrag for nfrag in neutronFrags) and any(nkey in key for nkey in neutronKeys):
77  workflows[numWF+upgradeSteps['Neutron']['offset']] = [ upgradeDatasetFromFragment[frag]+"_Neutron", stepList['Neutron']]
78 
79  # special workflows for tracker
80  if (upgradeDatasetFromFragment[frag]=="TTbar_13" or upgradeDatasetFromFragment[frag]=="TTbar_14TeV") and not 'PU' in key and hasHarvest:
81  # skip ALCA and Nano
82  trackingVariations = ['trackingOnly','trackingRun2','trackingOnlyRun2','trackingLowPU','pixelTrackingOnly']
83  for tv in trackingVariations:
84  stepList[tv] = [s for s in stepList[tv] if (("ALCA" not in s) and ("Nano" not in s))]
85  workflows[numWF+upgradeSteps['trackingOnly']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['trackingOnly']]
86  if '2017' in key:
87  for tv in trackingVariations[1:]:
88  workflows[numWF+upgradeSteps[tv]['offset']] = [ upgradeDatasetFromFragment[frag], stepList[tv]]
89  elif '2018' in key:
90  workflows[numWF+upgradeSteps['pixelTrackingOnly']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['pixelTrackingOnly']]
91 
92  # special workflows for HE
93  if upgradeDatasetFromFragment[frag]=="TTbar_13" and '2018' in key:
94  workflows[numWF+upgradeSteps['heCollapse']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['heCollapse']]
95 
96  # special workflows for stuck TBM
97  if any(upgradeDatasetFromFragment[frag]==nfrag for nfrag in tbmFrags) and '2018' in key:
98  workflows[numWF+upgradeSteps['killStuckTBM']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['killStuckTBM']]
99 
100  # workflow for profiling
101  if upgradeDatasetFromFragment[frag]=="TTbar_14TeV" and '2023' in key:
102  workflows[numWF+upgradeSteps['ProdLike']['offset']] = [ upgradeDatasetFromFragment[frag]+"_ProdLike", stepList['ProdLike']]
103 
104  # special workflows for ParkingBPH
105  if upgradeDatasetFromFragment[frag]=="TTbar_13" and '2018' in key:
106  workflows[numWF+upgradeSteps['ParkingBPH']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['ParkingBPH']]
107 
108  # premixing stage1, only for NuGun
109  if upgradeDatasetFromFragment[frag]=="NuGun" and 'PU' in key and '2023' in key:
110  workflows[numWF+upgradeSteps['Premix']['offset']] = [upgradeDatasetFromFragment[frag], stepList['Premix']]
111 
112  # premixing stage2, only for ttbar for time being
113  if 'PU' in key and '2023' in key and upgradeDatasetFromFragment[frag]=="TTbar_14TeV":
114  slist = []
115  for step in stepList['baseline']:
116  s = step
117  if "Digi" in step or "Reco" in step:
118  s = s.replace("PU", "PUPRMX", 1)
119  slist.append(s)
120  workflows[numWF+premixS2_offset] = [upgradeDatasetFromFragment[frag], slist]
121 
122  # Combined stage1+stage2
123  workflows[numWF+premixS1S2_offset] = [upgradeDatasetFromFragment[frag], # Signal fragment
124  [slist[0]] + # Start with signal generation
125  stepList['Premix'] + # Premixing stage1
126  [slist[1].replace("PUPRMX", "PUPRMXCombined")] + # Premixing stage2, customized for the combined (defined in relval_steps.py)
127  slist[2:]] # Remaining standard steps
128 
129  numWF+=1
def makeStepName(key, frag, step, suffix)
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
def replace(string, replacements)
CLHEP::HepMatrix Matrix
Definition: matutil.h:65
def makeStepNameSim(key, frag, step, suffix)