CMS 3D CMS Logo

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

Public Member Functions

def __init__ (self)
 
def addGenJetCollection (self, proc, jet, inputCollection="", genName="")
 
def addProcessAndTask (self, proc, label, module)
 

Public Attributes

 gpLabel
 
 main
 
 prerequisites
 

Detailed Description

Tool to schedule modules for building a genjet collection with input MiniAODs

Definition at line 62 of file jetCollectionTools.py.

Constructor & Destructor Documentation

◆ __init__()

def jetCollectionTools.GenJetAdder.__init__ (   self)

Definition at line 66 of file jetCollectionTools.py.

66  def __init__(self):
67  self.prerequisites = []
68  self.main = []
69  self.gpLabel = "prunedGenParticles"
70 

Member Function Documentation

◆ addGenJetCollection()

def jetCollectionTools.GenJetAdder.addGenJetCollection (   self,
  proc,
  jet,
  inputCollection = "",
  genName = "" 
)

Definition at line 75 of file jetCollectionTools.py.

75  def addGenJetCollection(self,
76  proc,
77  jet,
78  inputCollection = "",
79  genName = "",
80  ):
81  print("jetCollectionTools::GenJetAdder::addGenJetCollection: Adding Gen Jet Collection: {}".format(jet))
82 
83  #
84  # Decide which genJet collection we are dealing with
85  #
86  jetLower = jet.lower()
87  jetUpper = jet.upper()
88  tagName = jetUpper
89  genJetInfo = GenJetInfo(jet,inputCollection)
90 
91  #=======================================================
92  #
93  # If genJet collection in MiniAOD is not
94  # specified, build the genjet collection.
95  #
96  #========================================================
97  if not inputCollection:
98  print("jetCollectionTools::GenJetAdder::addGenJetCollection: inputCollection not specified. Building genjet collection now")
99  #
100  # Setup GenParticles
101  #
102  packedGenPartNoNu = "packedGenParticlesForJetsNoNu"
103  if packedGenPartNoNu not in self.prerequisites:
104  self.addProcessAndTask(proc, packedGenPartNoNu, cms.EDFilter("CandPtrSelector",
105  src = cms.InputTag("packedGenParticles"),
106  cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16"),
107  )
108  )
109  self.prerequisites.append(packedGenPartNoNu)
110  #
111  # Create the GenJet collection
112  #
113  genJetsCollection = "{}{}{}".format(genJetInfo.jetAlgo.upper(), genJetInfo.jetSize, 'GenJetsNoNu')
114  self.addProcessAndTask(proc, genJetsCollection, ak4GenJets.clone(
115  src = packedGenPartNoNu,
116  jetAlgorithm = cms.string(supportedJetAlgos[genJetInfo.jetAlgo]),
117  rParam = cms.double(genJetInfo.jetSizeNr),
118  )
119  )
120  self.prerequisites.append(genJetsCollection)
121 
122  return genJetInfo
123 
124 #============================================
125 #
126 # RecoJetInfo
127 #
128 #============================================

References jetCollectionTools.GenJetAdder.addProcessAndTask(), mps_setup.append, jetCollectionTools.GenJetAdder.prerequisites, and print().

◆ addProcessAndTask()

def jetCollectionTools.GenJetAdder.addProcessAndTask (   self,
  proc,
  label,
  module 
)

Definition at line 71 of file jetCollectionTools.py.

71  def addProcessAndTask(self, proc, label, module):
72  task = getPatAlgosToolsTask(proc)
73  addToProcessAndTask(label, module, proc, task)
74 

References helpers.addToProcessAndTask(), and helpers.getPatAlgosToolsTask().

Referenced by jetCollectionTools.GenJetAdder.addGenJetCollection(), and jetCollectionTools.RecoJetAdder.addRecoJetCollection().

Member Data Documentation

◆ gpLabel

jetCollectionTools.GenJetAdder.gpLabel

◆ main

jetCollectionTools.GenJetAdder.main

◆ prerequisites

jetCollectionTools.GenJetAdder.prerequisites
helpers.getPatAlgosToolsTask
def getPatAlgosToolsTask(process)
Definition: helpers.py:14
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
mps_setup.append
append
Definition: mps_setup.py:85
format
helpers.addToProcessAndTask
def addToProcessAndTask(label, module, process, task)
Definition: helpers.py:29