CMS 3D CMS Logo

Functions | Variables
nano_cff Namespace Reference

Functions

def nanoAOD_activateVID (process)
 
def nanoAOD_addBoostedTauIds (process, idsToRun=[])
 
def nanoAOD_addPNetToTaus (process, addPNetInfo=False, runPNetCHSAK4=False)
 
def nanoAOD_addTauIds (process, idsToRun=[])
 
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 188 of file nano_cff.py.

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

Referenced by nanoAOD_customizeCommon().

188 def nanoAOD_activateVID(process):
189 
190  switchOnVIDElectronIdProducer(process,DataFormat.MiniAOD,electronTask)
191  for modname in electron_id_modules_WorkingPoints_nanoAOD.modules:
192  setupAllVIDIdsInModule(process,modname,setupVIDElectronSelection)
193 
194  process.electronTask.add( process.egmGsfElectronIDTask )
195 
196  switchOnVIDPhotonIdProducer(process,DataFormat.MiniAOD,photonTask) # do not call this to avoid resetting photon IDs in VID, if called before inside makePuppiesFromMiniAOD
197  for modname in photon_id_modules_WorkingPoints_nanoAOD.modules:
198  setupAllVIDIdsInModule(process,modname,setupVIDPhotonSelection)
199 
200  process.photonTask.add( process.egmPhotonIDTask )
201 
202  return process
203 
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:188
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_addPNetToTaus()

def nano_cff.nanoAOD_addPNetToTaus (   process,
  addPNetInfo = False,
  runPNetCHSAK4 = False 
)

Definition at line 142 of file nano_cff.py.

References jetsAK4_CHS_cff.nanoAOD_addDeepInfoAK4CHS().

Referenced by nanoAOD_customizeCommon().

142 def nanoAOD_addPNetToTaus(process, addPNetInfo=False, runPNetCHSAK4=False):
143  if addPNetInfo:
144  originalTauName = process.finalTaus.src.value()
145  updatedTauName = originalTauName+'WithPNet'
146  jetCollection = "updatedJets"
147  process.load('RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff')
148  pnetTagName = "pfParticleNetFromMiniAODAK4CHSCentralJetTag"
149  pnetDiscriminators = [];
150  for tag in getattr(process,pnetTagName+"s").flav_names.value():
151  pnetDiscriminators.append(pnetTagName+"s:"+tag)
152 
153  # Define "hybridTau" producer
154  from PhysicsTools.PatAlgos.patTauHybridProducer_cfi import patTauHybridProducer
155  setattr(process, updatedTauName, patTauHybridProducer.clone(
156  src = originalTauName,
157  jetSource = jetCollection,
158  dRMax = 0.4,
159  jetPtMin = 15,
160  jetEtaMax = 2.5,
161  pnetLabel = pnetTagName+"s",
162  pnetScoreNames = pnetDiscriminators,
163  tauScoreMin = -1,
164  vsJetMin = 0.05,
165  checkTauScoreIsBest = False,
166  chargeAssignmentProbMin = 0.2,
167  addGenJetMatch = False,
168  genJetMatch = ""
169  ))
170  process.finalTaus.src = updatedTauName
171 
172  # run PNet for CHS AK4 jets if requested
173  if runPNetCHSAK4:
174  from PhysicsTools.NanoAOD.jetsAK4_CHS_cff import nanoAOD_addDeepInfoAK4CHS
175  process = nanoAOD_addDeepInfoAK4CHS(process,
176  addDeepBTag = False,
177  addDeepFlavour = False,
178  addParticleNet = True
179  )
180 
181  #remember to adjust the selection and tables with added IDs
182 
183  process.tauTask.add(process.jetTask, getattr(process, updatedTauName))
184 
185  return process
186 
def nanoAOD_addDeepInfoAK4CHS(process, addDeepBTag, addDeepFlavour, addParticleNet, addRobustParTAK4=False)
def nanoAOD_addPNetToTaus(process, addPNetInfo=False, runPNetCHSAK4=False)
Definition: nano_cff.py:142

◆ 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 , process.patTauMVAIDsTask )
123 
124  return process
125 
def nanoAOD_addTauIds(process, idsToRun=[])
Definition: nano_cff.py:111

◆ nanoAOD_customizeCommon()

def nano_cff.nanoAOD_customizeCommon (   process)

Definition at line 204 of file nano_cff.py.

References nanoAOD_activateVID(), nanoAOD_addBoostedTauIds(), jetsAK4_Puppi_cff.nanoAOD_addDeepInfoAK4(), jetsAK4_CHS_cff.nanoAOD_addDeepInfoAK4CHS(), jetsAK8_cff.nanoAOD_addDeepInfoAK8(), nanoAOD_addPNetToTaus(), and nanoAOD_addTauIds().

