CMS 3D CMS Logo

Functions | Variables
custom_jme_cff Namespace Reference

Functions

def AddBTaggingScores (proc, jetTableName="")
 
def AddDeepJetGluonLQuarkScores (proc, jetTableName="")
 
def AddJetID (proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")
 
def AddNewAK8CHSJets (proc, recoJA, runOnMC)
 
def AddNewAK8GenJetsForJEC (proc, genJA)
 
def AddNewAK8PuppiJetsForJEC (proc, recoJA, runOnMC)
 
def AddNewGenJets (proc, genJetInfo)
 
def AddNewPatJets (proc, recoJetInfo, runOnMC)
 
def AddParticleNetAK4Scores (proc, jetTableName="")
 
def AddPileUpJetIDVars (proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")
 
def AddQGLTaggerVars (proc, jetName="", jetSrc="", jetTableName="", jetTaskName="", calculateQGLVars=False)
 
def AddRobustParTAK4Scores (proc, jetTableName="")
 
def AddVariablesForAK4GenJets (proc)
 
def AddVariablesForAK8GenJets (proc)
 
def AddVariablesForAK8PuppiJets (proc)
 
def PrepJMECustomNanoAOD (process, runOnMC)
 
def PrepJMECustomNanoAOD_Data (process)
 
def PrepJMECustomNanoAOD_MC (process)
 
def ReclusterAK4CHSJets (proc, recoJA, runOnMC)
 
def ReclusterAK4GenJets (proc, genJA)
 
def ReclusterAK4PuppiJets (proc, recoJA, runOnMC)
 
def RemoveAllJetPtCuts (proc)
 
def SaveGenJets (proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)
 
def SavePatJets (proc, jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF, doCalo, ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=False)
 

Variables

 area
 
 bTagCSVV2
 
 btagDDX
 
 btagDDXV2
 
 btagDeepB
 
 bTagDeepCSV
 
 btagDeepCvB
 
 btagDeepCvL
 
 btagDeepFlavB
 
 btagDeepFlavC
 
 btagDeepFlavCvB
 
 btagDeepFlavCvL
 
 btagDeepFlavG
 
 btagDeepFlavQG
 
 btagDeepFlavUDS
 
 bTagDeepJet
 
 bTagDiscriminatorsForAK4
 
 btagHbb
 
 btagRobustParTAK4B
 
 btagRobustParTAK4C
 
 btagRobustParTAK4CvB
 
 btagRobustParTAK4CvL
 
 btagRobustParTAK4G
 
 btagRobustParTAK4QG
 
 btagRobustParTAK4UDS
 
 BTAGVARS
 
 CALOJETVARS
 
 chEmEF
 
 chHEF
 
 config_genjets
 
 config_recojets
 
 DEEPJETVARS
 
 doc
 
 emf
 
 float
 
 foo
 
 GENJETVARS
 
 hfEmEF
 
 hfHEF
 
 int
 
 muEF
 
 nanoInfo_genjets
 
 nanoInfo_recojets
 
 nConstChHads
 
 nConstElecs
 
 nConstHFEMs
 
 nConstHFHads
 
 nConstituents
 
 nConstMuons
 
 nConstNeuHads
 
 nConstPhotons
 
 neEmEF
 
 neHEF
 
 nElectrons
 
 nMuons
 
 particleNetAK4_B
 
 particleNetAK4_CvsB
 
 particleNetAK4_CvsL
 
 particleNetAK4_G
 
 particleNetAK4_puIdDisc
 
 particleNetAK4_QvsG
 
 PARTICLENETAK4VARS
 
 PFJETVARS
 
 precision
 
 puId_beta
 
 puId_dR2Mean
 
 puId_frac01
 
 puId_frac02
 
 puId_frac03
 
 puId_frac04
 
 puId_jetR
 
 puId_jetRchg
 
 puId_majW
 
 puId_minW
 
 puId_nCharged
 
 puId_ptD
 
 puId_pull
 
 PUIDVARS
 
 qgl_axis2
 
 qgl_mult
 
 qgl_ptD
 
 QGLVARS
 
 rawFactor
 
 ROBUSTPARTAK4VARS
 

Function Documentation

◆ AddBTaggingScores()

def custom_jme_cff.AddBTaggingScores (   proc,
  jetTableName = "" 
)
Store b-tagging scores from various algortihm

Definition at line 378 of file custom_jme_cff.py.

References common_cff.Var().

Referenced by SavePatJets().

378 def AddBTaggingScores(proc, jetTableName=""):
379  """
380  Store b-tagging scores from various algortihm
381  """
382 
383  getattr(proc, jetTableName).variables.btagDeepFlavB = DEEPJETVARS.btagDeepFlavB
384  getattr(proc, jetTableName).variables.btagDeepFlavCvL = DEEPJETVARS.btagDeepFlavCvL
385  getattr(proc, jetTableName).variables.btagDeepFlavCvB = DEEPJETVARS.btagDeepFlavCvB
386 
387  run2_nanoAOD_ANY.toModify(
388  getattr(proc, jetTableName).variables,
389  btagCSVV2 = Var("bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags')",float,doc=" pfCombinedInclusiveSecondaryVertexV2 b-tag discriminator (aka CSVV2)",precision=10),
390  btagDeepB = Var("?(bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'))>=0?bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb'):-1",float,doc="DeepCSV b+bb tag discriminator",precision=10),
391  btagDeepCvL = Var("?bDiscriminator('pfDeepCSVJetTags:probc')>=0?bDiscriminator('pfDeepCSVJetTags:probc')/(bDiscriminator('pfDeepCSVJetTags:probc')+bDiscriminator('pfDeepCSVJetTags:probudsg')):-1", float,doc="DeepCSV c vs udsg discriminator",precision=10),
392  btagDeepCvB = Var("?bDiscriminator('pfDeepCSVJetTags:probc')>=0?bDiscriminator('pfDeepCSVJetTags:probc')/(bDiscriminator('pfDeepCSVJetTags:probc')+bDiscriminator('pfDeepCSVJetTags:probb')+bDiscriminator('pfDeepCSVJetTags:probbb')):-1",float,doc="DeepCSV c vs b+bb discriminator",precision=10)
393  )
394 
395  return proc
396 
def AddBTaggingScores(proc, jetTableName="")
def Var(expr, valtype, doc=None, precision=-1)
Definition: common_cff.py:16

◆ AddDeepJetGluonLQuarkScores()

def custom_jme_cff.AddDeepJetGluonLQuarkScores (   proc,
  jetTableName = "" 
)
Store DeepJet raw score in jetTable for gluon and light quark

Definition at line 397 of file custom_jme_cff.py.

Referenced by SavePatJets().

397 def AddDeepJetGluonLQuarkScores(proc, jetTableName=""):
398  """
399  Store DeepJet raw score in jetTable for gluon and light quark
400  """
401 
402  getattr(proc, jetTableName).variables.btagDeepFlavG = DEEPJETVARS.btagDeepFlavG
403  getattr(proc, jetTableName).variables.btagDeepFlavUDS = DEEPJETVARS.btagDeepFlavUDS
404  getattr(proc, jetTableName).variables.btagDeepFlavQG = DEEPJETVARS.btagDeepFlavQG
405 
406  return proc
407 
def AddDeepJetGluonLQuarkScores(proc, jetTableName="")

◆ AddJetID()

def custom_jme_cff.AddJetID (   proc,
  jetName = "",
  jetSrc = "",
  jetTableName = "",
  jetTaskName = "" 
)
Setup modules to calculate PF jet ID

Definition at line 216 of file custom_jme_cff.py.

References PVValHelper.add(), and common_cff.Var().

Referenced by SavePatJets().

216 def AddJetID(proc, jetName="", jetSrc="", jetTableName="", jetTaskName=""):
217  """
218  Setup modules to calculate PF jet ID
219  """
220 
221  isPUPPIJet = True if "PUPPI" in jetName.upper() else False
222 
223  looseJetId = "looseJetId{}".format(jetName)
224  setattr(proc, looseJetId, proc.looseJetId.clone(
225  src = jetSrc,
226  filterParams = proc.looseJetId.filterParams.clone(
227  version = "WINTER16"
228  ),
229  )
230  )
231 
232  tightJetId = "tightJetId{}".format(jetName)
233  setattr(proc, tightJetId, proc.tightJetId.clone(
234  src = jetSrc,
235  filterParams = proc.tightJetId.filterParams.clone(
236  version = "RUN2UL{}".format("PUPPI" if isPUPPIJet else "CHS")
237  ),
238  )
239  )
240 
241  tightJetIdLepVeto = "tightJetIdLepVeto{}".format(jetName)
242  setattr(proc, tightJetIdLepVeto, proc.tightJetIdLepVeto.clone(
243  src = jetSrc,
244  filterParams = proc.tightJetIdLepVeto.filterParams.clone(
245  version = "RUN2UL{}".format("PUPPI" if isPUPPIJet else "CHS")
246  ),
247  )
248  )
249 
250  run2_jme_2016.toModify(
251  getattr(proc, tightJetId).filterParams, version = "RUN2UL16{}".format("PUPPI" if isPUPPIJet else "CHS")
252  ).toModify(
253  getattr(proc, tightJetIdLepVeto).filterParams, version = "RUN2UL16{}".format("PUPPI" if isPUPPIJet else "CHS")
254  )
255 
256  #
257  # Save variables as userInts in each jet
258  #
259  patJetWithUserData = "{}WithUserData".format(jetSrc)
260  getattr(proc, patJetWithUserData).userInts.tightId = cms.InputTag(tightJetId)
261  getattr(proc, patJetWithUserData).userInts.tightIdLepVeto = cms.InputTag(tightJetIdLepVeto)
262 
263  #
264  # Specfiy variables in the jetTable to save in NanoAOD
265  #
266  getattr(proc, jetTableName).variables.jetId = Var("userInt('tightId')*2+4*userInt('tightIdLepVeto')",int,doc="Jet ID flags bit1 is loose (always false in 2017 since it does not exist), bit2 is tight, bit3 is tightLepVeto")
267 
268  getattr(proc,jetTaskName).add(getattr(proc, tightJetId))
269  getattr(proc,jetTaskName).add(getattr(proc, tightJetIdLepVeto))
270 
271  return proc
272 
def Var(expr, valtype, doc=None, precision=-1)
Definition: common_cff.py:16
def AddJetID(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

◆ AddNewAK8CHSJets()

def custom_jme_cff.AddNewAK8CHSJets (   proc,
  recoJA,
  runOnMC 
)
Store an AK8 CHS jet collection for JEC studies.

Definition at line 1022 of file custom_jme_cff.py.

References print(), and SavePatJets().

Referenced by PrepJMECustomNanoAOD().

1022 def AddNewAK8CHSJets(proc, recoJA, runOnMC):
1023  """
1024  Store an AK8 CHS jet collection for JEC studies.
1025  """
1026  print("custom_jme_cff::AddNewAK8CHSJets: Make a new AK8 PF CHS jet collection for JEC studies")
1027 
1028  #
1029  # Recluster AK8 CHS jets
1030  #
1031  cfg = {
1032  "jet" : "ak8pfchs",
1033  "inputCollection" : "",
1034  "genJetsCollection": "AK8GenJetsNoNu",
1035  "minPtFastjet" : 0., # Remove any pt threshold at the jet clustering stage.
1036  }
1037  recoJetInfo = recoJA.addRecoJetCollection(proc, **cfg)
1038 
1039  jetName = recoJetInfo.jetUpper
1040  payload = recoJetInfo.jetCorrPayload
1041 
1042  patJetFinalColl = recoJetInfo.patJetFinalCollection
1043  jetTablePrefix = "FatJetCHS"
1044  jetTableDoc = "AK8 PF CHS jets with JECs applied. Reclustered for JEC studies so only minimal info stored."
1045  ptcut = 15
1046 
1047  SavePatJets(proc,
1048  jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF=True,
1049  doCalo=False, ptcut=ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=runOnMC
1050  )
1051 
1052  return proc
1053 
def AddNewAK8CHSJets(proc, recoJA, runOnMC)
def SavePatJets(proc, jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF, doCalo, ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=False)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ AddNewAK8GenJetsForJEC()

def custom_jme_cff.AddNewAK8GenJetsForJEC (   proc,
  genJA 
)
Make a separate AK8 Gen jet collection for JEC studies.

Definition at line 1188 of file custom_jme_cff.py.

References print(), and SaveGenJets().

Referenced by PrepJMECustomNanoAOD().

1188 def AddNewAK8GenJetsForJEC(proc, genJA):
1189  """
1190  Make a separate AK8 Gen jet collection for JEC studies.
1191  """
1192  print("custom_jme_cff::AddNewAK8GenJetsForJEC: Add new AK8 Gen jets for JEC studies")
1193 
1194  #
1195  # Recluster AK8 Gen jet
1196  #
1197  cfg = {
1198  "jet" : "ak8gen",
1199  }
1200  genJetInfo = genJA.addGenJetCollection(proc, **cfg)
1201 
1202  genJetName = genJetInfo.jetUpper
1203  genJetAlgo = genJetInfo.jetAlgo
1204  genJetSize = genJetInfo.jetSize
1205  genJetSizeNr = genJetInfo.jetSizeNr
1206  genJetFinalColl = "{}{}{}".format(genJetAlgo.upper(), genJetSize, "GenJetsNoNu")
1207  genJetTablePrefix = "GenJetAK8ForJEC"
1208  genJetTableDoc = "AK8 Gen jets (made with visible genparticles) with pt > 3 GeV. Reclustered for JEC studies."
1209 
1210  SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)
1211 
1212  return proc
1213 
def AddNewAK8GenJetsForJEC(proc, genJA)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)

◆ AddNewAK8PuppiJetsForJEC()

def custom_jme_cff.AddNewAK8PuppiJetsForJEC (   proc,
  recoJA,
  runOnMC 
)
Store a separate AK8 Puppi jet collection for JEC studies.
Only minimal info are stored

Definition at line 989 of file custom_jme_cff.py.

References print(), and SavePatJets().

Referenced by PrepJMECustomNanoAOD().

989 def AddNewAK8PuppiJetsForJEC(proc, recoJA, runOnMC):
990  """
991  Store a separate AK8 Puppi jet collection for JEC studies.
992  Only minimal info are stored
993  """
994  print("custom_jme_cff::AddNewAK8PuppiJetsForJEC: Make a new AK8 PF Puppi jet collection for JEC studies")
995 
996  #
997  # Recluster AK8 Puppi jets
998  #
999  cfg = {
1000  "jet" : "ak8pfpuppi",
1001  "inputCollection" : "",
1002  "genJetsCollection": "AK8GenJetsNoNu",
1003  "minPtFastjet" : 0., # Remove any pt threshold at the jet clustering stage.
1004  }
1005  recoJetInfo = recoJA.addRecoJetCollection(proc, **cfg)
1006 
1007  jetName = recoJetInfo.jetUpper
1008  payload = recoJetInfo.jetCorrPayload
1009 
1010  patJetFinalColl = recoJetInfo.patJetFinalCollection
1011  jetTablePrefix = "FatJetForJEC"
1012  jetTableDoc = "AK8 PF Puppi jets with JECs applied. Reclustered for JEC studies so only minimal info stored."
1013  ptcut = 15
1014 
1015  SavePatJets(proc,
1016  jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF=True,
1017  doCalo=False, ptcut=ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=runOnMC
1018  )
1019 
1020  return proc
1021 
def SavePatJets(proc, jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF, doCalo, ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=False)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def AddNewAK8PuppiJetsForJEC(proc, recoJA, runOnMC)

◆ AddNewGenJets()

def custom_jme_cff.AddNewGenJets (   proc,
  genJetInfo 
)
Add genJet into custom nanoAOD

Definition at line 1088 of file custom_jme_cff.py.

References SaveGenJets().

Referenced by PrepJMECustomNanoAOD().

1088 def AddNewGenJets(proc, genJetInfo):
1089  """
1090  Add genJet into custom nanoAOD
1091  """
1092 
1093  genJetName = genJetInfo.jetUpper
1094  genJetAlgo = genJetInfo.jetAlgo
1095  genJetSize = genJetInfo.jetSize
1096  genJetSizeNr = genJetInfo.jetSizeNr
1097  genJetFinalColl = "{}{}{}".format(genJetAlgo.upper(), genJetSize, "GenJetsNoNu")
1098  genJetTablePrefix = nanoInfo_genjets[genJetInfo.jet]["name"]
1099  genJetTableDoc = nanoInfo_genjets[genJetInfo.jet]["doc"]
1100 
1101  SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)
1102 
1103  return proc
1104 
def AddNewGenJets(proc, genJetInfo)
def SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)

