Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-29 02:25:38

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