Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hcalnano autonano #44492

Merged
merged 4 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions Configuration/Applications/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1796,37 +1796,44 @@ def prepare_PATGEN(self, stepSpec = "miniGEN"):
def prepare_NANO(self, stepSpec = '' ):
print(f"in prepare_nano {stepSpec}")
''' Enrich the schedule with NANO '''
_,_nanoSeq,_nanoCff = self.loadDefaultOrSpecifiedCFF(stepSpec,self.NANODefaultCFF,self.NANODefaultSeq)

# create full specified sequence using autoNANO
if not '@' in stepSpec:
_,_nanoSeq,_nanoCff = self.loadDefaultOrSpecifiedCFF(stepSpec,self.NANODefaultCFF,self.NANODefaultSeq)
else:
_nanoSeq = stepSpec
_nanoCff = self.NANODefaultCFF

print(_nanoSeq)
# create full specified sequence using autoNANO
from PhysicsTools.NanoAOD.autoNANO import autoNANO, expandNanoMapping
# if not a autoNANO mapping, load an empty customization, which later will be converted into the default.
_nanoCustoms = _nanoSeq.split('+') if '@' in stepSpec else ['']
_nanoCustoms = _nanoSeq.split('+') if '@' in stepSpec else ['']
_nanoSeq = _nanoSeq.split('+')
expandNanoMapping(_nanoSeq, autoNANO, 'sequence')
expandNanoMapping(_nanoCustoms, autoNANO, 'customize')
# make sure there are no duplicates while preserving the ordering
_nanoSeq = list(sorted(set(_nanoSeq), key=_nanoSeq.index))
_nanoCustoms = list(sorted(set(_nanoCustoms), key=_nanoCustoms.index))
# replace empty sequence with default
_nanoSeq = [seq if seq!='' else self.NANODefaultSeq for seq in _nanoSeq]
_nanoCustoms = [cust if cust!='' else self.NANODefaultCustom for cust in _nanoCustoms]
_nanoSeq = [seq if seq!='' else f"{self.NANODefaultCFF}.{self.NANODefaultSeq}" for seq in _nanoSeq]
_nanoCustoms = [cust if cust!='' else self.NANODefaultCustom for cust in _nanoCustoms]
# build and inject the sequence
if len(_nanoSeq) < 1 and '@' in stepSpec:
raise Exception(f'The specified mapping: {stepSpec} generates an empty NANO sequence. Please provide a valid mapping')
_seqToSchedule = []
for _subSeq in _nanoSeq:
if '.' in _subSeq:
_cff,_seq = _subSeq.split('.')
print("NANO: scheduling:",_seq,"from",_cff)
self.loadAndRemember(_cff)
_seqToSchedule.append(_seq)
else:
print("NANO: scheduling:",_subSeq)
_seqToSchedule.append(_subSeq)
self.scheduleSequence('+'.join(_seqToSchedule), 'nanoAOD_step')

# add the customisations
for custom in _nanoCustoms:
custom_path = custom if '.' in custom else '.'.join([_nanoCff,custom])
custom_path = custom if '.' in custom else '.'.join([_nanoCff,custom])
# customization order can be important for NANO, here later specified customise take precedence
self._options.customisation_file.append(custom_path)
if self._options.hltProcess:
Expand Down
36 changes: 24 additions & 12 deletions Configuration/PyReleaseValidation/python/relval_nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ def subnext(self):
steps['ZeroBias2023DRAW13.0']={'INPUT':InputInfo(location='STD', ls={369978: [[1, 800]]},
dataSet='/ZeroBias/Run2023D-v1/RAW')}

steps['TestEnablesEcalHcal2023C']={'INPUT':InputInfo(location='STD', ls={368489: [[46,546]]},
dataSet='/TestEnablesEcalHcal/Run2023C-Express-v4/RAW')}

steps['NANO_data13.0']=merge([{'--era':'Run3',
'--conditions':'auto:run3_data'},
_NANO_data])
Expand All @@ -154,18 +157,24 @@ def subnext(self):


steps['muDPGNANO_data13.0']=merge([{'-s' : 'RAW2DIGI,NANO:@MUDPG',
'--conditions':'auto:run3_data',
'-n' : '100',
'--era' : 'Run3',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD'}])
'-n' : '100',},
steps['NANO_data13.0']])

Comment on lines +160 to +162
Copy link
Contributor

@AdrianoDee AdrianoDee Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this, while unrelated with this PR, is just that you took the chance to implement the merge + steps['NANO_data13.0'] syntax also for @MUDPG auto NANO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sorry indeed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries of course


steps['muDPGNANOBkg_data13.0']=merge([{'-s' : 'RAW2DIGI,NANO:@MUDPGBKG',
'--conditions':'auto:run3_data',
'-n' : '100',
'--era' : 'Run3',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD'}])
'-n' : '100',},
steps['NANO_data13.0']])


steps['hcalDPGNANO_data13.0']=merge([{'-s' : 'RAW2DIGI,RECO,NANO:@HCAL',
'-n' : '100',
'--processName': 'NANO',},
steps['NANO_data13.0']])

steps['hcalDPGCalibNANO_data13.0']=merge([{'-s' : 'RAW2DIGI,RECO,NANO:@HCALCalib',
'-n' : '100',
'--processName': 'NANO',},
steps['NANO_data13.0']])

