9 #include <analysis/modules/AllParticleCombiner/AllParticleCombinerModule.h>
10 #include <analysis/DecayDescriptor/ParticleListName.h>
26 setDescription(R
"DOC("This module combines all particles of the provided list to one mother particle.
30 addParam(
"inputListNames", m_inputListNames,
"List of ParticleLists which are supposed to be combined", std::vector<std::string>());
31 addParam(
"cut", m_cutString,
"Selection criteria for the output ParticleList", std::string(
""));
32 addParam(
"writeOut", m_writeOut,
33 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
34 addParam(
"outputListName", m_outputListName,
35 "Name of the output list created by the combination of all particles in the input lists.", std::string(
""));
39 m_isSelfConjugatedParticle = 0;
79 if (nParticleLists == 0)
80 B2ERROR(
"No particle lists found for AllParticleCombinerModule.");
86 std::vector<int> daughterIndices;
88 for (
unsigned short iList = 0; iList < nParticleLists; ++iList) {
91 for (
unsigned int i = 0; i < plist->getListSize(); ++i) {
92 bool addParticle =
true;
93 Particle* particle = plist->getParticle(i,
true);
94 for (
auto* daughter : particle->getFinalStateDaughters()) {
95 int particleArrayIndex = daughter->getArrayIndex();
96 if (std::find(daughterIndices.begin(), daughterIndices.end(), particleArrayIndex) != daughterIndices.end()) {
102 for (
auto* daughter : particle->getFinalStateDaughters()) {
103 int particleArrayIndex = daughter->getArrayIndex();
104 daughterIndices.push_back(particleArrayIndex);
106 px += particle->getPx();
107 py += particle->getPy();
108 pz += particle->getPz();
109 E += particle->getEnergy();
114 const TLorentzVector vec(px, py, pz, E);
120 if (
m_cut->check(newParticle)) {
This module combines all particles of the provided list to one mother particle.
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
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
std::string m_cutString
Selection criteria.
std::unique_ptr< Variable::Cut > m_cut
cut object which performs the cuts
virtual void event() override
process event
virtual void initialize() override
Register input and output data.
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.
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...
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.
Type-safe access to single objects in the data store.
#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.