CMS 3D CMS Logo

Functions | Variables
nano_cff Namespace Reference

Functions

def nanoAOD_activateVID (process)
 
def nanoAOD_addBoostedTauIds (process, idsToRun=[])
 
def nanoAOD_addTauIds (process, idsToRun=[])
 
def nanoAOD_addUTagToTaus (process, addUTagInfo=False, usePUPPIjets=False)
 
def nanoAOD_customizeCommon (process)
 
def nanoL1TrigObjCustomize (process)
 
def nanoL1TrigObjCustomizeFull (process)
 
def nanoWmassGenCustomize (process)
 increasing the precision of selected GenParticles. More...
 

Variables

 _nanoTableTaskCommonRun2
 
 boostedTaus
 
 electrons
 
 jets
 
 lhcInfoTable
 
 linkedObjects
 
 lowPtElectrons
 
 muons
 
 nanoMetadata
 
 nanoSequence
 
 nanoSequenceCommon
 
 nanoSequenceFS
 
 nanoSequenceMC
 
 nanoSequenceOnlyData
 
 nanoSequenceOnlyFullSim
 
 nanoTableTaskCommon
 
 nanoTableTaskFS
 
 photons
 
 strings
 
 tag
 
 taus
 
 useNewLHCInfo
 
 vertices
 

Function Documentation

◆ nanoAOD_activateVID()

def nano_cff.nanoAOD_activateVID (   process)

Definition at line 191 of file nano_cff.py.

References vid_id_tools.setupAllVIDIdsInModule(), vid_id_tools.switchOnVIDElectronIdProducer(), and vid_id_tools.switchOnVIDPhotonIdProducer().

Referenced by nanoAOD_customizeCommon().

191 def nanoAOD_activateVID(process):
192 
193  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD,electronTask)
194  for modname in electron_id_modules_WorkingPoints_nanoAOD.modules:
195  setupAllVIDIdsInModule(process,modname,setupVIDElectronSelection)
196 
197  process.electronTask.add( process.egmGsfElectronIDTask )
198 
199  switchOnVIDPhotonIdProducer(process,DataFormat.MiniAOD,photonTask) # do not call this to avoid resetting photon IDs in VID, if called before inside makePuppiesFromMiniAOD
200  for modname in photon_id_modules_WorkingPoints_nanoAOD.modules:
201  setupAllVIDIdsInModule(process,modname,setupVIDPhotonSelection)
202 
203  process.photonTask.add( process.egmPhotonIDTask )
204 
205  return process
206 
def switchOnVIDElectronIdProducer(process, dataFormat, task=None)
Electrons.
Definition: vid_id_tools.py:66
def setupAllVIDIdsInModule(process, id_module_name, setupFunction, patProducer=None, addUserData=True, task=None)
Definition: vid_id_tools.py:49
def nanoAOD_activateVID(process)
Definition: nano_cff.py:191
def switchOnVIDPhotonIdProducer(process, dataFormat, task=None)
Photons.

◆ nanoAOD_addBoostedTauIds()

def nano_cff.nanoAOD_addBoostedTauIds (   process,
  idsToRun = [] 
)

Definition at line 126 of file nano_cff.py.

Referenced by nanoAOD_customizeCommon().

126 def nanoAOD_addBoostedTauIds(process, idsToRun=[]):
127  if idsToRun: #no-empty list of tauIDs to run
128  updatedBoostedTauName = "slimmedTausBoostedNewID"
129  boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False,
130  originalTauName = "slimmedTausBoosted",
131  updatedTauName = updatedBoostedTauName,
132  postfix = "BoostedForNano",
133  toKeep = idsToRun)
134  boostedTauIdEmbedder.runTauID()
135  process.finalBoostedTaus.src = updatedBoostedTauName
136  #remember to adjust the selection and tables with added IDs
137 
138  process.boostedTauTask.add( process.rerunMvaIsolationTaskBoostedForNano, getattr(process, updatedBoostedTauName))
139 
140  return process
141 
def nanoAOD_addBoostedTauIds(process, idsToRun=[])
Definition: nano_cff.py:126

◆ nanoAOD_addTauIds()

def nano_cff.nanoAOD_addTauIds (   process,
  idsToRun = [] 
)

Definition at line 111 of file nano_cff.py.

Referenced by nanoAOD_customizeCommon().

