Implements jet pt scale and resolution corrections. More...
#include <JetCorrector.h>
Classes | |
struct | IovParams |
Auxiliary structure aggregating parameters that depent on IOV. More... | |
Public Member Functions | |
JetCorrector (Dataset &dataset, Options const &options, TabulatedRngEngine &rngEngine) | |
double | GetJecFull (TLorentzVector const &rawP4, double area) const |
Computes JEC with all levels specified in the configuration applied. | |
double | GetJecL1 (TLorentzVector const &rawP4, double area) const |
Computes L1 JEC. | |
double | GetJecUncFactor (TLorentzVector const &corrP4) const |
Computes correction factor to account for JEC uncertainty. | |
double | GetJerFactor (TLorentzVector const &corrP4, GenJet const *genJet, double ptResultion, int rngChannel) const |
Computes correction factor to account for JER smearing. | |
double | GetPtResolution (TLorentzVector const &corrP4) const |
Returns relative jet pt resolution in simulation. | |
void | UpdateIov () const |
If needed, update IOV based on the current run. | |
Private Types | |
enum | Syst { None, JEC, JER } |
Supported types of systematic variations. | |
enum | SystDirection { Up, Down } |
Possible directions for systematic variations. | |
Private Member Functions | |
double | ClipFactor (double factor, double pt) const |
Clips negative or very small scaling fractors for jet momentum. | |
void | LoadJec () const |
Constructs an object to apply JEC using parameters of current IOV. | |
void | ReadIovParams (YAML::Node const config) |
Reads IOV parameters from the given node of the master configuration file. | |
Private Attributes | |
Syst | syst_ |
Type of requested systematic variation. | |
SystDirection | systDirection_ |
Direction of requested systematic variation. | |
std::vector< IovParams > | iovs_ |
Registered IOV-dependent parameters. | |
double | minPtClip_ |
Minimal pt to clip negative scaling factors, GeV. | |
IovParams const * | currentIov_ |
Currently active element of iovs_. | |
run_t | cachedRun_ |
Run seen most recently. | |
std::unique_ptr < FactorizedJetCorrector > | jetEnergyCorrector_ |
Object to compute JEC. | |
std::unique_ptr < JetCorrectionUncertainty > | jecUncProvider_ |
Object to provide JEC uncertainty. | |
std::unique_ptr < JME::JetResolution > | jerProvider_ |
Object that provides pt resolution in simulation. | |
std::unique_ptr < JME::JetResolutionScaleFactor > | jerSFProvider_ |
Object that provides data-to-simulation scale factors for jet pt resolution. | |
TabulatedRandomGenerator | tabulatedRng_ |
Random number generator. | |
TTreeReaderValue< UInt_t > | run_ |
Reader to access the current run. | |
TTreeReaderValue< float > | rho_ |
Median angular pt density. |
Implements jet pt scale and resolution corrections.
This class computes JEC (full nominal and L1-only), JEC uncertainty, and JER smearing factors. Systematic variations are provided if requested via the syst
option.
Paths to files that define JEC and JER are read from sections jets/corrections
and jets/resolution
of the master configuration.
double JetCorrector::ClipFactor | ( | double | factor, | |
double | pt | |||
) | const [private] |
Clips negative or very small scaling fractors for jet momentum.
[in] | factor | Original scaling factor. |
[in] | pt | Jet pt to be scaled. |
If scaling jet pt by the given original factor would produce a value below the threshold minPtClip_ (including a negative value), this method adjusts the factor to set the scaled pt equal to the threshold.
double JetCorrector::GetJecFull | ( | TLorentzVector const & | rawP4, | |
double | area | |||
) | const |
Computes JEC with all levels specified in the configuration applied.
In every event, UpdateIov must be called before the first call to this method. The effect of JEC uncertainties is not included.
double JetCorrector::GetJecL1 | ( | TLorentzVector const & | rawP4, | |
double | area | |||
) | const |
Computes L1 JEC.
In every event, UpdateIov must be called before the first call to this method.
double JetCorrector::GetJecUncFactor | ( | TLorentzVector const & | corrP4 | ) | const |
Computes correction factor to account for JEC uncertainty.
[in] | corrP4 | Corrected four-momentum of a jet. |
double JetCorrector::GetJerFactor | ( | TLorentzVector const & | corrP4, | |
GenJet const * | genJet, | |||
double | ptResultion, | |||
int | rngChannel | |||
) | const |
Computes correction factor to account for JER smearing.
[in] | corrP4 | Corrected four-momentum of a jet. |
[in] | genJet | Non-owning pointer to the generator-level jet matched to the given reconstructed jet. Can be nullptr if there is no match or when the stochastic smearing is desired. |
[in] | ptResolution | Relative pt resolution as computed by GetPtResolution. |
[in] | rngChannel | Channel to be used for the tabulated random number generator. |
The input four-momentum must have JEC applied. Normally, only the nominal JEC should be applied, even when a JEC variation has been requested. This is consistent with how JER smearing is applied in CMSSW.
The returned correction factor accounts for a systematic shift in JER if requested in the options. This method should only be called for simulation.
double JetCorrector::GetPtResolution | ( | TLorentzVector const & | corrP4 | ) | const |
Returns relative jet pt resolution in simulation.
[in] | corrP4 | Corrected four-momentum of a jet. |
void JetCorrector::ReadIovParams | ( | YAML::Node const | config | ) | [private] |
Reads IOV parameters from the given node of the master configuration file.
The given node must be a sequence of one or more nodes, each of which contains keys run_range
and levels
. The node run_range
is a sequence of two run numbers that define the IOV; it is optional, and if missing, a catch-all IOV is constructed. The node levels
is a sequence of paths to files defining different JEC levels.
void JetCorrector::UpdateIov | ( | ) | const |
If needed, update IOV based on the current run.
Must be called in every event before the first call to GetJecFull or GetJecL1.
std::unique_ptr<JetCorrectionUncertainty> JetCorrector::jecUncProvider_ [private] |
Object to provide JEC uncertainty.
Only created when a systematic variation in JEC has been requested and only when processing simulation.
std::unique_ptr<JME::JetResolution> JetCorrector::jerProvider_ [private] |
Object that provides pt resolution in simulation.
Only created when running on simulation.
std::unique_ptr<JME::JetResolutionScaleFactor> JetCorrector::jerSFProvider_ [private] |
Object that provides data-to-simulation scale factors for jet pt resolution.
Only created when running on simulation.
std::unique_ptr<FactorizedJetCorrector> JetCorrector::jetEnergyCorrector_ [mutable, private] |
Object to compute JEC.
It is constructed using run-dependent parameters, which are provided via the IOVs.