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 1021 of file custom_jme_cff.py.

References print(), and SavePatJets().

Referenced by PrepJMECustomNanoAOD().

1021 def AddNewAK8CHSJets(proc, recoJA, runOnMC):
1022  """
1023  Store an AK8 CHS jet collection for JEC studies.
1024  """
1025  print("custom_jme_cff::AddNewAK8CHSJets: Make a new AK8 PF CHS jet collection for JEC studies")
1026 
1027  #
1028  # Recluster AK8 CHS jets
1029  #
1030  cfg = {
1031  "jet" : "ak8pfchs",
1032  "inputCollection" : "",
1033  "genJetsCollection": "AK8GenJetsNoNu",
1034  "minPtFastjet" : 0., # Remove any pt threshold at the jet clustering stage.
1035  }
1036  recoJetInfo = recoJA.addRecoJetCollection(proc, **cfg)
1037 
1038  jetName = recoJetInfo.jetUpper
1039  payload = recoJetInfo.jetCorrPayload
1040 
1041  patJetFinalColl = recoJetInfo.patJetFinalCollection
1042  jetTablePrefix = "FatJetCHS"
1043  jetTableDoc = "AK8 PF CHS jets with JECs applied. Reclustered for JEC studies so only minimal info stored."
1044  ptcut = 15
1045 
1046  SavePatJets(proc,
1047  jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF=True,
1048  doCalo=False, ptcut=ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=runOnMC
1049  )
1050 
1051  return proc
1052 
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 1187 of file custom_jme_cff.py.

References print(), and SaveGenJets().

Referenced by PrepJMECustomNanoAOD().

1187 def AddNewAK8GenJetsForJEC(proc, genJA):
1188  """
1189  Make a separate AK8 Gen jet collection for JEC studies.
1190  """
1191  print("custom_jme_cff::AddNewAK8GenJetsForJEC: Add new AK8 Gen jets for JEC studies")
1192 
1193  #
1194  # Recluster AK8 Gen jet
1195  #
1196  cfg = {
1197  "jet" : "ak8gen",
1198  }
1199  genJetInfo = genJA.addGenJetCollection(proc, **cfg)
1200 
1201  genJetName = genJetInfo.jetUpper
1202  genJetAlgo = genJetInfo.jetAlgo
1203  genJetSize = genJetInfo.jetSize
1204  genJetSizeNr = genJetInfo.jetSizeNr
1205  genJetFinalColl = "{}{}{}".format(genJetAlgo.upper(), genJetSize, "GenJetsNoNu")
1206  genJetTablePrefix = "GenJetAK8ForJEC"
1207  genJetTableDoc = "AK8 Gen jets (made with visible genparticles) with pt > 3 GeV. Reclustered for JEC studies."
1208 
1209  SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)
1210 
1211  return proc
1212 
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 988 of file custom_jme_cff.py.

References print(), and SavePatJets().

Referenced by PrepJMECustomNanoAOD().

988 def AddNewAK8PuppiJetsForJEC(proc, recoJA, runOnMC):
989  """
990  Store a separate AK8 Puppi jet collection for JEC studies.
991  Only minimal info are stored
992  """
993  print("custom_jme_cff::AddNewAK8PuppiJetsForJEC: Make a new AK8 PF Puppi jet collection for JEC studies")
994 
995  #
996  # Recluster AK8 Puppi jets
997  #
998  cfg = {
999  "jet" : "ak8pfpuppi",
1000  "inputCollection" : "",
1001  "genJetsCollection": "AK8GenJetsNoNu",
1002  "minPtFastjet" : 0., # Remove any pt threshold at the jet clustering stage.
1003  }
1004  recoJetInfo = recoJA.addRecoJetCollection(proc, **cfg)
1005 
1006  jetName = recoJetInfo.jetUpper
1007  payload = recoJetInfo.jetCorrPayload
1008 
1009  patJetFinalColl = recoJetInfo.patJetFinalCollection
1010  jetTablePrefix = "FatJetForJEC"
1011  jetTableDoc = "AK8 PF Puppi jets with JECs applied. Reclustered for JEC studies so only minimal info stored."
1012  ptcut = 15
1013 
1014  SavePatJets(proc,
1015  jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF=True,
1016  doCalo=False, ptcut=ptcut, doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=runOnMC
1017  )
1018 
1019  return proc
1020 
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 1087 of file custom_jme_cff.py.

References SaveGenJets().

Referenced by PrepJMECustomNanoAOD().

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

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 1213 of file custom_jme_cff.py.

Referenced by PrepJMECustomNanoAOD().

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

◆ AddVariablesForAK8GenJets()

def custom_jme_cff.AddVariablesForAK8GenJets (   proc)

