Skip to content

Commit

Permalink
Merge pull request #44428 from vlimant/custom_autonano
Browse files Browse the repository at this point in the history
custom nano configuration and test [Backport]
  • Loading branch information
cmsbuild authored Apr 2, 2024
2 parents 692b88a + af72d05 commit 5eabc15
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 45 deletions.
3 changes: 3 additions & 0 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,9 @@ def prepare_NANO(self, stepSpec = '' ):
_cff,_seq = _subSeq.split('.')
self.loadAndRemember(_cff)
_seqToSchedule.append(_seq)
elif '/' in _subSeq:
self.loadAndRemember(_subSeq)
_seqToSchedule.append(self.NANODefaultSeq)
else:
_seqToSchedule.append(_subSeq)
self.scheduleSequence('+'.join(_seqToSchedule), 'nanoAOD_step')
Expand Down
69 changes: 39 additions & 30 deletions Configuration/PyReleaseValidation/python/relval_nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def subnext(self):
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD'}])

steps['muPOGNANO_data13.0']=merge([{'-s' : 'NANO:@PHYS+@MUPOG',
'-n' : '1000'},
steps['muPOGNANO_data13.0']=merge([{'-s' : 'NANO:@MUPOG,DQM:@nanoAODDQM', '-n' : '1000'},
steps['NANO_data13.0']])

steps['EGMNano_data13.0'] = merge([{'-s':'NANO:@EGM,DQM:@nanoAODDQM', '-n' : '1000'},
Expand All @@ -176,43 +175,49 @@ def subnext(self):
steps['EGMNano_mc13.0'] = merge([{'-s':'NANO:@EGM,DQM:@nanoAODDQM', '-n' : '1000'},
steps['NANO_mc13.0']])

steps['jmeNano_data13.0'] = merge([{'-s':'NANO:@JME', '-n' : '1000'},
steps['NANO_data13.0']])

steps['lepTimeLifeNANO_data13.0']=merge([{'-s' : 'NANO:@LepTimeLife,DQM:@nanoAODDQM',
'-n' : '1000'},
steps['NANO_data13.0']])

###current release cycle workflows : 13.2
steps['TTBarMINIAOD13.2'] = {'INPUT':InputInfo(location='STD',
## dataset below to be replaced with a 13.2 relval sample when available
dataSet='/RelValTTbar_14TeV/CMSSW_13_0_0-PU_130X_mcRun3_2022_realistic_v2_HS-v4/MINIAODSIM')}
dataSet='/RelValTTbar_14TeV/CMSSW_13_2_0-PU_131X_mcRun3_2023_realistic_v9-v1/MINIAODSIM')}

steps['NANO_mc13.2']=merge([{'--era':'Run3',
'--conditions':'auto:phase1_2022_realistic'},
_NANO_mc])

steps['muPOGNANO_mc13.2']=merge([{'-s' : 'NANO:@PHYS+@MUPOG ', '-n' : '1000'},
steps['muPOGNANO_mc13.2']=merge([{'-s' : 'NANO:@MUPOG,DQM:@nanoAODDQM', '-n' : '1000'},
steps['NANO_mc13.2']])

steps['EGMNano_mc13.2'] = merge([{'-s':'NANO:@EGM,DQM:@nanoAODDQM', '-n' : '1000'},
steps['NANO_mc13.2']])

steps['jmeNANO_mc13.2']=merge([{'-s' : 'NANO:@JME ', '-n' : '1000'},
steps['NANO_mc13.2']])

steps['lepTimeLifeNANO_mc13.2']=merge([{'-s' : 'NANO:@LepTimeLife,DQM:@nanoAODDQM',
'-n' : '1000'},
steps['NANO_mc13.2']])

##13.X INPUT
steps['RunScoutingPFRun32022D13.X']={'INPUT':InputInfo(dataSet='/ScoutingPFRun3/Run2022D-v1/RAW',label='2022D',events=100000,location='STD', ls=Run2022D)}

steps['NANO_dataRun3ScoutingPF13.X']=merge([{'-s':'NANO:PhysicsTools/NanoAOD/custom_run3scouting_cff',
'--conditions':'auto:run3_data',
'-n':'10',
'--era' : 'Run3',
'--geometry' : 'DB:Extended',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD'}])

steps['NANO_mcRun3ScoutingPF13.X']=merge([{'-s':'NANO:PhysicsTools/NanoAOD/custom_run3scouting_cff.nanoSequenceMC',
'--conditions':'auto:phase1_2022_realistic',
'-n':'10',
'--mc':'',
'--era' : 'Run3',
'--geometry' : 'DB:Extended',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD',
'--filein':'/store/mc/Run3Summer22MiniAODv3/BulkGravitonToHH_MX1120_MH121_TuneCP5_13p6TeV_madgraph-pythia8/MINIAODSIM/124X_mcRun3_2022_realistic_v12-v3/2810000/f9cdd76c-faac-4f24-bf0c-2496c8fffe54.root',
'--secondfilein':'/store/mc/Run3Summer22DRPremix/BulkGravitonToHH_MX1120_MH121_TuneCP5_13p6TeV_madgraph-pythia8/AODSIM/124X_mcRun3_2022_realistic_v12-v3/2810000/ab09fc5d-859c-407f-b7ce-74b0bae9bb96.root',
'--customise':'IOPool/Input/fixReading_12_4_X_Files.fixReading_12_4_X_Files'}])
steps['ScoutingPFRun32022DRAW13.X']={'INPUT':InputInfo(dataSet='/ScoutingPFRun3/Run2022D-v1/RAW',label='2022D',events=100000,location='STD', ls=Run2022D)}

steps['NANO_dataRun3ScoutingPF13.X']=merge([{'-s':'NANO:@Scout'},
steps['NANO_data13.0']])

steps['TTBarMINIAOD13.3'] = {'INPUT':InputInfo(location='STD',
dataSet='/RelValTTbar_14TeV/CMSSW_13_3_0-PU_133X_mcRun3_2023_realistic_v3-v1/MINIAODSIM')}

steps['NANO_mc13.3']=merge([{'--era':'Run3',
'--conditions':'133X_mcRun3_2023_realistic_v3'},
_NANO_mc])

steps['NANO_mcScouting13.X']=merge([{'-s':'NANO:@Scout'},
steps['NANO_mc13.3']])

_wfn=WFN(2500)
################
Expand Down Expand Up @@ -248,21 +253,25 @@ def subnext(self):
workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0_prompt', 'HRV_NANO_data']]
workflows[_wfn()] = ['muDPGNANO130Xrun3', ['ZMuSkim2023DRAWRECO13.0', 'muDPGNANO_data13.0']]
workflows[_wfn()] = ['muDPGNANOBkg130Xrun3', ['ZeroBias2023DRAW13.0', 'muDPGNANOBkg_data13.0']]
workflows[_wfn()] = ['muPOGNANO_data13.0', ['MuonEG2023MINIAOD13.0', 'muPOGNANO_data13.0']]
workflows[_wfn()] = ['muPOGNANO130Xrun3', ['MuonEG2023MINIAOD13.0', 'muPOGNANO_data13.0']]
workflows[_wfn()] = ['EGMNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'EGMNano_data13.0']]
workflows[_wfn()] = ['jmeNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'jmeNano_data13.0']]
workflows[_wfn()] = ['lepTimeLifeNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'lepTimeLifeNANO_data13.0']]

_wfn.next()
################
#13.2 workflows
workflows[_wfn()] = ['NANOmc132X', ['TTBarMINIAOD13.2', 'NANO_mc13.2', 'HRV_NANO_mc']]
workflows[_wfn()] = ['muPOGNANO_mc13.2', ['TTBarMINIAOD13.2', 'muPOGNANO_mc13.2']]
workflows[_wfn()] = ['muPOGNANOmc132X', ['TTBarMINIAOD13.2', 'muPOGNANO_mc13.2']]
workflows[_wfn()] = ['EGMNANOmc132X', ['TTBarMINIAOD13.2', 'EGMNano_mc13.2']]
workflows[_wfn()] = ['jmeNANOmc132X', ['TTBarMINIAOD13.2', 'jmeNANO_mc13.2']]
workflows[_wfn()] = ['lepTimeLifeNANOmc132X', ['TTBarMINIAOD13.2', 'lepTimeLifeNANO_mc13.2']]

_wfn.next()
################
#13.X workflows
workflows[_wfn()] = ['ScoutingNanodata13X',['RunScoutingPFRun32022D13.X', 'NANO_dataRun3ScoutingPF13.X']]
workflows[_wfn()] = ['ScoutingNanodata13X',['ScoutingPFRun32022DRAW13.X', 'NANO_dataRun3ScoutingPF13.X']]
_wfn.subnext()
workflows[_wfn()] = ['ScoutingNanomc13X',['NANO_mcRun3ScoutingPF13.X']]
workflows[_wfn()] = ['ScoutingNanomc13X',['TTBarMINIAOD13.3','NANO_mcScouting13.X']]

################
2 changes: 1 addition & 1 deletion Configuration/PyReleaseValidation/python/relval_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4108,7 +4108,7 @@ def gen2023HiMix(fragment,howMuch):
steps['NANOUP15'] = merge([{ '--conditions':'auto:run2_mc', '--era':'Run2_2016','-n':'10', '--filein':'file:step3_inMINIAODSIM.root','--nThreads':'2'}, stepNanoEDMMCProd ])
steps['NANOUP17'] = merge([{'--conditions':'auto:phase1_2017_realistic','--era': 'Run2_2017','-n':'10' ,'--filein':'file:step3_inMINIAODSIM.root', '--geometry':'DB:Extended', '--nThreads':'2'}, stepNanoEDMMCProd])
steps['NANOUP15Had']=merge([{'--filein':'file:step4_inMINIAODSIM.root'},steps['NANOUP15']])
steps['NANOUP15MC_PU25_JME']=merge([{'--customise':'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD_MC'},steps['NANOUP15']])
steps['NANOUP15MC_PU25_JME']=merge([{'--customise':'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'},steps['NANOUP15']])
steps['NANOUP15MC_PU25_Muon']=merge([{'--customise':'PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'},steps['NANOUP15']])
steps['NANOUP17Had']=merge([{'--filein':'file:step4_inMINIAODSIM.root'},steps['NANOUP17']])
steps['NANOUP18'] = merge([{'--conditions': 'auto:phase1_2018_realistic', '--era': 'Run2_2018','-n':'10', '--filein':'file:step3_inMINIAODSIM.root', '--nThreads':'2'}, stepNanoEDMMCProd ])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,7 @@ def condition(self, fragment, stepList, key, hasHarvest):
class UpgradeWorkflow_JMENano(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
if 'Nano' in step:
stepDict[stepName][k] = merge([{'--customise': 'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD_MC'}, stepDict[step][k]])
stepDict[stepName][k] = merge([{'--customise': 'PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'}, stepDict[step][k]])
def condition(self, fragment, stepList, key, hasHarvest):
return (fragment=="TTbar_13" or fragment=="TTbar_14TeV") and ('2017' in key or '2018' in key or '2021' in key) and ('FS' not in key)
upgradeWFs['JMENano'] = UpgradeWorkflow_JMENano(
Expand Down
8 changes: 7 additions & 1 deletion PhysicsTools/NanoAOD/python/autoNANO.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ def expandNanoMapping(seqList, mapping, key):
# L1 flavours: add tables through customize, supposed to be combined with PHYS
'L1' : {'customize': 'nanoL1TrigObjCustomize'},
'L1FULL' : {'customize': 'nanoL1TrigObjCustomizeFull'},
#scouting nano
'Scout' : {'sequence': 'PhysicsTools/NanoAOD/custom_run3scouting_cff'},
# JME custom NANO
'JME' : { 'sequence': '@PHYS',
'customize': '@PHYS+PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'},
# Muon POG flavours : add tables through customize, supposed to be combined with PHYS
'MUPOG' : {'customize' : 'PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'},
'MUPOG' : { 'sequence': '@PHYS',
'customize' : '@PHYS+PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'},
# MUDPG flavours: use their own sequence
'MUDPG' : {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoProducer',
'customize': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoCustomize'},
Expand Down
16 changes: 5 additions & 11 deletions PhysicsTools/NanoAOD/python/custom_jme_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,11 @@ def RemoveAllJetPtCuts(proc):
# CUSTOMIZATION function
#
#===========================================================================
def PrepJMECustomNanoAOD(process,runOnMC):

def PrepJMECustomNanoAOD(process):
## TODO : find a better way to handle data or MC by modifying the proper Tasks
runOnMC=True
if hasattr(process,"NANOEDMAODoutput") or hasattr(process,"NANOAODoutput"):
runOnMC = False
############################################################################
# Remove all default jet pt cuts from jets_cff.py
############################################################################
Expand Down Expand Up @@ -1343,12 +1346,3 @@ def addAK4JetTasks(proc, addAK4CHSJetTasks, addAK4PuppiJetTasks):
process.genWeightsTable.keepAllPSWeights = True

return process

def PrepJMECustomNanoAOD_MC(process):
process = PrepJMECustomNanoAOD(process,runOnMC=True)

return process

def PrepJMECustomNanoAOD_Data(process):
process = PrepJMECustomNanoAOD(process,runOnMC=False)
return process
3 changes: 2 additions & 1 deletion PhysicsTools/NanoAOD/python/custom_muon_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def Custom_Muon_Task(process):
process.nanoTableTaskFS.remove(process.metMCTable)
process.nanoTableTaskFS.remove(process.ttbarCatMCProducersTask)
process.nanoTableTaskFS.remove(process.ttbarCategoryTableTask)

process.nanoTableTaskFS.remove(process.rivetMetTable)

return process

def AddPFTracks(proc):
Expand Down

0 comments on commit 5eabc15

Please sign in to comment.