steps['muPOGNANO_data13.0']=merge([{'-s' : 'NANO:@PHYS+@MUPOG',
'-n' : '1000'},
Expand Down Expand Up @@ -260,10 +269,13 @@ def subnext(self):
workflows[_wfn()] = ['NANOmc130X', ['TTBarMINIAOD13.0', 'NANO_mc13.0', 'HRV_NANO_mc']]
workflows[_wfn()] = ['EGMNANOmc130X', ['TTBarMINIAOD13.0', 'EGMNano_mc13.0']]
_wfn.subnext()
workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0', 'HRV_NANO_data']]
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()] = ['hcalDPGNANO130Xrun3', ['ZeroBias2023DRAW13.0', 'hcalDPGNANO_data13.0']]
workflows[_wfn()] = ['hcalDPGCalibNANO130Xrun3', ['TestEnablesEcalHcal2023C', 'hcalDPGCalibNANO_data13.0']]
_wfn.subnext()
workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0', 'HRV_NANO_data']]
workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0_prompt', 'HRV_NANO_data']]
workflows[_wfn()] = ['muPOGNANO130Xrun3', ['MuonEG2023MINIAOD13.0', 'muPOGNANO_data13.0']]
workflows[_wfn()] = ['EGMNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'EGMNano_data13.0']]
workflows[_wfn()] = ['jmeNANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'jmeNano_data13.0']]
Expand Down
3 changes: 0 additions & 3 deletions Configuration/PyReleaseValidation/python/relval_production.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
workflows[1052] = ['',['RunCosmics2022F','TIER0EXPCOSMICSRUN3','ALCAEXPCOSMICSRUN3','ALCAHARVDSIPIXELLAMCS']]
workflows[1052.1] = ['',['RunSiPixelCalCosmics2022F','ALCASPLITSIPIXELLAMCS','ALCAHARVDSIPIXELLAMCS']]

workflows[1060.1] = ['',['RunZeroBias2022D', 'HcalNano']]
workflows[1060.2] = ['',['TestEnablesEcalHcal2023C', 'HcalNanoCalibGap']]

## MC production test
#workflows[1100] = [ '',[]]

Expand Down
20 changes: 0 additions & 20 deletions Configuration/PyReleaseValidation/python/relval_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,6 @@
steps['RunMuonEG2023C']={'INPUT':InputInfo(dataSet='/MuonEG/Run2023C-v1/RAW',label='2023C',events=100000,location='STD', ls=Run2023C)}
steps['RunParkingDoubleMuonLowMass2023C']={'INPUT':InputInfo(dataSet='/ParkingDoubleMuonLowMass0/Run2023C-v1/RAW',label='2023C',events=100000,location='STD', ls=Run2023C)}

Run2023C_LS500={368489: [[46,546]]}
steps['TestEnablesEcalHcal2023C']={'INPUT':InputInfo(dataSet='/TestEnablesEcalHcal/Run2023C-Express-v4/RAW',label='2023C',events=100000,location='STD', ls=Run2023C_LS500)}

Run2023D={369978: [[1, 800]]}
steps['RunMuon2023D']={'INPUT':InputInfo(dataSet='/Muon0/Run2023D-v1/RAW',label='2023D',events=100000,location='STD', ls=Run2023D)}
steps['RunZeroBias2023D']={'INPUT':InputInfo(dataSet='/ZeroBias/Run2023D-v1/RAW',label='2023D',events=100000,location='STD', ls=Run2023D)}
Expand Down Expand Up @@ -4122,23 +4119,6 @@ def gen2023HiMix(fragment,howMuch):
'--eventcontent':'NANOEDMAODSIM',
'--filein':'file:step3_inMINIAODSIM.root'}

steps['HcalNano']={'-s':'RAW2DIGI,RECO,USER:DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask',
'--conditions':'auto:run3_data_prompt',
'-n':'10',
'--era' : 'Run3',
'--geometry' : 'DB:Extended',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD'}

steps['HcalNanoCalibGap']={'-s':'RAW2DIGI,RECO,USER:DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask',
'--conditions':'auto:run3_data_prompt',
'-n':'10',
'--era' : 'Run3',
'--geometry' : 'DB:Extended',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD',
'--customise':'DPGAnalysis/HcalNanoAOD/hcalNano_cff.customiseHcalCalib',
'--processName': 'USER'}

#################################################################################
####From this line till the end of the file :
Expand Down
2 changes: 1 addition & 1 deletion DPGAnalysis/HcalNanoAOD/python/hcalNano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def customiseHcalCalib(process):
process.raw2digi_step = cms.Path(process.hcalCalibDigiSequence, process.RawToDigiTask)

# Insert the HLT filter at start of user path and nanoaod endpath
process.user_step.insert(0, process.hcalCalibHLTFilter)
process.nanoAOD_step.insert(0, process.hcalCalibHLTFilter)
process.NANOAODoutput_step.insert(0, process.hcalCalibHLTFilter)

return process
Expand Down
4 changes: 4 additions & 0 deletions PhysicsTools/NanoAOD/python/autoNANO.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def expandNanoMapping(seqList, mapping, key):
'customize': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoCustomize'},
'MUDPGBKG' : {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoProducerBkg',
'customize': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoBkgCustomize'},
# HCAL favlours:
'HCAL' : {'sequence': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask'},
'HCALCalib' : { 'sequence': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask',
'customize': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.customiseHcalCalib'},
#EGM flavours: add variables through customize
'EGM' : {'sequence': '@PHYS',
'customize' : '@PHYS+PhysicsTools/NanoAOD/egamma_custom_cff.addExtraEGammaVarsCustomize'},
Expand Down