Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-01-12 08:55:10

0001 from copy import copy, deepcopy
0002 from collections import OrderedDict
0003 from .MatrixUtil import merge, Kby, Mby
0004 import re
0005 
0006 # DON'T CHANGE THE ORDER, only append new keys. Otherwise the numbering for the runTheMatrix tests will change.
0007 
0008 upgradeKeys = {}
0009 
0010 upgradeKeys[2017] = [
0011     '2017',
0012     '2017PU',
0013     '2017Design',
0014     '2017DesignPU',
0015     '2018',
0016     '2018PU',
0017     '2018Design',
0018     '2018DesignPU',
0019     '2021',
0020     '2021PU',
0021     '2021Design',
0022     '2021DesignPU',
0023     '2023',
0024     '2023PU',
0025     '2024',
0026     '2024PU',
0027     '2021FS',
0028     '2021FSPU',
0029     '2021postEE',
0030     '2021postEEPU',
0031 ]
0032 
0033 upgradeKeys[2026] = [
0034     '2026D86',
0035     '2026D86PU',
0036     '2026D88',
0037     '2026D88PU',
0038     '2026D91',
0039     '2026D91PU',
0040     '2026D92',
0041     '2026D92PU',
0042     '2026D93',
0043     '2026D93PU',
0044     '2026D94',
0045     '2026D94PU',
0046     '2026D95',
0047     '2026D95PU',
0048     '2026D96',
0049     '2026D96PU',
0050     '2026D97',
0051     '2026D97PU',
0052 ]
0053 
0054 # pre-generation of WF numbers
0055 numWFStart={
0056     2017: 10000,
0057     2026: 20000,
0058 }
0059 numWFSkip=200
0060 # temporary measure to keep other WF numbers the same
0061 numWFConflict = [[20400,20800], #D87
0062                  [21200,22000], #D89-D90
0063                  [50000,51000]]
0064 numWFAll={
0065     2017: [],
0066     2026: []
0067 }
0068 
0069 for year in upgradeKeys:
0070     for i in range(0,len(upgradeKeys[year])):
0071         numWFtmp = numWFStart[year] if i==0 else (numWFAll[year][i-1] + numWFSkip)
0072         for conflict in numWFConflict:
0073             if numWFtmp>=conflict[0] and numWFtmp<conflict[1]:
0074                 numWFtmp = conflict[1]
0075                 break
0076         numWFAll[year].append(numWFtmp)
0077 
0078 # workflows for baseline and for variations
0079 # setup() automatically loops over all steps and applies any customizations specified in setup_() -> called in relval_steps.py
0080 # setupPU() and setupPU_() operate similarly -> called in relval_steps.py *after* merging PUDataSets w/ regular steps
0081 # workflow() adds a concrete workflow to the list based on condition() -> called in relval_upgrade.py
0082 # every special workflow gets its own derived class, which must then be added to the global dict upgradeWFs
0083 preventReuseKeyword = 'NOREUSE'
0084 class UpgradeWorkflow(object):
0085     def __init__(self,steps,PU,suffix,offset):
0086         self.steps = steps
0087         self.PU = PU
0088         self.allowReuse = True
0089 
0090         # ensure all PU steps are in normal step list
0091         for step in self.PU:
0092             if not step in self.steps:
0093                 self.steps.append(step)
0094 
0095         self.suffix = suffix
0096         if len(self.suffix)>0 and self.suffix[0]!='_': self.suffix = '_'+self.suffix
0097         self.offset = offset
0098         if self.offset < 0.0 or self.offset > 1.0:
0099             raise ValueError("Special workflow offset must be between 0.0 and 1.0")
0100     def getStepName(self, step, extra=""):
0101         stepName = step + self.suffix + extra
0102         return stepName
0103     def getStepNamePU(self, step, extra=""):
0104         stepNamePU = step + 'PU' + self.suffix + extra
0105         return stepNamePU
0106     def init(self, stepDict):
0107         for step in self.steps:
0108             stepDict[self.getStepName(step)] = {}
0109             if not self.allowReuse: stepDict[self.getStepName(step,preventReuseKeyword)] = {}
0110         for step in self.PU:
0111             stepDict[self.getStepNamePU(step)] = {}
0112             if not self.allowReuse: stepDict[self.getStepNamePU(step,preventReuseKeyword)] = {}
0113     def setup(self, stepDict, k, properties):
0114         for step in self.steps:
0115             self.setup_(step, self.getStepName(step), stepDict, k, properties)
0116             if not self.allowReuse: self.preventReuse(self.getStepName(step,preventReuseKeyword), stepDict, k)
0117     def setupPU(self, stepDict, k, properties):
0118         for step in self.PU:
0119             self.setupPU_(step, self.getStepNamePU(step), stepDict, k, properties)
0120             if not self.allowReuse: self.preventReuse(self.getStepNamePU(step,preventReuseKeyword), stepDict, k)
0121     def setup_(self, step, stepName, stepDict, k, properties):
0122         pass
0123     def setupPU_(self, step, stepName, stepDict, k, properties):
0124         pass
0125     def workflow(self, workflows, num, fragment, stepList, key, hasHarvest):
0126         if self.condition(fragment, stepList, key, hasHarvest):
0127             self.workflow_(workflows, num, fragment, stepList, key)
0128     def workflow_(self, workflows, num, fragment, stepList, key):
0129         fragmentTmp = [fragment, key]
0130         if len(self.suffix)>0: fragmentTmp.append(self.suffix)
0131         workflows[num+self.offset] = [ fragmentTmp, stepList ]
0132     def condition(self, fragment, stepList, key, hasHarvest):
0133         return False
0134     def preventReuse(self, stepName, stepDict, k):
0135         if "Sim" in stepName:
0136             stepDict[stepName][k] = None
0137         if "Gen" in stepName:
0138             stepDict[stepName][k] = None
0139 upgradeWFs = OrderedDict()
0140 
0141 class UpgradeWorkflow_baseline(UpgradeWorkflow):
0142     def setup_(self, step, stepName, stepDict, k, properties):
0143         cust=properties.get('Custom', None)
0144         era=properties.get('Era', None)
0145         modifier=properties.get('ProcessModifier',None)
0146         if cust is not None: stepDict[stepName][k]['--customise']=cust
0147         if era is not None:
0148             stepDict[stepName][k]['--era']=era
0149         if modifier is not None: stepDict[stepName][k]['--procModifier']=modifier
0150     def condition(self, fragment, stepList, key, hasHarvest):
0151         return True
0152 upgradeWFs['baseline'] = UpgradeWorkflow_baseline(
0153     steps =  [
0154         'Gen',
0155         'GenSim',
0156         'GenSimHLBeamSpot',
0157         'GenSimHLBeamSpot14',
0158         'GenSimHLBeamSpotHGCALCloseBy',
0159         'Digi',
0160         'DigiTrigger',
0161         'HLTRun3',
0162         'RecoLocal',
0163         'Reco',
0164         'RecoFakeHLT',
0165         'RecoGlobal',
0166         'RecoNano',
0167         'HARVEST',
0168         'HARVESTFakeHLT',
0169         'HARVESTNano',
0170         'FastSim',
0171         'HARVESTFast',
0172         'HARVESTGlobal',
0173         'ALCA',
0174         'ALCAPhase2',
0175         'Nano',
0176         'MiniAOD',
0177         'HLT75e33',
0178         'FastSimRun3',
0179         'HARVESTFastRun3',
0180     ],
0181     PU =  [
0182         'DigiTrigger',
0183         'RecoLocal',
0184         'RecoGlobal',
0185         'Digi',
0186         'Reco',
0187         'RecoFakeHLT',
0188         'RecoNano',
0189         'HARVEST',
0190         'HARVESTFakeHLT',
0191         'HARVESTNano',
0192         'HARVESTGlobal',
0193         'MiniAOD',
0194         'Nano',
0195         'HLT75e33',
0196         'FastSimRun3',
0197         'HARVESTFastRun3',
0198     ],
0199     suffix = '',
0200     offset = 0.0,
0201 )
0202 
0203 
0204 class UpgradeWorkflow_DigiNoHLT(UpgradeWorkflow):
0205     def setup_(self, step, stepName, stepDict, k, properties):
0206         if stepDict[step][k] != None:
0207             if 'ALCA' in step:
0208                 stepDict[stepName][k] = None
0209             if 'RecoNano' in step:
0210                 stepDict[stepName][k] = merge([{'--filein': 'file:step3.root', '--secondfilein': 'file:step2.root'}, stepDict[step][k]])
0211             if 'Digi' in step:
0212                 stepDict[stepName][k] = merge([{'-s': re.sub(',HLT.*', '', stepDict[step][k]['-s'])}, stepDict[step][k]])
0213     def condition(self, fragment, stepList, key, hasHarvest):
0214         if ('TTbar_14TeV' in fragment and '2021' == key):
0215             stepList.insert(stepList.index('Digi_DigiNoHLT_2021')+1, 'HLTRun3_2021')
0216         return ('TTbar_14TeV' in fragment and '2021' == key)
0217 upgradeWFs['DigiNoHLT'] = UpgradeWorkflow_DigiNoHLT(
0218     steps = [
0219         'Digi',
0220         'RecoNano',
0221         'ALCA'
0222     ],
0223     PU = [],
0224     suffix = '_DigiNoHLT',
0225     offset = 0.601,
0226 )
0227 
0228 # some commonalities among tracking WFs
0229 class UpgradeWorkflowTracking(UpgradeWorkflow):
0230 
0231     def __init__(self, steps, PU, suffix, offset):
0232         # always include some steps that will be skipped
0233         steps = steps + ["ALCA","Nano"]
0234         super().__init__(steps, PU, suffix, offset)
0235     def condition(self, fragment, stepList, key, hasHarvest):
0236         result = (fragment=="TTbar_13" or fragment=="TTbar_14TeV") and not 'PU' in key and hasHarvest and self.condition_(fragment, stepList, key, hasHarvest)
0237         return result
0238     def condition_(self, fragment, stepList, key, hasHarvest):
0239         return True
0240     def setup_(self, step, stepName, stepDict, k, properties):
0241         # skip ALCA and Nano steps (but not RecoNano or HARVESTNano for Run3)
0242         if 'ALCA' in step or 'Nano'==step:
0243             stepDict[stepName][k] = None
0244         self.setup__(step, stepName, stepDict, k, properties)
0245     # subordinate function for inherited classes
0246     def setup__(self, step, stepName, stepDict, k, properties):
0247         pass
0248 
0249 class UpgradeWorkflow_trackingOnly(UpgradeWorkflowTracking):
0250     def setup__(self, step, stepName, stepDict, k, properties):
0251         if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0252         elif 'HARVEST' in step: stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@trackingOnlyDQM'}, stepDict[step][k]])
0253 
0254     def condition(self, fragment, stepList, key, hasHarvest):
0255         result = (fragment=="TTbar_13" or fragment=="TTbar_14TeV") and hasHarvest and self.condition_(fragment, stepList, key, hasHarvest)
0256         return result
0257 
0258 
0259 
0260 upgradeWFs['trackingOnly'] = UpgradeWorkflow_trackingOnly(
0261     steps = [
0262         'Reco',
0263         'HARVEST',
0264         'RecoGlobal',
0265         'HARVESTGlobal',
0266         'RecoNano',
0267         'HARVESTNano',
0268         'RecoFakeHLT',
0269         'HARVESTFakeHLT',
0270     ],
0271     PU = [
0272         'Reco',
0273         'HARVEST',
0274         'RecoGlobal',
0275         'HARVESTGlobal',
0276         'RecoNano',
0277         'HARVESTNano',
0278         'RecoFakeHLT',
0279         'HARVESTFakeHLT'
0280     ],
0281 
0282 
0283     suffix = '_trackingOnly',
0284     offset = 0.1,
0285 )
0286 upgradeWFs['trackingOnly'].step3 = {
0287     '-s': 'RAW2DIGI,RECO:reconstruction_trackingOnly,VALIDATION:@trackingOnlyValidation,DQM:@trackingOnlyDQM',
0288     '--datatier':'GEN-SIM-RECO,DQMIO',
0289     '--eventcontent':'RECOSIM,DQM',
0290 }
0291 # used outside of upgrade WFs
0292 step3_trackingOnly = upgradeWFs['trackingOnly'].step3
0293 
0294 class UpgradeWorkflow_trackingRun2(UpgradeWorkflowTracking):
0295     def setup__(self, step, stepName, stepDict, k, properties):
0296         if 'Reco' in step and stepDict[step][k]['--era']=='Run2_2017':
0297             stepDict[stepName][k] = merge([{'--era': 'Run2_2017_trackingRun2'}, stepDict[step][k]])
0298     def condition_(self, fragment, stepList, key, hasHarvest):
0299         return '2017' in key
0300 upgradeWFs['trackingRun2'] = UpgradeWorkflow_trackingRun2(
0301     steps = [
0302         'Reco',
0303         'RecoFakeHLT',
0304     ],
0305     PU = [],
0306     suffix = '_trackingRun2',
0307     offset = 0.2,
0308 )
0309 
0310 class UpgradeWorkflow_trackingOnlyRun2(UpgradeWorkflowTracking):
0311     def setup__(self, step, stepName, stepDict, k, properties):
0312         if 'Reco' in step and stepDict[step][k]['--era']=='Run2_2017':
0313             stepDict[stepName][k] = merge([{'--era': 'Run2_2017_trackingRun2'}, self.step3, stepDict[step][k]])
0314         elif 'HARVEST' in step: stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@trackingOnlyDQM'}, stepDict[step][k]])
0315     def condition_(self, fragment, stepList, key, hasHarvest):
0316         return '2017' in key
0317 upgradeWFs['trackingOnlyRun2'] = UpgradeWorkflow_trackingOnlyRun2(
0318     steps = [
0319         'Reco',
0320         'HARVEST',
0321         'RecoFakeHLT',
0322         'HARVESTFakeHLT',
0323     ],
0324     PU = [],
0325     suffix = '_trackingOnlyRun2',
0326     offset = 0.3,
0327 )
0328 upgradeWFs['trackingOnlyRun2'].step3 = upgradeWFs['trackingOnly'].step3
0329 
0330 class UpgradeWorkflow_trackingLowPU(UpgradeWorkflowTracking):
0331     def setup__(self, step, stepName, stepDict, k, properties):
0332         if 'Reco' in step and stepDict[step][k]['--era']=='Run2_2017':
0333             stepDict[stepName][k] = merge([{'--era': 'Run2_2017_trackingLowPU'}, stepDict[step][k]])
0334     def condition_(self, fragment, stepList, key, hasHarvest):
0335         return '2017' in key
0336 upgradeWFs['trackingLowPU'] = UpgradeWorkflow_trackingLowPU(
0337     steps = [
0338         'Reco',
0339         'RecoFakeHLT',
0340     ],
0341     PU = [],
0342     suffix = '_trackingLowPU',
0343     offset = 0.4,
0344 )
0345 
0346 class UpgradeWorkflow_pixelTrackingOnly(UpgradeWorkflowTracking):
0347     def setup__(self, step, stepName, stepDict, k, properties):
0348         if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0349         # skip ALCA step as products might not be available
0350         elif 'ALCA' in step: stepDict[stepName][k] = None
0351         elif 'HARVEST' in step: stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'}, stepDict[step][k]])
0352     def condition_(self, fragment, stepList, key, hasHarvest):
0353         return ('2017' in key or '2018' in key or '2021' in key or '2026' in key) and ('FS' not in key)
0354 upgradeWFs['pixelTrackingOnly'] = UpgradeWorkflow_pixelTrackingOnly(
0355     steps = [
0356         'Reco',
0357         'HARVEST',
0358         'RecoGlobal',
0359         'HARVESTGlobal',
0360         'RecoNano',
0361         'HARVESTNano',
0362         'RecoFakeHLT',
0363         'HARVESTFakeHLT',
0364         'ALCA',
0365         'ALCAPhase2'
0366     ],
0367     PU = [],
0368     suffix = '_pixelTrackingOnly',
0369     offset = 0.5,
0370 )
0371 upgradeWFs['pixelTrackingOnly'].step3 = {
0372     '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
0373     '--datatier': 'GEN-SIM-RECO,DQMIO',
0374     '--eventcontent': 'RECOSIM,DQM',
0375 }
0376 
0377 class UpgradeWorkflow_trackingMkFit(UpgradeWorkflowTracking):
0378     def setup__(self, step, stepName, stepDict, k, properties):
0379         if 'Digi' in step: stepDict[stepName][k] = merge([self.step2, stepDict[step][k]])
0380         if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0381     def condition_(self, fragment, stepList, key, hasHarvest):
0382         return '2017' in key or '2021' in key
0383 upgradeWFs['trackingMkFit'] = UpgradeWorkflow_trackingMkFit(
0384     steps = [
0385         'Digi',
0386         'DigiTrigger',
0387         'Reco',
0388         'RecoGlobal',
0389         'RecoNano',
0390         'RecoFakeHLT',
0391     ],
0392     PU = [],
0393     suffix = '_trackingMkFit',
0394     offset = 0.7,
0395 )
0396 upgradeWFs['trackingMkFit'].step2 = {
0397     '--customise': 'RecoTracker/MkFit/customizeHLTIter0ToMkFit.customizeHLTIter0ToMkFit'
0398 }
0399 upgradeWFs['trackingMkFit'].step3 = {
0400     '--procModifiers': 'trackingMkFitDevel'
0401 }
0402 
0403 #DeepCore seeding for JetCore iteration workflow
0404 class UpgradeWorkflow_seedingDeepCore(UpgradeWorkflow):
0405     def setup_(self, step, stepName, stepDict, k, properties):
0406         # skip ALCA and Nano steps (but not RecoNano or HARVESTNano for Run3)
0407         if 'ALCA' in step or 'Nano'==step:
0408             stepDict[stepName][k] = None
0409         elif 'Reco' in step or 'HARVEST' in step: stepDict[stepName][k] = merge([{'--procModifiers': 'seedingDeepCore'}, stepDict[step][k]])
0410     def condition(self, fragment, stepList, key, hasHarvest):
0411         result = (fragment=="QCD_Pt_1800_2400_14" or fragment=="TTbar_14TeV" ) and ('2021' in key or '2024' in key) and hasHarvest
0412         return result
0413 upgradeWFs['seedingDeepCore'] = UpgradeWorkflow_seedingDeepCore(
0414     steps = [
0415         'Reco',
0416         'HARVEST',
0417         'RecoGlobal',
0418         'HARVESTGlobal',
0419         'RecoNano',
0420         'HARVESTNano',
0421         'Nano',
0422         'ALCA',
0423     ],
0424     PU = [
0425         'Reco',
0426         'RecoGlobal',
0427         'HARVESTGlobal',
0428         'RecoNano',
0429         'HARVESTNano',
0430     ],
0431     suffix = '_seedingDeepCore',
0432     offset = 0.17,
0433 )
0434 
0435 # Vector Hits workflows
0436 class UpgradeWorkflow_vectorHits(UpgradeWorkflow):
0437     def setup_(self, step, stepName, stepDict, k, properties):
0438         stepDict[stepName][k] = merge([{'--procModifiers': 'vectorHits'}, stepDict[step][k]])
0439     def condition(self, fragment, stepList, key, hasHarvest):
0440         return (fragment=="TTbar_14TeV" or fragment=="SingleMuPt10Extended") and '2026' in key
0441 upgradeWFs['vectorHits'] = UpgradeWorkflow_vectorHits(
0442     steps = [
0443         'RecoGlobal',
0444         'HARVESTGlobal'
0445     ],
0446     PU = [
0447         'RecoGlobal',
0448         'HARVESTGlobal'
0449     ],
0450     suffix = '_vectorHits',
0451     offset = 0.9,
0452 )
0453 
0454 # WeightedMeanFitter vertexing workflows
0455 class UpgradeWorkflow_weightedVertex(UpgradeWorkflow):
0456     def __init__(self, reco = {}, harvest = {}, **kwargs):
0457         # adapt the parameters for the UpgradeWorkflow init method
0458         super(UpgradeWorkflow_weightedVertex, self).__init__(
0459             steps = [
0460                 'Reco',
0461                 'HARVEST',
0462                 'RecoGlobal',
0463                 'HARVESTGlobal',
0464                 'RecoNano',
0465                 'HARVESTNano',
0466                 'RecoFakeHLT',
0467                 'HARVESTFakeHLT',
0468             ],
0469             PU = [
0470                 'Reco',
0471                 'HARVEST',
0472                 'RecoGlobal',
0473                 'HARVESTGlobal',
0474                 'RecoNano',
0475                 'HARVESTNano',
0476                 'RecoFakeHLT',
0477                 'HARVESTFakeHLT',
0478             ],
0479             **kwargs)
0480         self.__reco = reco
0481         self.__harvest = harvest
0482 
0483     def setup_(self, step, stepName, stepDict, k, properties):
0484         # temporarily remove trigger & downstream steps
0485         if 'Reco' in step:
0486             mod = {'--procModifiers': 'weightedVertexing,vertexInBlocks', '--datatier':'GEN-SIM-RECO,DQMIO',
0487             '--eventcontent':'RECOSIM,DQM'}
0488             stepDict[stepName][k] = merge([mod,self.step3, stepDict[step][k]])
0489         if 'HARVEST' in step:
0490             stepDict[stepName][k] = merge([self.step4,stepDict[step][k]])
0491 
0492     def condition(self, fragment, stepList, key, hasHarvest):
0493         # select only a subset of the workflows
0494         selected = [
0495             ('2021' in key and fragment == "TTbar_14TeV" and 'FS' not in key),
0496             ('2024' in key and fragment == "TTbar_14TeV"),
0497             ('2026' in key and fragment == "TTbar_14TeV")
0498         ]
0499         result = any(selected) and hasHarvest
0500 
0501         return result
0502 
0503 
0504 upgradeWFs['weightedVertex'] = UpgradeWorkflow_weightedVertex(
0505     suffix = '_weightedVertex',
0506     offset = 0.278,
0507 )
0508 
0509 upgradeWFs['weightedVertex'].step3 = {}
0510 upgradeWFs['weightedVertex'].step4 = {}
0511 
0512 upgradeWFs['weightedVertexTrackingOnly'] = UpgradeWorkflow_weightedVertex(
0513     suffix = '_weightedVertexTrackingOnly',
0514     offset = 0.279,
0515 )
0516 
0517 upgradeWFs['weightedVertexTrackingOnly'].step3 = {
0518     '-s': 'RAW2DIGI,RECO:reconstruction_trackingOnly,VALIDATION:@trackingOnlyValidation,DQM:@trackingOnlyDQM',
0519     '--datatier':'GEN-SIM-RECO,DQMIO',
0520     '--eventcontent':'RECOSIM,DQM',
0521 }
0522 
0523 upgradeWFs['weightedVertexTrackingOnly'].step4 = {
0524     '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'
0525 }
0526 
0527 # Special TICL Pattern recognition Workflows
0528 class UpgradeWorkflow_ticl_clue3D(UpgradeWorkflow):
0529     def setup_(self, step, stepName, stepDict, k, properties):
0530         if 'RecoGlobal' in step:
0531             stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0532         if 'HARVESTGlobal' in step:
0533             stepDict[stepName][k] = merge([self.step4, stepDict[step][k]])
0534     def condition(self, fragment, stepList, key, hasHarvest):
0535         return (fragment=="TTbar_14TeV" or 'CloseByPGun_CE' in fragment) and '2026' in key
0536 upgradeWFs['ticl_clue3D'] = UpgradeWorkflow_ticl_clue3D(
0537     steps = [
0538         'RecoGlobal',
0539         'HARVESTGlobal'
0540     ],
0541     PU = [
0542         'RecoGlobal',
0543         'HARVESTGlobal'
0544     ],
0545     suffix = '_ticl_clue3D',
0546     offset = 0.201,
0547 )
0548 upgradeWFs['ticl_clue3D'].step3 = {'--procModifiers': 'clue3D'}
0549 upgradeWFs['ticl_clue3D'].step4 = {'--procModifiers': 'clue3D'}
0550 
0551 class UpgradeWorkflow_ticl_FastJet(UpgradeWorkflow):
0552     def setup_(self, step, stepName, stepDict, k, properties):
0553         if 'RecoGlobal' in step:
0554             stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0555         if 'HARVESTGlobal' in step:
0556             stepDict[stepName][k] = merge([self.step4, stepDict[step][k]])
0557     def condition(self, fragment, stepList, key, hasHarvest):
0558         return (fragment=="TTbar_14TeV" or 'CloseByPGun_CE' in fragment) and '2026' in key
0559 upgradeWFs['ticl_FastJet'] = UpgradeWorkflow_ticl_FastJet(
0560     steps = [
0561         'RecoGlobal',
0562         'HARVESTGlobal'
0563     ],
0564     PU = [
0565         'RecoGlobal',
0566         'HARVESTGlobal'
0567     ],
0568     suffix = '_ticl_FastJet',
0569     offset = 0.202,
0570 )
0571 upgradeWFs['ticl_FastJet'].step3 = {'--procModifiers': 'fastJetTICL'}
0572 upgradeWFs['ticl_FastJet'].step4 = {'--procModifiers': 'fastJetTICL'}
0573 
0574 class UpgradeWorkflow_ticl_v3(UpgradeWorkflow):
0575     def setup_(self, step, stepName, stepDict, k, properties):
0576         if 'RecoGlobal' in step:
0577             stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0578         if 'HARVESTGlobal' in step:
0579             stepDict[stepName][k] = merge([self.step4, stepDict[step][k]])
0580     def condition(self, fragment, stepList, key, hasHarvest):
0581         return (fragment=="TTbar_14TeV" or 'CloseByP' in fragment or 'Eta1p7_2p7' in fragment) and '2026' in key
0582 upgradeWFs['ticl_v3'] = UpgradeWorkflow_ticl_v3(
0583     steps = [
0584         'RecoGlobal',
0585         'HARVESTGlobal'
0586     ],
0587     PU = [
0588         'RecoGlobal',
0589         'HARVESTGlobal'
0590     ],
0591     suffix = '_ticl_v3',
0592     offset = 0.203,
0593 )
0594 upgradeWFs['ticl_v3'].step3 = {'--procModifiers': 'ticl_v3'}
0595 upgradeWFs['ticl_v3'].step4 = {'--procModifiers': 'ticl_v3'}
0596 
0597 
0598 # Track DNN workflows
0599 class UpgradeWorkflow_trackdnn(UpgradeWorkflow):
0600     def setup_(self, step, stepName, stepDict, k, properties):
0601         stepDict[stepName][k] = merge([{'--procModifiers': 'trackdnn'}, stepDict[step][k]])
0602 
0603     def condition(self, fragment, stepList, key, hasHarvest):
0604         return fragment=="TTbar_14TeV" and '2021' in key
0605 upgradeWFs['trackdnn'] = UpgradeWorkflow_trackdnn(
0606     steps = [
0607         'Reco',
0608         'RecoNano',
0609     ],
0610     PU = [
0611         'Reco',
0612         'RecoNano',
0613     ],
0614     suffix = '_trackdnn',
0615     offset = 0.91,
0616 )
0617 
0618 
0619 # MLPF workflows
0620 class UpgradeWorkflow_mlpf(UpgradeWorkflow):
0621     def setup_(self, step, stepName, stepDict, k, properties):
0622         if 'Reco' in step:
0623             stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0624     def condition(self, fragment, stepList, key, hasHarvest):
0625         return (fragment=="TTbar_14TeV" or fragment=="QCD_FlatPt_15_3000HS_14") and '2021PU' in key
0626 
0627 upgradeWFs['mlpf'] = UpgradeWorkflow_mlpf(
0628     steps = [
0629         'Reco',
0630         'RecoNano',
0631     ],
0632     PU = [
0633         'Reco',
0634         'RecoNano',
0635     ],
0636     suffix = '_mlpf',
0637     offset = 0.13,
0638 )
0639 upgradeWFs['mlpf'].step3 = {
0640     '--datatier': 'GEN-SIM-RECO,RECOSIM,MINIAODSIM,NANOAODSIM,DQMIO',
0641     '--eventcontent': 'FEVTDEBUGHLT,RECOSIM,MINIAODSIM,NANOEDMAODSIM,DQM',
0642     '--procModifiers': 'mlpf'
0643 }
0644 
0645 
0646 # ECAL DeepSC clustering studies workflow
0647 class UpgradeWorkflow_ecalclustering(UpgradeWorkflow):
0648     def setup_(self, step, stepName, stepDict, k, properties):
0649         if 'Reco' in step:
0650             stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0651     def condition(self, fragment, stepList, key, hasHarvest):
0652         return (fragment=="ZEE_14" or fragment=="TTbar_14TeV" or fragment=="WprimeTolNu_M3000_13TeV_pythia8"
0653             or fragment=="DisplacedSUSY_stopToBottom_M_300_1000mm_13" or fragment=="RunEGamma2018D" )
0654 
0655 upgradeWFs['ecalDeepSC'] = UpgradeWorkflow_ecalclustering(
0656     steps = [
0657         'Reco',
0658         'RecoNano',
0659     ],
0660     PU = [
0661         'Reco',
0662         'RecoNano',
0663     ],
0664     suffix = '_ecalDeepSC',
0665     offset = 0.19,
0666 )
0667 upgradeWFs['ecalDeepSC'].step3 = {
0668     '--datatier': 'RECOSIM,MINIAODSIM,NANOAODSIM,DQMIO',
0669     '--eventcontent': 'RECOSIM,MINIAODSIM,NANOEDMAODSIM,DQM',
0670     '--procModifiers': 'ecal_deepsc'
0671 }
0672 
0673 
0674 # photonDRN workflows
0675 class UpgradeWorkflow_photonDRN(UpgradeWorkflow):
0676     def setup_(self, step, stepName, stepDict, k, properties):
0677         if 'Reco' in step:
0678             stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
0679     def condition(self, fragment, stepList, key, hasHarvest):
0680         return '2018' in key and "SingleGamma" in fragment
0681 
0682 upgradeWFs['photonDRN'] = UpgradeWorkflow_photonDRN(
0683     steps = [
0684         'Reco',
0685         'RecoNano',
0686         'RecoFakeHLT'
0687     ],
0688     PU = [
0689         'Reco',
0690         'RecoNano',
0691         'RecoFakeHLT'
0692     ],
0693     suffix = '_photonDRN',
0694     offset = 0.31,
0695 )
0696 upgradeWFs['photonDRN'].step3 = {
0697     '--procModifiers': 'enableSonicTriton,photonDRN'
0698 }
0699 
0700 
0701 # Patatrack workflows:
0702 #   - 2018 conditions, TTbar
0703 #   - 2018 conditions, Z->mumu,
0704 #   - 2021 conditions, TTbar
0705 #   - 2021 conditions, Z->mumu,
0706 class PatatrackWorkflow(UpgradeWorkflow):
0707     def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs):
0708         # adapt the parameters for the UpgradeWorkflow init method
0709         super(PatatrackWorkflow, self).__init__(
0710             steps = [
0711                 'Digi',
0712                 'DigiTrigger',
0713                 'Reco',
0714                 'HARVEST',
0715                 'RecoFakeHLT',
0716                 'HARVESTFakeHLT',
0717                 'RecoGlobal',
0718                 'HARVESTGlobal',
0719                 'RecoNano',
0720                 'HARVESTNano',
0721                 'Nano',
0722                 'ALCA',
0723                 'ALCAPhase2'
0724             ],
0725             PU = [],
0726             **kwargs)
0727         self.__digi = digi
0728         self.__reco = reco
0729         self.__reco.update({
0730             '--datatier':     'GEN-SIM-RECO,DQMIO',
0731             '--eventcontent': 'RECOSIM,DQM'
0732         })
0733         self.__harvest = harvest
0734 
0735     def condition(self, fragment, stepList, key, hasHarvest):
0736         # select only a subset of the workflows
0737         selected = [
0738             ('2018' in key and fragment == "TTbar_13"),
0739             ('2021' in key and fragment == "TTbar_14TeV" and 'FS' not in key),
0740             ('2018' in key and fragment == "ZMM_13"),
0741             ('2021' in key and fragment == "ZMM_14" and 'FS' not in key),
0742             ('2026D88' in key and fragment == "TTbar_14TeV" and "PixelOnly" in self.suffix)
0743         ]
0744         result = any(selected) and hasHarvest
0745 
0746         return result
0747 
0748     def setup_(self, step, stepName, stepDict, k, properties):
0749         # skip ALCA and Nano steps (but not RecoNano or HARVESTNano for Run3)
0750         if 'ALCA' in step or 'Nano'==step:
0751             stepDict[stepName][k] = None
0752         elif 'Digi' in step:
0753             if self.__digi is None:
0754               stepDict[stepName][k] = None
0755             else:
0756               stepDict[stepName][k] = merge([self.__digi, stepDict[step][k]])
0757         elif 'Reco' in step:
0758             if self.__reco is None:
0759               stepDict[stepName][k] = None
0760             else:
0761               stepDict[stepName][k] = merge([self.__reco, stepDict[step][k]])
0762         elif 'HARVEST' in step:
0763             if self.__harvest is None:
0764               stepDict[stepName][k] = None
0765             else:
0766               stepDict[stepName][k] = merge([self.__harvest, stepDict[step][k]])
0767 
0768 # Pixel-only quadruplets workflow running on CPU
0769 #  - HLT on CPU
0770 #  - Pixel-only reconstruction on CPU, with DQM and validation
0771 #  - harvesting
0772 upgradeWFs['PatatrackPixelOnlyCPU'] = PatatrackWorkflow(
0773     digi = {
0774         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0775     },
0776     reco = {
0777         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
0778         '--procModifiers': 'pixelNtupletFit'
0779     },
0780     harvest = {
0781         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'
0782     },
0783     suffix = 'Patatrack_PixelOnlyCPU',
0784     offset = 0.501,
0785 )
0786 
0787 # Pixel-only quadruplets workflow running on CPU or GPU
0788 #  - HLT on GPU (optional)
0789 #  - Pixel-only reconstruction on GPU (optional), with DQM and validation
0790 #  - harvesting
0791 upgradeWFs['PatatrackPixelOnlyGPU'] = PatatrackWorkflow(
0792     digi = {
0793         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0794         '--procModifiers': 'gpu'
0795     },
0796     reco = {
0797         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
0798         '--procModifiers': 'pixelNtupletFit,gpu'
0799     },
0800     harvest = {
0801         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'
0802     },
0803     suffix = 'Patatrack_PixelOnlyGPU',
0804     offset = 0.502,
0805 )
0806 
0807 # Pixel-only quadruplets workflow running on CPU and GPU
0808 #  - HLT on GPU (required)
0809 #  - Pixel-only reconstruction on both CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
0810 #  - harvesting
0811 upgradeWFs['PatatrackPixelOnlyGPUValidation'] = PatatrackWorkflow(
0812     digi = {
0813         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0814         '--accelerators': 'gpu-nvidia',
0815         '--procModifiers': 'gpu'
0816     },
0817     reco = {
0818         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
0819         '--accelerators': 'gpu-nvidia',
0820         '--procModifiers': 'pixelNtupletFit,gpuValidation'
0821     },
0822     harvest = {
0823         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM',
0824         '--procModifiers': 'gpuValidation'
0825     },
0826     suffix = 'Patatrack_PixelOnlyGPU_Validation',
0827     offset = 0.503,
0828 )
0829 
0830 # Pixel-only quadruplets workflow running on CPU or GPU, trimmed down for benchmarking
0831 #  - HLT on GPU (optional)
0832 #  - Pixel-only reconstruction on GPU (optional)
0833 upgradeWFs['PatatrackPixelOnlyGPUProfiling'] = PatatrackWorkflow(
0834     digi = {
0835         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0836         '--procModifiers': 'gpu'
0837     },
0838     reco = {
0839         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly',
0840         '--procModifiers': 'pixelNtupletFit,gpu',
0841         '--customise' : 'RecoTracker/Configuration/customizePixelOnlyForProfiling.customizePixelOnlyForProfilingGPUOnly'
0842     },
0843     harvest = None,
0844     suffix = 'Patatrack_PixelOnlyGPU_Profiling',
0845     offset = 0.504,
0846 )
0847 
0848 # Pixel-only triplets workflow running on CPU
0849 #  - HLT on CPU
0850 #  - Pixel-only reconstruction on CPU, with DQM and validation
0851 #  - harvesting
0852 upgradeWFs['PatatrackPixelOnlyTripletsCPU'] = PatatrackWorkflow(
0853     digi = {
0854         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0855     },
0856     reco = {
0857         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
0858         '--procModifiers': 'pixelNtupletFit',
0859         '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets'
0860     },
0861     harvest = {
0862         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'
0863     },
0864     suffix = 'Patatrack_PixelOnlyTripletsCPU',
0865     offset = 0.505,
0866 )
0867 
0868 # Pixel-only triplets workflow running on CPU or GPU
0869 #  - HLT on GPU (optional)
0870 #  - Pixel-only reconstruction on GPU (optional), with DQM and validation
0871 #  - harvesting
0872 upgradeWFs['PatatrackPixelOnlyTripletsGPU'] = PatatrackWorkflow(
0873     digi = {
0874         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0875         '--procModifiers': 'gpu'
0876     },
0877     reco = {
0878         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
0879         '--procModifiers': 'pixelNtupletFit,gpu',
0880         '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets'
0881     },
0882     harvest = {
0883         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM'
0884     },
0885     suffix = 'Patatrack_PixelOnlyTripletsGPU',
0886     offset = 0.506,
0887 )
0888 
0889 # Pixel-only triplets workflow running on CPU and GPU
0890 #  - HLT on GPU (required)
0891 #  - Pixel-only reconstruction on both CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
0892 #  - harvesting
0893 upgradeWFs['PatatrackPixelOnlyTripletsGPUValidation'] = PatatrackWorkflow(
0894     digi = {
0895         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0896         '--accelerators': 'gpu-nvidia',
0897         '--procModifiers': 'gpu'
0898     },
0899     reco = {
0900         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly,VALIDATION:@pixelTrackingOnlyValidation,DQM:@pixelTrackingOnlyDQM',
0901         '--accelerators': 'gpu-nvidia',
0902         '--procModifiers': 'pixelNtupletFit,gpuValidation',
0903         '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets'
0904     },
0905     harvest = {
0906         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM',
0907         '--procModifiers': 'gpuValidation',
0908     },
0909     suffix = 'Patatrack_PixelOnlyTripletsGPU_Validation',
0910     offset = 0.507,
0911 )
0912 
0913 # Pixel-only triplets workflow running on CPU or GPU, trimmed down for benchmarking
0914 #  - HLT on GPU (optional)
0915 #  - Pixel-only reconstruction on GPU (optional)
0916 upgradeWFs['PatatrackPixelOnlyTripletsGPUProfiling'] = PatatrackWorkflow(
0917     digi = {
0918         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0919         '--procModifiers': 'gpu'
0920     },
0921     reco = {
0922         '-s': 'RAW2DIGI:RawToDigi_pixelOnly,RECO:reconstruction_pixelTrackingOnly',
0923         '--procModifiers': 'pixelNtupletFit,gpu',
0924         '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets,RecoTracker/Configuration/customizePixelOnlyForProfiling.customizePixelOnlyForProfilingGPUOnly'
0925     },
0926     harvest = None,
0927     suffix = 'Patatrack_PixelOnlyTripletsGPU_Profiling',
0928     offset = 0.508,
0929 )
0930 
0931 # ECAL-only workflow running on CPU
0932 #  - HLT on CPU
0933 #  - ECAL-only reconstruction on CPU, with DQM and validation
0934 #  - harvesting
0935 upgradeWFs['PatatrackECALOnlyCPU'] = PatatrackWorkflow(
0936     digi = {
0937         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0938     },
0939     reco = {
0940         '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly',
0941     },
0942     harvest = {
0943         '-s': 'HARVESTING:@ecalOnlyValidation+@ecal'
0944     },
0945     suffix = 'Patatrack_ECALOnlyCPU',
0946     offset = 0.511,
0947 )
0948 
0949 # ECAL-only workflow running on CPU or GPU
0950 #  - HLT on GPU (optional)
0951 #  - ECAL-only reconstruction on GPU (optional), with DQM and validation
0952 #  - harvesting
0953 upgradeWFs['PatatrackECALOnlyGPU'] = PatatrackWorkflow(
0954     digi = {
0955         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0956         '--procModifiers': 'gpu'
0957     },
0958     reco = {
0959         '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly',
0960         '--procModifiers': 'gpu'
0961     },
0962     harvest = {
0963         '-s': 'HARVESTING:@ecalOnlyValidation+@ecal'
0964     },
0965     suffix = 'Patatrack_ECALOnlyGPU',
0966     offset = 0.512,
0967 )
0968 
0969 # ECAL-only workflow running on CPU and GPU
0970 #  - HLT on GPU (required)
0971 #  - ECAL-only reconstruction on both CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
0972 #  - harvesting
0973 upgradeWFs['PatatrackECALOnlyGPUValidation'] = PatatrackWorkflow(
0974     digi = {
0975         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0976         '--accelerators': 'gpu-nvidia',
0977         '--procModifiers': 'gpu'
0978     },
0979     reco = {
0980         '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly',
0981         '--accelerators': 'gpu-nvidia',
0982         '--procModifiers': 'gpuValidation'
0983     },
0984     harvest = {
0985         '-s': 'HARVESTING:@ecalOnlyValidation+@ecal'
0986     },
0987     suffix = 'Patatrack_ECALOnlyGPU_Validation',
0988     offset = 0.513,
0989 )
0990 
0991 # ECAL-only workflow running on CPU or GPU, trimmed down for benchmarking
0992 #  - HLT on GPU (optional)
0993 #  - ECAL-only reconstruction on GPU (optional)
0994 upgradeWFs['PatatrackECALOnlyGPUProfiling'] = PatatrackWorkflow(
0995     digi = {
0996         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
0997         '--procModifiers': 'gpu'
0998     },
0999     reco = {
1000         '-s': 'RAW2DIGI:RawToDigi_ecalOnly,RECO:reconstruction_ecalOnly',
1001         '--procModifiers': 'gpu',
1002         '--customise' : 'RecoLocalCalo/Configuration/customizeEcalOnlyForProfiling.customizeEcalOnlyForProfilingGPUOnly'
1003     },
1004     harvest = None,
1005     suffix = 'Patatrack_ECALOnlyGPU_Profiling',
1006     offset = 0.514,
1007 )
1008 
1009 # HCAL-only workflow running on CPU
1010 #  - HLT on CPU
1011 #  - HCAL-only reconstruction on CPU, with DQM and validation
1012 #  - harvesting
1013 upgradeWFs['PatatrackHCALOnlyCPU'] = PatatrackWorkflow(
1014     digi = {
1015         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1016     },
1017     reco = {
1018         '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only',
1019     },
1020     harvest = {
1021         '-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only'
1022     },
1023     suffix = 'Patatrack_HCALOnlyCPU',
1024     offset = 0.521,
1025 )
1026 
1027 # HCAL-only workflow running on CPU or GPU
1028 #  - HLT on GPU (optional)
1029 #  - HCAL-only reconstruction on GPU (optional), with DQM and validation
1030 #  - harvesting
1031 upgradeWFs['PatatrackHCALOnlyGPU'] = PatatrackWorkflow(
1032     digi = {
1033         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1034         '--procModifiers': 'gpu'
1035     },
1036     reco = {
1037         '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only',
1038         '--procModifiers': 'gpu'
1039     },
1040     harvest = {
1041         '-s': 'HARVESTING:@hcalOnlyValidation+@hcalOnly+@hcal2Only'
1042     },
1043     suffix = 'Patatrack_HCALOnlyGPU',
1044     offset = 0.522,
1045 )
1046 
1047 # HCAL-only workflow running on CPU and GPU
1048 #  - HLT on GPU (required)
1049 #  - HCAL-only reconstruction on both CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
1050 #  - harvesting
1051 upgradeWFs['PatatrackHCALOnlyGPUValidation'] = PatatrackWorkflow(
1052     digi = {
1053         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1054         '--accelerators': 'gpu-nvidia',
1055         '--procModifiers': 'gpu'
1056     },
1057     reco = {
1058         '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly,VALIDATION:@hcalOnlyValidation,DQM:@hcalOnly+@hcal2Only',
1059         '--accelerators': 'gpu-nvidia',
1060         '--procModifiers': 'gpuValidation'
1061     },
1062     harvest = {
1063         '-s': 'HARVESTING:@hcalOnlyValidation+@hcal'
1064     },
1065     suffix = 'Patatrack_HCALOnlyGPU_Validation',
1066     offset = 0.523,
1067 )
1068 
1069 # HCAL-only workflow running on CPU or GPU, trimmed down for benchmarking
1070 #  - HLT on GPU (optional)
1071 #  - HCAL-only reconstruction on GPU (optional)
1072 upgradeWFs['PatatrackHCALOnlyGPUProfiling'] = PatatrackWorkflow(
1073     digi = {
1074         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1075         '--procModifiers': 'gpu'
1076     },
1077     reco = {
1078         '-s': 'RAW2DIGI:RawToDigi_hcalOnly,RECO:reconstruction_hcalOnly',
1079         '--procModifiers': 'gpu',
1080         '--customise' : 'RecoLocalCalo/Configuration/customizeHcalOnlyForProfiling.customizeHcalOnlyForProfilingGPUOnly'
1081     },
1082     harvest = None,
1083     suffix = 'Patatrack_HCALOnlyGPU_Profiling',
1084     offset = 0.524,
1085 )
1086 
1087 # Workflow running the Pixel quadruplets, ECAL and HCAL reconstruction on CPU
1088 #  - HLT on CPU
1089 #  - reconstruction on CPU, with DQM and validation
1090 #  - harvesting
1091 upgradeWFs['PatatrackAllCPU'] = PatatrackWorkflow(
1092     digi = {
1093         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1094     },
1095     reco = {
1096         '-s': 'RAW2DIGI:RawToDigi_pixelOnly+RawToDigi_ecalOnly+RawToDigi_hcalOnly,RECO:reconstruction_pixelTrackingOnly+reconstruction_ecalOnly+reconstruction_hcalOnly,VALIDATION:@pixelTrackingOnlyValidation+@ecalOnlyValidation+@hcalOnlyValidation,DQM:@pixelTrackingOnlyDQM+@ecalOnly+@hcalOnly+@hcal2Only',
1097         '--procModifiers': 'pixelNtupletFit'
1098     },
1099     harvest = {
1100         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM+@ecalOnlyValidation+@ecal+@hcalOnlyValidation+@hcalOnly+@hcal2Only'
1101     },
1102     suffix = 'Patatrack_AllCPU',
1103     offset = 0.581,
1104 )
1105 
1106 # Workflow running the Pixel quadruplets, ECAL and HCAL reconstruction on CPU or GPU
1107 #  - HLT on GPU (optional)
1108 #  - reconstruction on GPU (optional), with DQM and validation
1109 #  - harvesting
1110 upgradeWFs['PatatrackAllGPU'] = PatatrackWorkflow(
1111     digi = {
1112         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1113         '--procModifiers': 'gpu'
1114     },
1115     reco = {
1116         '-s': 'RAW2DIGI:RawToDigi_pixelOnly+RawToDigi_ecalOnly+RawToDigi_hcalOnly,RECO:reconstruction_pixelTrackingOnly+reconstruction_ecalOnly+reconstruction_hcalOnly,VALIDATION:@pixelTrackingOnlyValidation+@ecalOnlyValidation+@hcalOnlyValidation,DQM:@pixelTrackingOnlyDQM+@ecalOnly+@hcalOnly+@hcal2Only',
1117         '--procModifiers': 'pixelNtupletFit,gpu'
1118     },
1119     harvest = {
1120         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM+@ecalOnlyValidation+@ecal+@hcalOnlyValidation+@hcalOnly+@hcal2Only'
1121     },
1122     suffix = 'Patatrack_AllGPU',
1123     offset = 0.582,
1124 )
1125 
1126 # Workflow running the Pixel quadruplets, ECAL and HCAL reconstruction on CPU and GPU
1127 #  - HLT on GPU (required)
1128 #  - reconstruction on CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
1129 #  - harvesting
1130 upgradeWFs['PatatrackAllGPUValidation'] = PatatrackWorkflow(
1131     digi = {
1132         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1133         '--accelerators': 'gpu-nvidia',
1134         '--procModifiers': 'gpu'
1135     },
1136     reco = {
1137         '-s': 'RAW2DIGI:RawToDigi_pixelOnly+RawToDigi_ecalOnly+RawToDigi_hcalOnly,RECO:reconstruction_pixelTrackingOnly+reconstruction_ecalOnly+reconstruction_hcalOnly,VALIDATION:@pixelTrackingOnlyValidation+@ecalOnlyValidation+@hcalOnlyValidation,DQM:@pixelTrackingOnlyDQM+@ecalOnly+@hcalOnly+@hcal2Only',
1138         '--accelerators': 'gpu-nvidia',
1139         '--procModifiers': 'pixelNtupletFit,gpuValidation'
1140     },
1141     harvest = {
1142         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM+@ecalOnlyValidation+@ecal+@hcalOnlyValidation+@hcalOnly+@hcal2Only',
1143         '--procModifiers': 'gpuValidation'
1144     },
1145     suffix = 'Patatrack_AllGPU_Validation',
1146     offset = 0.583,
1147 )
1148 
1149 # Workflow running the Pixel quadruplets, ECAL and HCAL reconstruction on CPU or GPU, trimmed down for benchmarking
1150 #  - HLT on GPU (optional)
1151 #  - minimal reconstruction on GPU (optional)
1152 # FIXME workflow 0.584 to be implemented
1153 
1154 # Workflow running the Pixel triplets, ECAL and HCAL reconstruction on CPU
1155 #  - HLT on CPU
1156 #  - reconstruction on CPU, with DQM and validation
1157 #  - harvesting
1158 upgradeWFs['PatatrackAllTripletsCPU'] = PatatrackWorkflow(
1159     digi = {
1160         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1161     },
1162     reco = {
1163         '-s': 'RAW2DIGI:RawToDigi_pixelOnly+RawToDigi_ecalOnly+RawToDigi_hcalOnly,RECO:reconstruction_pixelTrackingOnly+reconstruction_ecalOnly+reconstruction_hcalOnly,VALIDATION:@pixelTrackingOnlyValidation+@ecalOnlyValidation+@hcalOnlyValidation,DQM:@pixelTrackingOnlyDQM+@ecalOnly+@hcalOnly+@hcal2Only',
1164         '--procModifiers': 'pixelNtupletFit'
1165     },
1166     harvest = {
1167         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM+@ecalOnlyValidation+@ecal+@hcalOnlyValidation+@hcalOnly+@hcal2Only'
1168     },
1169     suffix = 'Patatrack_AllTripletsCPU',
1170     offset = 0.585,
1171 )
1172 
1173 # Workflow running the Pixel triplets, ECAL and HCAL reconstruction on CPU or GPU
1174 #  - HLT on GPU (optional)
1175 #  - reconstruction on GPU (optional), with DQM and validation
1176 #  - harvesting
1177 upgradeWFs['PatatrackAllTripletsGPU'] = PatatrackWorkflow(
1178     digi = {
1179         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1180         '--procModifiers': 'gpu'
1181     },
1182     reco = {
1183         '-s': 'RAW2DIGI:RawToDigi_pixelOnly+RawToDigi_ecalOnly+RawToDigi_hcalOnly,RECO:reconstruction_pixelTrackingOnly+reconstruction_ecalOnly+reconstruction_hcalOnly,VALIDATION:@pixelTrackingOnlyValidation+@ecalOnlyValidation+@hcalOnlyValidation,DQM:@pixelTrackingOnlyDQM+@ecalOnly+@hcalOnly+@hcal2Only',
1184         '--procModifiers': 'pixelNtupletFit,gpu'
1185     },
1186     harvest = {
1187         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM+@ecalOnlyValidation+@ecal+@hcalOnlyValidation+@hcalOnly+@hcal2Only'
1188     },
1189     suffix = 'Patatrack_AllTripletsGPU',
1190     offset = 0.586,
1191 )
1192 
1193 # Workflow running the Pixel triplets, ECAL and HCAL reconstruction on CPU and GPU
1194 #  - HLT on GPU (required)
1195 #  - reconstruction on CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
1196 #  - harvesting
1197 upgradeWFs['PatatrackAllTripletsGPUValidation'] = PatatrackWorkflow(
1198     digi = {
1199         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1200         '--accelerators': 'gpu-nvidia',
1201         '--procModifiers': 'gpu'
1202     },
1203     reco = {
1204         '-s': 'RAW2DIGI:RawToDigi_pixelOnly+RawToDigi_ecalOnly+RawToDigi_hcalOnly,RECO:reconstruction_pixelTrackingOnly+reconstruction_ecalOnly+reconstruction_hcalOnly,VALIDATION:@pixelTrackingOnlyValidation+@ecalOnlyValidation+@hcalOnlyValidation,DQM:@pixelTrackingOnlyDQM+@ecalOnly+@hcalOnly+@hcal2Only',
1205         '--accelerators': 'gpu-nvidia',
1206         '--procModifiers': 'pixelNtupletFit,gpuValidation'
1207     },
1208     harvest = {
1209         '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM+@ecalOnlyValidation+@ecal+@hcalOnlyValidation+@hcalOnly+@hcal2Only',
1210         '--procModifiers': 'gpuValidation'
1211     },
1212     suffix = 'Patatrack_AllTripletsGPU_Validation',
1213     offset = 0.587,
1214 )
1215 
1216 # Workflow running the Pixel triplets, ECAL and HCAL reconstruction on CPU or GPU, trimmed down for benchmarking
1217 #  - HLT on GPU (optional)
1218 #  - minimal reconstruction on GPU (optional)
1219 # FIXME workflow 0.588 to be implemented
1220 
1221 # Workflow running the Pixel quadruplets, ECAL and HCAL reconstruction on CPU, together with the full offline reconstruction
1222 #  - HLT on CPU
1223 #  - reconstruction on CPU, with DQM and validation
1224 #  - harvesting
1225 upgradeWFs['PatatrackFullRecoCPU'] = PatatrackWorkflow(
1226     digi = {
1227         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1228     },
1229     reco = {
1230         # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction
1231         '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM',
1232         '--procModifiers': 'pixelNtupletFit'
1233     },
1234     harvest = {
1235         # skip the @pixelTrackingOnlyDQM harvesting
1236     },
1237     suffix = 'Patatrack_FullRecoCPU',
1238     offset = 0.591,
1239 )
1240 
1241 # Workflow running the Pixel quadruplets, ECAL and HCAL reconstruction on GPU (optional), together with the full offline reconstruction on CPU
1242 #  - HLT on GPU (optional)
1243 #  - reconstruction on GPU (optional), with DQM and validation
1244 #  - harvesting
1245 upgradeWFs['PatatrackFullRecoGPU'] = PatatrackWorkflow(
1246     digi = {
1247         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1248         '--procModifiers': 'gpu'
1249     },
1250     reco = {
1251         # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction
1252         '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM',
1253         '--procModifiers': 'pixelNtupletFit,gpu'
1254     },
1255     harvest = {
1256         # skip the @pixelTrackingOnlyDQM harvesting
1257     },
1258     suffix = 'Patatrack_FullRecoGPU',
1259     offset = 0.592,
1260 )
1261 
1262 # Workflow running the Pixel quadruplets, ECAL and HCAL reconstruction on CPU and GPU, together with the full offline reconstruction on CPU
1263 #  - HLT on GPU (required)
1264 #  - reconstruction on CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
1265 #  - harvesting
1266 upgradeWFs['PatatrackFullRecoGPUValidation'] = PatatrackWorkflow(
1267     digi = {
1268         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1269         '--accelerators': 'gpu-nvidia',
1270         '--procModifiers': 'gpu'
1271     },
1272     reco = {
1273         # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction
1274         '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM',
1275         '--accelerators': 'gpu-nvidia',
1276         '--procModifiers': 'pixelNtupletFit,gpuValidation'
1277     },
1278     harvest = {
1279         # skip the @pixelTrackingOnlyDQM harvesting
1280     },
1281     suffix = 'Patatrack_FullRecoGPU_Validation',
1282     offset = 0.593,
1283 )
1284 
1285 # Workflow running the Pixel triplets, ECAL and HCAL reconstruction on CPU, together with the full offline reconstruction
1286 #  - HLT on CPU
1287 #  - reconstruction on CPU, with DQM and validation
1288 #  - harvesting
1289 upgradeWFs['PatatrackFullRecoTripletsCPU'] = PatatrackWorkflow(
1290     digi = {
1291         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1292     },
1293     reco = {
1294         # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction
1295         '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM',
1296         '--procModifiers': 'pixelNtupletFit',
1297         '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets'
1298     },
1299     harvest = {
1300         # skip the @pixelTrackingOnlyDQM harvesting
1301     },
1302     suffix = 'Patatrack_FullRecoTripletsCPU',
1303     offset = 0.595,
1304 )
1305 
1306 # Workflow running the Pixel triplets, ECAL and HCAL reconstruction on GPU (optional), together with the full offline reconstruction on CPU
1307 #  - HLT on GPU (optional)
1308 #  - reconstruction on GPU (optional), with DQM and validation
1309 #  - harvesting
1310 upgradeWFs['PatatrackFullRecoTripletsGPU'] = PatatrackWorkflow(
1311     digi = {
1312         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1313         '--procModifiers': 'gpu'
1314     },
1315     reco = {
1316         # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction
1317         '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM',
1318         '--procModifiers': 'pixelNtupletFit,gpu',
1319         '--customise': 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets'
1320     },
1321     harvest = {
1322         # skip the @pixelTrackingOnlyDQM harvesting
1323     },
1324     suffix = 'Patatrack_FullRecoTripletsGPU',
1325     offset = 0.596,
1326 )
1327 
1328 # Workflow running the Pixel triplets, ECAL and HCAL reconstruction on CPU and GPU, together with the full offline reconstruction on CPU
1329 #  - HLT on GPU (required)
1330 #  - reconstruction on CPU and GPU, with DQM and validation for GPU-vs-CPU comparisons
1331 #  - harvesting
1332 upgradeWFs['PatatrackFullRecoTripletsGPUValidation'] = PatatrackWorkflow(
1333     digi = {
1334         # the HLT menu is already set up for using GPUs if available and if the "gpu" modifier is enabled
1335         '--accelerators': 'gpu-nvidia',
1336         '--procModifiers': 'gpu'
1337     },
1338     reco = {
1339         # skip the @pixelTrackingOnlyValidation which cannot run together with the full reconstruction
1340         '-s': 'RAW2DIGI:RawToDigi+RawToDigi_pixelOnly,L1Reco,RECO:reconstruction+reconstruction_pixelTrackingOnly,RECOSIM,PAT,VALIDATION:@standardValidation+@miniAODValidation,DQM:@standardDQM+@ExtraHLT+@miniAODDQM+@pixelTrackingOnlyDQM',
1341         '--accelerators': 'gpu-nvidia',
1342         '--procModifiers': 'pixelNtupletFit,gpuValidation',
1343         '--customise' : 'RecoPixelVertexing/Configuration/customizePixelTracksForTriplets.customizePixelTracksForTriplets'
1344     },
1345     harvest = {
1346         # skip the @pixelTrackingOnlyDQM harvesting
1347     },
1348     suffix = 'Patatrack_FullRecoTripletsGPU_Validation',
1349     offset = 0.597,
1350 )
1351 
1352 
1353 # end of Patatrack workflows
1354 
1355 class UpgradeWorkflow_ProdLike(UpgradeWorkflow):
1356     def setup_(self, step, stepName, stepDict, k, properties):
1357         if 'GenSimHLBeamSpot14' in step:
1358             stepDict[stepName][k] = merge([{'--eventcontent': 'RAWSIM', '--datatier': 'GEN-SIM'},stepDict[step][k]])
1359         elif 'Digi' in step and 'Trigger' not in step:
1360             stepDict[stepName][k] = merge([{'-s': 'DIGI,L1,DIGI2RAW,HLT:@relval2022', '--datatier':'GEN-SIM-RAW', '--eventcontent':'RAWSIM'}, stepDict[step][k]])
1361         elif 'DigiTrigger' in step: # for Phase-2
1362             stepDict[stepName][k] = merge([{'-s': 'DIGI,L1TrackTrigger,L1,DIGI2RAW,HLT:@fake2', '--datatier':'GEN-SIM-RAW', '--eventcontent':'RAWSIM'}, stepDict[step][k]])
1363         elif 'Reco' in step:
1364             stepDict[stepName][k] = merge([{'-s': 'RAW2DIGI,L1Reco,RECO,RECOSIM', '--datatier':'AODSIM', '--eventcontent':'AODSIM'}, stepDict[step][k]])
1365         elif 'MiniAOD' in step:
1366             # the separate miniAOD step is used here
1367             stepDict[stepName][k] = deepcopy(stepDict[step][k])
1368         elif 'ALCA' in step or 'HARVEST' in step:
1369             # remove step
1370             stepDict[stepName][k] = None
1371         elif 'Nano'==step:
1372             stepDict[stepName][k] = merge([{'--filein':'file:step4.root','-s':'NANO','--datatier':'NANOAODSIM','--eventcontent':'NANOEDMAODSIM'}, stepDict[step][k]])
1373     def condition(self, fragment, stepList, key, hasHarvest):
1374         return fragment=="TTbar_14TeV" and ('2026' in key or '2021' in key)
1375 upgradeWFs['ProdLike'] = UpgradeWorkflow_ProdLike(
1376     steps = [
1377         'GenSimHLBeamSpot14',
1378         'Digi',
1379         'DigiTrigger',
1380         'Reco',
1381         'RecoGlobal',
1382         'RecoNano',
1383         'HARVEST',
1384         'HARVESTGlobal',
1385         'HARVESTNano',
1386         'MiniAOD',
1387         'ALCA',
1388         'ALCAPhase2',
1389         'Nano',
1390     ],
1391     PU = [
1392         'GenSimHLBeamSpot14',
1393         'Digi',
1394         'DigiTrigger',
1395         'Reco',
1396         'RecoGlobal',
1397         'RecoNano',
1398         'HARVEST',
1399         'HARVESTGlobal',
1400         'HARVESTNano',
1401         'MiniAOD',
1402         'ALCA',
1403         'ALCAPhase2',
1404         'Nano',
1405     ],
1406     suffix = '_ProdLike',
1407     offset = 0.21,
1408 )
1409 
1410 class UpgradeWorkflow_ProdLikeRunningPU(UpgradeWorkflow_ProdLike):
1411     def __init__(self, suffix, offset, fixedPU,
1412          steps = [],
1413         PU = [
1414             'GenSimHLBeamSpot14',
1415             'Digi',
1416             'DigiTrigger',
1417             'Reco',
1418             'RecoGlobal',
1419             'RecoNano',
1420             'HARVEST',
1421             'HARVESTGlobal',
1422             'HARVESTNano',
1423             'MiniAOD',
1424             'ALCA',
1425             'ALCAPhase2',
1426             'Nano',
1427         ]):
1428         super(UpgradeWorkflow_ProdLikeRunningPU, self).__init__(steps, PU, suffix, offset)
1429         self.__fixedPU = fixedPU
1430     def setupPU_(self, step, stepName, stepDict, k, properties):
1431         #  change PU skipping ALCA and HARVEST
1432         if stepDict[stepName][k] is not None and '--pileup' in stepDict[stepName][k]:
1433             stepDict[stepName][k]['--pileup'] = 'AVE_' + str(self.__fixedPU) + '_BX_25ns'
1434     def condition(self, fragment, stepList, key, hasHarvest):
1435         # lower PUs for Run3
1436         return (fragment=="TTbar_14TeV") and (('2026' in key) or ('2021' in key and self.__fixedPU<=100))
1437 
1438 # The numbering below is following the 0.21 for ProdLike wfs
1439 # 0.21N would have been a more natural choice but the
1440 # trailing zeros are ignored. Thus 0.21N1 is used
1441 
1442 upgradeWFs['ProdLikePU10'] = UpgradeWorkflow_ProdLikeRunningPU(
1443     suffix = '_ProdLikePU10',
1444     offset = 0.21101,
1445     fixedPU = 10,
1446 )
1447 
1448 upgradeWFs['ProdLikePU20'] = UpgradeWorkflow_ProdLikeRunningPU(
1449     suffix = '_ProdLikePU20',
1450     offset = 0.21201,
1451     fixedPU = 20,
1452 )
1453 
1454 upgradeWFs['ProdLikePU30'] = UpgradeWorkflow_ProdLikeRunningPU(
1455     suffix = '_ProdLikePU30',
1456     offset = 0.21301,
1457     fixedPU = 30,
1458 )
1459 
1460 upgradeWFs['ProdLikePU40'] = UpgradeWorkflow_ProdLikeRunningPU(
1461     suffix = '_ProdLikePU40',
1462     offset = 0.21401,
1463     fixedPU = 40,
1464 )
1465 
1466 upgradeWFs['ProdLikePU50'] = UpgradeWorkflow_ProdLikeRunningPU(
1467     suffix = '_ProdLikePU50',
1468     offset = 0.21501,
1469     fixedPU = 50,
1470 )
1471 
1472 upgradeWFs['ProdLikePU60'] = UpgradeWorkflow_ProdLikeRunningPU(
1473     suffix = '_ProdLikePU60',
1474     offset = 0.21601,
1475     fixedPU = 60,
1476 )
1477 
1478 upgradeWFs['ProdLikePU70'] = UpgradeWorkflow_ProdLikeRunningPU(
1479     suffix = '_ProdLikePU70',
1480     offset = 0.21701,
1481     fixedPU = 70,
1482 )
1483 
1484 upgradeWFs['ProdLikePU80'] = UpgradeWorkflow_ProdLikeRunningPU(
1485     suffix = '_ProdLikePU80',
1486     offset = 0.21801,
1487     fixedPU = 80,
1488 )
1489 
1490 upgradeWFs['ProdLikePU90'] = UpgradeWorkflow_ProdLikeRunningPU(
1491     suffix = '_ProdLikePU90',
1492     offset = 0.21901,
1493     fixedPU = 90,
1494 )
1495 
1496 upgradeWFs['ProdLikePU100'] = UpgradeWorkflow_ProdLikeRunningPU(
1497     suffix = '_ProdLikePU100',
1498     offset = 0.211001,
1499     fixedPU = 100,
1500 )
1501 
1502 upgradeWFs['ProdLikePU120'] = UpgradeWorkflow_ProdLikeRunningPU(
1503     suffix = '_ProdLikePU120',
1504     offset = 0.211201,
1505     fixedPU = 120,
1506 )
1507 
1508 upgradeWFs['ProdLikePU140'] = UpgradeWorkflow_ProdLikeRunningPU(
1509     suffix = '_ProdLikePU140',
1510     offset = 0.211401,
1511     fixedPU = 140,
1512 )
1513 
1514 upgradeWFs['ProdLikePU160'] = UpgradeWorkflow_ProdLikeRunningPU(
1515     suffix = '_ProdLikePU160',
1516     offset = 0.211601,
1517     fixedPU = 160,
1518 )
1519 
1520 upgradeWFs['ProdLikePU180'] = UpgradeWorkflow_ProdLikeRunningPU(
1521     suffix = '_ProdLikePU180',
1522     offset = 0.211801,
1523     fixedPU = 180,
1524 )
1525 
1526 class UpgradeWorkflow_HLT75e33(UpgradeWorkflow):
1527     def setup_(self, step, stepName, stepDict, k, properties):
1528         if 'HARVEST' in step:
1529             stepDict[stepName][k] = merge([{'--filein':'file:step3_inDQM.root'}, stepDict[step][k]])
1530         else:
1531             stepDict[stepName][k] = merge([stepDict[step][k]])
1532     def condition(self, fragment, stepList, key, hasHarvest):
1533         return fragment=="TTbar_14TeV" and '2026' in key
1534 upgradeWFs['HLT75e33'] = UpgradeWorkflow_HLT75e33(
1535     steps = [
1536         'GenSimHLBeamSpot14',
1537         'DigiTrigger',
1538         'RecoGlobal',
1539         'HLT75e33',
1540         'HARVESTGlobal',
1541     ],
1542     PU = [
1543         'GenSimHLBeamSpot14',
1544         'DigiTrigger',
1545         'RecoGlobal',
1546         'HLT75e33',
1547         'HARVESTGlobal',
1548     ],
1549     suffix = '_HLT75e33',
1550     offset = 0.75,
1551 )
1552 
1553 class UpgradeWorkflow_HLTwDIGI75e33(UpgradeWorkflow):
1554     def setup_(self, step, stepName, stepDict, k, properties):
1555         if 'DigiTrigger' in step:
1556             stepDict[stepName][k] = merge([{'-s':'DIGI:pdigi_valid,L1TrackTrigger,L1,DIGI2RAW,HLT:@relval2026'}, stepDict[step][k]])
1557     def condition(self, fragment, stepList, key, hasHarvest):
1558         return fragment=="TTbar_14TeV" and '2026' in key
1559 upgradeWFs['HLTwDIGI75e33'] = UpgradeWorkflow_HLTwDIGI75e33(
1560     steps = [
1561         'DigiTrigger',
1562     ],
1563     PU = [
1564         'DigiTrigger',
1565     ],
1566     suffix = '_HLTwDIGI75e33',
1567     offset = 0.76,
1568 )
1569 
1570 class UpgradeWorkflow_Neutron(UpgradeWorkflow):
1571     def setup_(self, step, stepName, stepDict, k, properties):
1572         if 'GenSim' in step:
1573             custNew = "SimG4Core/Application/NeutronBGforMuonsXS_cff.customise"
1574         else:
1575             custNew = "SLHCUpgradeSimulations/Configuration/customise_mixing.customise_Mix_LongLived_Neutrons"
1576         stepDict[stepName][k] = deepcopy(stepDict[step][k])
1577         if '--customise' in stepDict[stepName][k].keys():
1578             stepDict[stepName][k]['--customise'] += ","+custNew
1579         else:
1580             stepDict[stepName][k]['--customise'] = custNew
1581     def condition(self, fragment, stepList, key, hasHarvest):
1582         return any(fragment==nfrag for nfrag in self.neutronFrags) and any(nkey in key for nkey in self.neutronKeys)
1583 upgradeWFs['Neutron'] = UpgradeWorkflow_Neutron(
1584     steps = [
1585         'GenSim',
1586         'GenSimHLBeamSpot',
1587         'GenSimHLBeamSpot14',
1588         'Digi',
1589         'DigiTrigger',
1590     ],
1591     PU = [
1592         'Digi',
1593         'DigiTrigger',
1594     ],
1595     suffix = '_Neutron',
1596     offset = 0.12,
1597 )
1598 # add some extra info
1599 upgradeWFs['Neutron'].neutronKeys = [x for x in upgradeKeys[2026] if 'PU' not in x]
1600 upgradeWFs['Neutron'].neutronFrags = ['ZMM_14','MinBias_14TeV']
1601 
1602 class UpgradeWorkflow_heCollapse(UpgradeWorkflow):
1603     def setup_(self, step, stepName, stepDict, k, properties):
1604         stepDict[stepName][k] = merge([{'--procModifiers': 'run2_HECollapse_2018'}, stepDict[step][k]])
1605     def condition(self, fragment, stepList, key, hasHarvest):
1606         return fragment=="TTbar_13" and '2018' in key
1607 upgradeWFs['heCollapse'] = UpgradeWorkflow_heCollapse(
1608     steps = [
1609         'GenSim',
1610         'Digi',
1611         'Reco',
1612         'HARVEST',
1613         'ALCA',
1614     ],
1615     PU = [
1616         'Digi',
1617         'Reco',
1618         'HARVEST',
1619     ],
1620     suffix = '_heCollapse',
1621     offset = 0.6,
1622 )
1623 
1624 # ECAL Phase 2 development WF
1625 class UpgradeWorkflow_ecalDevel(UpgradeWorkflow):
1626     def __init__(self, digi = {}, reco = {}, harvest = {}, **kwargs):
1627         # adapt the parameters for the UpgradeWorkflow init method
1628         super(UpgradeWorkflow_ecalDevel, self).__init__(
1629             steps = [
1630                 'DigiTrigger',
1631                 'RecoGlobal',
1632                 'HARVESTGlobal',
1633                 'ALCAPhase2',
1634             ],
1635             PU = [
1636                 'DigiTrigger',
1637                 'RecoGlobal',
1638                 'HARVESTGlobal',
1639                 'ALCAPhase2',
1640             ],
1641             **kwargs)
1642         self.__digi = digi
1643         self.__reco = reco
1644         self.__harvest = harvest
1645 
1646     def setup_(self, step, stepName, stepDict, k, properties):
1647         # temporarily remove trigger & downstream steps
1648         mods = {'--era': stepDict[step][k]['--era']+',phase2_ecal_devel'}
1649         if 'Digi' in step:
1650             mods['-s'] = 'DIGI:pdigi_valid,DIGI2RAW'
1651             mods |= self.__digi
1652         elif 'Reco' in step:
1653             mods['-s'] = 'RAW2DIGI,RECO:reconstruction_ecalOnly,VALIDATION:@ecalOnlyValidation,DQM:@ecalOnly'
1654             mods['--datatier'] = 'GEN-SIM-RECO,DQMIO'
1655             mods['--eventcontent'] = 'FEVTDEBUGHLT,DQM'
1656             mods |= self.__reco
1657         elif 'HARVEST' in step:
1658             mods['-s'] = 'HARVESTING:@ecalOnlyValidation+@ecal'
1659             mods |= self.__harvest
1660         stepDict[stepName][k] = merge([mods, stepDict[step][k]])
1661         # skip ALCA step
1662         if 'ALCA' in step:
1663             stepDict[stepName][k] = None
1664 
1665     def condition(self, fragment, stepList, key, hasHarvest):
1666         return fragment=="TTbar_14TeV" and '2026' in key
1667 
1668 # ECAL Phase 2 workflow running on CPU
1669 upgradeWFs['ecalDevel'] = UpgradeWorkflow_ecalDevel(
1670     suffix = '_ecalDevel',
1671     offset = 0.61,
1672 )
1673 
1674 # ECAL Phase 2 workflow running on CPU or GPU (if available)
1675 upgradeWFs['ecalDevelGPU'] = UpgradeWorkflow_ecalDevel(
1676     reco = {'--procModifiers': 'gpu'},
1677     suffix = '_ecalDevelGPU',
1678     offset = 0.612,
1679 )
1680 
1681 class UpgradeWorkflow_0T(UpgradeWorkflow):
1682     def setup_(self, step, stepName, stepDict, k, properties):
1683         myGT=stepDict[step][k]['--conditions']
1684         myGT+="_0T"
1685         stepDict[stepName][k] = merge([{'-n':'1','--magField':'0T','--conditions':myGT}, stepDict[step][k]])
1686     def setupPU_(self, step, stepName, stepDict, k, properties):
1687         # override '-n' setting from PUDataSets in relval_steps.py
1688         stepDict[stepName][k] = merge([{'-n':'1'}, stepDict[step][k]])
1689     def condition(self, fragment, stepList, key, hasHarvest):
1690         return (fragment=="TTbar_13" or fragment=="TTbar_14TeV") and ('2017' in key or '2018' in key or '2021' in key) and ('FS' not in key)
1691 upgradeWFs['0T'] = UpgradeWorkflow_0T(
1692     steps = [
1693         'GenSim',
1694         'Digi',
1695         'Reco',
1696         'HARVEST',
1697         'RecoNano',
1698         'HARVESTNano',
1699         'ALCA',
1700     ],
1701     PU = [
1702         'Digi',
1703         'Reco',
1704         'HARVEST',
1705         'RecoNano',
1706         'HARVESTNano',
1707     ],
1708     suffix = '_0T',
1709     offset = 0.24,
1710 )
1711 
1712 class UpgradeWorkflow_ParkingBPH(UpgradeWorkflow):
1713     def setup_(self, step, stepName, stepDict, k, properties):
1714         if 'Reco' in step and 'Run2_2018' in stepDict[step][k]['--era']:
1715             stepDict[stepName][k] = merge([{'--era': 'Run2_2018,bParking'}, stepDict[step][k]])
1716     def condition(self, fragment, stepList, key, hasHarvest):
1717         return fragment=="TTbar_13" and '2018' in key
1718 upgradeWFs['ParkingBPH'] = UpgradeWorkflow_ParkingBPH(
1719     steps = [
1720         'Reco',
1721     ],
1722     PU = [],
1723     suffix = '_ParkingBPH',
1724     offset = 0.8,
1725 )
1726 
1727 class UpgradeWorkflow_JMENano(UpgradeWorkflow):
1728     def setup_(self, step, stepName, stepDict, k, properties):
1729         if 'Nano' in step:
1730             stepDict[stepName][k] = merge([{'--customise': 'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD_MC'}, stepDict[step][k]])
1731     def condition(self, fragment, stepList, key, hasHarvest):
1732         return (fragment=="TTbar_13" or fragment=="TTbar_14TeV") and ('2017' in key or '2018' in key or '2021' in key) and ('FS' not in key)
1733 upgradeWFs['JMENano'] = UpgradeWorkflow_JMENano(
1734     steps = [
1735         'Nano',
1736         'RecoNano',
1737     ],
1738     PU = [],
1739     suffix = '_JMENano',
1740     offset = 0.15,
1741 )
1742 
1743 
1744 # common operations for aging workflows
1745 class UpgradeWorkflowAging(UpgradeWorkflow):
1746     def setup_(self, step, stepName, stepDict, k, properties):
1747         if 'Digi' in step or 'Reco' in step:
1748             stepDict[stepName][k] = merge([{'--customise': 'SLHCUpgradeSimulations/Configuration/aging.customise_aging_'+self.lumi}, stepDict[step][k]])
1749     def condition(self, fragment, stepList, key, hasHarvest):
1750         return '2026' in key
1751 # define several of them
1752 upgradeWFs['Aging1000'] = UpgradeWorkflowAging(
1753     steps =  [
1754         'Digi',
1755         'DigiTrigger',
1756         'RecoLocal',
1757         'Reco',
1758         'RecoGlobal',
1759     ],
1760     PU =  [
1761         'Digi',
1762         'DigiTrigger',
1763         'RecoLocal',
1764         'Reco',
1765         'RecoGlobal',
1766     ],
1767     suffix = 'Aging1000',
1768     offset = 0.101,
1769 )
1770 upgradeWFs['Aging1000'].lumi = '1000'
1771 upgradeWFs['Aging3000'] = deepcopy(upgradeWFs['Aging1000'])
1772 upgradeWFs['Aging3000'].suffix = 'Aging3000'
1773 upgradeWFs['Aging3000'].offset = 0.103
1774 upgradeWFs['Aging3000'].lumi = '3000'
1775 
1776 #
1777 # Simulates Bias Rail in Phase-2 OT PS modules and X% random bad Strips
1778 # in PS-s and SS sensors
1779 #
1780 class UpgradeWorkflow_OTInefficiency(UpgradeWorkflow):
1781     def setup_(self, step, stepName, stepDict, k, properties):
1782         if 'Digi' in step:
1783             stepDict[stepName][k] = merge([{'--customise': 'SimTracker/SiPhase2Digitizer/customizeForOTInefficiency.customizeSiPhase2OTInefficiency'+self.percent+'Percent'}, stepDict[step][k]])
1784     def condition(self, fragment, stepList, key, hasHarvest):
1785         return fragment=="TTbar_14TeV" and '2026' in key
1786 # define several of them
1787 upgradeWFs['OTInefficiency'] = UpgradeWorkflow_OTInefficiency(
1788     steps =  [
1789         'Digi',
1790         'DigiTrigger',
1791     ],
1792     PU =  [
1793         'Digi',
1794         'DigiTrigger',
1795     ],
1796     suffix = '_OTInefficiency',
1797     offset = 0.111,
1798 )
1799 upgradeWFs['OTInefficiency'].percent = 'Zero'
1800 
1801 # 1% bad strips
1802 upgradeWFs['OTInefficiency1PC'] = deepcopy(upgradeWFs['OTInefficiency'])
1803 upgradeWFs['OTInefficiency1PC'].suffix = '_OTInefficiency1PC'
1804 upgradeWFs['OTInefficiency1PC'].offset = 0.112
1805 upgradeWFs['OTInefficiency1PC'].percent = 'One'
1806 
1807 # 5% bad strips
1808 upgradeWFs['OTInefficiency5PC'] = deepcopy(upgradeWFs['OTInefficiency'])
1809 upgradeWFs['OTInefficiency5PC'].suffix = '_OTInefficiency5PC'
1810 upgradeWFs['OTInefficiency5PC'].offset = 0.113
1811 upgradeWFs['OTInefficiency5PC'].percent = 'Five'
1812 
1813 # 10% bad strips
1814 upgradeWFs['OTInefficiency10PC'] = deepcopy(upgradeWFs['OTInefficiency'])
1815 upgradeWFs['OTInefficiency10PC'].suffix = '_OTInefficiency10PC'
1816 upgradeWFs['OTInefficiency10PC'].offset = 0.114
1817 upgradeWFs['OTInefficiency10PC'].percent = 'Ten'
1818 
1819 # Specifying explicitly the --filein is not nice but that was the
1820 # easiest way to "skip" the output of step2 (=premixing stage1) for
1821 # filein (as it goes to pileup_input). It works (a bit accidentally
1822 # though) also for "-i all" because in that case the --filein for DAS
1823 # input is after this one in the list of command line arguments to
1824 # cmsDriver, and gets then used in practice.
1825 digiPremixLocalPileup = {
1826     "--filein": "file:step1.root",
1827     "--pileup_input": "file:step2.root"
1828 }
1829 
1830 # for premix
1831 class UpgradeWorkflowPremix(UpgradeWorkflow):
1832     def setup_(self, step, stepName, stepDict, k, properties):
1833         # just copy steps
1834         stepDict[stepName][k] = merge([stepDict[step][k]])
1835     def setupPU_(self, step, stepName, stepDict, k, properties):
1836         # setup for stage 1
1837         if "GenSim" in stepName:
1838             stepNamePmx = stepName.replace('GenSim','Premix')
1839             if not stepNamePmx in stepDict: stepDict[stepNamePmx] = {}
1840             stepDict[stepNamePmx][k] = merge([
1841                 {
1842                     '-s': 'GEN,SIM,DIGI:pdigi_valid',
1843                     '--datatier': 'PREMIX',
1844                     '--eventcontent': 'PREMIX',
1845                     '--procModifiers': 'premix_stage1'
1846                 },
1847                 stepDict[stepName][k]
1848             ])
1849             if "ProdLike" in self.suffix:
1850                 stepDict[stepNamePmx][k] = merge([{'-s': 'GEN,SIM,DIGI'},stepDict[stepNamePmx][k]])
1851         # setup for stage 2
1852         elif "Digi" in step or "Reco" in step:
1853             # go back to non-PU step version
1854             d = merge([stepDict[self.getStepName(step)][k]])
1855             if d is None: return
1856             if "Digi" in step:
1857                 tmpsteps = []
1858                 for s in d["-s"].split(","):
1859                     if s == "DIGI" or "DIGI:" in s:
1860                         tmpsteps.extend([s, "DATAMIX"])
1861                     else:
1862                         tmpsteps.append(s)
1863                 d = merge([{"-s"             : ",".join(tmpsteps),
1864                             "--datamix"      : "PreMix",
1865                             "--procModifiers": "premix_stage2"},
1866                            d])
1867                 # for combined stage1+stage2
1868                 if "_PMXS1S2" in self.suffix:
1869                     d = merge([digiPremixLocalPileup, d])
1870             elif "Reco" in step:
1871                 if "--procModifiers" in d:
1872                     d["--procModifiers"] += ",premix_stage2"
1873                 else:
1874                     d["--procModifiers"] = "premix_stage2"
1875             stepDict[stepName][k] = d
1876         # Increase the input file step number by one for Nano in combined stage1+stage2
1877         elif "Nano"==step:
1878             # go back to non-PU step version
1879             d = merge([stepDict[self.getStepName(step)][k]])
1880             if "--filein" in d:
1881                 filein = d["--filein"]
1882                 m = re.search("step(?P<ind>\d+)_", filein)
1883                 if m:
1884                     d["--filein"] = filein.replace(m.group(), "step%d_"%(int(m.group("ind"))+1))
1885             stepDict[stepName][k] = d
1886             # run2/3 WFs use Nano (not NanoPU) in PU WF
1887             stepDict[self.getStepName(step)][k] = merge([d])
1888     def condition(self, fragment, stepList, key, hasHarvest):
1889         if not 'PU' in key:
1890             return False
1891         if not any(y in key for y in ['2021', '2023', '2024', '2026']):
1892             return False
1893         if self.suffix.endswith("S1"):
1894             return "NuGun" in fragment
1895         return True
1896     def workflow_(self, workflows, num, fragment, stepList, key):
1897         fragmentTmp = fragment
1898         if self.suffix.endswith("S1"):
1899             fragmentTmp = 'PREMIXUP' + key[2:].replace("PU", "").replace("Design", "") + '_PU25'
1900         super(UpgradeWorkflowPremix,self).workflow_(workflows, num, fragmentTmp, stepList, key)
1901 # Premix stage1
1902 upgradeWFs['PMXS1'] = UpgradeWorkflowPremix(
1903     steps = [
1904     ],
1905     PU = [
1906         'GenSim',
1907         'GenSimHLBeamSpot',
1908         'GenSimHLBeamSpot14',
1909     ],
1910     suffix = '_PMXS1',
1911     offset = 0.97,
1912 )
1913 # Premix stage2
1914 upgradeWFs['PMXS2'] = UpgradeWorkflowPremix(
1915     steps = [],
1916     PU = [
1917         'Digi',
1918         'DigiTrigger',
1919         'RecoLocal',
1920         'Reco',
1921         'RecoGlobal',
1922         'RecoNano',
1923         'Nano',
1924     ],
1925     suffix = '_PMXS2',
1926     offset = 0.98,
1927 )
1928 # Premix combined stage1+stage2
1929 upgradeWFs['PMXS1S2'] = UpgradeWorkflowPremix(
1930     steps = [],
1931     PU = [
1932         'GenSim',
1933         'GenSimHLBeamSpot',
1934         'GenSimHLBeamSpot14',
1935         'Digi',
1936         'DigiTrigger',
1937         'RecoLocal',
1938         'Reco',
1939         'RecoGlobal',
1940         'RecoNano',
1941         'Nano',
1942     ],
1943     suffix = '_PMXS1S2',
1944     offset = 0.99,
1945 )
1946 # Alternative version of above w/ less PU for PR tests
1947 class UpgradeWorkflowAdjustPU(UpgradeWorkflowPremix):
1948     def setupPU_(self, step, stepName, stepDict, k, properties):
1949         # adjust first, so it gets copied into new Premix step
1950         if '--pileup' in stepDict[stepName][k]:
1951             stepDict[stepName][k]['--pileup'] = 'AVE_50_BX_25ns_m3p3'
1952         super(UpgradeWorkflowAdjustPU,self).setupPU_(step, stepName, stepDict, k, properties)
1953     def condition(self, fragment, stepList, key, hasHarvest):
1954         # restrict to phase2
1955         return super(UpgradeWorkflowAdjustPU,self).condition(fragment, stepList, key, hasHarvest) and '2026' in key
1956 upgradeWFs['PMXS1S2PR'] = UpgradeWorkflowAdjustPU(
1957     steps = [],
1958     PU = [
1959         'GenSim',
1960         'GenSimHLBeamSpot',
1961         'GenSimHLBeamSpot14',
1962         'Digi',
1963         'DigiTrigger',
1964         'RecoLocal',
1965         'Reco',
1966         'RecoGlobal',
1967         'Nano',
1968         'HARVEST',
1969         'HARVESTGlobal',
1970     ],
1971     suffix = '_PMXS1S2PR',
1972     offset = 0.999,
1973 )
1974 
1975 class UpgradeWorkflowPremixProdLike(UpgradeWorkflowPremix,UpgradeWorkflow_ProdLike):
1976     def setup_(self, step, stepName, stepDict, k, properties):
1977         # copy steps, then apply specializations
1978         UpgradeWorkflowPremix.setup_(self, step, stepName, stepDict, k, properties)
1979         UpgradeWorkflow_ProdLike.setup_(self, step, stepName, stepDict, k, properties)
1980         #
1981         if 'Digi' in step:
1982             d = merge([stepDict[self.getStepName(step)][k]])
1983             tmpsteps = []
1984             for s in d["-s"].split(","):
1985                 if "DIGI:pdigi_valid" in s:
1986                     tmpsteps.append("DIGI")
1987                 else:
1988                     tmpsteps.append(s)
1989             d = merge([{"-s" : ",".join(tmpsteps),
1990                         "--eventcontent": "PREMIXRAW"},
1991                        d])
1992             stepDict[stepName][k] = d
1993         if 'Nano'==step:
1994             stepDict[stepName][k] = merge([{'--filein':'file:step5.root','-s':'NANO','--datatier':'NANOAODSIM','--eventcontent':'NANOEDMAODSIM'}, stepDict[step][k]])
1995     def condition(self, fragment, stepList, key, hasHarvest):
1996         # use both conditions
1997         return UpgradeWorkflowPremix.condition(self, fragment, stepList, key, hasHarvest) and UpgradeWorkflow_ProdLike.condition(self, fragment, stepList, key, hasHarvest)
1998 # premix stage2
1999 upgradeWFs['PMXS2ProdLike'] = UpgradeWorkflowPremixProdLike(
2000     steps = [],
2001     PU = [
2002         'Digi',
2003         'DigiTrigger',
2004         'RecoLocal',
2005         'Reco',
2006         'RecoGlobal',
2007         'RecoNano',
2008         'Nano',
2009         'HARVEST',
2010         'HARVESTGlobal',
2011         'HARVESTNano',
2012         'MiniAOD',
2013         'ALCA',
2014     ],
2015     suffix = '_PMXS2ProdLike',
2016     offset = 0.9821,
2017 )
2018 # premix combined stage1+stage2
2019 upgradeWFs['PMXS1S2ProdLike'] = UpgradeWorkflowPremixProdLike(
2020     steps = [],
2021     PU = [
2022         'GenSim',
2023         'GenSimHLBeamSpot',
2024         'GenSimHLBeamSpot14',
2025         'Digi',
2026         'DigiTrigger',
2027         'RecoLocal',
2028         'Reco',
2029         'RecoGlobal',
2030         'RecoNano',
2031         'Nano',
2032         'HARVEST',
2033         'HARVESTGlobal',
2034         'HARVESTNano',
2035         'MiniAOD',
2036         'ALCA',
2037     ],
2038     suffix = '_PMXS1S2ProdLike',
2039     offset = 0.9921,
2040 )
2041 
2042 class UpgradeWorkflow_Run3FStrackingOnly(UpgradeWorkflow):
2043     def setup_(self, step, stepName, stepDict, k, properties):
2044         if 'HARVESTFastRun3' in step:
2045             stepDict[stepName][k] = merge([{'-s':'HARVESTING:@trackingOnlyValidation+@trackingOnlyDQM',
2046                                             '--fast':'',
2047                                             '--era':'Run3_FastSim',
2048                                             '--filein':'file:step1_inDQM.root'}, stepDict[step][k]])
2049         else:
2050             stepDict[stepName][k] = merge([stepDict[step][k]])
2051     def condition(self, fragment, stepList, key, hasHarvest):
2052         return '2021FS' in key
2053 upgradeWFs['Run3FStrackingOnly'] = UpgradeWorkflow_Run3FStrackingOnly(
2054     steps = [
2055         'Gen',
2056         'FastSimRun3',
2057         'HARVESTFastRun3'
2058     ],
2059     PU = [
2060         'FastSimRun3',
2061         'HARVESTFastRun3'
2062     ],
2063     suffix = '_Run3FSTrackingOnly',
2064     offset = 0.302,
2065 )
2066 
2067 class UpgradeWorkflow_Run3FSMBMixing(UpgradeWorkflow):
2068     def setup_(self, step, stepName, stepDict, k, properties):
2069         if 'Gen' in step:
2070             stepDict[stepName][k] = merge([{'-s':'GEN,SIM,RECOBEFMIX',
2071                                             '--fast':'',
2072                                             '--era':'Run3_FastSim',
2073                                             '--eventcontent':'FASTPU',
2074                                             '--datatier':'GEN-SIM-RECO',
2075                                             '--relval':'27000,3000'}, stepDict[step][k]])
2076         else:
2077             stepDict[stepName][k] = None
2078     def condition(self, fragment, stepList, key, hasHarvest):
2079         return '2021FS' in key and fragment=="MinBias_14TeV"
2080 upgradeWFs['Run3FSMBMixing'] = UpgradeWorkflow_Run3FSMBMixing(
2081     steps = [
2082         'Gen',
2083         'FastSimRun3',
2084         'HARVESTFastRun3'
2085     ],
2086     PU = [],
2087     suffix = '_Run3FSMBMixing',
2088     offset = 0.303,
2089 )
2090 
2091 class UpgradeWorkflow_DD4hep(UpgradeWorkflow):
2092     def setup_(self, step, stepName, stepDict, k, properties):
2093         if 'Run3' in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']:
2094             stepDict[stepName][k] = merge([{'--geometry': 'DD4hepExtended2021'}, stepDict[step][k]])
2095         elif 'Phase2' in stepDict[step][k]['--era']:
2096             dd4hepGeom="DD4hep"
2097             dd4hepGeom+=stepDict[step][k]['--geometry']
2098             stepDict[stepName][k] = merge([{'--geometry' : dd4hepGeom, '--procModifiers': 'dd4hep'}, stepDict[step][k]])
2099     def condition(self, fragment, stepList, key, hasHarvest):
2100         return ('2021' in key or '2026' in key) and ('FS' not in key)
2101 upgradeWFs['DD4hep'] = UpgradeWorkflow_DD4hep(
2102     steps = [
2103         'GenSim',
2104         'GenSimHLBeamSpot',
2105         'GenSimHLBeamSpot14',
2106         'Digi',
2107         'DigiTrigger',
2108         'Reco',
2109         'RecoGlobal',
2110         'RecoNano',
2111         'HARVEST',
2112         'HARVESTGlobal',
2113         'HARVESTNano',
2114         'ALCA',
2115     ],
2116     PU = [],
2117     suffix = '_DD4hep',
2118     offset = 0.911,
2119 )
2120 upgradeWFs['DD4hep'].allowReuse = False
2121 
2122 #This workflow is now obsolete, it becomes default for Run-3.
2123 #Keep it for future use in Phase-2, then delete
2124 class UpgradeWorkflow_DD4hepDB(UpgradeWorkflow):
2125     def setup_(self, step, stepName, stepDict, k, properties):
2126         if 'Run3' in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']:
2127             stepDict[stepName][k] = merge([{'--conditions': 'auto:phase1_2022_realistic', '--geometry': 'DB:Extended'}, stepDict[step][k]])
2128     def condition(self, fragment, stepList, key, hasHarvest):
2129         return '2021' in key and 'FS' not in key
2130 upgradeWFs['DD4hepDB'] = UpgradeWorkflow_DD4hepDB(
2131     steps = [
2132         'GenSim',
2133         'GenSimHLBeamSpot',
2134         'GenSimHLBeamSpot14',
2135         'Digi',
2136         'DigiTrigger',
2137         'Reco',
2138         'RecoGlobal',
2139         'RecoNano',
2140         'HARVEST',
2141         'HARVESTGlobal',
2142         'HARVESTNano',
2143         'ALCA',
2144     ],
2145     PU = [],
2146     suffix = '_DD4hepDB',
2147     offset = 0.912,
2148 )
2149 upgradeWFs['DD4hepDB'].allowReuse = False
2150 
2151 class UpgradeWorkflow_DDDDB(UpgradeWorkflow):
2152     def setup_(self, step, stepName, stepDict, k, properties):
2153         if 'Run3' in stepDict[step][k]['--era'] and 'Fast' not in stepDict[step][k]['--era']:
2154             # retain any other eras
2155             tmp_eras = stepDict[step][k]['--era'].split(',')
2156             tmp_eras[tmp_eras.index("Run3")] = 'Run3_DDD'
2157             tmp_eras = ','.join(tmp_eras)
2158             stepDict[stepName][k] = merge([{'--conditions': 'auto:phase1_2022_realistic_ddd', '--geometry': 'DB:Extended', '--era': tmp_eras}, stepDict[step][k]])
2159     def condition(self, fragment, stepList, key, hasHarvest):
2160         return '2021' in key and 'FS' not in key
2161 upgradeWFs['DDDDB'] = UpgradeWorkflow_DDDDB(
2162     steps = [
2163         'GenSim',
2164         'GenSimHLBeamSpot',
2165         'GenSimHLBeamSpot14',
2166         'Digi',
2167         'DigiTrigger',
2168         'Reco',
2169         'RecoGlobal',
2170         'RecoNano',
2171         'HARVEST',
2172         'HARVESTGlobal',
2173         'HARVESTNano',
2174         'ALCA',
2175     ],
2176     PU = [],
2177     suffix = '_DDDDB',
2178     offset = 0.914,
2179 )
2180 upgradeWFs['DDDDB'].allowReuse = False
2181 
2182 class UpgradeWorkflow_SonicTriton(UpgradeWorkflow):
2183     def setup_(self, step, stepName, stepDict, k, properties):
2184         stepDict[stepName][k] = merge([{'--procModifiers': 'allSonicTriton'}, stepDict[step][k]])
2185     def condition(self, fragment, stepList, key, hasHarvest):
2186         return (fragment=='TTbar_13' and '2021' in key) \
2187             or (fragment=='TTbar_14TeV' and '2026' in key)
2188 upgradeWFs['SonicTriton'] = UpgradeWorkflow_SonicTriton(
2189     steps = [
2190         'GenSim',
2191         'GenSimHLBeamSpot',
2192         'GenSimHLBeamSpot14',
2193         'Digi',
2194         'DigiTrigger',
2195         'Reco',
2196         'RecoGlobal',
2197         'RecoNano',
2198         'HARVEST',
2199         'HARVESTGlobal',
2200         'HARVESTNano',
2201         'ALCA',
2202     ],
2203     PU = [
2204         'GenSim',
2205         'GenSimHLBeamSpot',
2206         'GenSimHLBeamSpot14',
2207         'Digi',
2208         'DigiTrigger',
2209         'Reco',
2210         'RecoGlobal',
2211         'RecoNano',
2212         'HARVEST',
2213         'HARVESTGlobal',
2214         'HARVESTNano',
2215         'ALCA',
2216     ],
2217     suffix = '_SonicTriton',
2218     offset = 0.9001,
2219 )
2220 
2221 # check for duplicate offsets
2222 offsets = [specialWF.offset for specialType,specialWF in upgradeWFs.items()]
2223 seen = set()
2224 dups = set(x for x in offsets if x in seen or seen.add(x))
2225 if len(dups)>0:
2226     raise ValueError("Duplicate special workflow offsets not allowed: "+','.join([str(x) for x in dups]))
2227 
2228 upgradeProperties = {}
2229 
2230 upgradeProperties[2017] = {
2231     '2017' : {
2232         'Geom' : 'DB:Extended',
2233         'GT' : 'auto:phase1_2017_realistic',
2234         'HLTmenu': '@relval2017',
2235         'Era' : 'Run2_2017',
2236         'ScenToRun' : ['GenSim','Digi','RecoFakeHLT','HARVESTFakeHLT','ALCA','Nano'],
2237     },
2238     '2017Design' : {
2239         'Geom' : 'DB:Extended',
2240         'GT' : 'auto:phase1_2017_design',
2241         'HLTmenu': '@relval2017',
2242         'Era' : 'Run2_2017',
2243         'BeamSpot': 'GaussSigmaZ4cm',
2244         'ScenToRun' : ['GenSim','Digi','RecoFakeHLT','HARVESTFakeHLT'],
2245     },
2246     '2018' : {
2247         'Geom' : 'DB:Extended',
2248         'GT' : 'auto:phase1_2018_realistic',
2249         'HLTmenu': '@relval2018',
2250         'Era' : 'Run2_2018',
2251         'BeamSpot': 'Realistic25ns13TeVEarly2018Collision',
2252         'ScenToRun' : ['GenSim','Digi','RecoFakeHLT','HARVESTFakeHLT','ALCA','Nano'],
2253     },
2254     '2018Design' : {
2255         'Geom' : 'DB:Extended',
2256         'GT' : 'auto:phase1_2018_design',
2257         'HLTmenu': '@relval2018',
2258         'Era' : 'Run2_2018',
2259         'BeamSpot': 'GaussSigmaZ4cm',
2260         'ScenToRun' : ['GenSim','Digi','RecoFakeHLT','HARVESTFakeHLT'],
2261     },
2262     '2021' : {
2263         'Geom' : 'DB:Extended',
2264         'GT' : 'auto:phase1_2022_realistic',
2265         'HLTmenu': '@relval2022',
2266         'Era' : 'Run3',
2267         'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision',
2268         'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'],
2269     },
2270     '2021Design' : {
2271         'Geom' : 'DB:Extended',
2272         'GT' : 'auto:phase1_2022_design',
2273         'HLTmenu': '@relval2022',
2274         'Era' : 'Run3',
2275         'BeamSpot': 'GaussSigmaZ4cm',
2276         'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano'],
2277     },
2278     '2023' : {
2279         'Geom' : 'DB:Extended',
2280         'GT' : 'auto:phase1_2023_realistic',
2281         'HLTmenu': '@relval2022',
2282         'Era' : 'Run3',
2283         'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision',
2284         'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'],
2285     },
2286     '2024' : {
2287         'Geom' : 'DB:Extended',
2288         'GT' : 'auto:phase1_2024_realistic',
2289         'HLTmenu': '@relval2022',
2290         'Era' : 'Run3',
2291         'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision',
2292         'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'],
2293     },
2294     '2021FS' : {
2295         'Geom' : 'DB:Extended',
2296         'GT' : 'auto:phase1_2022_realistic',
2297         'HLTmenu': '@relval2022',
2298         'Era' : 'Run3_FastSim',
2299         'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision',
2300         'ScenToRun' : ['Gen','FastSimRun3','HARVESTFastRun3'],
2301     },
2302     '2021postEE' : {
2303         'Geom' : 'DB:Extended',
2304         'GT' : 'auto:phase1_2022_realistic_postEE',
2305         'HLTmenu': '@relval2022',
2306         'Era' : 'Run3',
2307         'BeamSpot': 'Realistic25ns13p6TeVEarly2022Collision',
2308         'ScenToRun' : ['GenSim','Digi','RecoNano','HARVESTNano','ALCA'],
2309     },
2310 }
2311 
2312 # standard PU sequences
2313 for key in list(upgradeProperties[2017].keys()):
2314     upgradeProperties[2017][key+'PU'] = deepcopy(upgradeProperties[2017][key])
2315     if "FS" not in key:
2316         upgradeProperties[2017][key+'PU']['ScenToRun'] = ['GenSim','DigiPU'] + \
2317                                                          (['RecoNanoPU','HARVESTNanoPU'] if '202' in key else ['RecoFakeHLTPU','HARVESTFakeHLTPU']) + \
2318                                                          (['Nano'] if 'Nano' in upgradeProperties[2017][key]['ScenToRun'] else [])
2319     else:
2320         upgradeProperties[2017][key+'PU']['ScenToRun'] = ['Gen','FastSimRun3PU','HARVESTFastRun3PU']
2321 
2322 upgradeProperties[2026] = {
2323     '2026D86' : {
2324         'Geom' : 'Extended2026D86',
2325         'HLTmenu': '@fake2',
2326         'GT' : 'auto:phase2_realistic_T21',
2327         'Era' : 'Phase2C17I13M9',
2328         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2329     },
2330     '2026D88' : {
2331         'Geom' : 'Extended2026D88',
2332         'HLTmenu': '@fake2',
2333         'GT' : 'auto:phase2_realistic_T21',
2334         'Era' : 'Phase2C17I13M9',
2335         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2336     },
2337     '2026D91' : {
2338         'Geom' : 'Extended2026D91',
2339         'HLTmenu': '@fake2',
2340         'GT' : 'auto:phase2_realistic_T30',
2341         'Era' : 'Phase2C17I13M9',
2342         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2343     },
2344     '2026D92' : {
2345         'Geom' : 'Extended2026D92',
2346         'HLTmenu': '@fake2',
2347         'GT' : 'auto:phase2_realistic_T21',
2348         'Era' : 'Phase2C17I13M9',
2349         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2350     },
2351     '2026D93' : {
2352         'Geom' : 'Extended2026D93',
2353         'HLTmenu': '@fake2',
2354         'GT' : 'auto:phase2_realistic_T21',
2355         'Era' : 'Phase2C17I13M9',
2356         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2357     },
2358     '2026D94' : {
2359         'Geom' : 'Extended2026D94',
2360         'HLTmenu': '@fake2',
2361         'GT' : 'auto:phase2_realistic_T21',
2362         'Era' : 'Phase2C18I13M9',
2363         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2364     },
2365     '2026D95' : {
2366         'Geom' : 'Extended2026D95',
2367         'HLTmenu': '@fake2',
2368         'GT' : 'auto:phase2_realistic_T21',
2369         'Era' : 'Phase2C17I13M9',
2370         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2371     },
2372     '2026D96' : {
2373         'Geom' : 'Extended2026D96',
2374         'HLTmenu': '@fake2',
2375         'GT' : 'auto:phase2_realistic_T21',
2376         'Era' : 'Phase2C17I13M9',
2377         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2378     },
2379     '2026D97' : {
2380         'Geom' : 'Extended2026D97',
2381         'HLTmenu': '@fake2',
2382         'GT' : 'auto:phase2_realistic_T25',
2383         'Era' : 'Phase2C17I13M9',
2384         'ScenToRun' : ['GenSimHLBeamSpot','DigiTrigger','RecoGlobal', 'HARVESTGlobal', 'ALCAPhase2'],
2385     },
2386 }
2387 
2388 # standard PU sequences
2389 for key in list(upgradeProperties[2026].keys()):
2390     upgradeProperties[2026][key+'PU'] = deepcopy(upgradeProperties[2026][key])
2391     upgradeProperties[2026][key+'PU']['ScenToRun'] = ['GenSimHLBeamSpot','DigiTriggerPU','RecoGlobalPU', 'HARVESTGlobalPU']
2392 
2393 # for relvals
2394 defaultDataSets = {}
2395 for year in upgradeKeys:
2396     for key in upgradeKeys[year]:
2397         if 'PU' in key: continue
2398         defaultDataSets[key] = ''
2399 
2400 
2401 class UpgradeFragment(object):
2402     def __init__(self, howMuch, dataset):
2403         self.howMuch = howMuch
2404         self.dataset = dataset
2405 
2406 upgradeFragments = OrderedDict([
2407     ('FourMuPt_1_200_pythia8_cfi', UpgradeFragment(Kby(10,100),'FourMuPt1_200')),
2408     ('SingleElectronPt10_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleElectronPt10')),
2409     ('SingleElectronPt35_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleElectronPt35')),
2410     ('SingleElectronPt1000_pythia8_cfi', UpgradeFragment(Kby(9,50),'SingleElectronPt1000')),
2411     ('SingleGammaPt10_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleGammaPt10')),
2412     ('SingleGammaPt35_pythia8_cfi', UpgradeFragment(Kby(9,50),'SingleGammaPt35')),
2413     ('SingleMuPt1_pythia8_cfi', UpgradeFragment(Kby(25,100),'SingleMuPt1')),
2414     ('SingleMuPt10_Eta2p85_cfi', UpgradeFragment(Kby(9,100),'SingleMuPt10')),
2415     ('SingleMuPt100_Eta2p85_cfi', UpgradeFragment(Kby(9,100),'SingleMuPt100')),
2416     ('SingleMuPt1000_Eta2p85_cfi', UpgradeFragment(Kby(9,100),'SingleMuPt1000')),
2417     ('FourMuExtendedPt_1_200_pythia8_cfi', UpgradeFragment(Kby(10,100),'FourMuExtendedPt1_200')),
2418     ('TenMuExtendedE_0_200_pythia8_cfi', UpgradeFragment(Kby(10,100),'TenMuExtendedE_0_200')),
2419     ('DoubleElectronPt10Extended_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleElPt10Extended')),
2420     ('DoubleElectronPt35Extended_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleElPt35Extended')),
2421     ('DoubleElectronPt1000Extended_pythia8_cfi', UpgradeFragment(Kby(9,50),'SingleElPt1000Extended')),
2422     ('DoubleGammaPt10Extended_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleGammaPt10Extended')),
2423     ('DoubleGammaPt35Extended_pythia8_cfi', UpgradeFragment(Kby(9,50),'SingleGammaPt35Extended')),
2424     ('DoubleMuPt1Extended_pythia8_cfi', UpgradeFragment(Kby(25,100),'SingleMuPt1Extended')),
2425     ('DoubleMuPt10Extended_pythia8_cfi', UpgradeFragment(Kby(25,100),'SingleMuPt10Extended')),
2426     ('DoubleMuPt100Extended_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleMuPt100Extended')),
2427     ('DoubleMuPt1000Extended_pythia8_cfi', UpgradeFragment(Kby(9,100),'SingleMuPt1000Extended')),
2428     ('TenMuE_0_200_pythia8_cfi', UpgradeFragment(Kby(10,100),'TenMuE_0_200')),
2429     ('SinglePiE50HCAL_pythia8_cfi', UpgradeFragment(Kby(50,500),'SinglePiE50HCAL')),
2430     ('MinBias_13TeV_pythia8_TuneCUETP8M1_cfi', UpgradeFragment(Kby(90,100),'MinBias_13')),
2431     ('TTbar_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'TTbar_13')),
2432     ('ZEE_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'ZEE_13')),
2433     ('QCD_Pt_600_800_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'QCD_Pt_600_800_13')),
2434     ('Wjet_Pt_80_120_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'Wjet_Pt_80_120_14TeV')),
2435     ('Wjet_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'Wjet_Pt_3000_3500_14TeV')),
2436     ('LM1_sfts_14TeV_cfi', UpgradeFragment(Kby(9,100),'LM1_sfts_14TeV')),
2437     ('QCD_Pt_3000_3500_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'QCD_Pt_3000_3500_14TeV')),
2438     ('QCD_Pt_80_120_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'QCD_Pt_80_120_14TeV')),
2439     ('H200ChargedTaus_Tauola_14TeV_cfi', UpgradeFragment(Kby(9,100),'Higgs200ChargedTaus_14TeV')),
2440     ('JpsiMM_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(66,100),'JpsiMM_14TeV')),
2441     ('TTbar_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,100),'TTbar_14TeV')),
2442     ('WE_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'WE_14TeV')),
2443     ('ZTT_Tauola_All_hadronic_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,100),'ZTT_14TeV')),
2444     ('H130GGgluonfusion_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'H130GGgluonfusion_14TeV')),
2445     ('PhotonJet_Pt_10_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'PhotonJets_Pt_10_14TeV')),
2446     ('QQH1352T_Tauola_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'QQH1352T_Tauola_14TeV')),
2447     ('MinBias_14TeV_pythia8_TuneCP5_cfi', UpgradeFragment(Kby(90,100),'MinBias_14TeV')),
2448     ('WToMuNu_14TeV_TuneCP5_pythia8_cfi', UpgradeFragment(Kby(9,100),'WToMuNu_14TeV')),
2449     ('ZMM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(18,100),'ZMM_13')),
2450     ('QCDForPF_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(50,100),'QCD_FlatPt_15_3000HS_14')),
2451     ('DYToLL_M-50_14TeV_pythia8_cff', UpgradeFragment(Kby(9,100),'DYToLL_M_50_14TeV')),
2452     ('DYToTauTau_M-50_14TeV_pythia8_tauola_cff', UpgradeFragment(Kby(9,100),'DYtoTauTau_M_50_14TeV')),
2453     ('ZEE_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,100),'ZEE_14')),
2454     ('QCD_Pt_80_120_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,100),'QCD_Pt_80_120_13')),
2455     ('H125GGgluonfusion_13TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'H125GGgluonfusion_13')),
2456     ('QCD_Pt20toInf_MuEnrichedPt15_14TeV_TuneCP5_cff', UpgradeFragment(Kby(19565, 217391),'QCD_Pt20toInfMuEnrichPt15_14')), # effi = 4.6e-4,  local=8.000e-04
2457     ('ZMM_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(18,100),'ZMM_14')),
2458     ('QCD_Pt15To7000_Flat_14TeV_TuneCP5_cff', UpgradeFragment(Kby(9,50),'QCD_Pt15To7000_Flat_14')),
2459     ('H125GGgluonfusion_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'H125GGgluonfusion_14')),
2460     ('QCD_Pt_600_800_14TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'QCD_Pt_600_800_14')),
2461     ('UndergroundCosmicSPLooseMu_cfi', UpgradeFragment(Kby(9,50),'CosmicsSPLoose')),
2462     ('BeamHalo_13TeV_cfi', UpgradeFragment(Kby(9,50),'BeamHalo_13')),
2463     ('H200ChargedTaus_Tauola_13TeV_cfi', UpgradeFragment(Kby(9,50),'Higgs200ChargedTaus_13')),
2464     ('ADDMonoJet_13TeV_d3MD3_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'ADDMonoJet_d3MD3_13')),
2465     ('ZpMM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'ZpMM_13')),
2466     ('QCD_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'QCD_Pt_3000_3500_13')),
2467     ('WpM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'WpM_13')),
2468     ('SingleNuE10_cfi', UpgradeFragment(Kby(9,50),'NuGun')),
2469     ('TTbarLepton_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'TTbarLepton_13')),
2470     ('WE_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'WE_13')),
2471     ('WM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'WM_13')),
2472     ('ZTT_All_hadronic_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'ZTT_13')),
2473     ('PhotonJet_Pt_10_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'PhotonJets_Pt_10_13')),
2474     ('QQH1352T_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'QQH1352T_13')),
2475     ('Wjet_Pt_80_120_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'Wjet_Pt_80_120_13')),
2476     ('Wjet_Pt_3000_3500_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'Wjet_Pt_3000_3500_13')),
2477     ('SMS-T1tttt_mGl-1500_mLSP-100_13TeV-pythia8_cfi', UpgradeFragment(Kby(9,50),'SMS-T1tttt_mGl-1500_mLSP-100_13')),
2478     ('QCDForPF_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(50,100),'QCD_FlatPt_15_3000HS_13')),
2479     ('PYTHIA8_PhiToMuMu_TuneCUETP8M1_13TeV_cff', UpgradeFragment(Kby(9,50),'PhiToMuMu_13')),
2480     ('RSKKGluon_m3000GeV_13TeV_TuneCUETP8M1_cff', UpgradeFragment(Kby(9,50),'RSKKGluon_m3000GeV_13')),
2481     ('ZpMM_2250_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'ZpMM_2250_13')),
2482     ('ZpEE_2250_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'ZpEE_2250_13')),
2483     ('ZpTT_1500_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'ZpTT_1500_13')),
2484     ('Upsilon1SToMuMu_forSTEAM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(9,50),'Upsilon1SToMuMu_13')),
2485     ('EtaBToJpsiJpsi_forSTEAM_TuneCUEP8M1_13TeV_cfi', UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_13')),
2486     ('JpsiMuMu_Pt-8_forSTEAM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(3100,100000),'JpsiMuMu_Pt-8')),
2487     ('BuMixing_BMuonFilter_forSTEAM_13TeV_TuneCUETP8M1_cfi', UpgradeFragment(Kby(900,10000),'BuMixing_13')),
2488     ('HSCPstop_M_200_TuneCUETP8M1_13TeV_pythia8_cff', UpgradeFragment(Kby(9,50),'HSCPstop_M_200_13')),
2489     ('RSGravitonToGammaGamma_kMpl01_M_3000_TuneCUETP8M1_13TeV_pythia8_cfi', UpgradeFragment(Kby(9,50),'RSGravitonToGaGa_13')),
2490     ('WprimeToENu_M-2000_TuneCUETP8M1_13TeV-pythia8_cff', UpgradeFragment(Kby(9,50),'WpToENu_M-2000_13')),
2491     ('DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_13TeV_pythia8_cff', UpgradeFragment(Kby(9,50),'DisplacedSUSY_stopToB_M_800_500mm_13')),
2492     ('TenE_E_0_200_pythia8_cfi', UpgradeFragment(Kby(9,100),'TenE_0_200')),
2493     ('FlatRandomPtAndDxyGunProducer_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuonsDxy_0_500')),
2494     ('TenTau_E_15_500_pythia8_cfi', UpgradeFragment(Kby(9,100),'TenTau_15_500')),
2495     ('SinglePiPt25Eta1p7_2p7_cfi', UpgradeFragment(Kby(9,100),'SinglePiPt25Eta1p7_2p7')),
2496     ('SingleMuPt15Eta1p7_2p7_cfi', UpgradeFragment(Kby(9,100),'SingleMuPt15Eta1p7_2p7')),
2497     ('SingleGammaPt25Eta1p7_2p7_cfi', UpgradeFragment(Kby(9,100),'SingleGammaPt25Eta1p7_2p7')),
2498     ('SingleElectronPt15Eta1p7_2p7_cfi', UpgradeFragment(Kby(9,100),'SingleElectronPt15Eta1p7_2p7')),
2499     ('ZTT_All_hadronic_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'ZTT_14')),
2500     ('CloseByParticle_Photon_ERZRanges_cfi', UpgradeFragment(Kby(9,100),'CloseByParticleGun')),
2501     ('CE_E_Front_300um_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_E_Front_300um')),
2502     ('CE_E_Front_200um_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_E_Front_200um')),
2503     ('CE_E_Front_120um_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_E_Front_120um')),
2504     ('CE_H_Fine_300um_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_H_Fine_300um')),
2505     ('CE_H_Fine_200um_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_H_Fine_200um')),
2506     ('CE_H_Fine_120um_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_H_Fine_120um')),
2507     ('CE_H_Coarse_Scint_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_H_Coarse_Scint')),
2508     ('CE_H_Coarse_300um_cfi', UpgradeFragment(Kby(9,100),'CloseByPGun_CE_H_Coarse_300um')),
2509     ('SingleElectronFlatPt2To100_cfi', UpgradeFragment(Kby(9,100),'SingleEFlatPt2To100')),
2510     ('SingleMuFlatPt0p7To10_cfi', UpgradeFragment(Kby(9,100),'SingleMuFlatPt0p7To10')),
2511     ('SingleMuFlatPt2To100_cfi', UpgradeFragment(Kby(9,100),'SingleMuFlatPt2To100')),
2512     ('SingleGammaFlatPt8To150_cfi', UpgradeFragment(Kby(9,100),'SingleGammaFlatPt8To150')),
2513     ('SinglePiFlatPt0p7To10_cfi', UpgradeFragment(Kby(9,100),'SinglePiFlatPt0p7To10')),
2514     ('SingleTauFlatPt2To150_cfi', UpgradeFragment(Kby(9,100),'SingleTauFlatPt2To150')),
2515     ('FlatRandomPtAndDxyGunProducer_MuPt2To10_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt2To10')),
2516     ('FlatRandomPtAndDxyGunProducer_MuPt10To30_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt10To30')),
2517     ('FlatRandomPtAndDxyGunProducer_MuPt30To100_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt30To100')),
2518     ('B0ToKstarMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(304,3030),'B0ToKstarMuMu_14TeV')), # 3.3%
2519     ('BsToEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(223,2222),'BsToEleEle_14TeV')), # 4.5%
2520     ('BsToJpsiGamma_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(2500,25000),'BsToJpsiGamma_14TeV')), # 0.4%
2521     ('BsToJpsiPhi_mumuKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(910,9090),'BsToJpsiPhi_mumuKK_14TeV')), # 1.1%
2522     ('BsToMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(313,3125),'BsToMuMu_14TeV')), # 3.2%
2523     ('BsToPhiPhi_KKKK_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(556,5555),'BsToPhiPhi_KKKK_14TeV')), # 1.8%
2524     ('TauToMuMuMu_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(18939,189393),'TauToMuMuMu_14TeV')), # effi = 5.280e-04
2525     ('BdToKstarEleEle_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(206,2061),'BdToKstarEleEle_14TeV')), #effi = 4.850e-02
2526     ('ZpTT_1500_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'ZpTT_1500_14')),
2527     ('BuMixing_BMuonFilter_forSTEAM_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(900,10000),'BuMixing_14')),
2528     ('Upsilon1SToMuMu_forSTEAM_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50),'Upsilon1SToMuMu_14')),
2529     ('TenTau_E_15_500_Eta3p1_pythia8_cfi', UpgradeFragment(Kby(9,100),'TenTau_15_500_Eta3p1')),
2530     ('QCD_Pt_1800_2400_14TeV_TuneCP5_cfi', UpgradeFragment(Kby(9,50), 'QCD_Pt_1800_2400_14')),
2531     ('DisplacedSUSY_stopToBottom_M_800_500mm_TuneCP5_14TeV_pythia8_cff', UpgradeFragment(Kby(9,50),'DisplacedSUSY_14TeV')),
2532     ('GluGluTo2Jets_M_300_2000_14TeV_Exhume_cff',UpgradeFragment(Kby(9,100),'GluGluTo2Jets_14TeV')),
2533     ('TTbarToDilepton_mt172p5_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'TTbarToDilepton_14TeV')),
2534     ('QQToHToTauTau_mh125_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'QQToHToTauTau_14TeV')),
2535     ('ZpToEE_m6000_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'ZpToEE_m6000_14TeV')),
2536     ('ZpToMM_m6000_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'ZpToMM_m6000_14TeV')),
2537     ('SMS-T1tttt_mGl-1500_mLSP-100_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'SMS-T1tttt_14TeV')),
2538     ('VBFHZZ4Nu_TuneCP5_14TeV_pythia8_cfi',UpgradeFragment(Kby(9,50),'VBFHZZ4Nu_14TeV')),
2539     ('EtaBToJpsiJpsi_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(9,50),'EtaBToJpsiJpsi_14TeV')),
2540     ('WToLNu_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WToLNu_14TeV')),
2541     ('WprimeToLNu_M2000_14TeV_TuneCP5_pythia8_cfi',UpgradeFragment(Kby(21,50),'WprimeToLNu_M2000_14TeV')),
2542     ('DoubleMuFlatPt1p5To8_cfi', UpgradeFragment(Kby(9,100),'SingleMuFlatPt1p5To8')),
2543     ('DoubleElectronFlatPt1p5To8_cfi', UpgradeFragment(Kby(9,100),'SingleElectronFlatPt1p5To8')),
2544     ('DoubleMuFlatPt1p5To8Dxy100GunProducer_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt1p5To8Dxy100')),
2545     ('DoubleMuFlatPt2To100Dxy100GunProducer_cfi', UpgradeFragment(Kby(9,100),'DisplacedMuPt2To100Dxy100')),
2546     ('BuToJPsiPrimeKToJPsiPiPiK_14TeV_TuneCP5_pythia8_cfi', UpgradeFragment(Kby(223,2222),'BuToJPsiPrimeKToJPsiPiPiK_14TeV')), # 5.7%
2547     ('Psi2SToJPsiPiPi_14TeV_TuneCP5_pythia8_cfi', UpgradeFragment(Kby(45,500),'Psi2SToJPsiPiPi_14TeV')), # 24.6%
2548     ('XiMinus_13p6TeV_SoftQCDInel_TuneCP5_cfi', UpgradeFragment(Kby(8000,90000),'XiMinus_13p6TeV')), #2.8%
2549     ('Chib1PToUpsilon1SGamma_MuFilter_TuneCP5_14TeV-pythia8_evtgen_cfi', UpgradeFragment(Kby(3600,36000),'Chib1PToUpsilon1SGamma_14TeV')), #2.8%
2550     ('ChicToJpsiGamma_MuFilter_TuneCP5_14TeV_pythia8_evtgen_cfi', UpgradeFragment(Kby(2000,20000),'ChicToJpsiGamma_14TeV')), #5%
2551     ('B0ToJpsiK0s_JMM_Filter_DGamma0_TuneCP5_13p6TeV-pythia8-evtgen_cfi',UpgradeFragment(Kby(38000,38000),'B0ToJpsiK0s_DGamma0_13p6TeV')), #2.7%
2552     ('DStarToD0Pi_D0ToKsPiPi_inclusive_SoftQCD_TuneCP5_13p6TeV-pythia8-evtgen',UpgradeFragment(Kby(38000,38000),'DStarToD0Pi_D0ToKsPiPi_13p6TeV')), #1.3%
2553     ('LbToJpsiLambda_JMM_Filter_DGamma0_TuneCP5_13p6TeV-pythia8-evtgen_cfi',UpgradeFragment(Mby(66,660000),'LbToJpsiLambda_DGamma0_13p6TeV')), #0.3%
2554     ('LbToJpsiXiK0sPi_JMM_Filter_DGamma0_TuneCP5_13p6TeV-pythia8-evtgen_cfi',UpgradeFragment(Mby(50,500000),'LbToJpsiXiK0sPr_DGamma0_13p6TeV')), #0.6%
2555     ('OmegaMinus_13p6TeV_SoftQCDInel_TuneCP5_cfi',UpgradeFragment(Mby(100,1000000),'OmegaMinus_13p6TeV')), #0.1%
2556 ])