CMS 3D CMS Logo

Classes | Functions | Variables
custom_jme_cff Namespace Reference

Classes

class  TableGenJetAdder
 
class  TableRecoJetAdder
 

Functions

def AddPileUpJetIDVars (proc)
 
def PrepJMECustomNanoAOD (process, runOnMC)
 
def PrepJMECustomNanoAOD_Data (process)
 
def PrepJMECustomNanoAOD_MC (process)
 

Variables

 area
 
 chEmEF
 
 chHEF
 
 config_genjets
 
 config_recojets
 
 doc
 
 float
 
 genjetNameInNano
 
 HFEMEF
 
 HFHEF
 
 jercCHF
 
 jercCHPUF
 
 jetId
 
 JETVARS
 
 muEF
 
 nanoInfo_genjets
 
 nanoInfo_recojets
 
 neEmEF
 
 neHEF
 
 precision
 
 rawFactor
 
 recojetNameInNano
 

Function Documentation

def custom_jme_cff.AddPileUpJetIDVars (   proc)

Definition at line 330 of file custom_jme_cff.py.

References edm.print(), and common_cff.Var().

Referenced by PrepJMECustomNanoAOD().

331 
332  print("custom_jme_cff::AddPileUpJetIDVars: Recalculate pile-up jet ID variables and save them")
333 
334  #
335  # Recalculate PUJet ID variables
336  #
337  from RecoJets.JetProducers.PileupJetID_cfi import pileupJetIdCalculator
338  proc.pileupJetIdCalculatorAK4PFCHS = pileupJetIdCalculator.clone(
339  jets = "updatedJets",
340  vertexes = "offlineSlimmedPrimaryVertices",
341  inputIsCorrected = True,
342  applyJec = False
343  )
344  proc.jetSequence.insert(proc.jetSequence.index(proc.updatedJets)+1, proc.pileupJetIdCalculatorAK4PFCHS)
345 
346  #
347  # Get the variables
348  #
349  proc.puJetVarAK4PFCHS = cms.EDProducer("PileupJetIDVarProducer",
350  srcJet = cms.InputTag("updatedJets"),
351  srcPileupJetId = cms.InputTag("pileupJetIdCalculatorAK4PFCHS")
352  )
353  proc.jetSequence.insert(proc.jetSequence.index(proc.jercVars)+1, proc.puJetVarAK4PFCHS)
354 
355  #
356  # Save variables as userFloats and userInts in each jet
357  #
358  proc.updatedJetsWithUserData.userFloats.dR2Mean = cms.InputTag("puJetVarAK4PFCHS:dR2Mean")
359  proc.updatedJetsWithUserData.userFloats.majW = cms.InputTag("puJetVarAK4PFCHS:majW")
360  proc.updatedJetsWithUserData.userFloats.minW = cms.InputTag("puJetVarAK4PFCHS:minW")
361  proc.updatedJetsWithUserData.userFloats.frac01 = cms.InputTag("puJetVarAK4PFCHS:frac01")
362  proc.updatedJetsWithUserData.userFloats.frac02 = cms.InputTag("puJetVarAK4PFCHS:frac02")
363  proc.updatedJetsWithUserData.userFloats.frac03 = cms.InputTag("puJetVarAK4PFCHS:frac03")
364  proc.updatedJetsWithUserData.userFloats.frac04 = cms.InputTag("puJetVarAK4PFCHS:frac04")
365  proc.updatedJetsWithUserData.userFloats.ptD = cms.InputTag("puJetVarAK4PFCHS:ptD")
366  proc.updatedJetsWithUserData.userFloats.beta = cms.InputTag("puJetVarAK4PFCHS:beta")
367  proc.updatedJetsWithUserData.userFloats.pull = cms.InputTag("puJetVarAK4PFCHS:pull")
368  proc.updatedJetsWithUserData.userFloats.jetR = cms.InputTag("puJetVarAK4PFCHS:jetR")
369  proc.updatedJetsWithUserData.userFloats.jetRchg = cms.InputTag("puJetVarAK4PFCHS:jetRchg")
370  proc.updatedJetsWithUserData.userInts.nCharged = cms.InputTag("puJetVarAK4PFCHS:nCharged")
371 
372  #
373  # Specfiy variables in the jetTable to save in NanoAOD
374  #
375  proc.jetTable.variables.dR2Mean = Var("userFloat('dR2Mean')", float, doc="pT^2-weighted average square distance of jet constituents from the jet axis", precision= 6)
376  proc.jetTable.variables.majW = Var("userFloat('majW')", float, doc="major axis of jet ellipsoid in eta-phi plane", precision= 6)
377  proc.jetTable.variables.minW = Var("userFloat('minW')", float, doc="minor axis of jet ellipsoid in eta-phi plane", precision= 6)
378  proc.jetTable.variables.frac01 = Var("userFloat('frac01')", float, doc="frac of constituents' pT contained within dR<0.1", precision= 6)
379  proc.jetTable.variables.frac02 = Var("userFloat('frac02')", float, doc="frac of constituents' pT contained within 0.1<dR<0.2", precision= 6)
380  proc.jetTable.variables.frac03 = Var("userFloat('frac03')", float, doc="frac of constituents' pT contained within 0.2<dR<0.3", precision= 6)
381  proc.jetTable.variables.frac04 = Var("userFloat('frac04')", float, doc="frac of constituents' pT contained within 0.3<dR<0.4", precision= 6)
382  proc.jetTable.variables.ptD = Var("userFloat('ptD')", float, doc="pT-weighted average pT of constituents", precision= 6)
383  proc.jetTable.variables.beta = Var("userFloat('beta')", float, doc="fraction of pT of charged constituents associated to PV", precision= 6)
384  proc.jetTable.variables.pull = Var("userFloat('pull')", float, doc="magnitude of pull vector", precision= 6)
385  proc.jetTable.variables.jetR = Var("userFloat('jetR')", float, doc="fraction of jet pT carried by the leading constituent", precision= 6)
386  proc.jetTable.variables.jetRchg = Var("userFloat('jetRchg')", float, doc="fraction of jet pT carried by the leading charged constituent", precision= 6)
387  proc.jetTable.variables.nCharged = Var("userInt('nCharged')", int, doc="number of charged constituents")
388 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
def AddPileUpJetIDVars(proc)
def custom_jme_cff.PrepJMECustomNanoAOD (   process,
  runOnMC 
)