◆ AddNewPatJets()

def custom_jme_cff.AddNewPatJets (   proc,
  recoJetInfo,
  runOnMC 
)
Add patJet into custom nanoAOD

Definition at line 433 of file custom_jme_cff.py.

References SavePatJets().

Referenced by PrepJMECustomNanoAOD().

433 def AddNewPatJets(proc, recoJetInfo, runOnMC):
434  """
435  Add patJet into custom nanoAOD
436  """
437 
438  jetName = recoJetInfo.jetUpper
439  payload = recoJetInfo.jetCorrPayload
440  doPF = recoJetInfo.doPF
441  doCalo = recoJetInfo.doCalo
442  patJetFinalColl = recoJetInfo.patJetFinalCollection
443 
444  nanoInfoForJet = nanoInfo_recojets[recoJetInfo.jet]
445  jetTablePrefix = nanoInfoForJet["name"]
446  jetTableDoc = nanoInfoForJet["doc"]
447  ptcut = nanoInfoForJet["ptcut"] if "ptcut" in nanoInfoForJet else 8
448  doPUIDVar = nanoInfoForJet["doPUIDVar"] if "doPUIDVar" in nanoInfoForJet else False
449  doQGL = nanoInfoForJet["doQGL"] if "doQGL" in nanoInfoForJet else False
450  doBTag = nanoInfoForJet["doBTag"] if "doBTag" in nanoInfoForJet else False
451 
452  SavePatJets(proc,
453  jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF, doCalo,
454  ptcut=ptcut, doPUIDVar=doPUIDVar, doQGL=doQGL, doBTag=doBTag, runOnMC=runOnMC
455  )
456 
457  return proc
458 
def AddNewPatJets(proc, recoJetInfo, runOnMC)
def SavePatJets(proc, jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF, doCalo, ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=False)

◆ AddParticleNetAK4Scores()

def custom_jme_cff.AddParticleNetAK4Scores (   proc,
  jetTableName = "" 
)
Store ParticleNetAK4 scores in jetTable

Definition at line 419 of file custom_jme_cff.py.

Referenced by SavePatJets().

419 def AddParticleNetAK4Scores(proc, jetTableName=""):
420  """
421  Store ParticleNetAK4 scores in jetTable
422  """
423 
424  getattr(proc, jetTableName).variables.particleNetAK4_B = PARTICLENETAK4VARS.particleNetAK4_B
425  getattr(proc, jetTableName).variables.particleNetAK4_CvsL = PARTICLENETAK4VARS.particleNetAK4_CvsL
426  getattr(proc, jetTableName).variables.particleNetAK4_CvsB = PARTICLENETAK4VARS.particleNetAK4_CvsB
427  getattr(proc, jetTableName).variables.particleNetAK4_QvsG = PARTICLENETAK4VARS.particleNetAK4_QvsG
428  getattr(proc, jetTableName).variables.particleNetAK4_G = PARTICLENETAK4VARS.particleNetAK4_G
429  getattr(proc, jetTableName).variables.particleNetAK4_puIdDisc = PARTICLENETAK4VARS.particleNetAK4_puIdDisc
430 
431  return proc
432 
def AddParticleNetAK4Scores(proc, jetTableName="")

◆ AddPileUpJetIDVars()

def custom_jme_cff.AddPileUpJetIDVars (   proc,
  jetName = "",
  jetSrc = "",
  jetTableName = "",
  jetTaskName = "" 
)
Setup modules to calculate pileup jet ID input variables for PF jet

Definition at line 273 of file custom_jme_cff.py.

References PVValHelper.add().

Referenced by ReclusterAK4CHSJets(), ReclusterAK4PuppiJets(), and SavePatJets().

