Performs reweighting for pileup profile. More...
#include <PileUpWeight.h>
Classes | |
struct | Era |
Data pileup profiles for a single era. More... | |
Public Member Functions | |
PileUpWeight (Dataset &dataset, Options const &options, RunSampler const *runSampler) | |
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 |
Computes the pileup weight for the current event. | |
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 Member Functions | |
void | LoadDataProfiles (std::filesystem::path const &path) |
Loads data pileup profiles for all eras. | |
void | LoadSimProfile (YAML::Node const &config, std::string const &datasetName) |
Loads pileup profile in simulation for a given dataset or default one. | |
void | Update () const |
Computes all weights for the current event. | |
Private Attributes | |
std::unique_ptr< TH1 > | simProfile_ |
Histogram representing pileup profile in simulation. | |
std::vector< Era > | eras_ |
Eras with pileup profiles in data. | |
EventCache | cache_ |
RunSampler const * | runSampler_ |
Non-owning pointer to an object that samples representative run numbers. | |
std::array< double, 3 > | weights_ |
Cached weights. | |
int | defaultWeightIndex_ |
Index of the default weight to be returned by operator(). | |
TTreeReaderValue< float > | mu_ |
Interface to read the expected number of pileup interactions. |
Performs reweighting for pileup profile.
Paths to ROOT files containing the pileup profile used to produce simulation and the target profiles in data are read from the analysis configuration file. Systematic uncertainty in pileup is implemented using alternative data profiles, which have been constructed assuming different values for the pileup cross section.
The file with target pileup profiles must contain directories for one or more data taking eras. In each directory the following entries are expected:
run_range
Range of runs included in this era. Represented by TVectorD
of size 2. The boundaries of the range are included.nominal
, up
, down
TH1
representing nominal pileup profile and profiles for systamatic varations. Expect an integer binning.Computed weights are cached on per-event basis.
int PileUpWeight::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 PileUpWeight::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 PileUpWeight::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.
int PileUpWeight::defaultWeightIndex_ [private] |
Index of the default weight to be returned by operator().
Corresponds to array weights_.
std::vector<Era> PileUpWeight::eras_ [private] |
Eras with pileup profiles in data.
The collection is sorted by Era::minRun. There assumed to be no overlap between different eras.
std::unique_ptr<TH1> PileUpWeight::simProfile_ [private] |
Histogram representing pileup profile in simulation.
The histogram is normalized to represent probability density. Under- and overflow bins are empty.
std::array<double, 3> PileUpWeight::weights_ [mutable, private] |
Cached weights.
They are given in the order nominal, up, down.