9#include <generators/kkmc/KKGenInterface.h>
10#include <generators/modules/kkgeninput/KKGenInputModule.h>
11#include <framework/utilities/ConditionalGaussGenerator.h>
12#include <mdst/dataobjects/MCParticleGraph.h>
13#include <framework/utilities/FileSystem.h>
15#include <framework/datastore/DataStore.h>
16#include <framework/datastore/StoreArray.h>
17#include <framework/dataobjects/EventMetaData.h>
18#include <framework/datastore/StoreObjPtr.h>
20#include <framework/logging/Logger.h>
21#include <framework/utilities/IOIntercept.h>
23#include <boost/filesystem.hpp>
24#include <Math/Vector3D.h>
43 setDescription(
"KKGenInput module. This an interface for KK2f Event Generator for basf2. The generated events are stored into MCParticles. You can find an expample of its decay file (tau_decaytable.dat) for tau-pair events at ${BELLE2_RELEASE_DIR}/data/generators/kkmc. On the other hand, when you like to generate mu-pair events, ${BELLE2_RELEASE_DIR}/data/generators/kkmc/mu.input.dat should be set to tauinputFile in your steering file.");
82 B2FATAL(
"KKGenInputModule::event(): BeamParameters have changed within a job, this is not supported for KKMC!");
97 for (
int i = 0; i < nPart; ++i) {
101 sprintf(buf,
"IntC: %3d %4u %8d %4d %4d %4d %9.4f %9.4f %9.4f %9.4f",
102 p->getIndex(), p->getStatus(), p->getPDG(), moID,
103 p->getFirstDaughter(), p->getLastDaughter(),
104 p->get4Vector().Px(), p->get4Vector().Py(),
105 p->get4Vector().Pz(), p->get4Vector().E());
109 B2DEBUG(150,
"Generated event " << eventMetaDataPtr->getEvent() <<
" with " << nPart <<
" particles.");
128 auto uniqueOutputFileName = boost::filesystem::unique_path(
m_KKMCOutputFileName +
"-%%%%%%%%%%").native();
129 B2WARNING(
"The KKMC output file " <<
m_KKMCOutputFileName <<
" already exists. Using " << uniqueOutputFileName <<
" instead.");
137 B2FATAL(
"KKGenInputModule::initializeGenerator(): Failed to open KKMC output file!");
147 B2FATAL(
"KKGenInputModule::initializeGenerator(): " <<
m_tauinputFileName <<
" not found!");
163 initLogCapture.
start();
175 B2DEBUG(150,
"KKGenInputModule::initializeGenerator(): Finished initialising the KKGen Input Module. ");
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
Class implementing n-dimensional random number generator from Gaussian distribution where the first c...
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
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...
static bool fileExists(const std::string &filename)
Check if the file with given filename exists.
The base module for generator modules, which sets the generator information as EventExtraInfo.
bool start()
Start intercepting the output.
Capture stdout and stderr and convert into log messages.
bool finish()
Finish the capture and emit the message if output has appeard on stdout or stderr.
double getNominalEcmsSpread()
Get spread of CMS collision energy calculated from beam parameters.
double getNominalEcms()
Get the CMS energy of collisions.
const ConditionalGaussGenerator & getLorentzGenerator()
Get the generator for the Lorentz transformation.
int simulateEvent(MCParticleGraph &graph, const ConditionalGaussGenerator &lorentzGenerator, ROOT::Math::XYZVector vertex)
Simulate the events.
void term()
Terminate the generator.
int setup(const std::string &KKdefaultFileName, const std::string &tauinputFileName, const std::string &taudecaytableFileName, const std::string &KKMCOutputFileName)
Setup for KKMC and TAUOLA.
void set_beam_info(double Ecms0, double Ecms0Spread)
Setup for beams information.
@ c_Info
Info: for informational messages, e.g.
@ c_Debug
Debug: for code development.
Class to represent Particle data in graph.
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_Input
This module is an input module (reads data).
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.
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.
ROOT::Math::XYZVector getVertexConditional()
Generate vertex position and possibly update the generator of Lorentz transformation.
void initialize()
function to be executed on initialize()
void clear()
Reset particles and decay information to make the class reusable.
Abstract base class for different kinds of events.