CorrectionLibJECStack#

class coffea.jetmet_tools.CorrectionLibJECStack(jec=None, junc=None, jer=None, jersf=None)[source]#

Bases: object

Drop-in replacement for JECStack backed by correctionlib.

Parameters:

Attributes Summary

Methods Summary

from_file(path, jec_tag, data_type, jet_type)

Construct a CorrectionLibJECStack from a JSON-POG file.

Attributes Documentation

blank_name_map#
jec#
jer#
jersf#
junc#

Methods Documentation

classmethod from_file(path, jec_tag, data_type, jet_type, jec_level='L1L2L3Res', unc_sources=None, jer_tag=None)[source]#

Construct a CorrectionLibJECStack from a JSON-POG file.

Parameters:
  • path (str) – Path to the JSON-POG .json or .json.gz file.

  • jec_tag (str) – JEC campaign tag, e.g. "Summer24Prompt24_V2".

  • data_type (str) – "MC" or "DATA".

  • jet_type (str) – Jet algorithm, e.g. "AK4PFPuppi".

  • jec_level (str) – Compound correction level, e.g. "L1L2L3Res".

  • unc_sources (list[str], optional) – Uncertainty source names, e.g. ["Regrouped_FlavorQCD", "Regrouped_AbsoluteMPFBias"].

  • jer_tag (str, optional) – JER campaign tag. If None, JER/JERSF are not loaded.

Examples

Build a correctionlib-backed JEC stack and apply it to jets:

from coffea.jetmet_tools import CorrectionLibJECStack, CorrectedJetsFactory

# Load corrections from a JSON-POG file
jec_stack = CorrectionLibJECStack.from_file(
    "jet_jerc.json.gz",
    jec_tag="Summer24Prompt24_V2",
    data_type="MC",
    jet_type="AK4PFPuppi",
    jec_level="L1L2L3Res",
    unc_sources=["Regrouped_FlavorQCD", "Regrouped_AbsoluteMPFBias"],
    jer_tag="Summer23BPixPrompt23_RunD_JRV1",
)

# Build the name map (maps correction input names to jet field names)
name_map = jec_stack.blank_name_map
name_map["JetPt"] = "pt"
name_map["JetMass"] = "mass"
name_map["JetEta"] = "eta"
name_map["JetA"] = "area"
name_map["ptRaw"] = "pt_raw"
name_map["massRaw"] = "mass_raw"
name_map["Rho"] = "Rho"
name_map["ptGenJet"] = "pt_gen"
name_map["METpt"] = "met_pt"
name_map["METphi"] = "met_phi"
name_map["JetPhi"] = "phi"
name_map["UnClusteredEnergyDeltaX"] = "MetUnclustEnUpDeltaX"
name_map["UnClusteredEnergyDeltaY"] = "MetUnclustEnUpDeltaY"

# Create factory and apply corrections (same API as txt-based JECStack)
factory = CorrectedJetsFactory(name_map, jec_stack)
corrected_jets = factory.build(jets)

# Access uncertainties
for unc in factory.uncertainties():
    print(unc, corrected_jets[unc].up.pt, corrected_jets[unc].down.pt)