8#include <boost/python.hpp>
10#include <framework/modules/core/InteractiveModule.h>
12#include <framework/logging/Logger.h>
28 setDescription(
"Start an interactive (I)python shell in each call of event(). Also imports the ROOT.Belle2 namespace for convenience, allowing you to use Belle2.PyStoreArray etc. directly.");
31InteractiveModule::~InteractiveModule() =
default;
37 if (PyRun_SimpleString(
"import interactive") == -1) {
38 B2FATAL(
"'import interactive' failed.");
40 if (PyRun_SimpleString(
"from ROOT import Belle2") == -1) {
41 B2FATAL(
"'from ROOT import Belle2' failed.");
44 B2INFO(
"Opening (I)Python shell, press Ctrl+D to close it. Press Ctrl+C first to exit basf2.");
45 if (PyRun_SimpleString(
"interactive.embed()") == -1) {
46 B2ERROR(
"embed() failed!");
virtual void event() override
This method is the core of the module.
InteractiveModule()
Constructor.
void setDescription(const std::string &description)
Sets the description of the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.