10 #include <analysis/modules/ParticlePrinter/ParticlePrinterModule.h> 
   13 #include <framework/logging/Logger.h> 
   16 #include <analysis/VariableManager/Manager.h> 
   31 ParticlePrinterModule::ParticlePrinterModule() : 
Module()
 
   34   setDescription(
"Prints specified variables for all particles in the specified particle list to screen (useful for debugging).\n" 
   35                  "Event-based variables can be printed by not specifying the particle list (empty string).");
 
   41   vector<string> defaultVariables;
 
   42   addParam(
"variables", 
m_variables, 
"names of variables to be printed (see Variable::Manager)", defaultVariables);
 
   54       B2ERROR(
"ParticlePrinterModule::initialize Invalid input DecayString: " << 
m_listName);
 
   58       B2ERROR(
"ParticlePrinterModule::initialize Invalid input DecayString " << 
m_listName 
   59               << 
". DecayString should not contain any daughters, only the mother particle.");
 
   75     B2ERROR(
"ParticleList " << 
m_listName << 
" not found");
 
   81   B2INFO(
"[ParticlePrinterModule] START ------------------------------");
 
   85   for (
unsigned i = 0; i < 
m_plist->getListSize(); i++) {
 
   92       if (particle->
getParticleSource() == Particle::EParticleSourceObject::c_Composite) {
 
   95           s += 
" " + std::to_string(idx);
 
   96         B2INFO(
"     o) daughter indices =" << s);
 
  101   B2INFO(
"[ParticlePrinterModule] END   ------------------------------");
 
  110     auto var = manager.getVariable(varName);
 
  111     if (var == 
nullptr) {
 
  112       B2ERROR(
"ParticlePrinter: Variable::Manager doesn't have variable" << varName);
 
  115       if (std::holds_alternative<double>(result)) {
 
  116         double value = std::get<double>(result);
 
  117         B2INFO(
"     o) " << varName << 
" = " << value);
 
  118       } 
else if (std::holds_alternative<int>(result)) {
 
  119         int value = std::get<int>(result);
 
  120         B2INFO(
"     o) " << varName << 
" = " << value);
 
  121       } 
else if (std::holds_alternative<bool>(result)) {
 
  122         bool value = std::get<bool>(result);
 
  123         B2INFO(
"     o) " << varName << 
" = " << value);
 
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
int getNDaughters() const
return number of direct daughters.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
bool m_fullPrint
steering variable
std::vector< std::string > m_variables
names of variables to be printed
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
std::string m_listName
particle list name
DecayDescriptor m_decaydescriptor
Decay descriptor of the particle being selected.
StoreObjPtr< ParticleList > m_plist
particle list
void printVariables(const Particle *particle) const
Prints out the values of variables specified by the user via the Variables module parameter.
Class to store reconstructed particles.
int getPDGCode(void) const
Returns PDG code.
const std::vector< int > & getDaughterIndices() const
Returns a vector of store array indices of daughter particles.
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
void print() const
Prints the contents of a Particle object to standard output.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
Global list of available variables.
std::variant< double, int, bool > VarVariant
NOTE: the python interface is documented manually in analysis/doc/Variables.rst (because we use ROOT ...
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.