CMS 3D CMS Logo

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

Public Member Functions

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

Public Attributes

 main
 

Detailed Description

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

Definition at line 191 of file custom_jme_cff.py.

Constructor & Destructor Documentation

def custom_jme_cff.TableGenJetAdder.__init__ (   self)

Definition at line 196 of file custom_jme_cff.py.

Member Function Documentation

def custom_jme_cff.TableGenJetAdder.addTable (   self,
  proc,
  genJetInfo 
)

Definition at line 213 of file custom_jme_cff.py.

References custom_jme_cff.TableGenJetAdder.main, and edm.print().

213  def addTable(self, proc, genJetInfo):
214  currentTasks = []
215 
216  print("custom_jme_cff::TableGenJetAdder::addTable: Adding Table for GenJet Collection: {}".format(genJetInfo.jet))
217 
218  name = nanoInfo_genjets[genJetInfo.jet]["name"]
219  doc = nanoInfo_genjets[genJetInfo.jet]["doc"]
220 
221  if name in genjetNameInNano:
222  raise RuntimeError('GenJet collection name (%s) taken in NanoAOD for %s' %(name, genJetInfo.jet))
223 
224  #
225  # GenJet Table
226  #
227  table = "{}Table".format(genJetInfo.jetTagName)
228  genJetsCollection = "{}{}{}".format(genJetInfo.jetAlgo.upper(), genJetInfo.jetSize, 'GenJetsNoNu')
229  setattr(proc, table, cms.EDProducer("SimpleCandidateFlatTableProducer",
230  src = cms.InputTag(genJetsCollection),
231  cut = cms.string(""),
232  name = cms.string(name),
233  doc = cms.string('{} (generator level)'.format(doc)),
234  singleton = cms.bool(False),
235  extension = cms.bool(False),
236  variables = cms.PSet(P4Vars,
237  area = jetTable.variables.area,
238  ),
239  )
240  )
241  currentTasks.append(table)
242 
243  #
244  # GenJet Flavour Table
245  #
246  genFlavour = "{}Flavour".format(genJetInfo.jetTagName)
247  genFlavourTable = "{}Table".format(genFlavour)
248  if genFlavourTable in self.main:
249  raise ValueError("Step '%s' already implemented" % genFlavourTable)
250  setattr(proc, genFlavourTable, cms.EDProducer("GenJetFlavourTableProducer",
251  name = cms.string(name),
252  src = cms.InputTag(genJetsCollection),
253  cut = cms.string(""),
254  deltaR = cms.double(0.1),
255  jetFlavourInfos = cms.InputTag(genFlavour),
256  )
257  )
258  currentTasks.append(genFlavourTable)
259  self.main.extend(currentTasks)
260 
261 #============================================
262 #
263 # TableRecoJetAdder
264 #
265 #============================================
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def addTable(self, proc, genJetInfo)
def custom_jme_cff.TableGenJetAdder.getSequence (   self,
  proc 
)
Tool to add 

Definition at line 199 of file custom_jme_cff.py.

References custom_jme_cff.TableGenJetAdder.main.

199  def getSequence(self, proc):
200  """
201  Tool to add
202  """
203  tasks = self.main
204 
205  resultSequence = cms.Sequence()
206  for idx, task in enumerate(tasks):
207  if idx == 0:
208  resultSequence = cms.Sequence(getattr(proc, task))
209  else:
210  resultSequence.insert(idx, getattr(proc, task))
211  return resultSequence
212 

Member Data Documentation

custom_jme_cff.TableGenJetAdder.main