111 def nanoAOD_addTauIds(process, idsToRun=[]):
112  if idsToRun: #no-empty list of tauIDs to run
113  updatedTauName = "slimmedTausUpdated"
114  tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug = False,
115  updatedTauName = updatedTauName,
116  postfix = "ForNano",
117  toKeep = idsToRun)
118  tauIdEmbedder.runTauID()
119  process.finalTaus.src = updatedTauName
120  #remember to adjust the selection and tables with added IDs
121 
122  process.tauTask.add( process.rerunMvaIsolationTaskForNano, getattr(process, updatedTauName) )
123 
124  return process
125 
def nanoAOD_addTauIds(process, idsToRun=[])
Definition: nano_cff.py:111

◆ nanoAOD_addUTagToTaus()

def nano_cff.nanoAOD_addUTagToTaus (   process,
  addUTagInfo = False,
  usePUPPIjets = False 
)

Definition at line 142 of file nano_cff.py.

Referenced by nanoAOD_customizeCommon().

142 def nanoAOD_addUTagToTaus(process, addUTagInfo=False, usePUPPIjets=False):
143 
144  if addUTagInfo:
145  originalTauName = process.finalTaus.src.value()
146 
147  if usePUPPIjets: # option to use PUPPI jets
148  jetCollection = "updatedJetsPuppi"
149  TagName = "pfUnifiedParticleTransformerAK4JetTags"
150  tag_prefix = "byUTagPUPPI"
151  updatedTauName = originalTauName+'WithUTagPUPPI'
152  # Unified ParT Tagger used for PUPPI jets
153  from RecoBTag.ONNXRuntime.pfUnifiedParticleTransformerAK4JetTags_cfi import pfUnifiedParticleTransformerAK4JetTags
154  Discriminators = [TagName+":"+tag for tag in pfUnifiedParticleTransformerAK4JetTags.flav_names.value()]
155  else: # use CHS jets by default
156  jetCollection = "updatedJets"
157  TagName = "pfParticleNetFromMiniAODAK4CHSCentralJetTags"
158  tag_prefix = "byUTagCHS"
159  updatedTauName = originalTauName+'WithUTagCHS'
160  # PNet tagger used for CHS jets
161  from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff import pfParticleNetFromMiniAODAK4CHSCentralJetTags
162  Discriminators = [TagName+":"+tag for tag in pfParticleNetFromMiniAODAK4CHSCentralJetTags.flav_names.value()]
163 
164  # Define "hybridTau" producer
165  from PhysicsTools.PatAlgos.patTauHybridProducer_cfi import patTauHybridProducer
166  setattr(process, updatedTauName, patTauHybridProducer.clone(
167  src = originalTauName,
168  jetSource = jetCollection,
169  dRMax = 0.4,
170  jetPtMin = 15,
171  jetEtaMax = 2.5,
172  UTagLabel = TagName,
173  UTagScoreNames = Discriminators,
174  tagPrefix = tag_prefix,
175  tauScoreMin = -1,
176  vsJetMin = 0.05,
177  checkTauScoreIsBest = False,
178  chargeAssignmentProbMin = 0.2,
179  addGenJetMatch = False,
180  genJetMatch = ""
181  ))
182  process.finalTaus.src = updatedTauName
183 
184  #remember to adjust the selection and tables with added IDs
185 
186  process.tauTask.add(process.jetTask, getattr(process, updatedTauName))
187 
188  return process
189 
def nanoAOD_addUTagToTaus(process, addUTagInfo=False, usePUPPIjets=False)
Definition: nano_cff.py:142

◆ nanoAOD_customizeCommon()

def nano_cff.nanoAOD_customizeCommon (   process)

Definition at line 207 of file nano_cff.py.

References leptonTimeLifeInfo_common_cff.addTimeLifeInfoBase(), nanoAOD_activateVID(), nanoAOD_addBoostedTauIds(), jetsAK4_Puppi_cff.nanoAOD_addDeepInfoAK4(), jetsAK4_CHS_cff.nanoAOD_addDeepInfoAK4CHS(), jetsAK8_cff.nanoAOD_addDeepInfoAK8(), nanoAOD_addTauIds(), and nanoAOD_addUTagToTaus().