Definition at line 389 of file custom_jme_cff.py.

References AddPileUpJetIDVars(), and common_cff.Var().

Referenced by PrepJMECustomNanoAOD_Data(), and PrepJMECustomNanoAOD_MC().

389 def PrepJMECustomNanoAOD(process,runOnMC):
390  #
391  # Additional variables to AK4GenJets
392  #
393  process.genJetTable.variables.area = JETVARS.area
394  #
395  # Additional variables to AK8GenJets
396  #
397  process.genJetAK8Table.variables.area = JETVARS.area
398  #
399  # Additional variables for AK4PFCHS
400  #
401  process.jetTable.variables.HFHEF = JETVARS.HFHEF
402  process.jetTable.variables.HFEMEF = JETVARS.HFEMEF
403  #
404  # Additional variables to AK8PFPUPPI
405  #
406  # These variables are not stored for AK8PFCHS (slimmedJetsAK8)
407  # in MiniAOD if their pt < 170 GeV. Hence the conditional fill.
408  #
409  process.fatJetTable.variables.chHEF = Var("?isPFJet()?chargedHadronEnergyFraction():-1", float, doc="charged Hadron Energy Fraction", precision = 6)
410  process.fatJetTable.variables.neHEF = Var("?isPFJet()?neutralHadronEnergyFraction():-1", float, doc="neutral Hadron Energy Fraction", precision = 6)
411  process.fatJetTable.variables.chEmEF = Var("?isPFJet()?chargedEmEnergyFraction():-1", float, doc="charged Electromagnetic Energy Fraction", precision = 6)
412  process.fatJetTable.variables.neEmEF = Var("?isPFJet()?neutralEmEnergyFraction():-1", float, doc="neutral Electromagnetic Energy Fraction", precision = 6)
413  process.fatJetTable.variables.muEF = Var("?isPFJet()?muonEnergyFraction():-1", float, doc="muon Energy Fraction", precision = 6)
414  process.fatJetTable.variables.HFHEF = Var("?isPFJet()?HFHadronEnergyFraction():-1", float, doc="energy fraction in forward hadronic calorimeter", precision = 6)
415  process.fatJetTable.variables.HFEMEF = Var("?isPFJet()?HFEMEnergyFraction():-1", float, doc="energy fraction in forward EM calorimeter", precision = 6)
416  #
417  #
418  #
419  process.jercVarsFatJet = process.jercVars.clone(
420  srcJet = "updatedJetsAK8",
421  maxDR = 0.8,
422  )
423  process.jetSequence.insert(process.jetSequence.index(process.updatedJetsAK8WithUserData), process.jercVarsFatJet)
424 
425  process.updatedJetsAK8WithUserData.userFloats.jercCHPUF = cms.InputTag(
426  "%s:chargedHadronPUEnergyFraction" % process.jercVarsFatJet.label()
427  )
428  process.updatedJetsAK8WithUserData.userFloats.jercCHF = cms.InputTag(
429  "%s:chargedHadronCHSEnergyFraction" % process.jercVarsFatJet.label()
430  )
431  process.fatJetTable.variables.jercCHPUF = JETVARS.jercCHPUF
432  process.fatJetTable.variables.jercCHF = JETVARS.jercCHF
433  #
434  #
435  #
436  process.finalJets.cut = "" # 15 -> 10
437  process.finalJetsAK8.cut = "" # 170 -> 170
438  process.genJetTable.cut = "" # 10 -> 8
439  process.genJetFlavourTable.cut = "" # 10 -> 8
440  process.genJetAK8Table.cut = "" # 100 -> 80
441  process.genJetAK8FlavourTable.cut = "" # 100 -> 80
442  #
443  # Add variables for pileup jet ID studies.
444  #
445  AddPileUpJetIDVars(process)
446 
447  ######################################################################################################################
448 
449  #
450  # Add GenJets to NanoAOD
451  #
452  genJA = GenJetAdder()
453  tableGenJA = TableGenJetAdder()
454 
455  for jetConfig in config_genjets:
456  cfg = { k : v for k, v in jetConfig.items() if k != "enabled" }
457  genJetInfo = genJA.addGenJetCollection(process, **cfg)
458  tableGenJA.addTable(process, genJetInfo)
459 
460  #
461  # Add RecoJets to NanoAOD
462  #
463  recoJA = RecoJetAdder(runOnMC=runOnMC)
464  tableRecoJA = TableRecoJetAdder()
465 
466  for jetConfig in config_recojets:
467  cfg = { k : v for k, v in jetConfig.items() if k != "enabled" }
468  recoJetInfo = recoJA.addRecoJetCollection(process, **cfg)
469  tableRecoJA.addTable(process, recoJetInfo)
470 
471  if runOnMC:
472  process.nanoSequenceMC += genJA.getSequence(process)
473  process.nanoSequenceMC += recoJA.getSequence(process)
474  process.nanoSequenceMC += tableGenJA.getSequence(process)
475  process.nanoSequenceMC += tableRecoJA.getSequence(process)
476  else:
477  process.nanoSequence += recoJA.getSequence(process)
478  process.nanoSequence += tableRecoJA.getSequence(process)
479 
def PrepJMECustomNanoAOD(process, runOnMC)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
def AddPileUpJetIDVars(proc)
def custom_jme_cff.PrepJMECustomNanoAOD_Data (   process)

