10#include <generators/modules/evtgendecay/EvtGenDecayModule.h>
13#include <generators/evtgen/EvtGenUtilities.h>
16#include <framework/datastore/StoreArray.h>
17#include <framework/utilities/FileSystem.h>
20#include <EvtGenBase/EvtPDL.hh>
21#include <EvtGenBase/EvtDecayTable.hh>
29 setDescription(
"This module decays unstable particles using EvtGen. The "
30 "event should be already generated by another generator. "
31 "If you need to generate full event with EvtGen, then use "
32 "the module 'EvtGenInput'.");
35 "decfiles/dec/DECAY_BELLE2.DEC",
true));
39 "MCParticle collection name.", std::string(
""));
51 generators::checkEvtGenDecayFile(
m_DecFile);
65 B2FATAL(
"EvtGenDecayModule::event(): BeamParameters have changed within "
66 "a job, this is not supported for EvtGen!");
72 for (i = 0; i < n; i++) {
104 EvtDecayTable* decayTable;
106 decayTable = EvtDecayTable::getInstance();
107 n = EvtPDL::entries();
108 for (i = 0; i < n; i++) {
109 id = EvtPDL::getEntry(i);
110 if (decayTable->getNModes(
id) > 0)
virtual void initialize() override
Initialization.
virtual void event() override
This method is called for each event.
virtual void endRun() override
This method is called if the current run ends.
virtual void terminate() override
This method is called at the end of the event processing.
bool m_Initialized
Whether the generator is initialized or not.
std::string m_DecFile
Decay file.
virtual void beginRun() override
This method is called when entering a new run.
DBObjPtr< BeamParameters > m_BeamParameters
Beam parameters.
std::string m_UserDecFile
User decay file.
MCParticleGraph m_Graph
MCParticle graph.
std::string m_MCParticleColName
MCParticle collection name.
EvtGenInterface m_EvtGenInterface
Evtgen interface.
EvtGenDecayModule()
Constructor.
std::set< int > m_DecayableParticles
Monte-Carlo codes of particles that can be decayed by EvtGen.
virtual ~EvtGenDecayModule()
Destructor.
void initializeGenerator()
Generator initialization.
int simulateDecay(MCParticleGraph &graph, MCParticleGraph::GraphParticle &parent)
Simulate a particle decay.
int setup(const std::string &decayFileName, const std::string &parentParticle, const std::string &userFileName=std::string(""), bool coherentMixing=true)
Setup evtgen with the given decay files
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Class to represent Particle data in graph.
@ c_checkCyclic
Check for cyclic dependencies.
@ c_clearParticles
Clear the particle list before adding the graph.
@ c_setDecayInfo
Set decay time and vertex.
size_t size() const
Return the number of particles in the graph.
void loadList(const std::string &name="")
Load the MCParticle list given by name into the Graph.
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
int getNDaughters() const
Return number of daughter MCParticles.
int getPDG() const
Return PDG code of particle.
void setDescription(const std::string &description)
Sets the description of the module.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Accessor to arrays stored 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.
bool isInitial() const
Check if particle is an initial particle such as ISR.
void clear()
Reset particles and decay information to make the class reusable.
Abstract base class for different kinds of events.