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 261 of file custom_jme_cff.py.

Constructor & Destructor Documentation

def custom_jme_cff.TableRecoJetAdder.__init__ (   self)

Definition at line 266 of file custom_jme_cff.py.

Member Function Documentation

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

Definition at line 280 of file custom_jme_cff.py.

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

280  def addTable(self, proc, recoJetInfo):
281 
282  currentTasks = []
283 
284  print("custom_jme_cff::TableRecoJetAdder::addTable: Adding Table for Reco Jet Collection: {}".format(recoJetInfo.jet))
285 
286  name = nanoInfo_recojets[recoJetInfo.jet]["name"]
287  doc = nanoInfo_recojets[recoJetInfo.jet]["doc"]
288 
289  if name in recojetNameInNano:
290  raise RuntimeError('RecoJet collection name (%s) taken in NanoAOD for %s' %(name, recoJetInfo.jet))
291 
292  table = "{}Table".format(recoJetInfo.jetTagName)
293  if recoJetInfo.skipUserData:
294  if recoJetInfo.doCalo:
295  tableContents = cms.PSet(
296  P4Vars,
297  area = jetTable.variables.area,
298  rawFactor = jetTable.variables.rawFactor,
299  emf = Var("emEnergyFraction()", float, doc = "electromagnetic energy fraction", precision = 10),
300  )
301  else:
302  tableContents = cms.PSet(
303  P4Vars,
304  area = jetTable.variables.area,
305  rawFactor = jetTable.variables.rawFactor,
306  )
307  elif "puppi" in recoJetInfo.jet:
308  tableContents = JETVARS.clone(
309  puppiMultiplicity = Var("userFloat('patPuppiJetSpecificProducer:puppiMultiplicity')",float,doc="Sum of PUPPI weights of particles in the jet", precision= 6),
310  neutralPuppiMultiplicity = Var("userFloat('patPuppiJetSpecificProducer:neutralPuppiMultiplicity')",float,doc="Sum of PUPPI weights of neutral particles in the jet", precision= 6)
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  self.main.extend(currentTasks)
329 
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 269 of file custom_jme_cff.py.

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

269  def getSequence(self, proc):
270  tasks = self.main
271 
272  resultSequence = cms.Sequence()
273  for idx, task in enumerate(tasks):
274  if idx == 0:
275  resultSequence = cms.Sequence(getattr(proc, task))
276  else:
277  resultSequence.insert(idx, getattr(proc, task))
278  return resultSequence
279 

Member Data Documentation

custom_jme_cff.TableRecoJetAdder.main