10#include <analysis/modules/ParticleWeighting/ParticleWeightingModule.h>
12#include <framework/core/ModuleParam.templateDetails.h>
13#include <analysis/VariableManager/Manager.h>
16#include <framework/logging/Logger.h>
36 setDescription(
"Append weights from the database into the extraInfo of Particles.");
41 "If False (default), the basf2 process stops when the payload is not available. If True, this module is skipped.",
51 std::map<std::string, double> values;
52 for (
const auto& i_variable : variables) {
55 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
57 values.insert(std::make_pair(i_variable, std::get<double>(var->function(p))));
75 B2INFO(
"The payload for the " <<
m_tableName <<
" is not available! This module will do nothing.");
77 B2ERROR(
"The payload for the " <<
m_tableName <<
" is not available! The basf2 process will not start.");
85 B2WARNING(
"Input list " <<
m_inputList.getName() <<
" was not created?");
91 const unsigned int numParticles =
m_inputList->getListSize();
92 for (
unsigned int i = 0; i < numParticles; i++) {
99 for (
auto& selParticle : selParticles) {
102 for (
const auto& entry : info) {
103 pp->addExtraInfo(
m_tableName +
"_" + entry.first, entry.second);
108 for (
const auto& entry : info) {
109 p->addExtraInfo(
m_tableName +
"_" + entry.first, entry.second);
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
std::vector< const Particle * > getSelectionParticles(const Particle *particle)
Get a vector of pointers with selected daughters in the decay tree.
void setDescription(const std::string &description)
Sets the description of the module.
ParticleWeightingModule()
Constructor.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processing by the module.
WeightInfo getInfo(const Particle *p)
Get LookUp information for the particle.
StoreArray< Particle > m_particles
StoreArray of Particles.
std::string m_selectedDaughters
Daughters for which one wants to append weights.
StoreObjPtr< ParticleList > m_inputList
input particle list
DecayDescriptor m_decayDescriptor
Decay Descriptor to be initialized with m_selectedDaughters.
std::unique_ptr< OptionalDBObjPtr< ParticleWeightingLookUpTable > > m_ParticleWeightingLookUpTable
Pointer to the table in DB.
std::string m_tableName
Name of the table.
bool m_allowToSkip
Controls whether the process is skipped when the payload is missing.
std::string m_inputListName
name of input particle list.
Class to store reconstructed particles.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
std::vector< std::string > resolveCollections(const std::vector< std::string > &variables)
Resolve Collection Returns variable names corresponding to the given collection or if it is not a col...
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
static Manager & Instance()
get singleton instance.
std::map< std::string, double > WeightInfo
Weight information: a line from the weight lookup table.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.
A variable returning a floating-point value for a given Particle.