10#include <analysis/modules/ParticleCombinerFromMC/ParticleCombinerFromMCModule.h>
13#include <framework/logging/Logger.h>
16#include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
17#include <analysis/DecayDescriptor/ParticleListName.h>
19#include <analysis/ParticleCombiner/ParticleCombiner.h>
22#include <analysis/utility/MCMatching.h>
49 "Input DecayDescriptor string (see :ref:`DecayString`).");
51 addParam(
"decayMode",
m_decayModeID,
"User-specified decay mode identifier (saved in 'decayModeID' extra-info for each Particle)",
55 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
57 "If true, the charge-conjugated mode will be reconstructed as well",
true);
85 B2DEBUG(10,
"event() started !!!");
91 bool existingList = plist.isValid();
94 B2WARNING(
"Output list " <<
m_listName <<
" was not created");
100 std::vector<unsigned int> toRemove;
101 unsigned int n = plist->getListSize();
102 for (
unsigned i = 0; i < n; i++) {
103 const Particle* part = plist->getParticle(i);
110 plist->removeParticles(toRemove);
119 for (
int i = 0; i < nProducts; ++i) {
138 B2ERROR(listName <<
" already exist ! You cannot write same sub-decay twice !!!");
143 bool isSelfConjugatedParticle = (listName == antiListName);
146 particleList.registerInDataStore(flags);
163 bool isSelfConjugatedParticle = (listName == antiListName);
167 outputList->initialize(pdgCode, listName);
172 outputAntiList->initialize(-1 * pdgCode, antiListName);
174 outputList->bindAntiParticleList(*(outputAntiList));
177 unsigned int numberOfLists = decaydescriptor.
getNDaughters();
179 for (
unsigned int i = 0; i < numberOfLists; ++i) {
187 if (!plist.isValid())
188 B2ERROR(daughter->getFullName() <<
" is not created");
190 unsigned nPart = plist->getListSize();
191 for (
unsigned iPart = 0; iPart < nPart; iPart++) {
192 const Particle* part = plist->getParticle(iPart);
194 if (particleType == Particle::c_Track or
195 particleType == Particle::c_ECLCluster or
196 particleType == Particle::c_KLMCluster)
197 B2ERROR(daughter->getFullName() <<
" contains a reconstructed particle! It is not accepted in ParticleCombinerFromMCModule!");
207 m_generator = std::make_unique<ParticleGenerator>(decaydescriptor,
"");
218 outputList->addParticle(iparticle, particle.getPDGCode(), particle.getFlavorType());
224 std::vector<unsigned int> toRemove;
225 unsigned int n = outputList->getListSize();
226 for (
unsigned i = 0; i < n; i++) {
227 const Particle* part = outputList->getParticle(i);
232 if (!cutIsSignal->check(part)) toRemove.push_back(part->
getArrayIndex());
234 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.
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)
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
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.
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 Particle *particle)
This is the main function of MC matching algorithm.
static int getMCErrors(const Particle *particle, const MCParticle *mcParticle=nullptr)
Returns quality indicator of the match as a bit pattern where the individual bits indicate the the ty...