9#include <analysis/modules/SignalSideVariablesToDaughterExtraInfo/SignalSideVariablesToDaughterExtraInfoModule.h>
10#include <framework/core/ModuleParam.templateDetails.h>
11#include <framework/datastore/StoreArray.h>
13#include <analysis/dataobjects/Particle.h>
14#include <analysis/dataobjects/RestOfEvent.h>
21REG_MODULE(SignalSideVariablesToDaughterExtraInfo);
31 setDescription(
"The module writes properties (values of specified variables) of the particle related to the current ROE\n"
32 "as an ExtraInfo to the single particle in the input ParticleList.\n"
33 "This module is intended to be executed only in for_each ROE path.");
36 std::map<std::string, std::string> emptymap;
40 "Dictionary of variables and extraInfo names to save in the extra-info field.",
43 "-1/0/1/2: Overwrite if lower / don't overwrite / overwrite if higher / always overwrite, in case if extra info with given name already exists",
55 B2ERROR(
"Variable '" << pair.first <<
"' is not available in Variable::Manager!");
66 unsigned int n = plist->getListSize();
72 B2WARNING(
"Input ParticleList " <<
m_particleListName <<
" contains more than 1 particle. plist.size = " << n);
76 auto* signalSide = roe->getRelatedFrom<
Particle>();
77 Particle* daughter = plist->getParticle(0);
80 for (
unsigned int iVar = 0; iVar < nVars; iVar++) {
81 double value = std::numeric_limits<double>::quiet_NaN();
82 if (std::holds_alternative<double>(
m_functions[iVar](signalSide))) {
83 value = std::get<double>(
m_functions[iVar](signalSide));
84 }
else if (std::holds_alternative<int>(
m_functions[iVar](signalSide))) {
85 value = std::get<int>(
m_functions[iVar](signalSide));
86 }
else if (std::holds_alternative<bool>(
m_functions[iVar](signalSide))) {
87 value = std::get<bool>(
m_functions[iVar](signalSide));
98 B2WARNING(
"Extra info with given name " <<
m_extraInfoNames[iVar] <<
" already set, I won't set it again.");
void setDescription(const std::string &description)
Sets the description of the module.
Class to store reconstructed particles.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
const Var * getVariable(std::string name)
Get the variable belonging to the given key.
static Manager & Instance()
get singleton instance.
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.