Mēnsūra
|
A plugin to compute systematic variation due to generator-level weights. More...
#include <GenWeightSyst.hpp>
Public Member Functions | |
GenWeightSyst (std::string const name, std::initializer_list< std::pair< unsigned, unsigned >> const &systWeightsIndices) | |
Constructs a new reweighting plugin with the given name. More... | |
GenWeightSyst (std::initializer_list< std::pair< unsigned, unsigned >> const &systWeightsIndices) | |
A short-cut for the above version with a default name "GenWeightSyst". | |
GenWeightSyst (GenWeightSyst const &src) | |
Copy constructor. | |
GenWeightSyst (GenWeightSyst &&)=default | |
Default move constructor. | |
GenWeightSyst & | operator= (GenWeightSyst const &)=delete |
Assignment operator is deleted. | |
virtual void | BeginRun (Dataset const &dataset) override |
Saves pointers to dependencies and find mean weights for the current dataset. More... | |
virtual Plugin * | Clone () const override |
Creates a newly configured clone. More... | |
void | NormalizeByMeanWeights (std::string const &databaseFile) |
Requests that weight are normalized by their mean values. More... | |
![]() | |
EventWeightPlugin (std::string const &name) | |
Constructs an instance with the given name. | |
double | GetWeight () const |
Returns the nominal weight. | |
unsigned | GetNumVariations () const noexcept |
Returns the number of systematic variations. | |
double | GetWeightUp (unsigned iSource) const |
Returns an "up" systematic variation with the given index. More... | |
double | GetWeightDown (unsigned iSource) const |
Returns a "down" systematic variation with the given index. More... | |
std::vector< double > const & | GetWeights () const noexcept |
Returns a vector with nominal weight and all systematic variations. More... | |
![]() | |
AnalysisPlugin (std::string const &name) | |
Constructor. | |
AnalysisPlugin (AnalysisPlugin const &)=default | |
Default copy constructor. | |
AnalysisPlugin (AnalysisPlugin &&)=default | |
Default move constructor. | |
AnalysisPlugin & | operator= (AnalysisPlugin const &)=default |
Default assignment operator. | |
virtual | ~AnalysisPlugin () |
Trivial destructor. | |
![]() | |
Plugin (std::string const &name) | |
Constructor. | |
Plugin (Plugin const &)=default | |
Default copy constructor. | |
Plugin (Plugin &&)=default | |
Default move constructor. | |
Plugin & | operator= (Plugin const &)=default |
Default assignment operator. | |
virtual | ~Plugin () |
Trivial destructor. | |
virtual void | EndRun () |
Performs necessary actions needed after processing of a dataset is finished. More... | |
Processor const & | GetMaster () const |
Returns a reference to the master. More... | |
std::string const & | GetName () const |
Returns name of the plugin. | |
EventOutcome | ProcessEventToOutcome () |
Processes a new event from the current dataset. More... | |
void | SetMaster (Processor const *processor) |
Provides a pointer to an instance of Processor class that owns the plugin. More... | |
Additional Inherited Members | |
![]() | |
enum | EventOutcome { EventOutcome::Ok, EventOutcome::FilterFailed, EventOutcome::NoEvents } |
Outcome of processing of an event. More... | |
![]() | |
Plugin const * | GetDependencyPlugin (std::string const &name) const |
Returns a pointer to a precedent plugin in the path with the given name. More... | |
![]() | |
std::vector< double > | weights |
Weights assigned to the current event. More... | |
A plugin to compute systematic variation due to generator-level weights.
This reweighting plugin reads generator-level weights with specified indices and computes systematic variations based on them. Nominal weight is always unit. Weights are accessed from a GeneratorReader with a default name "Generator".
There are three modes of running. In the simplest case weights with specified indices are used directly, after they are divided by a reference weight in the current event (by default given by index 0). Using method NormalizeByMeanWeights, user can request that weights are normalized by their man values read from a database file. In this case a weight w_i is rescaled as (w_i / w_0) / (<w_i> / <w_0>), where w_0 is the reference weight, and <w> denotes corresponding mean weights. Rescaling by mean weights allows to preserve the total normalization. Finally, if the rescaling has been requested but the database file does not contain entry for the current dataset, systematic variations are not evaluated and their number is set to zero.
GenWeightSyst::GenWeightSyst | ( | std::string const | name, |
std::initializer_list< std::pair< unsigned, unsigned >> const & | systWeightsIndices | ||
) |
Constructs a new reweighting plugin with the given name.
The second argument is a vector of indices of weights for systematic variations. The indices will be used to access the weights via GeneratorReader::GetAltWeight. Each pair corresponds to an independent systematic variation, first weight is for "up" variation, second is for "down" one.
|
overridevirtual |
|
overridevirtual |
void GenWeightSyst::NormalizeByMeanWeights | ( | std::string const & | databaseFile | ) |
Requests that weight are normalized by their mean values.
The values are read from the given JSON file, whose location is resolved using FileInPath. Example structure of the file is shown below:
[ { "datasetId": "ttbar-pw_3.1.0_wdo", "meanLHEWeights": [ { "index": 0, "value": 1.0 }, { "index": 4, "value": 0.8726374369 } ] }, ... ]
Here field "datasetId" includes label uniquely identifying the sample as returned by Dataset::GetSourceDatasetID, and indices correspond to GeneratorReader::GetAltWeight.