Computes weights for b tag scale factors. More...
#include <BTagWeight.h>
Public Member Functions | |
BTagWeight (Dataset &dataset, Options const &options, BTagger const *bTagger, JetBuilder const *jetBuilder) | |
Construct. | |
virtual double | NominalWeight () const override |
Returns nominal weight for the current event. | |
virtual int | NumVariations () const override |
Returns number of supported systematic variations. | |
virtual double | operator() () const override |
Returns the default weight. | |
virtual double | RelWeight (int variation) const override |
Returns relative weight for requested systematic variation. | |
virtual 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 | |
double | ComputeWeight (Variation variation) const |
Computes event weight for the given systematic variation. | |
void | LoadEffTables () |
Loads b tag efficiencies. | |
double | GetEfficiency (double pt, double eta, int flavour) const |
Returns b tag efficiency computed for the jet with given properties. | |
double | GetScaleFactor (double pt, double eta, int flavour, Variation variation) const |
Return b tag scale factor computed for the jet with given properties. | |
void | Update () const |
Computes event weights for all systematic variations. | |
Private Attributes | |
BTagger const * | bTagger_ |
Non-owning pointer to object that provides numeric value of the b tag discriminator and thresholds from configuration file. | |
JetBuilder const * | jetBuilder_ |
Non-owning pointer to JetBuilder that provides jets. | |
std::filesystem::path const | effTablesPath_ |
Path of b tag efficiencies profiles. | |
std::map< std::string, std::unique_ptr< TH2F > > | effTables_ |
Object that contains b tag efficiencies. | |
std::unique_ptr < BTagCalibrationReader > | scaleFactorReader_ |
Object that provies values of b tag scale factors. | |
Variation | defaultVariation_ |
Requested systematic variation. | |
EventCache | cache_ |
std::array< double, 5 > | weights_ |
Cached weights for all systematic variations. |
Computes weights for b tag scale factors.
Jets considered in the computation are read from a JetBuilder. Computed weights are cached on per-event basis.
enum BTagWeight::Variation [private] |
Supported systematic variations.
Cast to int, a variable of this type can index array weights_.
BTagWeight::BTagWeight | ( | Dataset & | dataset, | |
Options const & | options, | |||
BTagger const * | bTagger, | |||
JetBuilder const * | jetBuilder | |||
) |
Construct.
[in] | dataset | Current dataset |
[in] | options | Configuration options |
[in] | bTagger | Object to tag jets |
[in] | jetBuilder | Object providing collection of jets |
Objects bTagger
and jetBuilder
must exist for the lifetime of this BTagWeight.
virtual int BTagWeight::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.
virtual double BTagWeight::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.
virtual double BTagWeight::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.
virtual std::string_view BTagWeight::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::array<double, 5> BTagWeight::weights_ [mutable, private] |
Cached weights for all systematic variations.
The order is the same as in enum Variation.