Computes event weights that account for pileup ID scale factors. More...
#include <PileUpIdWeight.h>
Classes | |
struct | Context |
Auxiliary structure that provides details specific to each |eta| range. More... | |
Public Member Functions | |
PileUpIdWeight (Dataset &dataset, Options const &options, PileUpIdFilter const *pileUpIdFilter, JetBuilder const *jetBuilder) | |
Constructor. | |
double | NominalWeight () const override |
Returns nominal weight for the current event. | |
int | NumVariations () const override |
Returns number of supported systematic variations. | |
double | operator() () const override |
Returns the default weight. | |
double | RelWeight (int variation) const override |
Returns relative weight for requested systematic variation. | |
std::string_view | VariationName (int variation) const override |
Returns the label of the systematic variation with the given index. | |
Private Types | |
enum | Variation { kNominal = 0, kTagUp = 1, kTagDown = 2, kMistagUp = 3, kMistagDown = 4 } |
Supported systematic variations. More... | |
Private Member Functions | |
Context const & | FindContext (Jet const &jet) const |
Finds which |eta| range the jet falls into and returns the corresponding context object. | |
double | GetEfficiency (Context const &context, Jet const &jet) const |
Computes pileup ID efficiency in simulation for given jet. | |
double | GetScaleFactor (Context const &context, Jet const &jet, Variation variation) const |
Finds pileup ID scale factor for given jet and variation. | |
void | LoadScaleFactors (YAML::Node const config, int year) |
Reads histograms with scale factors for all used working points. | |
void | Update () const |
Computes event weights for all systematic variations. | |
Private Attributes | |
PileUpIdFilter const * | pileUpIdFilter_ |
JetBuilder const * | jetBuilder_ |
std::vector< double > | absEtaEdges_ |
Edges between different |eta| regions. | |
std::vector< Context > | contexts_ |
Context for each |eta| region | |
std::array< float, 13 > | effFeatures_ |
Array with input features for the computation of the pileup ID efficiency in simulation. | |
std::optional< XGBoostPredictor > | effCalc_ |
Model that parameterizes the pileup ID efficiency in simulation. | |
TTreeReaderValue< float > | expPileUp_ |
Interface to read the expected number of pileup interactions. | |
Variation | defaultVariation_ |
Requested systematic variation. | |
EventCache | cache_ |
std::array< double, 5 > | weights_ |
Cached weights for all systematic variations. |
Computes event weights that account for pileup ID scale factors.
A multivariate parameterization is used for the efficiency of the pileup ID in simulation. Computed weights are cached on per-event basis.
The behaviour is controlled by the section pileup_id
of the master configuration. Some information from it is extracted via PileUpIdFilter -- see its documentation on how the jet selection should be specified. In class PileUpIdWeight it is assumed that section pileup_id
exists; otherwise an object of this class should not be constructed.
Systematic variations in the scale factors are provided. The scale factors for pileup and matched jets are varied simulatneously within each category and independently between the categories.
enum PileUpIdWeight::Variation [private] |
Supported systematic variations.
Cast to int, a variable of this type can index array weights_.
PileUpIdWeight::PileUpIdWeight | ( | Dataset & | dataset, | |
Options const & | options, | |||
PileUpIdFilter const * | pileUpIdFilter, | |||
JetBuilder const * | jetBuilder | |||
) |
Constructor.
[in] | dataset | Dataset that will be processed. |
[in] | options | Configuration options. |
[in] | pileUpIdFilter | Pointer to a valid PileUpIdFilter, which describes jet selection based on pileup ID. |
[in] | jetBuilder | Pointer to a valid JetBuilder. |
void PileUpIdWeight::LoadScaleFactors | ( | YAML::Node const | config, | |
int | year | |||
) | [private] |
Reads histograms with scale factors for all used working points.
[in] | config | Master configuration. |
[in] | year | Year of data taking the scale factors for which should be read. |
int PileUpIdWeight::NumVariations | ( | ) | const [inline, override, virtual] |
Returns number of supported systematic variations.
Up and down variations are counted separately. The nominal weight is not included.
Reimplemented from WeightBase.
double PileUpIdWeight::operator() | ( | ) | const [inline, override, virtual] |
Returns the default weight.
This might be different from the nominal weight if a specific variation has been requested via command line options.
Reimplemented from WeightBase.
double PileUpIdWeight::RelWeight | ( | int | ) | const [inline, override, virtual] |
Returns relative weight for requested systematic variation.
The relative weight is computed with respect to the nominal weight. The argument must satisfy 0 <= variation < NumVariations()
.
Reimplemented from WeightBase.
std::string_view PileUpIdWeight::VariationName | ( | int | ) | const [override, virtual] |
Returns the label of the systematic variation with the given index.
If the variation has the meaning of an "up" or "down" one, the label must end with "_up" or "_down" respectively. The argument must satisfy 0 <= variation < NumVariations()
.
Reimplemented from WeightBase.
std::vector<double> PileUpIdWeight::absEtaEdges_ [private] |
Edges between different |eta| regions.
Copied from pileUpIdFilter_.
std::array<float, 13> PileUpIdWeight::effFeatures_ [mutable, private] |
Array with input features for the computation of the pileup ID efficiency in simulation.
It will be reused for each computation. Features that don't change are set in the constructor.
std::array<double, 5> PileUpIdWeight::weights_ [mutable, private] |
Cached weights for all systematic variations.
The order is the same as in enum Variation.