Definition at line 483 of file custom_jme_cff.py.

References PrepJMECustomNanoAOD().

484  PrepJMECustomNanoAOD(process,runOnMC=False)
485 
def PrepJMECustomNanoAOD(process, runOnMC)
def PrepJMECustomNanoAOD_Data(process)
def custom_jme_cff.PrepJMECustomNanoAOD_MC (   process)

Definition at line 480 of file custom_jme_cff.py.

References PrepJMECustomNanoAOD().

481  PrepJMECustomNanoAOD(process,runOnMC=True)
482 
def PrepJMECustomNanoAOD(process, runOnMC)
def PrepJMECustomNanoAOD_MC(process)

Variable Documentation

custom_jme_cff.chEmEF

Definition at line 172 of file custom_jme_cff.py.

custom_jme_cff.chHEF

Definition at line 170 of file custom_jme_cff.py.

custom_jme_cff.config_genjets

Definition at line 19 of file custom_jme_cff.py.

custom_jme_cff.config_recojets

Definition at line 76 of file custom_jme_cff.py.

custom_jme_cff.doc

Definition at line 167 of file custom_jme_cff.py.

custom_jme_cff.float

Definition at line 167 of file custom_jme_cff.py.

custom_jme_cff.genjetNameInNano

Definition at line 164 of file custom_jme_cff.py.

custom_jme_cff.HFEMEF

Definition at line 168 of file custom_jme_cff.py.

custom_jme_cff.HFHEF

Definition at line 167 of file custom_jme_cff.py.

custom_jme_cff.jercCHF

Definition at line 178 of file custom_jme_cff.py.

custom_jme_cff.jercCHPUF

Definition at line 177 of file custom_jme_cff.py.

custom_jme_cff.JETVARS

Definition at line 166 of file custom_jme_cff.py.

custom_jme_cff.muEF

Definition at line 174 of file custom_jme_cff.py.

custom_jme_cff.nanoInfo_genjets

Definition at line 45 of file custom_jme_cff.py.

custom_jme_cff.nanoInfo_recojets

Definition at line 124 of file custom_jme_cff.py.

custom_jme_cff.neEmEF

Definition at line 173 of file custom_jme_cff.py.

custom_jme_cff.neHEF

Definition at line 171 of file custom_jme_cff.py.

custom_jme_cff.precision

Definition at line 167 of file custom_jme_cff.py.

custom_jme_cff.rawFactor

Definition at line 175 of file custom_jme_cff.py.

custom_jme_cff.recojetNameInNano

Definition at line 159 of file custom_jme_cff.py.