204 def nanoAOD_customizeCommon(process):
205 
206  process = nanoAOD_activateVID(process)
207 
208  run2_nanoAOD_106Xv2.toModify(
209  nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch=True,
210  nanoAOD_addRobustParTAK4Tag_switch=True,
211  )
212 
213  # This function is defined in jetsAK4_Puppi_cff.py
214  process = nanoAOD_addDeepInfoAK4(process,
215  addParticleNet=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addParticleNet_switch,
216  addRobustParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addRobustParTAK4Tag_switch
217  )
218 
219  # This function is defined in jetsAK4_CHS_cff.py
220  process = nanoAOD_addDeepInfoAK4CHS(process,
221  addDeepBTag=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepBTag_switch,
222  addDeepFlavour=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepFlavourTag_switch,
223  addParticleNet=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addParticleNet_switch,
224  addRobustParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addRobustParTAK4Tag_switch
225  )
226 
227  # This function is defined in jetsAK8_cff.py
228  process = nanoAOD_addDeepInfoAK8(process,
229  addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
230  addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
231  addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
232  addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
233  addParticleNetMassLegacy=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMassLegacy_switch,
234  addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
235  jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload
236  )
237 
238  nanoAOD_tau_switch = cms.PSet(
239  idsToAdd = cms.vstring(),
240  runPNetAK4 = cms.bool(False),
241  addPNet = cms.bool(True)
242  )
243  (run2_nanoAOD_106Xv2 | run3_nanoAOD_122).toModify(
244  nanoAOD_tau_switch, idsToAdd = ["deepTau2018v2p5"]
245  ).toModify(
246  process, lambda p : nanoAOD_addTauIds(p, nanoAOD_tau_switch.idsToAdd.value())
247  )
248  # Add PNet info to taus
249  # enable rerun of PNet for CHS jets for early run3 eras
250  # (it is rerun for run2 within jet tasks while is not needed for newer
251  # run3 eras as it is present in miniAOD)
252  (run3_nanoAOD_122 | run3_nanoAOD_124).toModify(
253  nanoAOD_tau_switch, runPNetAK4 = True
254  )
255  nanoAOD_addPNetToTaus(process,
256  addPNetInfo = nanoAOD_tau_switch.addPNet.value(),
257  runPNetCHSAK4 = nanoAOD_tau_switch.runPNetAK4.value()
258  )
259  nanoAOD_boostedTau_switch = cms.PSet(
260  idsToAdd = cms.vstring()
261  )
262  run2_nanoAOD_106Xv2.toModify(
263  nanoAOD_boostedTau_switch, idsToAdd = ["2017v2", "dR0p32017v2", "newDM2017v2","againstEle2018"]
264  ).toModify(
265  process, lambda p : nanoAOD_addBoostedTauIds(p, nanoAOD_boostedTau_switch.idsToAdd.value())
266  )
267 
268  return process
269 
def nanoAOD_addDeepInfoAK4(process, addParticleNet, addRobustParTAK4=False)
def nanoAOD_activateVID(process)
Definition: nano_cff.py:188
def nanoAOD_customizeCommon(process)
Definition: nano_cff.py:204
def nanoAOD_addDeepInfoAK4CHS(process, addDeepBTag, addDeepFlavour, addParticleNet, addRobustParTAK4=False)
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_addBoostedTauIds(process, idsToRun=[])
Definition: nano_cff.py:126
def nanoAOD_addPNetToTaus(process, addPNetInfo=False, runPNetCHSAK4=False)
Definition: nano_cff.py:142

◆ nanoL1TrigObjCustomize()

def nano_cff.nanoL1TrigObjCustomize (   process)

Definition at line 282 of file nano_cff.py.

References l1trig_cff.setL1NanoToReduced().

282 def nanoL1TrigObjCustomize(process):
283  process.nanoTableTaskCommon.add(process.l1TablesTask)
284  process = setL1NanoToReduced(process)
285  return process
286 
def nanoL1TrigObjCustomize(process)
Definition: nano_cff.py:282
def setL1NanoToReduced(process)
Definition: l1trig_cff.py:159

◆ nanoL1TrigObjCustomizeFull()

def nano_cff.nanoL1TrigObjCustomizeFull (   process)

Definition at line 287 of file nano_cff.py.

287 def nanoL1TrigObjCustomizeFull(process):
288  process.nanoTableTaskCommon.add(process.l1TablesTask)
289  return process
290 
def nanoL1TrigObjCustomizeFull(process)
Definition: nano_cff.py:287

◆ nanoWmassGenCustomize()

def nano_cff.nanoWmassGenCustomize (   process)

increasing the precision of selected GenParticles.

Definition at line 271 of file nano_cff.py.

271 def nanoWmassGenCustomize(process):
272  pdgSelection="?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)"
273  # Keep precision same as default RECO for selected particles
274  ptPrecision="{}?{}:{}".format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
275  process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
276  phiPrecision="{} ? {} : {}".format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
277  process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
278  etaPrecision="{} ? {} : {}".format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
279  process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
280  return process
281 
def nanoWmassGenCustomize(process)
increasing the precision of selected GenParticles.
Definition: nano_cff.py:271

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.