Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-04 22:36:21

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.scoutingNanoSequence',
0036                'customize': 'PhysicsTools/NanoAOD/custom_run3scouting_cff.customiseScoutingNano'},
0037     'ScoutMonitor' : {'sequence': '@Scout',
0038                       'customize': '@Scout+PhysicsTools/NanoAOD/custom_run3scouting_cff.customiseScoutingNanoForScoutingPFMonitor'},
0039     'ScoutFromMini' : {'sequence': '@Scout',
0040                        'customize': '@Scout+PhysicsTools/NanoAOD/custom_run3scouting_cff.customiseScoutingNanoFromMini'},
0041     # BPH nano
0042     'BPH' : {'sequence': '@PHYS',
0043              'customize': '@PHYS+PhysicsTools/NanoAOD/custom_bph_cff.nanoAOD_customizeBPH'},
0044     # JME nano
0045     'JME': {'sequence': '@PHYS',
0046             'customize': '@PHYS+PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'},
0047     'JMErePuppi': {'sequence': '@PHYS',
0048                    'customize': '@PHYS+@JME+PhysicsTools/NanoAOD/custom_jme_cff.RecomputePuppiWeightsMETAK8'},
0049     # L1 DPG (standalone with full calo TP info, L1T reemulation customization)
0050     'L1DPG' : {'sequence': 'DPGAnalysis/L1TNanoAOD/l1tNano_cff.l1tNanoSequence',
0051                'customize': ','.join(['PhysicsTools/NanoAOD/l1trig_cff.nanoL1TrigObjCustomizeFull',
0052                                       'DPGAnalysis/L1TNanoAOD/l1tNano_cff.addCaloFull',
0053                                       'L1Trigger/Configuration/customiseReEmul.L1TReEmulFromRAW'])},
0054     # Phase-2 L1 DPG (from RAW/DIGI)
0055     'Phase2L1DPG' : {'sequence': 'DPGAnalysis/Phase2L1TNanoAOD/l1tPh2Nano_cff.l1tPh2NanoSequence',
0056                      'customize': ','.join([
0057                         #  'DPGAnalysis/Phase2L1TNanoAOD/l1tPh2Nano_cff.addFullPh2L1Nano', # <- this add all customisations listed below
0058                          'DPGAnalysis/Phase2L1TNanoAOD/l1tPh2Nano_cff.addPh2L1Objects',
0059                          'DPGAnalysis/Phase2L1TNanoAOD/l1tPh2Nano_cff.addPh2GTObjects',
0060                         #  'DPGAnalysis/Phase2L1TNanoAOD/l1tPh2Nano_cff.addGenObjects', # <- not included here as requires reco vertices and cannot be run in workflows w/o MINIAOD
0061                          ])},
0062     'Phase2L1DPGwithGen' : {'sequence': '@Phase2L1DPG',
0063                             'customize': '@Phase2L1DPG+DPGAnalysis/Phase2L1TNanoAOD/l1tPh2Nano_cff.addGenObjects',},
0064     # Muon POG flavours : add tables through customize, supposed to be combined with PHYS
0065     'MUPOG': {'sequence': '@PHYS',
0066               'customize': '@PHYS+PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'},
0067     # MUDPG flavours: use their own sequence
0068     'MUDPG': {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoProducer',
0069               'customize': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoCustomize'},
0070     'MUDPGBKG': {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoProducerBkg',
0071                  'customize': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoBkgCustomize'},
0072     # HLT Nano
0073     'Phase2HLT' : {'sequence': 'HLTrigger/NGTScouting/HLTNanoProducer_cff.hltNanoProducer',
0074              'customize': 'HLTrigger/NGTScouting/HLTNanoProducer_cff.hltNanoCustomize'},
0075 
0076     # NGT scouting Nano
0077     'NGTScouting' : {'sequence': 'HLTrigger/NGTScouting/HLTNanoProducer_cff.dstNanoProducer',
0078                      'customize': 'HLTrigger/NGTScouting/HLTNanoProducer_cff.hltNanoCustomize'},
0079     # Muon High Level Trigger
0080     'MUHLT' : {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducerHlt_cff.hltMuNanoProducer',
0081                'customize': 'DPGAnalysis/MuonTools/muNtupleProducerHlt_cff.hltMuNanoCustomize'},
0082     # HCAL flavors:
0083     'HCAL': {'sequence': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask'},
0084     'HCALCalib': {'sequence': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask',
0085                   'customize': 'DPGAnalysis/HcalNanoAOD/customiseHcalCalib_cff.customiseHcalCalib'},
0086     'HCALMC': {'sequence': 'DPGAnalysis/HcalNanoAOD/hcalNano_cff.hcalNanoTask',
0087                   'customize': 'DPGAnalysis/HcalNanoAOD/customiseHcalMC_cff.customiseHcalMC'},
0088     # EGM flavours: add variables through customize
0089     'EGM': {'sequence': '@PHYS',
0090             'customize': '@PHYS+PhysicsTools/NanoAOD/egamma_custom_cff.addExtraEGammaVarsCustomize'},
0091     # PromptReco config: PHYS+L1
0092     'Prompt': {'sequence': '@PHYS',
0093                'customize': '@PHYS+@L1'},
0094     # Add lepton track parameters through customize combined with PHYS
0095     'LepTrackInfo' : {'sequence': '@PHYS',
0096                       'customize': '@PHYS+PhysicsTools/NanoAOD/leptonTimeLifeInfo_common_cff.addTrackVarsToTimeLifeInfo'},
0097     # Custom BTV Nano for SF measurements or tagger training
0098     'BTV': {'sequence': '@PHYS',
0099             'customize': '@PHYS+PhysicsTools/NanoAOD/custom_btv_cff.BTVCustomNanoAOD'},
0100     # NANOGEN (from LHE/GEN/AOD)
0101     'GEN': {'sequence': 'PhysicsTools/NanoAOD/nanogen_cff.nanogenSequence',
0102             'customize': 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGEN'},
0103     # NANOGEN (from MiniAOD)
0104     'GENFromMini': {'sequence': 'PhysicsTools/NanoAOD/nanogen_cff.nanogenSequence',
0105                     'customize': 'PhysicsTools/NanoAOD/nanogen_cff.customizeNanoGENFromMini'},
0106 }