CMS 3D CMS Logo

autoNANO.py
Go to the documentation of this file.
1 def expandNanoMapping(seqList, mapping, key):
2  maxLevel=30
3  level=0
4  while '@' in repr(seqList) and level<maxLevel:
5  level+=1
6  for specifiedCommand in seqList:
7  if specifiedCommand.startswith('@'):
8  location=specifiedCommand[1:]
9  if not location in mapping:
10  raise Exception("Impossible to map "+location+" from "+repr(mapping))
11  mappedTo=mapping[location]
12  # no mapping for specified key
13  # NOTE: mising key of key=None is interpreted differently than empty string:
14  # - An empty string recalls the default for the given key
15  # - None is interpreted as "ignore this"
16  insertAt=seqList.index(specifiedCommand)
17  seqList.remove(specifiedCommand)
18  if key in mappedTo and mappedTo[key] is not None:
19  allToInsert=mappedTo[key].split('+')
20  for offset,toInsert in enumerate(allToInsert):
21  seqList.insert(insertAt+offset,toInsert)
22  break;
23  if level==maxLevel:
24  raise Exception("Could not fully expand "+repr(seqList)+" from "+repr(mapping))
25 
26 
27 autoNANO = {
28  # PHYS is a mapping to the default NANO config, i.e. empty strings
29  'PHYS': {'sequence': '',
30  'customize': ''},
31  # L1 flavours: add tables through customize, supposed to be combined with PHYS
32  'L1' : {'customize': 'nanoL1TrigObjCustomize'},
33  'L1FULL' : {'customize': 'nanoL1TrigObjCustomizeFull'},
34  #scouting nano
35  'Scout' : {'sequence': 'PhysicsTools/NanoAOD/custom_run3scouting_cff'},
36  # JME custom NANO
37  'JME' : { 'sequence': '@PHYS',
38  'customize': '@PHYS+PhysicsTools/NanoAOD/custom_jme_cff.PrepJMECustomNanoAOD'},
39  'JMErePuppi' : { 'sequence': '@PHYS',
40  'customize': '@PHYS+@JME+PhysicsTools/NanoAOD/custom_jme_cff.RecomputePuppiWeightsAndMET'},
41  # Muon POG flavours : add tables through customize, supposed to be combined with PHYS
42  'MUPOG' : { 'sequence': '@PHYS',
43  'customize' : '@PHYS+PhysicsTools/NanoAOD/custom_muon_cff.PrepMuonCustomNanoAOD'},
44  # MUDPG flavours: use their own sequence
45  'MUDPG' : {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoProducer',
46  'customize': 'DPGAnalysis/MuonTools/muNtupleProducer_cff.muDPGNanoCustomize'},
47  'MUDPGBKG' : {'sequence': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoProducerBkg',
48  'customize': 'DPGAnalysis/MuonTools/muNtupleProducerBkg_cff.muDPGNanoBkgCustomize'},
49  #EGM flavours: add variables through customize
50  'EGM' : {'sequence': '@PHYS',
51  'customize' : '@PHYS+PhysicsTools/NanoAOD/egamma_custom_cff.addExtraEGammaVarsCustomize'},
52  # PromptReco config: PHYS+L1
53  'Prompt' : {'sequence': '@PHYS',
54  'customize': '@PHYS+@L1'},
55  # Add lepton track parameters through customize combined with PHYS
56  'LepTrackInfo' : {'sequence': '@PHYS',
57  'customize': '@PHYS+PhysicsTools/NanoAOD/leptonTimeLifeInfo_common_cff.addTrackVarsToTimeLifeInfo'},
58  # Custom BTV Nano for SF measurements or tagger training
59  'BTV' : {'sequence': '@PHYS',
60  'customize':'@PHYS+PhysicsTools/NanoAOD/custom_btv_cff.BTVCustomNanoAOD'}
61 }
def expandNanoMapping(seqList, mapping, key)
Definition: autoNANO.py:1