Definition at line 1217 of file custom_jme_cff.py.

Referenced by PrepJMECustomNanoAOD().

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

◆ AddVariablesForAK8PuppiJets()

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

Definition at line 1053 of file custom_jme_cff.py.

References common_cff.Var().

Referenced by PrepJMECustomNanoAOD().

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

1246 def PrepJMECustomNanoAOD(process,runOnMC):
1247 
1248 
1251  process = RemoveAllJetPtCuts(process)
1252 
1253 
1258  genJA = GenJetAdder()
1259  if runOnMC:
1260 
1263  process = AddVariablesForAK8GenJets(process)
1264 
1267  process = AddNewAK8GenJetsForJEC(process, genJA)
1268 
1271  process = ReclusterAK4GenJets(process, genJA)
1272  process = AddVariablesForAK4GenJets(process)
1273 
1276  for jetConfig in config_genjets:
1277  cfg = { k : v for k, v in jetConfig.items() if k != "enabled"}
1278  genJetInfo = genJA.addGenJetCollection(process, **cfg)
1279  AddNewGenJets(process, genJetInfo)
1280 
1281 
1286  recoJA = RecoJetAdder(runOnMC=runOnMC)
1287 
1290  process = AddVariablesForAK8PuppiJets(process)
1291 
1294  process = AddNewAK8PuppiJetsForJEC(process, recoJA, runOnMC)
1295 
1298  process = AddNewAK8CHSJets(process, recoJA, runOnMC)
1299 
1302  process = ReclusterAK4CHSJets(process, recoJA, runOnMC)
1303 
1306  process = ReclusterAK4PuppiJets(process, recoJA, runOnMC)
1307 
1310  for jetConfig in config_recojets:
1311  cfg = { k : v for k, v in jetConfig.items() if k != "enabled"}
1312  recoJetInfo = recoJA.addRecoJetCollection(process, **cfg)
1313  AddNewPatJets(process, recoJetInfo, runOnMC)
1314 
1315 
1320  def addAK4JetTasks(proc, addAK4CHSJetTasks, addAK4PuppiJetTasks):
1321  if addAK4CHSJetTasks:
1322  proc.nanoTableTaskCommon.add(proc.jetTask)
1323  proc.nanoTableTaskCommon.add(proc.jetTablesTask)
1324  proc.nanoTableTaskCommon.add(proc.jetForMETTask)
1325  if addAK4PuppiJetTasks:
1326  proc.nanoTableTaskCommon.add(proc.jetPuppiTask)
1327  proc.nanoTableTaskCommon.add(proc.jetPuppiTablesTask)
1328  proc.nanoTableTaskCommon.add(proc.jetPuppiForMETTask)
1329  return proc
1330 
1331  jmeNano_addAK4JetTasks_switch = cms.PSet(
1332  jmeNano_addAK4CHS_switch = cms.untracked.bool(True),
1333  jmeNano_addAK4Puppi_switch = cms.untracked.bool(False)
1334  )
1335  run2_nanoAOD_ANY.toModify(jmeNano_addAK4JetTasks_switch,
1336  jmeNano_addAK4CHS_switch = False,
1337  jmeNano_addAK4Puppi_switch = True
1338  )
1339  process = addAK4JetTasks(process,
1340  addAK4CHSJetTasks = jmeNano_addAK4JetTasks_switch.jmeNano_addAK4CHS_switch,
1341  addAK4PuppiJetTasks = jmeNano_addAK4JetTasks_switch.jmeNano_addAK4Puppi_switch,
1342  )
1343 
1344 
1347  if runOnMC:
1348  process.puTable.savePtHatMax = True
1349 
1350 
1353  if runOnMC:
1354  process.genWeightsTable.keepAllPSWeights = True
1355 
1356  return process
1357 
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 1363 of file custom_jme_cff.py.

References PrepJMECustomNanoAOD().

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

◆ PrepJMECustomNanoAOD_MC()

def custom_jme_cff.PrepJMECustomNanoAOD_MC (   process)

Definition at line 1358 of file custom_jme_cff.py.

References PrepJMECustomNanoAOD().

1358 def PrepJMECustomNanoAOD_MC(process):
1359  process = PrepJMECustomNanoAOD(process,runOnMC=True)
1360 
1361  return process
1362 
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 769 of file custom_jme_cff.py.

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

Referenced by PrepJMECustomNanoAOD().

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

References print().

Referenced by PrepJMECustomNanoAOD().

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

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

Referenced by PrepJMECustomNanoAOD().

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

Referenced by PrepJMECustomNanoAOD().

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

Referenced by AddNewAK8GenJetsForJEC(), and AddNewGenJets().

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