Mēnsūra
|
A service to report requested systematic variation to plugins. More...
#include <SystService.hpp>
Public Types | |
enum | VarDirection { Undefined, Up, Down } |
Supported directions for systematic variations. | |
Public Member Functions | |
SystService (std::string name="Systematics") | |
Creates a new service with the given name. More... | |
SystService (std::string const &label, VarDirection direction) | |
Creates a new service with a default name "Systematics". More... | |
virtual Service * | Clone () const override |
Creates a newly configured clone. | |
void | Register (std::string const &label, bool hasDirection) |
Registers a new type of systematic uncertainty. More... | |
void | Set (std::string const &label, VarDirection direction=VarDirection::Undefined) |
Requests the given variation. More... | |
void | Set (std::initializer_list< std::pair< std::string, VarDirection >> variations) |
A version of the above method to request multiple variations. More... | |
std::pair< bool, VarDirection > | Test (std::string const &label) const |
Tests if a systematic variation with the given label has been requested. More... | |
![]() | |
Service (std::string const &name) | |
Constructor. More... | |
Service (Service const &)=default | |
Default copy constructor. | |
Service (Service &&)=default | |
Default move constructor. | |
Service & | operator= (Service const &)=default |
Default assignment operator. | |
virtual | ~Service ()=default |
Default destructor. | |
virtual void | BeginRun (Dataset const &dataset) |
Performs initialization needed when processing of a new dataset starts. More... | |
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. | |
void | SetMaster (Processor const *processor) |
Provides a pointer to an instance of Processor class that owns the service. More... | |
A service to report requested systematic variation to plugins.
Types of systematic uncertainties are described by arbitrary text labels. A new label must first be registered, then a corresponding systematic variation can be requested using method Set. Several types of uncertainty are registered automatically: "None", "JEC", "JER", "METUncl", "WeightPileUp", "WeightBTag".
SystService::SystService | ( | std::string | name = "Systematics" | ) |
Creates a new service with the given name.
Registers the default set of systematic uncertainties (see documentation to the class). Sets the requested variation to "None".
SystService::SystService | ( | std::string const & | label, |
VarDirection | direction | ||
) |
Creates a new service with a default name "Systematics".
Registers the default set of systematic uncertainties (see documentation to the class). Sets the requested variation to the given one.
void SystService::Register | ( | std::string const & | label, |
bool | hasDirection | ||
) |
Registers a new type of systematic uncertainty.
The uncertainty might have a direction (e.g. JEC) or not (uncertainties implemented as event weights). This method does not set an uncertainty, only adds a new allowed type.
void SystService::Set | ( | std::string const & | label, |
VarDirection | direction = VarDirection::Undefined |
||
) |
Requests the given variation.
The uncertainty with the given label must have been registered beforehand. If it is not the case, an exception is thrown. If the provided variation does not agree with what was set with flag hasDirection in method Register, an exception is thrown.
If this method is called several times, only the last call has an effect.
void SystService::Set | ( | std::initializer_list< std::pair< std::string, VarDirection >> | variations | ) |
A version of the above method to request multiple variations.
Mostly useful for uncertainties implemented as event weights since usually they should be calculated together.
std::pair< bool, SystService::VarDirection > SystService::Test | ( | std::string const & | label | ) | const |
Tests if a systematic variation with the given label has been requested.
If the variation is not known (has not been registered beforehand), an exception is thrown. The first value of the returned pair indicates whether the variation has been requested, the second value is the corresponding direction.