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
 
 vertices
 

Function Documentation

◆ nanoAOD_activateVID()

def nano_cff.nanoAOD_activateVID (   process)

Definition at line 184 of file nano_cff.py.

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

Referenced by nanoAOD_customizeCommon().

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

◆ nanoAOD_addBoostedTauIds()

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

Definition at line 122 of file nano_cff.py.

Referenced by nanoAOD_customizeCommon().

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

◆ nanoAOD_addPNetToTaus()

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

Definition at line 138 of file nano_cff.py.

References jetsAK4_CHS_cff.nanoAOD_addDeepInfoAK4CHS().

Referenced by nanoAOD_customizeCommon().

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

◆ nanoAOD_addTauIds()

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

Definition at line 107 of file nano_cff.py.

Referenced by nanoAOD_customizeCommon().

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

◆ nanoAOD_customizeCommon()

def nano_cff.nanoAOD_customizeCommon (   process)

Definition at line 200 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().

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

◆ nanoL1TrigObjCustomize()

def nano_cff.nanoL1TrigObjCustomize (   process)

Definition at line 278 of file nano_cff.py.

References l1trig_cff.setL1NanoToReduced().

278 def nanoL1TrigObjCustomize(process):
279  process.nanoTableTaskCommon.add(process.l1TablesTask)
280  process = setL1NanoToReduced(process)
281  return process
282 
def nanoL1TrigObjCustomize(process)
Definition: nano_cff.py:278
def setL1NanoToReduced(process)
Definition: l1trig_cff.py:159

◆ nanoL1TrigObjCustomizeFull()

def nano_cff.nanoL1TrigObjCustomizeFull (   process)

Definition at line 283 of file nano_cff.py.

283 def nanoL1TrigObjCustomizeFull(process):
284  process.nanoTableTaskCommon.add(process.l1TablesTask)
285  return process
286 
287 
def nanoL1TrigObjCustomizeFull(process)
Definition: nano_cff.py:283

◆ nanoWmassGenCustomize()

def nano_cff.nanoWmassGenCustomize (   process)

increasing the precision of selected GenParticles.

Definition at line 267 of file nano_cff.py.

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

Variable Documentation

◆ _nanoTableTaskCommonRun2

nano_cff._nanoTableTaskCommonRun2
private

Definition at line 77 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 59 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 90 of file nano_cff.py.

◆ nanoSequenceCommon

nano_cff.nanoSequenceCommon

Definition at line 85 of file nano_cff.py.

◆ nanoSequenceFS

nano_cff.nanoSequenceFS

Definition at line 99 of file nano_cff.py.

◆ nanoSequenceMC

nano_cff.nanoSequenceMC

Definition at line 102 of file nano_cff.py.

◆ nanoSequenceOnlyData

nano_cff.nanoSequenceOnlyData

Definition at line 88 of file nano_cff.py.

◆ nanoSequenceOnlyFullSim

nano_cff.nanoSequenceOnlyFullSim

Definition at line 87 of file nano_cff.py.

◆ nanoTableTaskCommon

nano_cff.nanoTableTaskCommon

Definition at line 61 of file nano_cff.py.

◆ nanoTableTaskFS

nano_cff.nanoTableTaskFS

Definition at line 92 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.

◆ vertices

nano_cff.vertices

Definition at line 46 of file nano_cff.py.