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="", 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 63 of file jetCollectionTools.py.

Constructor & Destructor Documentation

◆ __init__()

def jetCollectionTools.GenJetAdder.__init__ (   self)

Definition at line 67 of file jetCollectionTools.py.

67  def __init__(self):
68  self.prerequisites = []
69  self.main = []
70  self.gpLabel = "prunedGenParticles"
71 
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 81 of file jetCollectionTools.py.

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

Referenced by jetCollectionTools.GenJetAdder.addProcessAndTask().

81  ):
82  print("jetCollectionTools::GenJetAdder::addGenJetCollection: Adding Gen Jet Collection: {}".format(jet))
83 
84  #
85  # Decide which genJet collection we are dealing with
86  #
87  genJetInfo = GenJetInfo(jet,inputCollection)
88  jetLower = genJetInfo.jetLower
89  jetUpper = genJetInfo.jetUpper
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  #
121  # Set minimum pt threshold of gen jets to be saved after fastjet clustering
122  #
123  if minPtFastjet != None:
124  getattr(proc, genJetsCollection).jetPtMin = minPtFastjet
125  self.prerequisites.append(genJetsCollection)
126 
127  return genJetInfo
128 #============================================
129 #
130 # RecoJetInfo
131 #
132 #============================================
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 72 of file jetCollectionTools.py.

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

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

72  def addProcessAndTask(self, proc, label, module):
73  task = getPatAlgosToolsTask(proc)
74  addToProcessAndTask(label, module, proc, task)
75 
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