273 def AddPileUpJetIDVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName=""):
274  """
275  Setup modules to calculate pileup jet ID input variables for PF jet
276  """
277 
278  #
279  # Calculate pileup jet ID variables
280  #
281  puJetIdVarsCalculator = "puJetIdCalculator{}".format(jetName)
282  setattr(proc, puJetIdVarsCalculator, pileupJetIdCalculator.clone(
283  jets = jetSrc,
284  vertexes = "offlineSlimmedPrimaryVertices",
285  inputIsCorrected = True,
286  applyJec = False,
287  srcConstituentWeights = "packedPFCandidatespuppi" if "PUPPI" in jetName.upper() else ""
288  )
289  )
290  getattr(proc,jetTaskName).add(getattr(proc, puJetIdVarsCalculator))
291 
292  #
293  # Get the variables
294  #
295  puJetIDVar = "puJetIDVar{}".format(jetName)
296  setattr(proc, puJetIDVar, cms.EDProducer("PileupJetIDVarProducer",
297  srcJet = cms.InputTag(jetSrc),
298  srcPileupJetId = cms.InputTag(puJetIdVarsCalculator)
299  )
300  )
301  getattr(proc,jetTaskName).add(getattr(proc, puJetIDVar))
302 
303  #
304  # Save variables as userFloats and userInts for each jet
305  #
306  patJetWithUserData = "{}WithUserData".format(jetSrc)
307  getattr(proc,patJetWithUserData).userFloats.puId_dR2Mean = cms.InputTag("{}:dR2Mean".format(puJetIDVar))
308  getattr(proc,patJetWithUserData).userFloats.puId_majW = cms.InputTag("{}:majW".format(puJetIDVar))
309  getattr(proc,patJetWithUserData).userFloats.puId_minW = cms.InputTag("{}:minW".format(puJetIDVar))
310  getattr(proc,patJetWithUserData).userFloats.puId_frac01 = cms.InputTag("{}:frac01".format(puJetIDVar))
311  getattr(proc,patJetWithUserData).userFloats.puId_frac02 = cms.InputTag("{}:frac02".format(puJetIDVar))
312  getattr(proc,patJetWithUserData).userFloats.puId_frac03 = cms.InputTag("{}:frac03".format(puJetIDVar))
313  getattr(proc,patJetWithUserData).userFloats.puId_frac04 = cms.InputTag("{}:frac04".format(puJetIDVar))
314  getattr(proc,patJetWithUserData).userFloats.puId_ptD = cms.InputTag("{}:ptD".format(puJetIDVar))
315  getattr(proc,patJetWithUserData).userFloats.puId_beta = cms.InputTag("{}:beta".format(puJetIDVar))
316  getattr(proc,patJetWithUserData).userFloats.puId_pull = cms.InputTag("{}:pull".format(puJetIDVar))
317  getattr(proc,patJetWithUserData).userFloats.puId_jetR = cms.InputTag("{}:jetR".format(puJetIDVar))
318  getattr(proc,patJetWithUserData).userFloats.puId_jetRchg = cms.InputTag("{}:jetRchg".format(puJetIDVar))
319  getattr(proc,patJetWithUserData).userInts.puId_nCharged = cms.InputTag("{}:nCharged".format(puJetIDVar))
320 
321  #
322  # Specfiy variables in the jet table to save in NanoAOD
323  #
324  getattr(proc,jetTableName).variables.puId_dR2Mean = PUIDVARS.puId_dR2Mean
325  getattr(proc,jetTableName).variables.puId_majW = PUIDVARS.puId_majW
326  getattr(proc,jetTableName).variables.puId_minW = PUIDVARS.puId_minW
327  getattr(proc,jetTableName).variables.puId_frac01 = PUIDVARS.puId_frac01
328  getattr(proc,jetTableName).variables.puId_frac02 = PUIDVARS.puId_frac02
329  getattr(proc,jetTableName).variables.puId_frac03 = PUIDVARS.puId_frac03
330  getattr(proc,jetTableName).variables.puId_frac04 = PUIDVARS.puId_frac04
331  getattr(proc,jetTableName).variables.puId_ptD = PUIDVARS.puId_ptD
332  getattr(proc,jetTableName).variables.puId_beta = PUIDVARS.puId_beta
333  getattr(proc,jetTableName).variables.puId_pull = PUIDVARS.puId_pull
334  getattr(proc,jetTableName).variables.puId_jetR = PUIDVARS.puId_jetR
335  getattr(proc,jetTableName).variables.puId_jetRchg = PUIDVARS.puId_jetRchg
336  getattr(proc,jetTableName).variables.puId_nCharged = PUIDVARS.puId_nCharged
337 
338  return proc
339 
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
def AddPileUpJetIDVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")

◆ AddQGLTaggerVars()

def custom_jme_cff.AddQGLTaggerVars (   proc,
  jetName = "",
  jetSrc = "",
  jetTableName = "",
  jetTaskName = "",
  calculateQGLVars = False 
)
Schedule the QGTagger module to calculate input variables to the QG likelihood

Definition at line 340 of file custom_jme_cff.py.

References PVValHelper.add().

Referenced by ReclusterAK4PuppiJets(), and SavePatJets().

340 def AddQGLTaggerVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="", calculateQGLVars=False):
341  """
342  Schedule the QGTagger module to calculate input variables to the QG likelihood
343  """
344 
345  isPUPPIJet = True if "PUPPI" in jetName.upper() else False
346 
347  QGLTagger="qgtagger{}".format(jetName)
348  patJetWithUserData="{}WithUserData".format(jetSrc)
349 
350  if calculateQGLVars:
351  setattr(proc, QGLTagger, qgtagger.clone(
352  srcJets = jetSrc,
353  computeLikelihood = False,
354  )
355  )
356  if isPUPPIJet:
357  getattr(proc,QGLTagger).srcConstituentWeights = cms.InputTag("packedPFCandidatespuppi")
358 
359  #
360  # Save variables as userFloats and userInts for each jet
361  #
362  getattr(proc,patJetWithUserData).userFloats.qgl_axis2 = cms.InputTag(QGLTagger+":axis2")
363  getattr(proc,patJetWithUserData).userFloats.qgl_ptD = cms.InputTag(QGLTagger+":ptD")
364  getattr(proc,patJetWithUserData).userInts.qgl_mult = cms.InputTag(QGLTagger+":mult")
365 
366  #
367  # Specfiy variables in the jet table to save in NanoAOD
368  #
369  getattr(proc,jetTableName).variables.qgl_axis2 = QGLVARS.qgl_axis2
370  getattr(proc,jetTableName).variables.qgl_ptD = QGLVARS.qgl_ptD
371  getattr(proc,jetTableName).variables.qgl_mult = QGLVARS.qgl_mult
372 
373  if calculateQGLVars:
374  getattr(proc,jetTaskName).add(getattr(proc, QGLTagger))
375 
376  return proc
377 
def AddQGLTaggerVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="", calculateQGLVars=False)
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

◆ AddRobustParTAK4Scores()

def custom_jme_cff.AddRobustParTAK4Scores (   proc,
  jetTableName = "" 
)
Store RobustParTAK4 scores in jetTable

Definition at line 408 of file custom_jme_cff.py.

Referenced by SavePatJets().

408 def AddRobustParTAK4Scores(proc, jetTableName=""):
409  """
410  Store RobustParTAK4 scores in jetTable
411  """
412 
413  getattr(proc, jetTableName).variables.btagRobustParTAK4B = ROBUSTPARTAK4VARS.btagRobustParTAK4B
414  getattr(proc, jetTableName).variables.btagRobustParTAK4CvL = ROBUSTPARTAK4VARS.btagRobustParTAK4CvL
415  getattr(proc, jetTableName).variables.btagRobustParTAK4CvB = ROBUSTPARTAK4VARS.btagRobustParTAK4CvB
416 
417  return proc
418 
def AddRobustParTAK4Scores(proc, jetTableName="")

◆ AddVariablesForAK4GenJets()

def custom_jme_cff.AddVariablesForAK4GenJets (   proc)

Definition at line 1214 of file custom_jme_cff.py.

Referenced by PrepJMECustomNanoAOD().

1214 def AddVariablesForAK4GenJets(proc):
1215  proc.genJetTable.variables.nConstituents = GENJETVARS.nConstituents
1216  return proc
1217 
def AddVariablesForAK4GenJets(proc)

◆ AddVariablesForAK8GenJets()

def custom_jme_cff.AddVariablesForAK8GenJets (   proc)

Definition at line 1218 of file custom_jme_cff.py.

Referenced by PrepJMECustomNanoAOD().

1218 def AddVariablesForAK8GenJets(proc):
1219  proc.genJetAK8Table.variables.nConstituents = GENJETVARS.nConstituents
1220  return proc
1221 
1222 #===========================================================================
1223 #
1224 # Misc. functions
1225 #
1226 #===========================================================================
def AddVariablesForAK8GenJets(proc)

◆ AddVariablesForAK8PuppiJets()

def custom_jme_cff.AddVariablesForAK8PuppiJets (   proc)
Add more variables for AK8 PFPUPPI jets

Definition at line 1054 of file custom_jme_cff.py.

References common_cff.Var().

Referenced by PrepJMECustomNanoAOD().

1054 def AddVariablesForAK8PuppiJets(proc):
1055  """
1056  Add more variables for AK8 PFPUPPI jets
1057  """
1058 
1059  proc.fatJetTable.variables.rawFactor.precision = 10
1060 
1061  #
1062  # These variables are not stored for AK8PFPUPPI (slimmedJetsAK8)
1063  # in MiniAOD if their pt < 170 GeV. Hence the conditional fill.
1064  #
1065  proc.fatJetTable.variables.chHEF = Var("?isPFJet()?chargedHadronEnergyFraction():-1", float, doc="charged Hadron Energy Fraction", precision = 6)
1066  proc.fatJetTable.variables.neHEF = Var("?isPFJet()?neutralHadronEnergyFraction():-1", float, doc="neutral Hadron Energy Fraction", precision = 6)
1067  proc.fatJetTable.variables.chEmEF = Var("?isPFJet()?chargedEmEnergyFraction():-1", float, doc="charged Electromagnetic Energy Fraction", precision = 6)
1068  proc.fatJetTable.variables.neEmEF = Var("?isPFJet()?neutralEmEnergyFraction():-1", float, doc="neutral Electromagnetic Energy Fraction", precision = 6)
1069  proc.fatJetTable.variables.muEF = Var("?isPFJet()?muonEnergyFraction():-1", float, doc="muon Energy Fraction", precision = 6)
1070  proc.fatJetTable.variables.hfHEF = Var("?isPFJet()?HFHadronEnergyFraction():-1", float, doc="energy fraction in forward hadronic calorimeter", precision = 6)
1071  proc.fatJetTable.variables.hfEmEF = Var("?isPFJet()?HFEMEnergyFraction():-1", float, doc="energy fraction in forward EM calorimeter", precision = 6)
1072  proc.fatJetTable.variables.nConstChHads = Var("?isPFJet()?chargedHadronMultiplicity():-1",int, doc="number of charged hadrons in the jet")
1073  proc.fatJetTable.variables.nConstNeuHads = Var("?isPFJet()?neutralHadronMultiplicity():-1",int, doc="number of neutral hadrons in the jet")
1074  proc.fatJetTable.variables.nConstHFHads = Var("?isPFJet()?HFHadronMultiplicity():-1", int, doc="number of HF Hadrons in the jet")
1075  proc.fatJetTable.variables.nConstHFEMs = Var("?isPFJet()?HFEMMultiplicity():-1", int, doc="number of HF EMs in the jet")
1076  proc.fatJetTable.variables.nConstMuons = Var("?isPFJet()?muonMultiplicity():-1", int, doc="number of muons in the jet")
1077  proc.fatJetTable.variables.nConstElecs = Var("?isPFJet()?electronMultiplicity():-1", int, doc="number of electrons in the jet")
1078  proc.fatJetTable.variables.nConstPhotons = Var("?isPFJet()?photonMultiplicity():-1", int, doc="number of photons in the jet")
1079 
1080  return proc
1081 #******************************************
1082 #
1083 #
1084 # Gen Jets related functions
1085 #
1086 #
1087 #******************************************
def Var(expr, valtype, doc=None, precision=-1)
Definition: common_cff.py:16
def AddVariablesForAK8PuppiJets(proc)

