 |
Belle II Software
release-05-02-19
|
11 #include <analysis/modules/AllParticleCombiner/AllParticleCombinerModule.h>
12 #include <analysis/dataobjects/Particle.h>
13 #include <analysis/dataobjects/ParticleList.h>
14 #include <analysis/DecayDescriptor/ParticleListName.h>
15 #include <framework/datastore/StoreArray.h>
16 #include <framework/datastore/StoreObjPtr.h>
32 setDescription(R
"DOC("This module combines all particles of the provided list to one mother particle.
36 addParam(
"inputListNames", m_inputListNames,
"List of ParticleLists which are supposed to be combined", std::vector<std::string>());
37 addParam(
"cut", m_cutString,
"Selection criteria for the output ParticleList", std::string(
""));
38 addParam(
"writeOut", m_writeOut,
39 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
40 addParam(
"outputListName", m_outputListName,
41 "Name of the output list created by the combination of all particles in the input lists.", std::string(
""));
45 m_isSelfConjugatedParticle = 0;
65 particleList.registerInDataStore(flags);
68 antiParticleList.registerInDataStore(flags);
84 outputAntiList.create();
87 outputList->bindAntiParticleList(*(outputAntiList));
91 if (nParticleLists == 0)
92 B2ERROR(
"No particle lists found for AllParticleCombinerModule.");
98 std::vector<int> daughterIndices;
100 for (
unsigned short iList = 0; iList < nParticleLists; ++iList) {
103 for (
unsigned int i = 0; i < plist->getListSize(); ++i) {
104 bool addParticle =
true;
105 Particle* particle = plist->getParticle(i,
true);
106 for (
auto* daughter : particle->getFinalStateDaughters()) {
107 int particleArrayIndex = daughter->getArrayIndex();
108 if (std::find(daughterIndices.begin(), daughterIndices.end(), particleArrayIndex) != daughterIndices.end()) {
114 for (
auto* daughter : particle->getFinalStateDaughters()) {
115 int particleArrayIndex = daughter->getArrayIndex();
116 daughterIndices.push_back(particleArrayIndex);
118 px += particle->getPx();
119 py += particle->getPy();
120 pz += particle->getPz();
121 E += particle->getEnergy();
126 const TLorentzVector vec(px, py, pz, E);
129 daughterIndices, particles.getPtr());
131 Particle* newParticle = particles.appendNew(combinedParticle);
132 if (
m_cut->check(newParticle)) {
133 outputList->addParticle(newParticle);
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...
DecayDescriptor m_decaydescriptor
Decay descriptor of the decay being reconstructed.
std::vector< std::string > m_inputListNames
List of ParticleLists which are supposed to be combined.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
This module combines all particles of the provided list to one mother particle.
EStoreFlags
Flags describing behaviours of objects etc.
bool m_writeOut
If true, the output ParticleList will be saved by RootOutput.
Represents a particle in the DecayDescriptor.
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
std::string m_outputListName
Name of the output list created by the combination of all particles in the input list.
std::string antiParticleListName(const std::string &listName)
Returns name of anti-particle-list corresponding to listName.
bool m_isSelfConjugatedParticle
flag that indicates whether an anti-particle mother does not exist and should not be reconstructed as...
@ c_Flavored
Is either particle or antiparticle.
@ c_WriteOut
Object/array should be saved by output modules.
virtual void event() override
process event
std::string m_cutString
Selection criteria.
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
@ c_Unflavored
Is its own antiparticle or we don't know whether it is a particle/antiparticle.
Class to store reconstructed particles.
virtual void initialize() override
Register input and output data.
std::string m_antiListName
output anti-particle list name
const DecayDescriptorParticle * getMother() const
return mother.
std::unique_ptr< Variable::Cut > m_cut
cut object which performs the cuts
int m_pdgCode
PDG code of the combined mother particle.