CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Public Attributes
jetCollectionTools.GenJetAdder Class Reference
Inheritance diagram for jetCollectionTools.GenJetAdder:

Public Member Functions

def __init__
 
def addGenJetCollection
 
def addProcessAndTask
 

Public Attributes

 gpLabel
 
 main
 
 prerequisites
 

Detailed Description

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

Definition at line 63 of file jetCollectionTools.py.

Constructor & Destructor Documentation

def jetCollectionTools.GenJetAdder.__init__ (   self)

Member Function Documentation

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

Definition at line 81 of file jetCollectionTools.py.

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

Referenced by jetCollectionTools.GenJetAdder.addProcessAndTask().

81 
82  ):
83  print("jetCollectionTools::GenJetAdder::addGenJetCollection: Adding Gen Jet Collection: {}".format(jet))
84 
85  #
86  # Decide which genJet collection we are dealing with
87  #
88  genJetInfo = GenJetInfo(jet,inputCollection)
89  jetLower = genJetInfo.jetLower
90  jetUpper = genJetInfo.jetUpper
91 
92  #=======================================================
93  #
94  # If genJet collection in MiniAOD is not
95  # specified, build the genjet collection.
96  #
97  #========================================================
98  if not inputCollection:
99  print("jetCollectionTools::GenJetAdder::addGenJetCollection: inputCollection not specified. Building genjet collection now")
100  #
101  # Setup GenParticles
102  #
103  packedGenPartNoNu = "packedGenParticlesForJetsNoNu"
104  if packedGenPartNoNu not in self.prerequisites:
105  self.addProcessAndTask(proc, packedGenPartNoNu, cms.EDFilter("CandPtrSelector",
106  src = cms.InputTag("packedGenParticles"),
107  cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16"),
108  )
109  )
110  self.prerequisites.append(packedGenPartNoNu)
111  #
112  # Create the GenJet collection
113  #
114  genJetsCollection = "{}{}{}".format(genJetInfo.jetAlgo.upper(), genJetInfo.jetSize, 'GenJetsNoNu')
115  self.addProcessAndTask(proc, genJetsCollection, ak4GenJets.clone(
116  src = packedGenPartNoNu,
117  jetAlgorithm = cms.string(supportedJetAlgos[genJetInfo.jetAlgo]),
118  rParam = cms.double(genJetInfo.jetSizeNr),
119  )
120  )
121  #
122  # Set minimum pt threshold of gen jets to be saved after fastjet clustering
123  #
124  if minPtFastjet != None:
125  getattr(proc, genJetsCollection).jetPtMin = minPtFastjet
126  self.prerequisites.append(genJetsCollection)
127 
128  return genJetInfo
129 #============================================
130 #
131 # RecoJetInfo
132 #
#============================================
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def jetCollectionTools.GenJetAdder.addProcessAndTask (   self,
  proc,
  label,
  module 
)

Definition at line 72 of file jetCollectionTools.py.

References jetCollectionTools.GenJetAdder.addGenJetCollection(), helpers.addToProcessAndTask(), and helpers.getPatAlgosToolsTask().

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

72 
73  def addProcessAndTask(self, proc, label, module):
74  task = getPatAlgosToolsTask(proc)
75  addToProcessAndTask(label, module, proc, task)
def getPatAlgosToolsTask
Definition: helpers.py:13
def addToProcessAndTask
Definition: helpers.py:28

Member Data Documentation

jetCollectionTools.GenJetAdder.gpLabel

Definition at line 70 of file jetCollectionTools.py.

Referenced by jetCollectionTools.RecoJetAdder.addRecoJetCollection().

jetCollectionTools.GenJetAdder.main

Definition at line 69 of file jetCollectionTools.py.

Referenced by jetCollectionTools.RecoJetAdder.addRecoJetCollection().

jetCollectionTools.GenJetAdder.prerequisites

Definition at line 68 of file jetCollectionTools.py.

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