◆ PrepJMECustomNanoAOD()

def custom_jme_cff.PrepJMECustomNanoAOD (   process,
  runOnMC 
)

Definition at line 1247 of file custom_jme_cff.py.

References AddNewAK8CHSJets(), AddNewAK8GenJetsForJEC(), AddNewAK8PuppiJetsForJEC(), AddNewGenJets(), AddNewPatJets(), AddVariablesForAK4GenJets(), AddVariablesForAK8GenJets(), AddVariablesForAK8PuppiJets(), ReclusterAK4CHSJets(), ReclusterAK4GenJets(), ReclusterAK4PuppiJets(), and RemoveAllJetPtCuts().

Referenced by PrepJMECustomNanoAOD_Data(), and PrepJMECustomNanoAOD_MC().

1247 def PrepJMECustomNanoAOD(process,runOnMC):
1248 
1249 
1252  process = RemoveAllJetPtCuts(process)
1253 
1254 
1259  genJA = GenJetAdder()
1260  if runOnMC:
1261 
1264  process = AddVariablesForAK8GenJets(process)
1265 
1268  process = AddNewAK8GenJetsForJEC(process, genJA)
1269 
1272  process = ReclusterAK4GenJets(process, genJA)
1273  process = AddVariablesForAK4GenJets(process)
1274 
1277  for jetConfig in config_genjets:
1278  cfg = { k : v for k, v in jetConfig.items() if k != "enabled"}
1279  genJetInfo = genJA.addGenJetCollection(process, **cfg)
1280  AddNewGenJets(process, genJetInfo)
1281 
1282 
1287  recoJA = RecoJetAdder(runOnMC=runOnMC)
1288 
1291  process = AddVariablesForAK8PuppiJets(process)
1292 
1295  process = AddNewAK8PuppiJetsForJEC(process, recoJA, runOnMC)
1296 
1299  process = AddNewAK8CHSJets(process, recoJA, runOnMC)
1300 
1303  process = ReclusterAK4CHSJets(process, recoJA, runOnMC)
1304 
1307  process = ReclusterAK4PuppiJets(process, recoJA, runOnMC)
1308 
1311  for jetConfig in config_recojets:
1312  cfg = { k : v for k, v in jetConfig.items() if k != "enabled"}
1313  recoJetInfo = recoJA.addRecoJetCollection(process, **cfg)
1314  AddNewPatJets(process, recoJetInfo, runOnMC)
1315 
1316 
1321  def addAK4JetTasks(proc, addAK4CHSJetTasks, addAK4PuppiJetTasks):
1322  if addAK4CHSJetTasks:
1323  proc.nanoTableTaskCommon.add(proc.jetTask)
1324  proc.nanoTableTaskCommon.add(proc.jetTablesTask)
1325  proc.nanoTableTaskCommon.add(proc.jetForMETTask)
1326  if addAK4PuppiJetTasks:
1327  proc.nanoTableTaskCommon.add(proc.jetPuppiTask)
1328  proc.nanoTableTaskCommon.add(proc.jetPuppiTablesTask)
1329  proc.nanoTableTaskCommon.add(proc.jetPuppiForMETTask)
1330  return proc
1331 
1332  jmeNano_addAK4JetTasks_switch = cms.PSet(
1333  jmeNano_addAK4CHS_switch = cms.untracked.bool(True),
1334  jmeNano_addAK4Puppi_switch = cms.untracked.bool(False)
1335  )
1336  run2_nanoAOD_ANY.toModify(jmeNano_addAK4JetTasks_switch,
1337  jmeNano_addAK4CHS_switch = False,
1338  jmeNano_addAK4Puppi_switch = True
1339  )
1340  process = addAK4JetTasks(process,
1341  addAK4CHSJetTasks = jmeNano_addAK4JetTasks_switch.jmeNano_addAK4CHS_switch,
1342  addAK4PuppiJetTasks = jmeNano_addAK4JetTasks_switch.jmeNano_addAK4Puppi_switch,
1343  )
1344 
1345 
1348  if runOnMC:
1349  process.puTable.savePtHatMax = True
1350 
1351 
1354  if runOnMC:
1355  process.genWeightsTable.keepAllPSWeights = True
1356 
1357  return process
1358 
def ReclusterAK4CHSJets(proc, recoJA, runOnMC)
def RemoveAllJetPtCuts(proc)
def PrepJMECustomNanoAOD(process, runOnMC)
def AddNewPatJets(proc, recoJetInfo, runOnMC)
def ReclusterAK4GenJets(proc, genJA)
def AddNewAK8CHSJets(proc, recoJA, runOnMC)
def AddNewAK8GenJetsForJEC(proc, genJA)
def ReclusterAK4PuppiJets(proc, recoJA, runOnMC)
def AddNewAK8PuppiJetsForJEC(proc, recoJA, runOnMC)
def AddNewGenJets(proc, genJetInfo)
def AddVariablesForAK4GenJets(proc)
def AddVariablesForAK8PuppiJets(proc)
def AddVariablesForAK8GenJets(proc)

◆ PrepJMECustomNanoAOD_Data()

def custom_jme_cff.PrepJMECustomNanoAOD_Data (   process)

Definition at line 1364 of file custom_jme_cff.py.

References PrepJMECustomNanoAOD().

1364 def PrepJMECustomNanoAOD_Data(process):
1365  process = PrepJMECustomNanoAOD(process,runOnMC=False)
1366  return process
1367 
def PrepJMECustomNanoAOD(process, runOnMC)
def PrepJMECustomNanoAOD_Data(process)

◆ PrepJMECustomNanoAOD_MC()

def custom_jme_cff.PrepJMECustomNanoAOD_MC (   process)

Definition at line 1359 of file custom_jme_cff.py.

References PrepJMECustomNanoAOD().

1359 def PrepJMECustomNanoAOD_MC(process):
1360  process = PrepJMECustomNanoAOD(process,runOnMC=True)
1361 
1362  return process
1363 
def PrepJMECustomNanoAOD(process, runOnMC)
def PrepJMECustomNanoAOD_MC(process)

◆ ReclusterAK4CHSJets()

def custom_jme_cff.ReclusterAK4CHSJets (   proc,
  recoJA,
  runOnMC 
)
Recluster AK4 CHS jets and replace slimmedJets that is used as default to
save AK4 CHS jets in NanoAODs (for Run-2).

Definition at line 770 of file custom_jme_cff.py.

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

Referenced by PrepJMECustomNanoAOD().

