CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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="", minPtFastjet=None)
 
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 65 of file jetCollectionTools.py.

Constructor & Destructor Documentation

◆ __init__()

def jetCollectionTools.GenJetAdder.__init__ (   self)

Definition at line 69 of file jetCollectionTools.py.

69  def __init__(self):
70  self.prerequisites = []
71  self.main = []
72  self.gpLabel = "prunedGenParticles"
73 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ addGenJetCollection()

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

Definition at line 83 of file jetCollectionTools.py.

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

Referenced by jetCollectionTools.GenJetAdder.addProcessAndTask().

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

◆ addProcessAndTask()

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

Definition at line 74 of file jetCollectionTools.py.

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

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

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

Member Data Documentation

◆ gpLabel

jetCollectionTools.GenJetAdder.gpLabel

◆ main

jetCollectionTools.GenJetAdder.main

◆ prerequisites

jetCollectionTools.GenJetAdder.prerequisites