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>
34 ParticleWeightingModule::ParticleWeightingModule() :
Module()
36 setDescription(
"Append weights from the database into the extraInfo of Particles.");
48 std::map<std::string, double> values;
49 for (
const auto& i_variable : variables) {
52 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
54 values.insert(std::make_pair(i_variable, std::get<double>(var->function(p))));
74 B2WARNING(
"Input list " <<
m_inputList.getName() <<
" was not created?");
78 const unsigned int numParticles =
m_inputList->getListSize();
79 for (
unsigned int i = 0; i < numParticles; i++) {
86 for (
auto& selParticle : selParticles) {
89 for (
const auto& entry : info) {
90 pp->addExtraInfo(
m_tableName +
"_" + entry.first, entry.second);
95 for (
const auto& entry : info) {
96 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.
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.
std::unique_ptr< DBObjPtr< ParticleWeightingLookUpTable > > m_ParticleWeightingLookUpTable
Pointer to the table in DB.
StoreObjPtr< ParticleList > m_inputList
input particle list
DecayDescriptor m_decayDescriptor
Decay Descriptor to be initialized with m_selectedDaughters.
std::string m_tableName
Name of the table.
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.
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.