-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
54 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,76 @@ | ||
def expandNanoMapping(seqList, mapping, key): | ||
maxLevel=30 | ||
level=0 | ||
while '@' in repr(seqList) and level<maxLevel: | ||
level+=1 | ||
maxLevel = 30 | ||
level = 0 | ||
while '@' in repr(seqList) and level < maxLevel: | ||
level += 1 | ||
for specifiedCommand in seqList: | ||
if specifiedCommand.startswith('@'): | ||
location=specifiedCommand[1:] | ||
location = specifiedCommand[1:] | ||
if not location in mapping: | ||
raise Exception("Impossible to map "+location+" from "+repr(mapping)) | ||
mappedTo=mapping[location] | ||
raise Exception("Impossible to map " + location + " from " + repr(mapping)) | ||
mappedTo = mapping[location] | ||
# no mapping for specified key | ||
# NOTE: mising key of key=None is interpreted differently than empty string: | ||
# - An empty string recalls the default for the given key | ||
# - None is interpreted as "ignore this" | ||
insertAt=seqList.index(specifiedCommand) | ||
insertAt = seqList.index(specifiedCommand) | ||
seqList.remove(specifiedCommand) | ||
if key in mappedTo and mappedTo[key] is not None: | ||
allToInsert=mappedTo[key].split('+') | ||
for offset,toInsert in enumerate(allToInsert): | ||
seqList.insert(insertAt+offset,toInsert) | ||
break; | ||
if level==maxLevel: | ||
raise Exception("Could not fully expand "+repr(seqList)+" from "+repr(mapping)) | ||
allToInsert = mappedTo[key].split('+') | ||
for offset, toInsert in enumerate(allToInsert): | ||
seqList.insert(insertAt + offset, toInsert) | ||
break | ||
if level == maxLevel: | ||
raise Exception("Could not fully expand " + repr(seqList) + " from " + repr(mapping)) | ||
|
||
|
||
autoNANO = { | ||
# PHYS is a mapping to the default NANO config, i.e. empty strings | ||
'PHYS': {'sequence': '', | ||
'customize': ''}, | ||
# L1 flavours: add tables through customize, supposed to be combined with PHYS | ||
'L1' : {'customize': 'PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomize'}, | ||
'L1FULL' : {'customize': 'PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomizeFull'}, | ||
#scouting nano | ||
'Scout' : {'sequence': 'PhysicsTools/NanoAOD/custom_run3scouting_cff'}, | ||
'JME' : { 'sequence': '@PHYS', | ||
'customize': '@PHYS+PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'}, | ||
'JMErePuppi' : { 'sequence': '@PHYS', | ||
'customize': '@PHYS+@JME+PhysicsTools/NanoAOD/custom_jme_cff.RecomputePuppiWeightsAndMET'}, | ||
'L1': {'customize': 'PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomize'}, | ||
'L1FULL': {'customize': 'PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomizeFull'}, | ||
# scouting nano | ||
'Scout': {'sequence': 'PhysicsTools/NanoAOD/custom_run3scouting_cff'}, | ||
# JME nano | ||
'JME': {'sequence': '@PHYS', | ||
'customize': '@PHYS+PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'}, | ||
'JMErePuppi': {'sequence': '@PHYS', | ||
'customize': '@PHYS+@JME+PhysicsTools/NanoAOD/custom_jme_cff.RecomputePuppiWeightsAndMET'}, | ||
# L1 DPG (standalone with full calo TP info, L1T reemulation customization) | ||
'L1DPG' : {'sequence': 'DPGAnalysis/L1TNanoAOD/l1tNano_cff.l1tNanoSequence', | ||
'customize': 'PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomizeFull,DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull,L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAW'}, | ||
'customize': ','.join(['PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomizeFull', | ||
'DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull', | ||
'L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAW'])}, | ||
# Muon POG flavours : add tables through customize, supposed to be combined with PHYS | ||
'MUPOG' : {'sequence': '@PHYS', | ||
'customize' : '@PHYS+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'}, | ||
'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'}, | ||
'MUDPG': {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoProducer', | ||
'customize': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoCustomize'}, | ||
'MUDPGBKG': {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoProducerBkg', | ||
'customize': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoBkgCustomize'}, | ||
# HCAL flavors: | ||
'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'}, | ||
# PromptReco config: PHYS+L1 | ||
'Prompt' : {'sequence': '@PHYS', | ||
'customize': '@PHYS+@L1'}, | ||
'Prompt': {'sequence': '@PHYS', | ||
'customize': '@PHYS+@L1'}, | ||
# Add lepton track parameters through customize combined with PHYS | ||
'LepTrackInfo' : {'sequence': '@PHYS', | ||
'customize': '@PHYS+PhysicsTools/NanoAOD/leptonTimeLifeInfo_common_cff.addTrackVarsToTimeLifeInfo'}, | ||
# Custom BTV Nano for SF measurements or tagger training | ||
'BTV' : {'sequence': '@PHYS', | ||
'customize':'@PHYS+PhysicsTools/NanoAOD/custom_btv_cff.BTVCustomNanoAOD'} | ||
'BTV': {'sequence': '@PHYS', | ||
'customize': '@PHYS+PhysicsTools/NanoAOD/custom_btv_cff.BTVCustomNanoAOD'}, | ||
# NANOGEN (from LHE/GEN/AOD) | ||
'GEN': {'sequence': 'PhysicsTools/NanoAOD/nanogen_cff.nanogenSequence', | ||
'customize': 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGEN'}, | ||
# NANOGEN (from MiniAOD) | ||
'GENFromMini': {'sequence': 'PhysicsTools/NanoAOD/nanogen_cff.nanogenSequence', | ||
'customize': 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGENFromMini'}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters