CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
custom_jme_cff.TableRecoJetAdder Class Reference
Inheritance diagram for custom_jme_cff.TableRecoJetAdder:

Public Member Functions

def __init__ (self)
 
def addTable (self, proc, recoJetInfo)
 
def getSequence (self, proc)
 

Public Attributes

 main
 

Detailed Description

Tool to store reco jet variables in NanoAOD for customized
reco jet collections.

Definition at line 266 of file custom_jme_cff.py.

Constructor & Destructor Documentation

def custom_jme_cff.TableRecoJetAdder.__init__ (   self)

Definition at line 271 of file custom_jme_cff.py.

Member Function Documentation

def custom_jme_cff.TableRecoJetAdder.addTable (   self,
  proc,
  recoJetInfo 
)

Definition at line 285 of file custom_jme_cff.py.

References edm.print(), and common_cff.Var().

285  def addTable(self, proc, recoJetInfo):
286 
287  currentTasks = []
288 
289  print("custom_jme_cff::TableRecoJetAdder::addTable: Adding Table for Reco Jet Collection: {}".format(recoJetInfo.jet))
290 
291  name = nanoInfo_recojets[recoJetInfo.jet]["name"]
292  doc = nanoInfo_recojets[recoJetInfo.jet]["doc"]
293 
294  if name in recojetNameInNano:
295  raise RuntimeError('RecoJet collection name (%s) taken in NanoAOD for %s' %(name, recoJetInfo.jet))
296 
297  table = "{}Table".format(recoJetInfo.jetTagName)
298  if recoJetInfo.skipUserData:
299  if recoJetInfo.doCalo:
300  tableContents = cms.PSet(
301  P4Vars,
302  area = jetTable.variables.area,
303  rawFactor = jetTable.variables.rawFactor,
304  emf = Var("emEnergyFraction()", float, doc = "electromagnetic energy fraction", precision = 10),
305  )
306  else:
307  tableContents = cms.PSet(
308  P4Vars,
309  area = jetTable.variables.area,
310  rawFactor = jetTable.variables.rawFactor,
311  )
312  else:
313  tableContents = JETVARS.clone()
314 
315  updatedJets = "updatedJets{}".format(recoJetInfo.jetTagName)
316  setattr(proc, table, cms.EDProducer("SimpleCandidateFlatTableProducer",
317  src = cms.InputTag(updatedJets),
318  cut = cms.string(""),
319  name = cms.string(name),
320  doc = cms.string(doc),
321  singleton = cms.bool(False),
322  extension = cms.bool(False),
323  variables = tableContents,
324  )
325  )
326  currentTasks.append(table)
327 
328  tightJetIdLepVeto = "tightJetIdLepVeto{}".format(recoJetInfo.jetTagName)
329  if not recoJetInfo.skipUserData:
330  altTasks = copy.deepcopy(currentTasks)
331  for idx, task in enumerate(altTasks):
332  if task == tightJetIdLepVeto:
333  altTasks[idx] = looseJetId
334  for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
335  modifier.toReplaceWith(currentTasks, altTasks)
336  self.main.extend(currentTasks)
337 
338 
def addTable(self, proc, recoJetInfo)
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
def custom_jme_cff.TableRecoJetAdder.getSequence (   self,
  proc 
)

Definition at line 274 of file custom_jme_cff.py.

References custom_jme_cff.TableGenJetAdder.main, and custom_jme_cff.TableRecoJetAdder.main.

274  def getSequence(self, proc):
275  tasks = self.main
276 
277  resultSequence = cms.Sequence()
278  for idx, task in enumerate(tasks):
279  if idx == 0:
280  resultSequence = cms.Sequence(getattr(proc, task))
281  else:
282  resultSequence.insert(idx, getattr(proc, task))
283  return resultSequence
284 

Member Data Documentation

custom_jme_cff.TableRecoJetAdder.main