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','2023D22','2023D23']
19 neutronFrags = ['ZMM_14','MinBias_14TeV']
20 
21 #just define all of them
22 
23 for year in upgradeKeys:
24  for i,key in enumerate(upgradeKeys[year]):
25  numWF=numWFAll[year][i]
26  for frag in upgradeFragments:
27  stepList={}
28  for stepType in upgradeSteps.keys():
29  stepList[stepType] = []
30  hasHarvest = False
31  for step in upgradeProperties[year][key]['ScenToRun']:
32  stepMaker = makeStepName
33  if 'Sim' in step:
34  if 'HLBeamSpotFull' in step and '14TeV' in frag:
35  step = 'GenSimHLBeamSpotFull14'
36  stepMaker = makeStepNameSim
37 
38  if 'HARVEST' in step: hasHarvest = True
39 
40  for stepType in upgradeSteps.keys():
41  # use variation only when available
42  if stepType == 'Premix':
43  # Premixing stage1
44  #
45  # This is a hack which should be placed somewhere else, but likely requires more massive changes for "proper" PUPRMX treatment
46  #
47  # On one hand the place where upgradeWorkflowComponents.upgradeProperties[year][...PU]
48  # are defined from the noPU workflows would be a logical place. On the other hand, that
49  # would need the premixing workflows to be defined in upgradeWorkflowComponents.upgradeKeys[year]
50  # dictionary, which would further mean that we would get full set of additional workflows for
51  # premixing, while the preferred solution would be to define the premixing workflows as variations of the PU workflows.
52  s = step.replace('GenSim', 'Premix')
53  if not s in upgradeSteps[stepType]['PU']:
54  continue
55  s = s + 'PU' # later processing requires to have PU here
56  stepList[stepType].append(stepMaker(key,frag[:-4],s,upgradeSteps[stepType]['suffix']))
57  elif (stepType is not 'baseline') and ( ('PU' in step and step.replace('PU','') in upgradeSteps[stepType]['PU']) or (step in upgradeSteps[stepType]['steps']) ):
58  stepList[stepType].append(stepMaker(key,frag[:-4],step,upgradeSteps[stepType]['suffix']))
59  else:
60  stepList[stepType].append(stepMaker(key,frag[:-4],step,upgradeSteps['baseline']['suffix']))
61 
62  workflows[numWF] = [ upgradeDatasetFromFragment[frag], stepList['baseline']]
63 
64  # only keep some special workflows for timing
65  if upgradeDatasetFromFragment[frag]=="TTbar_14TeV" and '2023' in key:
66  workflows[numWF+upgradeSteps['Timing']['offset']] = [ upgradeDatasetFromFragment[frag]+"_Timing", stepList['Timing']]
67 
68  # special workflows for neutron bkg sim
69  if any(upgradeDatasetFromFragment[frag]==nfrag for nfrag in neutronFrags) and any(nkey in key for nkey in neutronKeys):
70  workflows[numWF+upgradeSteps['Neutron']['offset']] = [ upgradeDatasetFromFragment[frag]+"_Neutron", stepList['Neutron']]
71 
72  # special workflows for tracker
73  if (upgradeDatasetFromFragment[frag]=="TTbar_13" or upgradeDatasetFromFragment[frag]=="TTbar_14TeV") and not 'PU' in key and hasHarvest:
74  # skip ALCA
75  trackingVariations = ['trackingOnly','trackingRun2','trackingOnlyRun2','trackingLowPU','pixelTrackingOnly']
76  for tv in trackingVariations:
77  stepList[tv] = filter(lambda s : "ALCA" not in s, stepList[tv])
78  workflows[numWF+upgradeSteps['trackingOnly']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['trackingOnly']]
79  if '2017' in key:
80  for tv in trackingVariations[1:]:
81  workflows[numWF+upgradeSteps[tv]['offset']] = [ upgradeDatasetFromFragment[frag], stepList[tv]]
82  elif '2018' in key:
83  workflows[numWF+upgradeSteps['pixelTrackingOnly']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['pixelTrackingOnly']]
84 
85  # special workflows for HE
86  if upgradeDatasetFromFragment[frag]=="TTbar_13" and '2018' in key:
87  workflows[numWF+upgradeSteps['heCollapse']['offset']] = [ upgradeDatasetFromFragment[frag], stepList['heCollapse']]
88 
89  # premixing stage1, only for NuGun
90  if upgradeDatasetFromFragment[frag]=="NuGun" and 'PU' in key and '2023' in key:
91  workflows[numWF+upgradeSteps['Premix']['offset']] = [upgradeDatasetFromFragment[frag], stepList['Premix']]
92 
93  # premixing stage2, only for ttbar for time being
94  if 'PU' in key and '2023' in key and upgradeDatasetFromFragment[frag]=="TTbar_14TeV":
95  slist = []
96  for step in stepList['baseline']:
97  s = step
98  if "Digi" in step or "Reco" in step:
99  s = s.replace("PU", "PUPRMX", 1)
100  slist.append(s)
101  workflows[numWF+premixS2_offset] = [upgradeDatasetFromFragment[frag], slist]
102 
103  numWF+=1
def makeStepName(key, frag, step, suffix)
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
CLHEP::HepMatrix Matrix
Definition: matutil.h:65
def makeStepNameSim(key, frag, step, suffix)