207 def nanoAOD_customizeCommon(process):
208 
209  process = nanoAOD_activateVID(process)
210 
211  run2_nanoAOD_106Xv2.toModify(
212  nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch=True,
213  nanoAOD_addRobustParTAK4Tag_switch=False,
214  nanoAOD_addUnifiedParTAK4Tag_switch=True,
215  )
216 
217  # enable rerun of PNet for CHS jets for early run3 eras
218  # (it is rerun for run2 within jet tasks while is not needed for newer
219  # run3 eras as it is present in miniAOD)
220  (run3_nanoAOD_122 | run3_nanoAOD_124).toModify(
221  nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch = True
222  )
223 
224  # This function is defined in jetsAK4_Puppi_cff.py
225  process = nanoAOD_addDeepInfoAK4(process,
226  addParticleNet=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addParticleNet_switch,
227  addRobustParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addRobustParTAK4Tag_switch,
228  addUnifiedParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addUnifiedParTAK4Tag_switch
229  )
230 
231  # This function is defined in jetsAK4_CHS_cff.py
232  process = nanoAOD_addDeepInfoAK4CHS(process,
233  addDeepBTag=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepBTag_switch,
234  addDeepFlavour=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepFlavourTag_switch,
235  addParticleNet=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addParticleNet_switch,
236  addRobustParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addRobustParTAK4Tag_switch,
237  addUnifiedParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addUnifiedParTAK4Tag_switch
238  )
239 
240  # This function is defined in jetsAK8_cff.py
241  process = nanoAOD_addDeepInfoAK8(process,
242  addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
243  addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
244  addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
245  addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
246  addParticleNetMassLegacy=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMassLegacy_switch,
247  addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
248  jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload
249  )
250 
251  nanoAOD_tau_switch = cms.PSet(
252  idsToAdd = cms.vstring(),
253  addUParTInfo = cms.bool(True),
254  addPNet = cms.bool(True)
255  )
256  (run2_nanoAOD_106Xv2 | run3_nanoAOD_122).toModify(
257  nanoAOD_tau_switch, idsToAdd = ["deepTau2018v2p5"]
258  ).toModify(
259  process, lambda p : nanoAOD_addTauIds(p, nanoAOD_tau_switch.idsToAdd.value())
260  )
261 
262  # Don't add Unified Tagger for PUPPI jets for Run 2 (as different PUPPI tune
263  # and base jet algorithm) or early Run 3 eras
264  (run3_nanoAOD_122 | run3_nanoAOD_124 | run2_nanoAOD_106Xv2).toModify(
265  nanoAOD_tau_switch, addUParTInfo = False
266  )
267 
268  # Add Unified Tagger For CHS Jets (PNet 2023)
269  nanoAOD_addUTagToTaus(process,
270  addUTagInfo = nanoAOD_tau_switch.addPNet.value(),
271  usePUPPIjets = False
272  )
273 
274  # Add Unified Tagger For PUPPI Jets (UParT 2024)
275  nanoAOD_addUTagToTaus(process,
276  addUTagInfo = nanoAOD_tau_switch.addUParTInfo.value(),
277  usePUPPIjets = True
278  )
279 
280  nanoAOD_boostedTau_switch = cms.PSet(
281  idsToAdd = cms.vstring()
282  )
283  run2_nanoAOD_106Xv2.toModify(
284  nanoAOD_boostedTau_switch, idsToAdd = ["mvaIso", "mvaIsoNewDM", "mvaIsoDR0p3", "againstEle"]
285  ).toModify(
286  process, lambda p : nanoAOD_addBoostedTauIds(p, nanoAOD_boostedTau_switch.idsToAdd.value())
287  )
288 
289  # Add lepton time-life info
290  from PhysicsTools.NanoAOD.leptonTimeLifeInfo_common_cff import addTimeLifeInfoBase
291  process = addTimeLifeInfoBase(process)
292 
293  return process
294 
def nanoAOD_activateVID(process)
Definition: nano_cff.py:191
def nanoAOD_customizeCommon(process)
Definition: nano_cff.py:207
def nanoAOD_addUTagToTaus(process, addUTagInfo=False, usePUPPIjets=False)
Definition: nano_cff.py:142
def nanoAOD_addTauIds(process, idsToRun=[])
Definition: nano_cff.py:111
def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNetMassLegacy, addParticleNet, jecPayload)
Definition: jetsAK8_cff.py:218
def nanoAOD_addDeepInfoAK4(process, addParticleNet, addRobustParTAK4=False, addUnifiedParTAK4=False)
def nanoAOD_addBoostedTauIds(process, idsToRun=[])
Definition: nano_cff.py:126
def nanoAOD_addDeepInfoAK4CHS(process, addDeepBTag, addDeepFlavour, addParticleNet, addRobustParTAK4=False, addUnifiedParTAK4=False)

