Mēnsūra
|
A plugin that combines weights from several instances of EventWeightPlugin. More...
#include <WeightCollector.hpp>
Public Member Functions | |
WeightCollector (std::string const &name, std::initializer_list< std::string > const &weightPluginNames={}) noexcept | |
Creates a new instance with the given name. More... | |
WeightCollector (std::initializer_list< std::string > const &weightPluginNames) noexcept | |
A short-cut for the above version with a default name "EventWeights". | |
void | AddWeightPlugin (std::string const &name) |
Adds a new reweighting plugin to the list of associated ones. | |
virtual void | BeginRun (Dataset const &) override |
Saves pointers to all associated reweighting plugins. More... | |
virtual Plugin * | Clone () const override |
Creates a newly configured clone. More... | |
unsigned | GetNumPlugins () const |
Returns the number of registered reweighting plugins. | |
EventWeightPlugin const * | GetPlugin (std::string const &name) const |
Returns a non-owning pointer to one of the associated reweighting plugins. More... | |
EventWeightPlugin const * | GetPlugin (unsigned index) const |
Alternative version that accesses reweighting plugin by index. | |
double | GetWeight () const |
Computes the nominal weight for the current event. More... | |
double | GetWeightDown (std::string const &pluginName, unsigned iVar) const |
Computes full event weight with a down systematic variation in the given reweighting plugin. More... | |
double | GetWeightDown (unsigned index, unsigned iVar) const |
Alternative version that accesses reweighting plugin by index. | |
double | GetWeightUp (std::string const &pluginName, unsigned iVar) const |
Computes full event weight with an up systematic variation in the given reweighting plugin. More... | |
double | GetWeightUp (unsigned index, unsigned iVar) const |
Alternative version that accesses reweighting plugin by index. | |
![]() | |
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... | |
A plugin that combines weights from several instances of EventWeightPlugin.
This plugin simplifies handling of event reweighting with multiple plugins. It computes a product of weights calculated by an arbitrary number of associated reweighting plugins. It also allows to access systematic variations of weights.
|
noexcept |
Creates a new instance with the given name.
The optional argument provides names of reweighting plugins to be associated with this collector.
|
overridevirtual |
|
overridevirtual |
EventWeightPlugin const * WeightCollector::GetPlugin | ( | std::string const & | name | ) | const |
Returns a non-owning pointer to one of the associated reweighting plugins.
Throws an exception if the plugin with the given name is not found among the ones associated with this collector.
double WeightCollector::GetWeight | ( | ) | const |
Computes the nominal weight for the current event.
Calculates as the product of nominal weights given by every associated reweighting plugin.
double WeightCollector::GetWeightDown | ( | std::string const & | pluginName, |
unsigned | iVar | ||
) | const |
Computes full event weight with a down systematic variation in the given reweighting plugin.
From the reweighting plugin with the given name the down variation corresponding to the given index is requested. It is multiplied by nominal weights for all other plugins. Throws an exception if the plugin with the given name is not associated with this collector.
double WeightCollector::GetWeightUp | ( | std::string const & | pluginName, |
unsigned | iVar | ||
) | const |
Computes full event weight with an up systematic variation in the given reweighting plugin.
Consult documentation for method GetWeightDown for details.