770 def ReclusterAK4CHSJets(proc, recoJA, runOnMC):
771  """
772  Recluster AK4 CHS jets and replace slimmedJets that is used as default to
773  save AK4 CHS jets in NanoAODs (for Run-2).
774  """
775  print("custom_jme_cff::ReclusterAK4CHSJets: Recluster AK4 PF CHS jets")
776 
777  #
778  # Recluster AK4 CHS jets
779  #
780  cfg = {
781  "jet" : "ak4pfchs",
782  "inputCollection" : "",
783  "genJetsCollection": "AK4GenJetsNoNu",
784  "bTagDiscriminators": bTagDiscriminatorsForAK4,
785  "minPtFastjet" : 0.,
786  }
787  recoJetInfo = recoJA.addRecoJetCollection(proc, **cfg)
788 
789  jetName = recoJetInfo.jetUpper
790  patJetFinalColl = recoJetInfo.patJetFinalCollection
791 
792  #
793  # Change the input jet source for jetCorrFactorsNano
794  # and updatedJets
795  #
796  proc.jetCorrFactorsNano.src=patJetFinalColl
797  proc.updatedJets.jetSource=patJetFinalColl
798 
799  #
800  # Change pt cut
801  #
802  finalJetsCut = ""
803  if runOnMC:
804  finalJetsCut = "(pt >= 8) || ((pt < 8) && (genJetFwdRef().backRef().isNonnull()))"
805  else:
806  finalJetsCut = "(pt >= 8)"
807 
808  proc.finalJets.cut = finalJetsCut
809  #
810  # Add a minimum pt cut for corrT1METJets.
811  #
812  proc.corrT1METJetTable.cut = "pt>=8 && pt<15 && abs(eta)<9.9"
813 
814  #
815  # Jet table cut
816  #
817  jetTableCut = "" # must not have any cut at the jetTable for AK4 CHS as it has been cross-cleaned
818  proc.jetTable.src = cms.InputTag("finalJets")
819  proc.jetTable.cut = jetTableCut
820  proc.jetMCTable.cut = jetTableCut
821  proc.jetTable.name = "JetCHS"
822 
823  #
824  # For Run-2 eras, the main AK4 jet collection in NanoAOD is the CHS collection
825  #
826  run2_nanoAOD_ANY.toModify(
827  proc.jetTable,
828  src = cms.InputTag("linkedObjects","jets"),
829  name = "Jet"
830  )
831 
832  #
833  # Jet table documentation
834  #
835  jetTableDoc = "AK4 PF CHS jets with JECs applied. Jets with pt >= 8 GeV are stored."
836  if runOnMC:
837  jetTableDoc += "For jets with pt < 8 GeV, only those matched to AK4 Gen jets are stored."
838  proc.jetTable.doc = jetTableDoc
839 
840  proc.jetTable.variables.rawFactor.precision = 10
841 
842  #
843  # Add variables
844  #
845  proc.jetTable.variables.hfHEF = PFJETVARS.hfHEF
846  proc.jetTable.variables.hfEmEF = PFJETVARS.hfEmEF
847  proc.jetTable.variables.nConstChHads = PFJETVARS.nConstChHads
848  proc.jetTable.variables.nConstNeuHads = PFJETVARS.nConstNeuHads
849  proc.jetTable.variables.nConstHFHads = PFJETVARS.nConstHFHads
850  proc.jetTable.variables.nConstHFEMs = PFJETVARS.nConstHFEMs
851  proc.jetTable.variables.nConstMuons = PFJETVARS.nConstMuons
852  proc.jetTable.variables.nConstElecs = PFJETVARS.nConstElecs
853  proc.jetTable.variables.nConstPhotons = PFJETVARS.nConstPhotons
854 
855  #
856  # Add charged energy fraction from other primary vertices
857  #
858  proc.updatedJetsWithUserData.userFloats.chFPV1EF = cms.InputTag("jercVars:chargedFromPV1EnergyFraction")
859  proc.updatedJetsWithUserData.userFloats.chFPV2EF = cms.InputTag("jercVars:chargedFromPV2EnergyFraction")
860  proc.updatedJetsWithUserData.userFloats.chFPV3EF = cms.InputTag("jercVars:chargedFromPV3EnergyFraction")
861  proc.jetTable.variables.chFPV1EF = Var("userFloat('chFPV1EF')", float, doc="charged fromPV==1 Energy Fraction (component of the total charged Energy Fraction).", precision= 6)
862  proc.jetTable.variables.chFPV2EF = Var("userFloat('chFPV2EF')", float, doc="charged fromPV==2 Energy Fraction (component of the total charged Energy Fraction).", precision= 6)
863  proc.jetTable.variables.chFPV3EF = Var("userFloat('chFPV3EF')", float, doc="charged fromPV==3 Energy Fraction (component of the total charged Energy Fraction).", precision= 6)
864 
865  #
866  # Add variables for pileup jet ID studies.
867  #
868  proc = AddPileUpJetIDVars(proc,
869  jetName = jetName,
870  jetSrc = "updatedJets",
871  jetTableName = "jetTable",
872  jetTaskName = "jetTask"
873  )
874  #
875  # Add variables for quark guon likelihood tagger studies.
876  # Save variables as userFloats and userInts in each jet
877  #
878  proc.updatedJetsWithUserData.userFloats.qgl_axis2 = cms.InputTag("qgtagger:axis2")
879  proc.updatedJetsWithUserData.userFloats.qgl_ptD = cms.InputTag("qgtagger:ptD")
880  proc.updatedJetsWithUserData.userInts.qgl_mult = cms.InputTag("qgtagger:mult")
881  #
882  # Save quark gluon likelihood input variables variables
883  #
884  proc.jetTable.variables.qgl_axis2 = QGLVARS.qgl_axis2
885  proc.jetTable.variables.qgl_ptD = QGLVARS.qgl_ptD
886  proc.jetTable.variables.qgl_mult = QGLVARS.qgl_mult
887  #
888  # Save standard b-tagging and c-tagging variables
889  #
890  proc.jetTable.variables.btagDeepB = BTAGVARS.btagDeepB
891  proc.jetTable.variables.btagDeepCvL = BTAGVARS.btagDeepCvL
892  proc.jetTable.variables.btagDeepCvB = BTAGVARS.btagDeepCvB
893  #
894  # Save DeepJet b-tagging and c-tagging variables
895  #
896  proc.jetTable.variables.btagDeepFlavB = DEEPJETVARS.btagDeepFlavB
897  proc.jetTable.variables.btagDeepFlavCvL = DEEPJETVARS.btagDeepFlavCvL
898  proc.jetTable.variables.btagDeepFlavCvB = DEEPJETVARS.btagDeepFlavCvB
899  #
900  # Save DeepJet raw score for gluon and light quarks
901  #
902  proc.jetTable.variables.btagDeepFlavG = DEEPJETVARS.btagDeepFlavG
903  proc.jetTable.variables.btagDeepFlavUDS = DEEPJETVARS.btagDeepFlavUDS
904  proc.jetTable.variables.btagDeepFlavQG = DEEPJETVARS.btagDeepFlavQG
905  #
906  # Save RobustParTAK4 b-tagging and c-tagging variables
907  #
908  proc.jetTable.variables.btagRobustParTAK4B = ROBUSTPARTAK4VARS.btagRobustParTAK4B
909  proc.jetTable.variables.btagRobustParTAK4CvL = ROBUSTPARTAK4VARS.btagRobustParTAK4CvL
910  proc.jetTable.variables.btagRobustParTAK4CvB = ROBUSTPARTAK4VARS.btagRobustParTAK4CvB
911  #
912  # Add ParticleNetAK4 scores
913  #
914  proc.jetTable.variables.particleNetAK4_B = PARTICLENETAK4VARS.particleNetAK4_B
915  proc.jetTable.variables.particleNetAK4_CvsL = PARTICLENETAK4VARS.particleNetAK4_CvsL
916  proc.jetTable.variables.particleNetAK4_CvsB = PARTICLENETAK4VARS.particleNetAK4_CvsB
917  proc.jetTable.variables.particleNetAK4_QvsG = PARTICLENETAK4VARS.particleNetAK4_QvsG
918  proc.jetTable.variables.particleNetAK4_G = PARTICLENETAK4VARS.particleNetAK4_G
919  proc.jetTable.variables.particleNetAK4_puIdDisc = PARTICLENETAK4VARS.particleNetAK4_puIdDisc
920 
921  #Adding hf shower shape producer to the jet sequence. By default this producer is not automatically rerun at the NANOAOD step
922  #The following lines make sure it is.
923  hfJetShowerShapeforCustomNanoAOD = "hfJetShowerShapeforCustomNanoAOD"
924  setattr(proc, hfJetShowerShapeforCustomNanoAOD, hfJetShowerShape.clone(jets="updatedJets", vertices="offlineSlimmedPrimaryVertices") )
925  proc.jetUserDataTask.add(getattr(proc, hfJetShowerShapeforCustomNanoAOD))
926  proc.updatedJetsWithUserData.userFloats.hfsigmaEtaEta = cms.InputTag('hfJetShowerShapeforCustomNanoAOD:sigmaEtaEta')
927  proc.updatedJetsWithUserData.userFloats.hfsigmaPhiPhi = cms.InputTag('hfJetShowerShapeforCustomNanoAOD:sigmaPhiPhi')
928  proc.updatedJetsWithUserData.userInts.hfcentralEtaStripSize = cms.InputTag('hfJetShowerShapeforCustomNanoAOD:centralEtaStripSize')
929  proc.updatedJetsWithUserData.userInts.hfadjacentEtaStripsSize = cms.InputTag('hfJetShowerShapeforCustomNanoAOD:adjacentEtaStripsSize')
930  proc.jetTable.variables.hfsigmaEtaEta = Var("userFloat('hfsigmaEtaEta')",float,doc="sigmaEtaEta for HF jets (noise discriminating variable)",precision=10)
931  proc.jetTable.variables.hfsigmaPhiPhi = Var("userFloat('hfsigmaPhiPhi')",float,doc="sigmaPhiPhi for HF jets (noise discriminating variable)",precision=10)
932  proc.jetTable.variables.hfcentralEtaStripSize = Var("userInt('hfcentralEtaStripSize')", int, doc="eta size of the central tower strip in HF (noise discriminating variable) ")
933  proc.jetTable.variables.hfadjacentEtaStripsSize = Var("userInt('hfadjacentEtaStripsSize')", int, doc="eta size of the strips next to the central tower strip in HF (noise discriminating variable) ")
934 
935  #
936  # Since AK4 Puppi jet is the main AK4 jet collection for Run-3, disable
937  # b-jets/c-jets NN-based mass regression for AK4 CHS.
938  #
939  (~run2_nanoAOD_ANY).toReplaceWith(
940  proc.jetUserDataTask,
941  proc.jetUserDataTask.copyAndExclude([proc.bJetVars])
942  ).toReplaceWith(
943  proc.jetTablesTask,
944  proc.jetTablesTask.copyAndExclude([proc.bjetNN, proc.cjetNN])
945  ).toModify(proc.updatedJetsWithUserData.userFloats,
946  leadTrackPt = None,
947  leptonPtRelv0 = None,
948  leptonPtRelInvv0 = None,
949  leptonDeltaR = None,
950  vtxPt = None,
951  vtxMass = None,
952  vtx3dL = None,
953  vtx3deL = None,
954  ptD = None,
955  ).toModify(
956  proc.updatedJetsWithUserData.userInts,
957  vtxNtrk = None,
958  leptonPdgId = None
959  ).toModify(
960  proc.jetTable, externalVariables = cms.PSet()
961  ).toReplaceWith(
962  #
963  # For Run-3, don't need to save the low pt AK4 CHS jet table for MET
964  #
965  proc.jetForMETTask,
966  proc.jetForMETTask.copyAndExclude([proc.corrT1METJetTable])
967  )
968 
969  #
970  # Save MC-only jet variables in jet table
971  #
972  if runOnMC:
973  jetMCTableName = "jet{}MCTable".format(jetName)
974  setattr(proc, jetMCTableName, proc.jetMCTable.clone(
975  src = proc.jetTable.src,
976  name = proc.jetTable.name
977  )
978  )
979  jetMCTableTaskName = "jet{}MCTablesTask".format(jetName)
980  setattr(proc, jetMCTableTaskName, cms.Task(getattr(proc,jetMCTableName)))
981 
982  (~run2_nanoAOD_ANY).toReplaceWith(
983  proc.nanoTableTaskFS,
984  proc.nanoTableTaskFS.copyAndAdd(getattr(proc,jetMCTableTaskName))
985  )
986 
987  return proc
988 
def ReclusterAK4CHSJets(proc, recoJA, runOnMC)
def Var(expr, valtype, doc=None, precision=-1)
Definition: common_cff.py:16
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def AddPileUpJetIDVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")

◆ ReclusterAK4GenJets()

def custom_jme_cff.ReclusterAK4GenJets (   proc,
  genJA 
)
Recluster AK4 Gen jets and replace
slimmedGenJets that is used as default
to save AK4 Gen jets in NanoAODs.

Definition at line 1148 of file custom_jme_cff.py.

References print().

Referenced by PrepJMECustomNanoAOD().

