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="", minPt=5.)
 
def getSequence (self, proc)
 

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 = "",
  minPt = 5. 
)

Definition at line 82 of file jetCollectionTools.py.

82  def addGenJetCollection(self,
83  proc,
84  jet,
85  inputCollection = "",
86  genName = "",
87  minPt = 5.,
88  ):
89  print("jetCollectionTools::GenJetAdder::addGenJetCollection: Adding Gen Jet Collection: {}".format(jet))
90  currentTasks = []
91 
92  #
93  # Decide which jet collection we're dealing with
94  #
95  jetLower = jet.lower()
96  jetUpper = jet.upper()
97  tagName = jetUpper
98  genJetInfo = GenJetInfo(jet,inputCollection)
99 
100  #=======================================================
101  #
102  # If gen jet collection in MiniAOD is not
103  # specified, build the genjet collection.
104  #
105  #========================================================
106  if not inputCollection:
107  print("jetCollectionTools::GenJetAdder::addGenJetCollection: inputCollection not specified. Building genjet collection now")
108  #
109  # Setup GenParticles
110  #
111  packedGenPartNoNu = "packedGenParticlesForJetsNoNu"
112  if packedGenPartNoNu not in self.prerequisites:
113  setattr(proc, packedGenPartNoNu, cms.EDFilter("CandPtrSelector",
114  src = cms.InputTag("packedGenParticles"),
115  cut = cms.string("abs(pdgId) != 12 && abs(pdgId) != 14 && abs(pdgId) != 16"),
116  )
117  )
118  self.prerequisites.append(packedGenPartNoNu)
119  #
120  # Create the GenJet collection
121  #
122  genJetsCollection = "{}{}{}".format(genJetInfo.jetAlgo.upper(), genJetInfo.jetSize, 'GenJetsNoNu')
123  setattr(proc, genJetsCollection, ak4GenJets.clone(
124  src = packedGenPartNoNu,
125  jetAlgorithm = cms.string(supportedJetAlgos[genJetInfo.jetAlgo]),
126  rParam = cms.double(genJetInfo.jetSizeNr),
127  )
128  )
129  self.prerequisites.append(genJetsCollection)
130  #
131  # GenJet Flavour Labelling
132  #
133  genFlavour = "{}Flavour".format(genJetInfo.jetTagName)
134  setattr(proc, genFlavour, patJetFlavourAssociation.clone(
135  jets = cms.InputTag(genJetsCollection),
136  jetAlgorithm = cms.string(supportedJetAlgos[genJetInfo.jetAlgo]),
137  rParam = cms.double(genJetInfo.jetSizeNr),
138  )
139  )
140 
141  currentTasks.append(genFlavour)
142  self.main.extend(currentTasks)
143 
144  return genJetInfo
145 
146 #============================================
147 #
148 # RecoJetInfo
149 #
150 #============================================

References mps_setup.append, jetCollectionTools.GenJetAdder.main, custom_jme_cff.TableGenJetAdder.main, custom_jme_cff.TableRecoJetAdder.main, jetCollectionTools.GenJetAdder.prerequisites, and edm.print().

◆ getSequence()

def jetCollectionTools.GenJetAdder.getSequence (   self,
  proc 
)

Definition at line 71 of file jetCollectionTools.py.

71  def getSequence(self, proc):
72  tasks = self.prerequisites + self.main
73 
74  resultSequence = cms.Sequence()
75  for idx, task in enumerate(tasks):
76  if idx == 0:
77  resultSequence = cms.Sequence(getattr(proc, task))
78  else:
79  resultSequence.insert(idx, getattr(proc, task))
80  return resultSequence
81 

References jetCollectionTools.GenJetAdder.main, custom_jme_cff.TableGenJetAdder.main, custom_jme_cff.TableRecoJetAdder.main, and jetCollectionTools.GenJetAdder.prerequisites.

Member Data Documentation

◆ gpLabel

jetCollectionTools.GenJetAdder.gpLabel

◆ main

jetCollectionTools.GenJetAdder.main

◆ prerequisites

jetCollectionTools.GenJetAdder.prerequisites
trackselectionRefitting.getSequence
def getSequence(process, collection, saveCPU=False, TTRHBuilder="WithAngleAndTemplate", usePixelQualityFlag=None, openMassWindow=False, cosmicsDecoMode=False, cosmicsZeroTesla=True, momentumConstraint=None, cosmicTrackSplitting=False, isPVValidation=False, use_d0cut=True)
Definition: trackselectionRefitting.py:7
mps_setup.append
append
Definition: mps_setup.py:85
edm::print
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
format