 |
Belle II Software
release-05-01-25
|
12 #include <EvtGenBase/EvtPDL.hh>
13 #include <EvtGenBase/EvtDecayTable.hh>
16 #include <framework/datastore/StoreArray.h>
17 #include <framework/utilities/FileSystem.h>
18 #include <generators/modules/evtgendecay/EvtGenDecayModule.h>
26 setDescription(
"This module decays unstable particles using EvtGen. The "
27 "event should be already generated by another generator. "
28 "If you need to generate full event with EvtGen, then use "
29 "the module 'EvtGenInput'.");
30 addParam(
"DecFile", m_DecFile,
"EvtGen decay file (DECAY.DEC)",
32 "decfiles/dec/DECAY_BELLE2.DEC",
true));
33 addParam(
"UserDecFile", m_UserDecFile,
"User EvtGen decay file",
35 addParam(
"MCParticleColName", m_MCParticleColName,
36 "MCParticle collection name.", std::string(
""));
37 m_Initialized =
false;
47 mcParticles.isRequired();
48 const std::string defaultDecFile =
51 B2ERROR(
"No global decay file defined, please make sure "
52 "the parameter 'DecFile' is set correctly.");
55 if (defaultDecFile.empty()) {
56 B2WARNING(
"Cannot find default decay file");
58 B2INFO(
"Using non-standard DECAY file \"" <<
m_DecFile <<
"\"");
73 B2FATAL(
"EvtGenDecayModule::event(): BeamParameters have changed within "
74 "a job, this is not supported for EvtGen!");
80 for (i = 0; i < n; i++) {
112 EvtDecayTable* decayTable;
114 decayTable = EvtDecayTable::getInstance();
115 n = EvtPDL::entries();
116 for (i = 0; i < n; i++) {
117 id = EvtPDL::getEntry(i);
118 if (decayTable->getNModes(
id) > 0)
virtual ~EvtGenDecayModule()
Destructor.
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
MCParticleGraph m_Graph
MCParticle graph.
void initializeGenerator()
Generator initialization.
size_t size() const
Return the number of particles in the graph.
int simulateDecay(MCParticleGraph &graph, MCParticleGraph::GraphParticle &parent)
Simulate a particle decay.
std::set< int > m_DecayableParticles
Monte-Carlo codes of particles that can be decayed by EvtGen.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
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
@ c_checkCyclic
Check for cyclic dependencies.
std::string m_DecFile
Decay file.
void loadList(const std::string &name="")
Load the MCParticle list given by name into the Graph.
std::string m_UserDecFile
User decay file.
bool isInitial() const
Check if particle is an initial particle such as ISR.
@ c_setDecayInfo
Set decay time and vertex.
virtual void beginRun() override
This method is called when entering a new run.
Abstract base class for different kinds of events.
int getPDG() const
Return PDG code of particle.
virtual void endRun() override
This method is called if the current run ends.
@ c_clearParticles
Clear the particle list before adding the graph.
bool m_Initialized
Whether the generator is initialized or not.
virtual void initialize() override
Initialization.
DBObjPtr< BeamParameters > m_BeamParameters
Beam parameters.
virtual void terminate() override
This method is called at the end of the event processing.
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...
int getNDaughters() const
Return number of daughter MCParticles.
void clear()
Reset particles and decay information to make the class reusable.
std::string m_MCParticleColName
MCParticle collection name.
This module decays unstable particles using EvtGen.
Class to represent Particle data in graph.
virtual void event() override
This method is called for each event.
EvtGenInterface m_EvtGenInterface
Evtgen interface.