1148 def ReclusterAK4GenJets(proc, genJA):
1149  """
1150  Recluster AK4 Gen jets and replace
1151  slimmedGenJets that is used as default
1152  to save AK4 Gen jets in NanoAODs.
1153  """
1154  print("custom_jme_cff::ReclusterAK4GenJets: Recluster AK4 Gen jets")
1155 
1156  #
1157  # Recluster AK4 Gen jet
1158  #
1159  cfg = {
1160  "jet" : "ak4gen",
1161  }
1162  genJetInfo = genJA.addGenJetCollection(proc, **cfg)
1163 
1164  genJetName = genJetInfo.jetUpper
1165  genJetAlgo = genJetInfo.jetAlgo
1166  genJetSize = genJetInfo.jetSize
1167  genJetSizeNr = genJetInfo.jetSizeNr
1168  selectedGenJets = "{}{}{}".format(genJetAlgo.upper(), genJetSize, "GenJetsNoNu")
1169 
1170  #
1171  # Change jet source to the newly clustered jet collection. Set very low pt cut for jets
1172  # to be stored in the GenJet Table
1173  #
1174  proc.genJetTable.src = selectedGenJets
1175  proc.genJetTable.cut = "" # No cut specified here. Save all gen jets after clustering
1176  proc.genJetTable.doc = "AK4 Gen jets (made with visible genparticles) with pt > 3 GeV" # default pt cut after clustering is 3 GeV
1177 
1178  genJetFlavourAssociationName = "genJet{}FlavourAssociation".format(genJetName)
1179  setattr(proc, genJetFlavourAssociationName, genJetFlavourAssociation.clone(
1180  jets = proc.genJetTable.src,
1181  jetAlgorithm = supportedJetAlgos[genJetAlgo],
1182  rParam = genJetSizeNr,
1183  )
1184  )
1185  proc.jetMCTask.add(getattr(proc, genJetFlavourAssociationName))
1186  return proc
1187 
def ReclusterAK4GenJets(proc, genJA)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

◆ ReclusterAK4PuppiJets()

def custom_jme_cff.ReclusterAK4PuppiJets (   proc,
  recoJA,
  runOnMC 
)
Recluster AK4 Puppi jets and replace slimmedJetsPuppi
that is used as default to save AK4 Puppi jets in NanoAODs.

Definition at line 603 of file custom_jme_cff.py.

References AddPileUpJetIDVars(), AddQGLTaggerVars(), and print().

Referenced by PrepJMECustomNanoAOD().

603 def ReclusterAK4PuppiJets(proc, recoJA, runOnMC):
604  """
605  Recluster AK4 Puppi jets and replace slimmedJetsPuppi
606  that is used as default to save AK4 Puppi jets in NanoAODs.
607  """
608  print("custom_jme_cff::ReclusterAK4PuppiJets: Recluster AK4 PF Puppi jets")
609 
610  #
611  # Recluster AK4 Puppi jets
612  #
613  cfg = {
614  "jet" : "ak4pfpuppi",
615  "inputCollection" : "",
616  "genJetsCollection": "AK4GenJetsNoNu",
617  "bTagDiscriminators": bTagDiscriminatorsForAK4,
618  "minPtFastjet" : 0.,
619  }
620  recoJetInfo = recoJA.addRecoJetCollection(proc, **cfg)
621 
622  jetName = recoJetInfo.jetUpper
623  patJetFinalColl = recoJetInfo.patJetFinalCollection
624 
625  #
626  # Set the jetID for UL 16 era
627  #
628  run2_jme_2016.toModify(
629  proc.tightJetPuppiId.filterParams, version = "RUN2UL16PUPPI"
630  ).toModify(
631  proc.tightJetIdLepVeto.filterParams, version = "RUN2UL16PUPPI"
632  )
633 
634  #
635  # Change the input jet source for jetCorrFactorsNano
636  # and updatedJets
637  #
638  proc.jetPuppiCorrFactorsNano.src=patJetFinalColl
639  proc.updatedJetsPuppi.jetSource=patJetFinalColl
640 
641  #
642  # Change pt cut
643  #
644  finalJetsPuppiCut = ""
645  if runOnMC:
646  finalJetsPuppiCut = "(pt >= 8) || ((pt < 8) && (genJetFwdRef().backRef().isNonnull()))"
647  else:
648  finalJetsPuppiCut = "(pt >= 8)"
649 
650  proc.finalJetsPuppi.cut = finalJetsPuppiCut
651  #
652  # Add a minimum pt cut for corrT1METJets.
653  #
654  proc.corrT1METJetPuppiTable.cut = "pt>=8 && pt<15 && abs(eta)<9.9"
655 
656  #
657  # Jet table
658  #
659  # For Run-2 eras, the main AK4 jet collection in NanoAOD is the CHS collection
660  run2_nanoAOD_ANY.toModify(
661  proc.jetTable, name = "Jet"
662  ).toModify(
663  # So need to change the table name for AK4 puppi here
664  proc.jetPuppiTable,
665  name = "JetPuppi",
666  src = cms.InputTag("finalJetsPuppi")
667  )
668 
669  #
670  # Jet table documentation
671  #
672  jetPuppiTableDoc = "AK4 PF Puppi jets with JECs applied. Jets with pt >= 8 GeV are stored."
673  if runOnMC:
674  jetPuppiTableDoc += "For jets with pt < 8 GeV, only those matched to AK4 Gen jets are stored."
675  proc.jetPuppiTable.doc = jetPuppiTableDoc
676 
677  proc.jetPuppiTable.variables.rawFactor.precision = 10
678 
679  #
680  # Add variables
681  #
682  proc.jetPuppiTable.variables.hfHEF = PFJETVARS.hfHEF
683  proc.jetPuppiTable.variables.hfEmEF = PFJETVARS.hfEmEF
684  proc.jetPuppiTable.variables.nConstChHads = PFJETVARS.nConstChHads
685  proc.jetPuppiTable.variables.nConstNeuHads = PFJETVARS.nConstNeuHads
686  proc.jetPuppiTable.variables.nConstHFHads = PFJETVARS.nConstHFHads
687  proc.jetPuppiTable.variables.nConstHFEMs = PFJETVARS.nConstHFEMs
688  proc.jetPuppiTable.variables.nConstMuons = PFJETVARS.nConstMuons
689  proc.jetPuppiTable.variables.nConstElecs = PFJETVARS.nConstElecs
690  proc.jetPuppiTable.variables.nConstPhotons = PFJETVARS.nConstPhotons
691 
692  #
693  # Add variables for pileup jet ID studies.
694  #
695 
696  proc = AddPileUpJetIDVars(proc,
697  jetName = jetName,
698  jetSrc = "updatedJetsPuppi",
699  jetTableName = "jetPuppiTable",
700  jetTaskName = "jetPuppiTask"
701  )
702  #
703  # Add variables for quark guon likelihood tagger studies.
704  # Save variables as userFloats and userInts in each jet
705  #
706  proc = AddQGLTaggerVars(proc,
707  jetName = jetName,
708  jetSrc = "updatedJetsPuppi",
709  jetTableName = "jetPuppiTable",
710  jetTaskName = "jetPuppiTask",
711  calculateQGLVars=True
712  )
713  #
714  # Save DeepJet b-tagging and c-tagging variables
715  #
716  proc.jetPuppiTable.variables.btagDeepFlavB = DEEPJETVARS.btagDeepFlavB
717  proc.jetPuppiTable.variables.btagDeepFlavCvL = DEEPJETVARS.btagDeepFlavCvL
718  proc.jetPuppiTable.variables.btagDeepFlavCvB = DEEPJETVARS.btagDeepFlavCvB
719  #
720  # Save DeepJet raw score for gluon and light quarks
721  #
722  proc.jetPuppiTable.variables.btagDeepFlavG = DEEPJETVARS.btagDeepFlavG
723  proc.jetPuppiTable.variables.btagDeepFlavUDS = DEEPJETVARS.btagDeepFlavUDS
724  proc.jetPuppiTable.variables.btagDeepFlavQG = DEEPJETVARS.btagDeepFlavQG
725  #
726  # Save RobustParTAK4 b-tagging and c-tagging variables
727  #
728  proc.jetPuppiTable.variables.btagRobustParTAK4B = ROBUSTPARTAK4VARS.btagRobustParTAK4B
729  proc.jetPuppiTable.variables.btagRobustParTAK4CvL = ROBUSTPARTAK4VARS.btagRobustParTAK4CvL
730  proc.jetPuppiTable.variables.btagRobustParTAK4CvB = ROBUSTPARTAK4VARS.btagRobustParTAK4CvB
731  #
732  # Add ParticleNetAK4 scores
733  #
734  proc.jetPuppiTable.variables.particleNetAK4_B = PARTICLENETAK4VARS.particleNetAK4_B
735  proc.jetPuppiTable.variables.particleNetAK4_CvsL = PARTICLENETAK4VARS.particleNetAK4_CvsL
736  proc.jetPuppiTable.variables.particleNetAK4_CvsB = PARTICLENETAK4VARS.particleNetAK4_CvsB
737  proc.jetPuppiTable.variables.particleNetAK4_QvsG = PARTICLENETAK4VARS.particleNetAK4_QvsG
738  proc.jetPuppiTable.variables.particleNetAK4_G = PARTICLENETAK4VARS.particleNetAK4_G
739  proc.jetPuppiTable.variables.particleNetAK4_puIdDisc = PARTICLENETAK4VARS.particleNetAK4_puIdDisc
740 
741  #
742  # For Run-2 eras, don't need to save the low pt AK4 Puppi jet table for MET
743  #
744  run2_nanoAOD_ANY.toReplaceWith(
745  proc.jetPuppiForMETTask,
746  proc.jetPuppiForMETTask.copyAndExclude([proc.corrT1METJetPuppiTable])
747  )
748 
749  #
750  # Save MC-only jet variables in jet table
751  #
752  if runOnMC:
753 
754  jetMCTableName = "jet{}MCTable".format(jetName)
755  setattr(proc, jetMCTableName, proc.jetMCTable.clone(
756  src = proc.jetPuppiTable.src,
757  name = proc.jetPuppiTable.name
758  )
759  )
760  jetMCTableTaskName = "jet{}MCTablesTask".format(jetName)
761  setattr(proc, jetMCTableTaskName, cms.Task(getattr(proc,jetMCTableName)))
762 
763  run2_nanoAOD_ANY.toReplaceWith(
764  proc.nanoTableTaskFS,
765  proc.nanoTableTaskFS.copyAndAdd( getattr(proc,jetMCTableTaskName))
766  )
767 
768  return proc
769 
def AddQGLTaggerVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="", calculateQGLVars=False)
def ReclusterAK4PuppiJets(proc, recoJA, runOnMC)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def AddPileUpJetIDVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")

