jets#
Jet energy corrections and jet resolution smearing.
Summary#
|
Helper function to get a list of correction evaluators from a |
|
Evaluate a |
|
Functions#
- get_evaluators(correction_set, names)[source]#
Helper function to get a list of correction evaluators from a
correctionlib.highlevel.CorrectionSetobject given a list of names. The names can refer to either simple or compound corrections.- Parameters:
correction_set (
CorrectionSet) – evaluator provided by correctionlibnames (
list[str]) – List of names of corrections to be applied
- Raises:
RuntimeError – If a requested correction in names is not available
- Return type:
- Returns:
List of compounded corrections, see
correctionlib.highlevel.CorrectionSet
- ak_evaluate(evaluator, *args)[source]#
Evaluate a
correctionlib.highlevel.Correctionusing one or more as inputs.- Parameters:
evaluator (
Correction) – Evaluator instance- Raises:
ValueError – If no are provided
- Return type:
- Returns:
The correction factor derived from the input arrays
Calibrators#
- class jets(*args, requires_func=law.util.no_value, setup_func=law.util.no_value, sandbox=law.util.no_value, call_force=law.util.no_value, max_chunk_size=law.util.no_value, pick_cached_result=law.util.no_value, inst_dict=None, **kwargs)[source]#
Bases:
Calibrator- call_func(events, **kwargs)#
Instance of
Calibratorthat does all relevant calibrations for jets, i.e. JEC and JER. For more information, seejec()andjer().
- data_only = False#
- gen_jet_name = 'GenJet'#
- get_jec_config = None#
- get_jec_file = None#
- get_jer_config = None#
- get_jer_file = None#
- jet_name = 'Jet'#
- mc_only = False#
- nominal_only = False#
- produces = {<class 'columnflow.calibration.cms.jets.jer'>, <class 'columnflow.calibration.cms.jets.jec'>}#
- propagate_met = None#
- shifts_only = None#
- skip_func()#
- static update_cls_dict(cls_name, cls_dict, get_attr)#
- uses = {<class 'columnflow.calibration.cms.jets.jer'>, <class 'columnflow.calibration.cms.jets.jec'>}#
- class jec(*args, requires_func=law.util.no_value, setup_func=law.util.no_value, sandbox=law.util.no_value, call_force=law.util.no_value, max_chunk_size=law.util.no_value, pick_cached_result=law.util.no_value, inst_dict=None, **kwargs)[source]#
Bases:
Calibrator- call_func(events, min_pt_met_prop=15.0, max_eta_met_prop=5.2, **kwargs)#
Performs the jet energy corrections (JECs) and uncertainty shifts using the correctionlib, optionally propagating the changes to the MET.
The jet_name should be set to the name of the NanoAOD jet collection to calibrate (default:
Jet, i.e. AK4 jets).Requires an external file in the config pointing to the JSON files containing the JECs. The file key can be specified via an optional
external_file_keyin thejecconfig entry. If not given, the file key will be determined automatically based on the jet collection name:jet_jercforJet(AK4 jets),fat_jet_jercfor``FatJet`` (AK8 jets). A full set of JSON files can be specified as:cfg.x.external_files = DotDict.wrap({ "jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/jet_jerc.json.gz", "fat_jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/fatJet_jerc.json.gz", })
For more file-grained control, the get_jec_file can be adapted in a subclass in case it is stored differently in the external files
The JEC configuration should be an auxiliary entry in the config, specifying the correction details under “jec”. Separate configs should be given for each jet collection to calibrate, using the jet collection name as a subkey. An example of a valid configuration for correction AK4 jets with JEC is:
cfg.x.jec = { "Jet": { "campaign": "Summer19UL17", "version": "V5", "jet_type": "AK4PFchs", "levels": ["L1L2L3Res"], # or individual correction levels "levels_for_type1_met": ["L1FastJet"], "uncertainty_sources": [ "Total", "CorrelationGroupMPFInSitu", "CorrelationGroupIntercalibration", "CorrelationGroupbJES", "CorrelationGroupFlavor", "CorrelationGroupUncorrelated", ] }, }
get_jec_config can be adapted in a subclass in case it is stored differently in the config.
If running on data, the datasets must have an auxiliary field jec_era defined, e.g. “RunF”, or an auxiliary field era, e.g. “F”.
This instance of
Calibratoris initialized with the following parameters by default:- Parameters:
events (
Array) – awkward array containing events to processmin_pt_met_prop (
float, default:15.0) – If propagate_met variable isTruepropagate the updated jet values to the missing transverse energy (MET) usingpropagate_met()for events wheremet.pt > *min_pt_met_prop*.max_eta_met_prop (
float, default:5.2) – If propagate_met variable isTruepropagate the updated jet values to the missing transverse energy (MET) usingpropagate_met()for events wheremet.eta > *min_eta_met_prop*.
- Return type:
- data_only = False#
- get_jec_config()#
Load config relevant to the jet energy corrections (JEC).
By default, this is extracted from the current config_inst, assuming the JEC configurations are stored under the ‘jec’ aux key. Separate configurations should be specified for each jet collection, using the collection name as a key. For example, the configuration for the default jet collection
Jetwill be retrieved from the following config entry:self.config_inst.x.jec.Jet
Used in
setup_func().- Return type:
- Returns:
Dictionary containing configuration for jet energy calibration
- get_jec_file(external_files)#
Function to obtain external correction files for JEC and/or JER.
By default, this function extracts the location of the jec correction files from the current config instance config_inst. The key of the external file depends on the jet collection. For
Jet(AK4 jets), this resolves tojet_jerc, and forFatJetit is resolved tofat_jet_jerc.cfg.x.external_files = DotDict.wrap({ "jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/jet_jerc.json.gz", "fat_jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/fatJet_jerc.json.gz", })
- jet_name = 'Jet'#
- mc_only = False#
- met_name = 'MET'#
- nominal_only = False#
- propagate_met = True#
- raw_met_name = 'RawMET'#
- setup_func(reqs, inputs, reader_targets)#
Load the correct jec files using the
from_string()method of thecorrectionlib.highlevel.CorrectionSetfunction and apply the corrections as needed.The source files for the
correctionlib.highlevel.CorrectionSetinstance are extracted with theget_jec_file().Uses the member function
get_jec_config()to construct the required keys, which are based on the following information about the JEC:levels
campaign
version
jet_type
A corresponding example snippet wihtin the config_inst could like something like this:
cfg.x.jec = DotDict.wrap({ "Jet": { # campaign name for this JEC correctiono "campaign": f"Summer19UL{year2}{jerc_postfix}", # version of the corrections "version": "V7", # Type of jets that the corrections should be applied on "jet_type": "AK4PFchs", # relevant levels in the derivation process of the JEC "levels": ["L1FastJet", "L2Relative", "L2L3Residual", "L3Absolute"], # relevant levels in the derivation process of the Type 1 MET JEC "levels_for_type1_met": ["L1FastJet"], # names of the uncertainties to be applied "uncertainty_sources": [ "Total", "CorrelationGroupMPFInSitu", "CorrelationGroupIntercalibration", "CorrelationGroupbJES", "CorrelationGroupFlavor", "CorrelationGroupUncorrelated", ], }, })
- Parameters:
reqs (
dict) – Requirement dictionary for thisCalibratorinstanceinputs (
dict) – Additional inputs, currently not usedreader_targets (
InsertableDict) – TODO: add documentation
- Return type:
- shifts_only = None#
- uncertainty_sources = None#
- static update_cls_dict(cls_name, cls_dict, get_attr)#
- uses = {<Route 'Rho.fixedGridRhoFastjetAll' (tags=optional)>, <Route 'fixedGridRhoFastjetAll' (tags=optional)>, <class 'columnflow.production.util.attach_coffea_behavior'>}#
- class jer(*args, requires_func=law.util.no_value, setup_func=law.util.no_value, sandbox=law.util.no_value, call_force=law.util.no_value, max_chunk_size=law.util.no_value, pick_cached_result=law.util.no_value, inst_dict=None, **kwargs)[source]#
Bases:
Calibrator- call_func(events, **kwargs)#
Applies the jet energy resolution smearing in MC and calculates the associated uncertainty shifts using the correctionlib, following the recommendations given in https://twiki.cern.ch/twiki/bin/viewauth/CMS/JetResolution.
The jet_name and gen_jet_name should be set to the name of the NanoAOD jet and gen jet collections to use as an input for JER smearing (default:
JetandGenJet, respectively, i.e. AK4 jets).Requires an external file in the config pointing to the JSON files containing the JER information. The file key can be specified via an optional
external_file_keyin thejerconfig entry. If not given, the file key will be determined automatically based on the jet collection name:jet_jercforJet(AK4 jets),fat_jet_jercfor``FatJet`` (AK8 jets). A full set of JSON files can be specified as:cfg.x.external_files = DotDict.wrap({ "jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/jet_jerc.json.gz", "fat_jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/fatJet_jerc.json.gz", })
For more fine-grained control, the get_jer_file can be adapted in a subclass in case it is stored differently in the external files.
The JER smearing configuration should be an auxiliary entry in the config, specifying the input JER to use under “jer”. Separate configs should be given for each jet collection to smear, using the jet collection name as a subkey. An example of a valid configuration for smearing AK4 jets with JER is:
cfg.x.jer = { "Jet": { "campaign": "Summer19UL17", "version": "JRV2", "jet_type": "AK4PFchs", }, }
get_jer_config can be adapted in a subclass in case it is stored differently in the config.
The nominal JER smearing is performed on nominal jets as well as those varied as a result of jet energy corrections. For this purpose, get_jec_config and jec_uncertainty_sources can be defined to control the considered variations. Consequently, the matching of jets to gen jets which depends on pt values of the former is subject to a choice regarding which pt values to use. If gen_jet_matching_nominal is True, the nominal pt values are used, and the jec varied pt values otherwise.
Throws an error if running on data.
- data_only = False#
- deterministic_seed_index = -1#
- gen_jet_matching_nominal = False#
- gen_jet_name = 'GenJet'#
- get_jec_config()#
Load config relevant to the jet energy corrections (JEC).
By default, this is extracted from the current config_inst, assuming the JEC configurations are stored under the ‘jec’ aux key. Separate configurations should be specified for each jet collection, using the collection name as a key. For example, the configuration for the default jet collection
Jetwill be retrieved from the following config entry:self.config_inst.x.jec.Jet
Used in
setup_func().- Return type:
- Returns:
Dictionary containing configuration for jet energy calibration
- get_jer_config()#
Load config relevant to the jet energy resolution (JER) smearing.
By default, this is extracted from the current config_inst, assuming the JER configurations are stored under the ‘jer’ aux key. Separate configurations should be specified for each jet collection, using the collection name as a key. For example, the configuration for the default jet collection
Jetwill be retrieved from the following config entry:self.config_inst.x.jer.Jet
Used in
setup_func().- Return type:
- Returns:
Dictionary containing configuration for JER smearing
- get_jer_file(external_files)#
Function to obtain external correction files for JEC and/or JER.
By default, this function extracts the location of the jec correction files from the current config instance config_inst. The key of the external file depends on the jet collection. For
Jet(AK4 jets), this resolves tojet_jerc, and forFatJetit is resolved tofat_jet_jerc.cfg.x.external_files = DotDict.wrap({ "jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/jet_jerc.json.gz", "fat_jet_jerc": "/afs/cern.ch/work/m/mrieger/public/mirrors/jsonpog-integration-9ea86c4c/POG/JME/2017_UL/fatJet_jerc.json.gz", })
- jec_uncertainty_sources = None#
- jet_name = 'Jet'#
- mc_only = True#
- met_name = 'MET'#
- nominal_only = False#
- propagate_met = True#
- setup_func(reqs, inputs, reader_targets)#
Load the correct jer files using the
from_string()method of thecorrectionlib.highlevel.CorrectionSetfunction and apply the corrections as needed.The source files for the
correctionlib.highlevel.CorrectionSetinstance are extracted with theget_jer_file().Uses the member function
get_jer_config()to construct the required keys, which are based on the following information about the JER:campaign
version
jet_type
A corresponding example snippet within the config_inst could like something like this:
cfg.x.jer = DotDict.wrap({ "Jet": { "campaign": f"Summer19UL{year2}{jerc_postfix}", "version": "JRV3", "jet_type": "AK4PFchs", }, })
- Parameters:
reqs (
dict) – Requirement dictionary for thisCalibratorinstance.inputs (
dict) – Additional inputs, currently not used.reader_targets (
InsertableDict) – TODO: add documentation.
- Return type:
- shifts_only = None#
- static update_cls_dict(cls_name, cls_dict, get_attr)#
- uses = {<Route 'Rho.fixedGridRhoFastjetAll' (tags=optional)>, <Route 'fixedGridRhoFastjetAll' (tags=optional)>, <class 'columnflow.production.util.attach_coffea_behavior'>}#