◆ nanoL1TrigObjCustomize()

def nano_cff.nanoL1TrigObjCustomize (   process)

Definition at line 307 of file nano_cff.py.

References l1trig_cff.setL1NanoToReduced().

307 def nanoL1TrigObjCustomize(process):
308  process.nanoTableTaskCommon.add(process.l1TablesTask)
309  process = setL1NanoToReduced(process)
310  return process
311 
def nanoL1TrigObjCustomize(process)
Definition: nano_cff.py:307
def setL1NanoToReduced(process)
Definition: l1trig_cff.py:159

◆ nanoL1TrigObjCustomizeFull()

def nano_cff.nanoL1TrigObjCustomizeFull (   process)

Definition at line 312 of file nano_cff.py.

312 def nanoL1TrigObjCustomizeFull(process):
313  process.nanoTableTaskCommon.add(process.l1TablesTask)
314  return process
315 
def nanoL1TrigObjCustomizeFull(process)
Definition: nano_cff.py:312

◆ nanoWmassGenCustomize()

def nano_cff.nanoWmassGenCustomize (   process)

increasing the precision of selected GenParticles.

Definition at line 296 of file nano_cff.py.

296 def nanoWmassGenCustomize(process):
297  pdgSelection="?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)"
298  # Keep precision same as default RECO for selected particles
299  ptPrecision="{}?{}:{}".format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
300  process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
301  phiPrecision="{} ? {} : {}".format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
302  process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
303  etaPrecision="{} ? {} : {}".format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
304  process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
305  return process
306 
def nanoWmassGenCustomize(process)
increasing the precision of selected GenParticles.
Definition: nano_cff.py:296

Variable Documentation

◆ _nanoTableTaskCommonRun2

nano_cff._nanoTableTaskCommonRun2
private

Definition at line 81 of file nano_cff.py.

◆ boostedTaus

nano_cff.boostedTaus

Definition at line 44 of file nano_cff.py.

Referenced by PATObjectCrossLinker.produce().

◆ electrons

nano_cff.electrons

Definition at line 41 of file nano_cff.py.

◆ jets

nano_cff.jets

Definition at line 39 of file nano_cff.py.

◆ lhcInfoTable

nano_cff.lhcInfoTable

Definition at line 60 of file nano_cff.py.

◆ linkedObjects

nano_cff.linkedObjects

Definition at line 38 of file nano_cff.py.

◆ lowPtElectrons

nano_cff.lowPtElectrons

Definition at line 42 of file nano_cff.py.

Referenced by PATObjectCrossLinker.produce().

◆ muons

nano_cff.muons

Definition at line 40 of file nano_cff.py.

◆ nanoMetadata

nano_cff.nanoMetadata

Definition at line 32 of file nano_cff.py.

◆ nanoSequence

nano_cff.nanoSequence

Definition at line 94 of file nano_cff.py.

◆ nanoSequenceCommon

nano_cff.nanoSequenceCommon

Definition at line 89 of file nano_cff.py.

◆ nanoSequenceFS

nano_cff.nanoSequenceFS

Definition at line 103 of file nano_cff.py.

◆ nanoSequenceMC

nano_cff.nanoSequenceMC

Definition at line 106 of file nano_cff.py.

◆ nanoSequenceOnlyData

nano_cff.nanoSequenceOnlyData

Definition at line 92 of file nano_cff.py.

◆ nanoSequenceOnlyFullSim

nano_cff.nanoSequenceOnlyFullSim

Definition at line 91 of file nano_cff.py.

◆ nanoTableTaskCommon

nano_cff.nanoTableTaskCommon

Definition at line 65 of file nano_cff.py.

◆ nanoTableTaskFS

nano_cff.nanoTableTaskFS

Definition at line 96 of file nano_cff.py.

◆ photons

nano_cff.photons

Definition at line 45 of file nano_cff.py.

◆ strings

nano_cff.strings

Definition at line 33 of file nano_cff.py.

◆ tag

nano_cff.tag

Definition at line 34 of file nano_cff.py.

◆ taus

nano_cff.taus

Definition at line 43 of file nano_cff.py.

◆ useNewLHCInfo

nano_cff.useNewLHCInfo

Definition at line 62 of file nano_cff.py.

◆ vertices

nano_cff.vertices

Definition at line 46 of file nano_cff.py.