Interface to access generator weights. More...
#include <GenWeight.h>
Public Types | |
enum | Var { Nominal, Up, Down } |
Supported directions for systematic variations. | |
Public Member Functions | |
GenWeight (Dataset &dataset, Options const &options) | |
double | EnvelopeMEScale (Var direction) const |
Finds the requested boundary of the envelope of variations in ME scales. | |
double | NominalWeight () const override |
Returns nominal generator weight. | |
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. | |
double | RelWeightAlphaS (Var direction) const |
Returns relative weight for requested variation in alpha_s in PDF. | |
double | RelWeightMEScale (Var renorm, Var factor) const |
Returns relative weight for requested variation in ME scales. | |
double | RelWeightPdf (Var direction) const |
Returns relative weight for combined PDF variation. | |
std::string_view | VariationName (int variation) const override |
Returns the label of the systematic variation with the given index. | |
Private Types | |
enum | PdfVarType { Hessian, MC } |
Type of PDF variations. More... | |
Private Member Functions | |
void | InitializeLheScale (Dataset &dataset) |
void | InitializePdf (Dataset &dataset) |
Static Private Member Functions | |
static std::tuple< PdfVarType, std::optional< std::array< int, 2 > >, double > | LookUpPdfSet (int lhapdf) |
Helper function to look up metadata about a PDF set from YAML file. | |
Private Attributes | |
double | datasetWeight_ |
Common dataset weight, in pb. | |
bool | lheScaleWeightsPresent_ |
Indicates whether LHE scale variations are available. | |
std::map< std::pair< Var, Var > , int > | meScaleIndices_ |
Mapping from variations in the renormalization and factorization scales in the ME to the index of the corresponding weight in the source array. | |
bool | pdfWeightsPresent_ |
Indicates whether PDF weights are available. | |
std::pair< int, int > | pdfWeightsIndices_ |
Indices for PDF weights with variations. | |
PdfVarType | pdfVarType_ |
Type of PDF variations. | |
bool | alphaSWeightsPresent_ |
Indicates whether PDF weights include also alpha_s variations. | |
std::array< int, 2 > | alphaSWeightsIndices_ |
Indices of weights for alpha_s variation. | |
double | alphaSVarScaleFactor_ |
How much to rescale alpha_s variation given by weights in input file. | |
std::vector< std::string > | availableVariations_ |
Names of available variations. | |
int | defaultVariationIndex_ |
Default variation index to be used with operator(). | |
TTreeReaderValue< float > | srcLheNominalWeight_ |
TTreeReaderValue< float > | srcGenNominalWeight_ |
TTreeReaderArray< float > | srcScaleWeights_ |
TTreeReaderArray< float > | srcPdfWeights_ |
Interface to access generator weights.
The nominal weight includes the normalization to the cross section and the sum of the nominal weights in the full dataset.
Weights corresponding to several systematic variations are provided with dedicated methods. These are always relative weights, which should be applied in addition to the nominal one. The standard weight interface is also implemented.
enum GenWeight::PdfVarType [private] |
double GenWeight::EnvelopeMEScale | ( | Var | direction | ) | const |
Finds the requested boundary of the envelope of variations in ME scales.
The returned weight is relative with respect to the nominal one. All variations of the two ME scales are considered, except for the cases when they go in the opposite directions. The "up" boundary corresponds to the largest relative weight (which becomes the smallest absolute weight if the nominal weight is negative), and vice versa.
Note that using such an envelope in a shape-based analysis leads to incorrect correlations between different bins of the distribution.
double GenWeight::NominalWeight | ( | ) | const [override, virtual] |
Returns nominal generator weight.
It includes the normalization to the cross section and the sum of the nominal weights in the full dataset.
Implements WeightBase.
int GenWeight::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 GenWeight::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 GenWeight::RelWeight | ( | int | variation | ) | const [override, virtual] |
Returns relative weight for requested systematic variation.
The order of the variations, provided that all are available, is as follows:
Reimplemented from WeightBase.
double GenWeight::RelWeightAlphaS | ( | Var | direction | ) | const |
Returns relative weight for requested variation in alpha_s in PDF.
The variation is scaled linearly to the recommended size.
double GenWeight::RelWeightPdf | ( | Var | direction | ) | const |
Returns relative weight for combined PDF variation.
This is a pure PDF variation, i.e. it does not include alpha_s. Different weights are combined on the fly on the per-even basis, as described here. The resulting variation is conservative.
std::string_view GenWeight::VariationName | ( | int | ) | const [inline, 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::array<int, 2> GenWeight::alphaSWeightsIndices_ [private] |
Indices of weights for alpha_s variation.
Correspond to the weights in branch LHEPdfWeight. The first index is for an increase in alpha_s, the second one is for a decrease. The array is not initialized if alphaSWeightsPresent_ is false.
double GenWeight::datasetWeight_ [private] |
Common dataset weight, in pb.
Computed as the cross section divided by the sum of the nominal event weights in the full dataset.
int GenWeight::defaultVariationIndex_ [private] |
Default variation index to be used with operator().
Corresponds to the argument of RelWeight, with a special value of -1 denoting nominal weight.
std::pair<int, int> GenWeight::pdfWeightsIndices_ [private] |
Indices for PDF weights with variations.
These indices correspond to the weights in branch LHEPdfWeight. They don't include the nominal weight nor the alpha_s variations. The range of indices to be used is [first, second), i.e. semiinclusive.