10#include <analysis/modules/ParticleCombinerFromMC/ParticleCombinerFromMCModule.h>
13#include <framework/logging/Logger.h>
16#include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
19#include <analysis/DecayDescriptor/ParticleListName.h>
20#include <analysis/utility/MCMatching.h>
47 "Input DecayDescriptor string (see :ref:`DecayString`).");
49 addParam(
"decayMode",
m_decayModeID,
"User-specified decay mode identifier (saved in 'decayModeID' extra-info for each Particle)",
53 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
55 "If true, the charge-conjugated mode will be reconstructed as well",
true);
83 B2DEBUG(10,
"event() started !!!");
89 bool existingList = plist.isValid();
92 B2WARNING(
"Output list " <<
m_listName <<
" was not created");
98 std::vector<unsigned int> toRemove;
99 unsigned int n = plist->getListSize();
100 for (
unsigned i = 0; i < n; i++) {
101 const Particle* part = plist->getParticle(i);
108 plist->removeParticles(toRemove);
117 for (
int i = 0; i < nProducts; ++i) {
136 B2ERROR(listName <<
" already exist ! You cannot write same sub-decay twice !!!");
141 bool isSelfConjugatedParticle = (listName == antiListName);
144 particleList.registerInDataStore(flags);
161 bool isSelfConjugatedParticle = (listName == antiListName);
165 outputList->initialize(pdgCode, listName);
170 outputAntiList->initialize(-1 * pdgCode, antiListName);
172 outputList->bindAntiParticleList(*(outputAntiList));
175 unsigned int numberOfLists = decaydescriptor.
getNDaughters();
177 for (
unsigned int i = 0; i < numberOfLists; ++i) {
185 if (!plist.isValid())
186 B2ERROR(daughter->getFullName() <<
" is not created");
188 unsigned nPart = plist->getListSize();
189 for (
unsigned iPart = 0; iPart < nPart; iPart++) {
190 const Particle* part = plist->getParticle(iPart);
192 if (particleType == Particle::c_Track or
193 particleType == Particle::c_ECLCluster or
194 particleType == Particle::c_KLMCluster)
195 B2ERROR(daughter->getFullName() <<
" contains a reconstructed particle! It is not accepted in ParticleCombinerFromMCModule!");
205 m_generator = std::make_unique<ParticleGenerator>(decaydescriptor,
"");
222 std::vector<unsigned int> toRemove;
223 unsigned int n = outputList->getListSize();
224 for (
unsigned i = 0; i < n; i++) {
225 const Particle* part = outputList->getParticle(i);
230 if (!cutIsSignal->check(part)) toRemove.push_back(part->
getArrayIndex());
232 outputList->removeParticles(toRemove);
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
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
bool init(const std::string &str)
Initialise the DecayDescriptor from given string.
const DecayDescriptor * getDaughter(int i) const
return i-th daughter (0 based index).
int getNDaughters() const
return number of direct daughters.
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.
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...
void combineRecursively(const DecayDescriptor &decaydescriptor)
Combine particles which have (sub-)decay recursively.
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
void registerParticleRecursively(const DecayDescriptor &decaydescriptor)
Register particles which have (sub-)decay recursively.
std::string m_decayString
Input DecayString specifying the decay being reconstructed.
std::string m_listName
output particle list name
StoreArray< Particle > m_particles
StoreArray of Particles.
ParticleCombinerFromMCModule()
Constructor.
std::unique_ptr< ParticleGenerator > m_generator
Generates the combinations.
std::unique_ptr< Variable::Cut > m_cut
cut object which performs the cuts
int m_decayModeID
user specified decay mode identifier
std::string m_cutParameter
selection criteria
DecayDescriptor m_decaydescriptor
Decay descriptor of the decay being reconstructed.
bool m_writeOut
toggle output particle list btw.
std::vector< std::string > m_vector_listName
vector of output particle list name
bool m_chargeConjugation
boolean to control whether charge conjugated decay should be reconstructed as well
Class to store reconstructed particles.
EParticleSourceObject
particle source enumerators
EFlavorType getFlavorType() const
Returns flavor type of the decay (for FS particles: flavor type of particle)
int getPDGCode(void) const
Returns PDG code.
void addExtraInfo(const std::string &name, double value)
Sets the user-defined data of given name to the given value.
EParticleSourceObject getParticleSource() const
Returns particle source as defined with enum EParticleSourceObject.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
bool create(bool replace=false)
Create a default object in the data store.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
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.
static bool setMCTruth(const Belle2::Particle *particle)
This is the main function of MC matching algorithm.
static int getMCErrors(const Belle2::Particle *particle, const Belle2::MCParticle *mcParticle=nullptr)
Returns quality indicator of the match as a bit pattern where the individual bits indicate the the ty...