◆ RemoveAllJetPtCuts()

def custom_jme_cff.RemoveAllJetPtCuts (   proc)
Remove default pt cuts for all jets set in jets_cff.py

Definition at line 1227 of file custom_jme_cff.py.

Referenced by PrepJMECustomNanoAOD().

1227 def RemoveAllJetPtCuts(proc):
1228  """
1229  Remove default pt cuts for all jets set in jets_cff.py
1230  """
1231 
1232  proc.finalJets.cut = "" # 15 -> 10
1233  proc.finalJetsPuppi.cut = "" # 15 -> 10
1234  proc.finalJetsAK8.cut = "" # 170 -> 170
1235  proc.genJetTable.cut = "" # 10 -> 8
1236  proc.genJetFlavourTable.cut = "" # 10 -> 8
1237  proc.genJetAK8Table.cut = "" # 100 -> 80
1238  proc.genJetAK8FlavourTable.cut = "" # 100 -> 80
1239 
1240  return proc
1241 
1242 #===========================================================================
1243 #
1244 # CUSTOMIZATION function
1245 #
1246 #===========================================================================
def RemoveAllJetPtCuts(proc)

◆ SaveGenJets()

def custom_jme_cff.SaveGenJets (   proc,
  genJetName,
  genJetAlgo,
  genJetSizeNr,
  genJetFinalColl,
  genJetTablePrefix,
  genJetTableDoc,
  runOnMC = False 
)
Schedule modules for a given genJet collection and save its variables into custom NanoAOD

Definition at line 1105 of file custom_jme_cff.py.

Referenced by AddNewAK8GenJetsForJEC(), and AddNewGenJets().

1105 def SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False):
1106  """
1107  Schedule modules for a given genJet collection and save its variables into custom NanoAOD
1108  """
1109 
1110  genJetTableName = "jet{}Table".format(genJetName)
1111  setattr(proc, genJetTableName, genJetTable.clone(
1112  src = genJetFinalColl,
1113  cut = "", # No cut specified here. Save all gen jets after clustering
1114  name = genJetTablePrefix,
1115  doc = genJetTableDoc,
1116  variables = GENJETVARS
1117  )
1118  )
1119 
1120  genJetFlavourAssociationName = "genJet{}FlavourAssociation".format(genJetName)
1121  setattr(proc, genJetFlavourAssociationName, genJetFlavourAssociation.clone(
1122  jets = getattr(proc,genJetTableName).src,
1123  jetAlgorithm = supportedJetAlgos[genJetAlgo],
1124  rParam = genJetSizeNr,
1125  )
1126  )
1127 
1128  genJetFlavourTableName = "genJet{}FlavourTable".format(genJetName)
1129  setattr(proc, genJetFlavourTableName, genJetFlavourTable.clone(
1130  name = getattr(proc,genJetTableName).name,
1131  src = getattr(proc,genJetTableName).src,
1132  cut = getattr(proc,genJetTableName).cut,
1133  jetFlavourInfos = genJetFlavourAssociationName,
1134  )
1135  )
1136 
1137  genJetTaskName = "genJet{}Task".format(genJetName)
1138  setattr(proc, genJetTaskName, cms.Task(
1139  getattr(proc,genJetTableName),
1140  getattr(proc,genJetFlavourAssociationName),
1141  getattr(proc,genJetFlavourTableName)
1142  )
1143  )
1144  proc.jetMCTask.add(getattr(proc,genJetTaskName))
1145 
1146  return proc
1147 
def SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)

◆ SavePatJets()

def custom_jme_cff.SavePatJets (   proc,
  jetName,
  payload,
  patJetFinalColl,
  jetTablePrefix,
  jetTableDoc,
  doPF,
  doCalo,
  ptcut,
  doPUIDVar = False,
  doQGL = False,
  doBTag = False,
  runOnMC = False 
)
Schedule modules for a given patJet collection and save its variables into custom NanoAOD

Definition at line 460 of file custom_jme_cff.py.

References AddBTaggingScores(), AddDeepJetGluonLQuarkScores(), AddJetID(), AddParticleNetAK4Scores(), AddPileUpJetIDVars(), AddQGLTaggerVars(), AddRobustParTAK4Scores(), and common_cff.Var().

Referenced by AddNewAK8CHSJets(), AddNewAK8PuppiJetsForJEC(), and AddNewPatJets().

