Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-16 05:06:28

0001 def expandNanoMapping(seqList, mapping, key):
0002     maxLevel = 30
0003     level = 0
0004     while '@' in repr(seqList) and level < maxLevel:
0005         level += 1
0006         for specifiedCommand in seqList:
0007             if specifiedCommand.startswith('@'):
0008                 location = specifiedCommand[1:]
0009                 if not location in mapping:
0010                     raise Exception("Impossible to map " + location + " from " + repr(mapping))
0011                 mappedTo = mapping[location]
0012                 # no mapping for specified key
0013                 # NOTE: mising key of key=None is interpreted differently than empty string:
0014                 #  - An empty string recalls the default for the given key
0015                 #  - None is interpreted as "ignore this"
0016                 insertAt = seqList.index(specifiedCommand)
0017                 seqList.remove(specifiedCommand)
0018                 if key in mappedTo and mappedTo[key] is not None:
0019                     allToInsert = mappedTo[key].split('+')
0020                     for offset, toInsert in enumerate(allToInsert):
0021                         seqList.insert(insertAt + offset, toInsert)
0022                 break
0023         if level == maxLevel:
0024             raise Exception("Could not fully expand " + repr(seqList) + " from " + repr(mapping))
0025 
0026 
0027 autoNANO = {
0028     # PHYS is a mapping to the default NANO config, i.e. empty strings
0029     'PHYS': {'sequence': '',
0030              'customize': ''},
0031     # L1 flavours: add tables through customize, supposed to be combined with PHYS
0032     'L1': {'customize': 'PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomize'},
0033     'L1FULL': {'customize': 'PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomizeFull'},
0034     # scouting nano
0035     'Scout': {'sequence': 'PhysicsTools/NanoAOD/custom_run3scouting_cff'},
0036     # JME nano
0037     'JME': {'sequence': '@PHYS',
0038             'customize': '@PHYS+PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'},
0039     'JMErePuppi': {'sequence': '@PHYS',
0040                    'customize': '@PHYS+@JME+PhysicsTools/NanoAOD/custom_jme_cff.RecomputePuppiWeightsMETAK8'},
0041     # L1 DPG (standalone with full calo TP info, L1T reemulation customization)
0042     'L1DPG' : {'sequence': 'DPGAnalysis/L1TNanoAOD/l1tNano_cff.l1tNanoSequence',
0043                'customize': ','.join(['PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomizeFull',
0044                                       'DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull',
0045                                       'L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAW'])},
0046     # Muon POG flavours : add tables through customize, supposed to be combined with PHYS
0047     'MUPOG': {'sequence': '@PHYS',
0048               'customize': '@PHYS+PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'},
0049     # MUDPG flavours: use their own sequence
0050     'MUDPG': {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoProducer',
0051               'customize': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoCustomize'},
0052     'MUDPGBKG': {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoProducerBkg',
0053                  'customize': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoBkgCustomize'},
0054     # HCAL flavors:
0055     'HCAL': {'sequence': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask'},
0056     'HCALCalib': {'sequence': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask',
0057                   'customize': 'DPGAnalysis/HcalNanoAOD/customiseHcalCalib_cff.customiseHcalCalib'},
0058     # EGM flavours: add variables through customize
0059     'EGM': {'sequence': '@PHYS',
0060             'customize': '@PHYS+PhysicsTools/NanoAOD/egamma_custom_cff.addExtraEGammaVarsCustomize'},
0061     # PromptReco config: PHYS+L1
0062     'Prompt': {'sequence': '@PHYS',
0063                'customize': '@PHYS+@L1'},
0064     # Add lepton track parameters through customize combined with PHYS
0065     'LepTrackInfo' : {'sequence': '@PHYS',
0066                       'customize': '@PHYS+PhysicsTools/NanoAOD/leptonTimeLifeInfo_common_cff.addTrackVarsToTimeLifeInfo'},
0067     # Custom BTV Nano for SF measurements or tagger training
0068     'BTV': {'sequence': '@PHYS',
0069             'customize': '@PHYS+PhysicsTools/NanoAOD/custom_btv_cff.BTVCustomNanoAOD'},
0070     # NANOGEN (from LHE/GEN/AOD)
0071     'GEN': {'sequence': 'PhysicsTools/NanoAOD/nanogen_cff.nanogenSequence',
0072             'customize': 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGEN'},
0073     # NANOGEN (from MiniAOD)
0074     'GENFromMini': {'sequence': 'PhysicsTools/NanoAOD/nanogen_cff.nanogenSequence',
0075                     'customize': 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGENFromMini'},
0076 }