10#include <analysis/modules/ParticleCopier/ParticleCopierModule.h>
14#include <framework/datastore/StoreObjPtr.h>
17#include <framework/logging/Logger.h>
20#include <analysis/dataobjects/Particle.h>
21#include <analysis/dataobjects/ParticleList.h>
24#include <analysis/utility/ParticleCopy.h>
41 setDescription(
"Replaces each Particle in the ParticleList with its copy.\n"
42 "Particle's (grand)^n-daughter Particles are copied as well.\n"
43 "The existing relations of the original Particle (or it's (grand-)^n-daughters)\n"
44 "are copied as well.");
48 vector<string> defaultList;
50 "list of input ParticleList names", defaultList);
67 bool isReserved = plist->getIsReserved();
69 plist->setEditable(
true);
71 const unsigned int origSize = plist->getListSize();
72 std::vector<Particle*> copies(origSize);
74 for (
unsigned i = 0; i < origSize; i++) {
75 const Particle* origP = plist->getParticle(i);
84 for (
unsigned i = 0; i < origSize; i++)
85 plist->addParticle(copies[i]);
87 unsigned int copySize = plist->getListSize();
90 if (copySize != origSize)
91 B2FATAL(
"Size of the ParticleList " << inputListName
92 <<
" has changed while copying the Particles! original size = "
93 << origSize <<
" vs. new size = " << copySize);
96 plist->setEditable(
false);
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...
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
std::vector< std::string > m_inputListNames
input ParticleList names
ParticleCopierModule()
Constructor.
Class to store reconstructed particles.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Type-safe access to single objects in the data store.
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.
Particle * copyParticle(const Particle *original)
Function takes argument Particle and creates a copy of it and copies of all its (grand-)^n-daughters.
Abstract base class for different kinds of events.