460  doPF, doCalo, ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=False):
461  """
462  Schedule modules for a given patJet collection and save its variables into custom NanoAOD
463  """
464 
465  #
466  # Setup jet correction factors
467  #
468  jetCorrFactors = "jetCorrFactorsNano{}".format(jetName)
469  setattr(proc, jetCorrFactors, jetCorrFactorsNano.clone(
470  src = patJetFinalColl,
471  payload = payload,
472  )
473  )
474 
475  #
476  # Update jets
477  #
478  srcJets = "updatedJets{}".format(jetName)
479  setattr(proc, srcJets, updatedJets.clone(
480  jetSource = patJetFinalColl,
481  jetCorrFactorsSource = [jetCorrFactors],
482  )
483  )
484 
485  #
486  # Setup UserDataEmbedder
487  #
488  srcJetsWithUserData = "updatedJets{}WithUserData".format(jetName)
489  setattr(proc, srcJetsWithUserData, cms.EDProducer("PATJetUserDataEmbedder",
490  src = cms.InputTag(srcJets),
491  userFloats = cms.PSet(),
492  userInts = cms.PSet(),
493  )
494  )
495 
496  #
497  # Filter jets with pt cut
498  #
499  finalJetsCut = "(pt >= {ptcut:.0f})".format(ptcut=ptcut)
500  if runOnMC:
501  finalJetsCut = "(pt >= {ptcut:.0f}) || ((pt < {ptcut:.0f}) && (genJetFwdRef().backRef().isNonnull()))".format(ptcut=ptcut)
502 
503  finalJetsForTable = "finalJets{}".format(jetName)
504  setattr(proc, finalJetsForTable, finalJets.clone(
505  src = srcJetsWithUserData,
506  cut = finalJetsCut
507  )
508  )
509 
510  #
511  # Save jets in table
512  #
513  tableContent = PFJETVARS
514  if doCalo:
515  tableContent = CALOJETVARS
516 
517  jetTableCutDefault = "" #Don't apply any cuts for the table.
518 
519  jetTableDocDefault = jetTableDoc + " with JECs applied. Jets with pt >= {ptcut:.0f} GeV are stored.".format(ptcut=ptcut)
520  if runOnMC:
521  jetTableDocDefault += "For jets with pt < {ptcut:.0f} GeV, only those matched to gen jets are stored.".format(ptcut=ptcut)
522 
523  if doCalo:
524  jetTableDocDefault = jetTableDoc
525 
526  jetTableName = "jet{}Table".format(jetName)
527  setattr(proc,jetTableName, simpleCandidateFlatTableProducer.clone(
528  src = cms.InputTag(finalJetsForTable),
529  cut = cms.string(jetTableCutDefault),
530  name = cms.string(jetTablePrefix),
531  doc = cms.string(jetTableDocDefault),
532  variables = cms.PSet(tableContent)
533  )
534  )
535  getattr(proc,jetTableName).variables.pt.precision=10
536  getattr(proc,jetTableName).variables.rawFactor.precision=10
537 
538  #
539  # Save MC-only jet variables in table
540  #
541  jetMCTableName = "jet{}MCTable".format(jetName)
542  setattr(proc, jetMCTableName, simpleCandidateFlatTableProducer.clone(
543  src = cms.InputTag(finalJetsForTable),
544  cut = getattr(proc,jetTableName).cut,
545  name = cms.string(jetTablePrefix),
546  extension = cms.bool(True), # this is an extension table
547  variables = cms.PSet(
548  partonFlavour = Var("partonFlavour()", int, doc="flavour from parton matching"),
549  hadronFlavour = Var("hadronFlavour()", int, doc="flavour from hadron ghost clustering"),
550  genJetIdx = Var("?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, doc="index of matched gen jet"),
551  )
552  )
553  )
554 
555  #
556  # Define the jet modules Task first
557  #
558  jetTaskName = "jet{}Task".format(jetName)
559  setattr(proc, jetTaskName, cms.Task(
560  getattr(proc,jetCorrFactors),
561  getattr(proc,srcJets),
562  getattr(proc,srcJetsWithUserData),
563  getattr(proc,finalJetsForTable)
564  )
565  )
566  proc.nanoTableTaskCommon.add(getattr(proc,jetTaskName))
567 
568  #
569  # Define the jet tables Task
570  #
571  jetTableTaskName = "jet{}TablesTask".format(jetName)
572  setattr(proc, jetTableTaskName, cms.Task(getattr(proc,jetTableName)))
573  proc.nanoTableTaskCommon.add(getattr(proc,jetTableTaskName))
574 
575  jetMCTableTaskName = "jet{}MCTablesTask".format(jetName)
576  setattr(proc, jetMCTableTaskName, cms.Task(getattr(proc,jetMCTableName)))
577  if runOnMC:
578  proc.nanoTableTaskFS.add(getattr(proc,jetMCTableTaskName))
579 
580  #
581  # Schedule plugins to calculate Jet ID, PileUp Jet ID input variables, and Quark-Gluon Likehood input variables.
582  #
583  if doPF:
584  proc = AddJetID(proc, jetName=jetName, jetSrc=srcJets, jetTableName=jetTableName, jetTaskName=jetTaskName)
585  if doPUIDVar:
586  proc = AddPileUpJetIDVars(proc, jetName=jetName, jetSrc=srcJets, jetTableName=jetTableName, jetTaskName=jetTaskName)
587  if doQGL:
588  proc = AddQGLTaggerVars(proc,jetName=jetName, jetSrc=srcJets, jetTableName=jetTableName, jetTaskName=jetTaskName, calculateQGLVars=True)
589 
590  #
591  # Save b-tagging algorithm scores. Should only be done for jet collection with b-tagging
592  # calculated when reclustered or collection saved with b-tagging info in MiniAOD
593  #
594  if doBTag:
595  AddBTaggingScores(proc,jetTableName=jetTableName)
596  AddDeepJetGluonLQuarkScores(proc,jetTableName=jetTableName)
597  AddParticleNetAK4Scores(proc,jetTableName=jetTableName)
598  AddRobustParTAK4Scores(proc,jetTableName=jetTableName)
599 
600  return proc
601 
602 
def AddBTaggingScores(proc, jetTableName="")
def AddQGLTaggerVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="", calculateQGLVars=False)
def Var(expr, valtype, doc=None, precision=-1)
Definition: common_cff.py:16
def AddRobustParTAK4Scores(proc, jetTableName="")
def AddDeepJetGluonLQuarkScores(proc, jetTableName="")
def AddJetID(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")
def AddParticleNetAK4Scores(proc, jetTableName="")
def AddPileUpJetIDVars(proc, jetName="", jetSrc="", jetTableName="", jetTaskName="")

Variable Documentation

◆ area

◆ bTagCSVV2

custom_jme_cff.bTagCSVV2

Definition at line 21 of file custom_jme_cff.py.

◆ btagDDX

custom_jme_cff.btagDDX

Definition at line 40 of file custom_jme_cff.py.

◆ btagDDXV2

custom_jme_cff.btagDDXV2

Definition at line 48 of file custom_jme_cff.py.

◆ btagDeepB

custom_jme_cff.btagDeepB

Definition at line 171 of file custom_jme_cff.py.

◆ bTagDeepCSV

custom_jme_cff.bTagDeepCSV

Definition at line 22 of file custom_jme_cff.py.

◆ btagDeepCvB

custom_jme_cff.btagDeepCvB

Definition at line 173 of file custom_jme_cff.py.

◆ btagDeepCvL

custom_jme_cff.btagDeepCvL

Definition at line 172 of file custom_jme_cff.py.

◆ btagDeepFlavB

custom_jme_cff.btagDeepFlavB

Definition at line 176 of file custom_jme_cff.py.

◆ btagDeepFlavC

custom_jme_cff.btagDeepFlavC

Definition at line 177 of file custom_jme_cff.py.

◆ btagDeepFlavCvB

custom_jme_cff.btagDeepFlavCvB

Definition at line 181 of file custom_jme_cff.py.

◆ btagDeepFlavCvL

custom_jme_cff.btagDeepFlavCvL

Definition at line 180 of file custom_jme_cff.py.

◆ btagDeepFlavG

custom_jme_cff.btagDeepFlavG

Definition at line 178 of file custom_jme_cff.py.

◆ btagDeepFlavQG

custom_jme_cff.btagDeepFlavQG

Definition at line 182 of file custom_jme_cff.py.

◆ btagDeepFlavUDS

custom_jme_cff.btagDeepFlavUDS

Definition at line 179 of file custom_jme_cff.py.

◆ bTagDeepJet

custom_jme_cff.bTagDeepJet

Definition at line 23 of file custom_jme_cff.py.

◆ bTagDiscriminatorsForAK4

custom_jme_cff.bTagDiscriminatorsForAK4

Definition at line 29 of file custom_jme_cff.py.

◆ btagHbb

custom_jme_cff.btagHbb

Definition at line 39 of file custom_jme_cff.py.

◆ btagRobustParTAK4B

custom_jme_cff.btagRobustParTAK4B

Definition at line 185 of file custom_jme_cff.py.

◆ btagRobustParTAK4C

custom_jme_cff.btagRobustParTAK4C

Definition at line 186 of file custom_jme_cff.py.

◆ btagRobustParTAK4CvB

custom_jme_cff.btagRobustParTAK4CvB

Definition at line 190 of file custom_jme_cff.py.

◆ btagRobustParTAK4CvL

custom_jme_cff.btagRobustParTAK4CvL

Definition at line 189 of file custom_jme_cff.py.

◆ btagRobustParTAK4G

custom_jme_cff.btagRobustParTAK4G

Definition at line 187 of file custom_jme_cff.py.

◆ btagRobustParTAK4QG

custom_jme_cff.btagRobustParTAK4QG

Definition at line 191 of file custom_jme_cff.py.

◆ btagRobustParTAK4UDS

custom_jme_cff.btagRobustParTAK4UDS

Definition at line 188 of file custom_jme_cff.py.

◆ BTAGVARS

custom_jme_cff.BTAGVARS

Definition at line 170 of file custom_jme_cff.py.

◆ CALOJETVARS

custom_jme_cff.CALOJETVARS

Definition at line 202 of file custom_jme_cff.py.

◆ chEmEF

custom_jme_cff.chEmEF

Definition at line 134 of file custom_jme_cff.py.

◆ chHEF

custom_jme_cff.chHEF

Definition at line 132 of file custom_jme_cff.py.

◆ config_genjets

custom_jme_cff.config_genjets

Definition at line 60 of file custom_jme_cff.py.

◆ config_recojets

custom_jme_cff.config_recojets

Definition at line 83 of file custom_jme_cff.py.

◆ DEEPJETVARS

custom_jme_cff.DEEPJETVARS

Definition at line 175 of file custom_jme_cff.py.

◆ doc

custom_jme_cff.doc

Definition at line 130 of file custom_jme_cff.py.

◆ emf

◆ float

custom_jme_cff.float

Definition at line 130 of file custom_jme_cff.py.

◆ foo

◆ GENJETVARS

custom_jme_cff.GENJETVARS

Definition at line 126 of file custom_jme_cff.py.

◆ hfEmEF

custom_jme_cff.hfEmEF

Definition at line 138 of file custom_jme_cff.py.

◆ hfHEF

custom_jme_cff.hfHEF

Definition at line 137 of file custom_jme_cff.py.

◆ int

custom_jme_cff.int

Definition at line 142 of file custom_jme_cff.py.

◆ muEF

custom_jme_cff.muEF

Definition at line 136 of file custom_jme_cff.py.

◆ nanoInfo_genjets

custom_jme_cff.nanoInfo_genjets

Definition at line 70 of file custom_jme_cff.py.

◆ nanoInfo_recojets

custom_jme_cff.nanoInfo_recojets

Definition at line 109 of file custom_jme_cff.py.

◆ nConstChHads

custom_jme_cff.nConstChHads

Definition at line 142 of file custom_jme_cff.py.

◆ nConstElecs

custom_jme_cff.nConstElecs

Definition at line 147 of file custom_jme_cff.py.

◆ nConstHFEMs

custom_jme_cff.nConstHFEMs

Definition at line 145 of file custom_jme_cff.py.

◆ nConstHFHads

custom_jme_cff.nConstHFHads

Definition at line 144 of file custom_jme_cff.py.

◆ nConstituents

◆ nConstMuons

custom_jme_cff.nConstMuons

Definition at line 146 of file custom_jme_cff.py.

◆ nConstNeuHads

custom_jme_cff.nConstNeuHads

Definition at line 143 of file custom_jme_cff.py.

◆ nConstPhotons

custom_jme_cff.nConstPhotons

Definition at line 148 of file custom_jme_cff.py.

◆ neEmEF

custom_jme_cff.neEmEF

Definition at line 135 of file custom_jme_cff.py.

◆ neHEF

custom_jme_cff.neHEF

Definition at line 133 of file custom_jme_cff.py.

◆ nElectrons

◆ nMuons

◆ particleNetAK4_B

custom_jme_cff.particleNetAK4_B

Definition at line 194 of file custom_jme_cff.py.

◆ particleNetAK4_CvsB

custom_jme_cff.particleNetAK4_CvsB

Definition at line 196 of file custom_jme_cff.py.

◆ particleNetAK4_CvsL

custom_jme_cff.particleNetAK4_CvsL

Definition at line 195 of file custom_jme_cff.py.

◆ particleNetAK4_G

custom_jme_cff.particleNetAK4_G

Definition at line 198 of file custom_jme_cff.py.

◆ particleNetAK4_puIdDisc

custom_jme_cff.particleNetAK4_puIdDisc

Definition at line 199 of file custom_jme_cff.py.

◆ particleNetAK4_QvsG

custom_jme_cff.particleNetAK4_QvsG

Definition at line 197 of file custom_jme_cff.py.

◆ PARTICLENETAK4VARS

custom_jme_cff.PARTICLENETAK4VARS

Definition at line 193 of file custom_jme_cff.py.

◆ PFJETVARS

custom_jme_cff.PFJETVARS

Definition at line 129 of file custom_jme_cff.py.

◆ precision

custom_jme_cff.precision

Definition at line 130 of file custom_jme_cff.py.

◆ puId_beta

custom_jme_cff.puId_beta

Definition at line 159 of file custom_jme_cff.py.

◆ puId_dR2Mean

custom_jme_cff.puId_dR2Mean

Definition at line 151 of file custom_jme_cff.py.

◆ puId_frac01

custom_jme_cff.puId_frac01

Definition at line 154 of file custom_jme_cff.py.

◆ puId_frac02

custom_jme_cff.puId_frac02

Definition at line 155 of file custom_jme_cff.py.

◆ puId_frac03

custom_jme_cff.puId_frac03

Definition at line 156 of file custom_jme_cff.py.

◆ puId_frac04

custom_jme_cff.puId_frac04

Definition at line 157 of file custom_jme_cff.py.

◆ puId_jetR

custom_jme_cff.puId_jetR

Definition at line 161 of file custom_jme_cff.py.

◆ puId_jetRchg

custom_jme_cff.puId_jetRchg

Definition at line 162 of file custom_jme_cff.py.

◆ puId_majW

custom_jme_cff.puId_majW

Definition at line 152 of file custom_jme_cff.py.

◆ puId_minW

custom_jme_cff.puId_minW

Definition at line 153 of file custom_jme_cff.py.

◆ puId_nCharged

custom_jme_cff.puId_nCharged

Definition at line 163 of file custom_jme_cff.py.

◆ puId_ptD

custom_jme_cff.puId_ptD

Definition at line 158 of file custom_jme_cff.py.

◆ puId_pull

custom_jme_cff.puId_pull

Definition at line 160 of file custom_jme_cff.py.

◆ PUIDVARS

custom_jme_cff.PUIDVARS

Definition at line 150 of file custom_jme_cff.py.

◆ qgl_axis2

custom_jme_cff.qgl_axis2

Definition at line 166 of file custom_jme_cff.py.

◆ qgl_mult

custom_jme_cff.qgl_mult

Definition at line 168 of file custom_jme_cff.py.

◆ qgl_ptD

custom_jme_cff.qgl_ptD

Definition at line 167 of file custom_jme_cff.py.

◆ QGLVARS

custom_jme_cff.QGLVARS

Definition at line 165 of file custom_jme_cff.py.

◆ rawFactor

custom_jme_cff.rawFactor

Definition at line 130 of file custom_jme_cff.py.

◆ ROBUSTPARTAK4VARS

custom_jme_cff.ROBUSTPARTAK4VARS

Definition at line 184 of file custom_jme_cff.py.