9#include <analysis/modules/AllParticleCombiner/AllParticleCombinerModule.h>
10#include <analysis/DecayDescriptor/ParticleListName.h>
12#include <Math/Vector4D.h>
28 setDescription(R
"DOC(This module combines all particles of the provided list to one mother particle.
32 addParam(
"inputListNames",
m_inputListNames,
"List of ParticleLists which are supposed to be combined", std::vector<std::string>());
33 addParam(
"cut",
m_cutString,
"Selection criteria for the output ParticleList", std::string(
""));
35 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
37 "Name of the output list created by the combination of all particles in the input lists.", std::string(
""));
81 if (nParticleLists == 0)
82 B2ERROR(
"No particle lists found for AllParticleCombinerModule.");
88 std::vector<int> daughterIndices;
90 for (
unsigned short iList = 0; iList < nParticleLists; ++iList) {
93 for (
unsigned int i = 0; i < plist->getListSize(); ++i) {
94 bool addParticle =
true;
95 Particle* particle = plist->getParticle(i,
true);
96 for (
auto* daughter : particle->getFinalStateDaughters()) {
97 int particleArrayIndex = daughter->getArrayIndex();
98 if (std::find(daughterIndices.begin(), daughterIndices.end(), particleArrayIndex) != daughterIndices.end()) {
104 for (
auto* daughter : particle->getFinalStateDaughters()) {
105 int particleArrayIndex = daughter->getArrayIndex();
106 daughterIndices.push_back(particleArrayIndex);
108 px += particle->getPx();
109 py += particle->getPy();
110 pz += particle->getPz();
111 E += particle->getEnergy();
116 const ROOT::Math::PxPyPzEVector vec(px, py, pz,
E);
122 if (
m_cut->check(newParticle)) {
bool m_isSelfConjugatedParticle
flag that indicates whether an anti-particle mother does not exist and should not be reconstructed as...
std::string m_antiListName
output anti-particle list name
virtual void initialize() override
Register input and output data.
virtual void event() override
process event
std::vector< std::string > m_inputListNames
List of ParticleLists which are supposed to be combined.
StoreObjPtr< ParticleList > m_outputAntiList
output anti-particle list
StoreArray< Particle > m_particles
StoreArray of Particle objects.
StoreObjPtr< ParticleList > m_outputList
output particle list
AllParticleCombinerModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_cutString
Selection criteria.
std::unique_ptr< Variable::Cut > m_cut
cut object which performs the cuts
DecayDescriptor m_decaydescriptor
Decay descriptor of the decay being reconstructed.
bool m_writeOut
If true, the output ParticleList will be saved by RootOutput.
int m_pdgCode
PDG code of the combined mother particle.
std::string m_outputListName
Name of the output list created by the combination of all particles in the input list.
EStoreFlags
Flags describing behaviours of objects etc.
@ c_WriteOut
Object/array should be saved by output modules.
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Represents a particle in the DecayDescriptor.
int getPDGCode() const
Return PDG code.
std::string getFullName() const
returns the full name of the particle full_name = name:label
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptorParticle * getMother() const
return mother.
static std::unique_ptr< GeneralCut > compile(const std::string &cut)
Creates an instance of a cut and returns a unique_ptr to it, if you need a copy-able object instead y...
void setDescription(const std::string &description)
Sets the description of the module.
Class to store reconstructed particles.
@ c_Unflavored
Is its own antiparticle or we don't know whether it is a particle/antiparticle.
@ c_Flavored
Is either particle or antiparticle.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
T * appendNew()
Construct a new T object at the end of the array.
TClonesArray * getPtr() const
Raw access to the underlying TClonesArray.
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.
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
Abstract base class for different kinds of events.