CMS 3D CMS Logo

relval_upgrade.py
Go to the documentation of this file.
1 # import the definition of the steps and input files:
3 
4 # here only define the workflows as a combination of the steps defined above:
5 workflows = Matrix()
6 
7 # each workflow defines a name and a list of steps to be done.
8 # if no explicit name/label given for the workflow (first arg),
9 # the name of step1 will be used
10 
11 def makeStepNameSim(key,frag,step,suffix):
12  return frag+'_'+key+'_'+step+suffix
13 
14 def makeStepName(key,frag,step,suffix):
15  return step+suffix+'_'+key
16 
17 #just define all of them
18 
19 
20 def notForGenOnly(key,specialType):
21  return "GenOnly" in key and specialType != 'baseline'
22 
23 for year in upgradeKeys:
24  for i,key in enumerate(upgradeKeys[year]):
25  numWF=numWFAll[year][i]
26  for frag,info in upgradeFragments.items():
27  # phase2-specific fragments are skipped in phase1
28  if ("CE_E" in frag or "CE_H" in frag) and year==2017:
29  numWF += 1
30  continue
31  stepList={}
32  for specialType in upgradeWFs.keys():
33  if notForGenOnly(key,specialType):
34  continue
35  stepList[specialType] = []
36  hasHarvest = False
37  for step in upgradeProperties[year][key]['ScenToRun']:
38  stepMaker = makeStepName
39  if 'Sim' in step and 'Fast' not in step and step != "Sim":
40  if 'HLBeamSpot' in step:
41  if '14TeV' in frag:
42  step = 'GenSimHLBeamSpot14'
43  if 'CloseByParticle' in frag or 'CE_E' in frag or 'CE_H' in frag:
44  step = 'GenSimHLBeamSpotHGCALCloseBy'
45  stepMaker = makeStepNameSim
46  elif 'Gen' in step:
47  if 'HLBeamSpot' in step:
48  if '14TeV' in frag:
49  step = 'GenHLBeamSpot14'
50  stepMaker = makeStepNameSim
51 
52  if 'HARVEST' in step: hasHarvest = True
53 
54  for specialType,specialWF in upgradeWFs.items():
55 
56  if notForGenOnly(key,specialType):
57  continue
58 
59  if (specialType != 'baseline') and ( ('PU' in step and step.replace('PU','') in specialWF.PU) or (step in specialWF.steps) ):
60  stepList[specialType].append(stepMaker(key,frag[:-4],step,specialWF.suffix))
61  # hack to add an extra step
62  if 'ProdLike' in specialType:
63  if 'Reco' in step: # handles both Reco, RecoFakeHLT and RecoGlobal
64  stepWoFakeHLT = step.replace('FakeHLT','') # ignore "FakeHLT" from step
65  stepList[specialType].append(stepMaker(key,frag[:-4],stepWoFakeHLT.replace('RecoGlobal','MiniAOD').replace('RecoNano','MiniAOD').replace('Reco','MiniAOD'),specialWF.suffix))
66  if 'RecoNano' in stepWoFakeHLT:
67  stepList[specialType].append(stepMaker(key,frag[:-4],stepWoFakeHLT.replace('RecoNano','Nano'),specialWF.suffix))
68  # hack to add extra HLT75e33 step for Phase-2
69  if 'HLT75e33' in specialType:
70  if 'RecoGlobal' in step:
71  stepList[specialType].append(stepMaker(key,frag[:-4],step.replace('RecoGlobal','HLT75e33'),specialWF.suffix))
72  # similar hacks for premixing
73  if 'PMX' in specialType:
74  if 'GenSim' in step:
75  s = step.replace('GenSim','Premix')+'PU' # later processing requires to have PU here
76  if step in specialWF.PU:
77  stepMade = stepMaker(key,'PREMIX',s,specialWF.suffix)
78  # append for combined
79  if 'S2' in specialType: stepList[specialType].append(stepMade)
80  # replace for s1
81  else: stepList[specialType][-1] = stepMade
82  else:
83  stepList[specialType].append(stepMaker(key,frag[:-4],step,''))
84 
85  for specialType,specialWF in upgradeWFs.items():
86  # remove other steps for premixS1
87  if notForGenOnly(key,specialType):
88  continue
89  if specialType=="PMXS1":
90  stepList[specialType] = stepList[specialType][:1]
91  specialWF.workflow(workflows, numWF, info.dataset, stepList[specialType], key, hasHarvest)
92 
93  numWF+=1
def makeStepName(key, frag, step, suffix)
def replace(string, replacements)
def notForGenOnly(key, specialType)
...
portabletest::Matrix Matrix
def makeStepNameSim(key, frag, step, suffix)