12 #include <analysis/modules/ParticleWeighting/ParticleWeightingModule.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/core/ModuleParam.templateDetails.h>
15 #include <framework/database/DBObjPtr.h>
16 #include <analysis/VariableManager/Manager.h>
19 #include <framework/logging/Logger.h>
45 setDescription(
"Weights particles according to LookUp table");
46 addParam(
"tableName", m_tableName,
"ID of table used for reweighing");
47 addParam(
"particleList", m_inputListName,
"Name of the ParticleList to reduce to the best candidates");
54 std::vector<std::string> variables = Variable::Manager::Instance().resolveCollections((
55 *m_ParticleWeightingLookUpTable.get())->getAxesNames());
56 std::map<std::string, double> values;
57 for (
const auto& i_variable : variables) {
60 B2ERROR(
"Variable '" << i_variable <<
"' is not available in Variable::Manager!");
62 values.insert(std::make_pair(i_variable, var->function(p)));
65 return (*m_ParticleWeightingLookUpTable.get())->getInfo(values);
69 void ParticleWeightingModule::initialize()
72 m_inputList.isRequired(m_inputListName);
73 m_ParticleWeightingLookUpTable = std::make_unique<DBObjPtr<ParticleWeightingLookUpTable>>(m_tableName);
77 void ParticleWeightingModule::event()
80 B2WARNING(
"Input list " << m_inputList.getName() <<
" was not created?");
84 const unsigned int numParticles = m_inputList->getListSize();
85 for (
unsigned int i = 0; i < numParticles; i++) {
86 const Particle* ppointer = m_inputList->getParticle(i);
90 for (
const auto& entry : info) {
91 p->addExtraInfo(m_tableName +
"_" + entry.first, entry.second);