10#include <analysis/modules/ParticleExtractorFromROE/ParticleExtractorFromROEModule.h>
13#include <framework/logging/Logger.h>
14#include <framework/datastore/StoreArray.h>
17#include <analysis/dataobjects/Particle.h>
18#include <analysis/DecayDescriptor/DecayDescriptorParticle.h>
19#include <analysis/DecayDescriptor/ParticleListName.h>
36 setDescription(
"Extract Particles that belong to the ROE and fill them into ParticleLists.");
40 std::vector<std::string> defaultList;
42 "list of ParticleList names to be created", defaultList);
44 "Name of signal side ParticleList. It is required if the function is called in the main path.", std::string(
""));
46 "List of all mask names for which the info will be printed.",
50 "If true, the output ParticleList will be saved by RootOutput. If false, it will be ignored when writing the file.",
false);
67 for (
int iList = 0; iList < nLists; iList++) {
72 if (not dd.
init(listName))
73 B2ERROR(
"Invalid PariticleList name: " << listName);
87 particleList.registerInDataStore(listName, flags);
88 if (listName != antiListName) {
111 m_pLists[iList]->initialize(pdgCode, listName);
112 if (listName != antiListName) {
115 m_antiPLists[iList]->initialize(-1 * pdgCode, antiListName);
129 B2ERROR(
"RestOfEvent object is not valid and signalSideListName is not provided");
134 const int nSignalSideCandidates = signaSideParticleList->getListSize();
136 if (nSignalSideCandidates > 1) {
137 B2ERROR(
"Signal side ParticleList has more than one candidate. There must be only one candidate.");
139 }
else if (nSignalSideCandidates == 0) {
143 const Particle* particle = signaSideParticleList->getParticle(0);
154 for (
auto part : particlesInROE) {
155 const int absPdg = abs(part->getPDGCode());
161 const int indexList = std::distance(
m_absPdgCodes.begin(), result);
162 m_pLists[indexList]->addParticle(part);
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.
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 DecayDescriptorParticle * getMother() const
return mother.
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...
std::string m_signalSideParticleListName
output ParticleList names
std::vector< std::string > m_outputListNames
output ParticleList names
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
void extractParticlesFromROE(const RestOfEvent *roe)
Extract particles that belong to the given ROE and fill them in the output ParticleLists.
std::string m_maskName
mask name to be applied
ParticleExtractorFromROEModule()
Constructor.
std::vector< StoreObjPtr< ParticleList > > m_pLists
output ParticleList names
std::vector< StoreObjPtr< ParticleList > > m_antiPLists
output anti-ParticleList names
std::vector< int > m_pdgCodes
pdg codes of output ParticleList
std::vector< std::string > m_outputAntiListNames
output anti-ParticleList names
bool m_writeOut
toggle output particle list btw.
std::vector< int > m_absPdgCodes
pdg codes of output ParticleList
Class to store reconstructed particles.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
This is a general purpose class for collecting reconstructed MDST data objects that are not used in r...
std::vector< const Particle * > getParticles(const std::string &maskName=c_defaultMaskName, bool unpackComposite=true) const
Get all Particles from ROE mask.
static constexpr const char * c_defaultMaskName
Default mask name.
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.
Accessor to arrays stored in the data store.
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
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.