DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4PythonAction.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // \author Markus Frank
11 // \date 2015-11-03
12 //
13 //==========================================================================
14 
15 // Framework include files
16 #include <DDG4/Factories.h>
19 #include <DDG4/Python/DDPython.h>
20 
21 using namespace dd4hep::sim;
22 
24 
25 Geant4PythonAction::Geant4PythonAction(Geant4Context* ctxt, const std::string& nam)
27  : Geant4Action(ctxt,nam)
28 {
29  m_needsControl = true;
30 }
31 
33 int Geant4PythonAction::exec(const std::string& cmd) {
34  return DDPython::instance().execute(cmd);
35 }
36 
38 int Geant4PythonAction::eval(const std::string& cmd) {
39  return DDPython::instance().evaluate(cmd);
40 }
41 
43 int Geant4PythonAction::runFile(const std::string& cmd) {
44  return DDPython::instance().runFile(cmd);
45 }
46 
48 int Geant4PythonAction::call(PyObject* method, PyObject* args) {
49  return Geant4PythonCall().execute<int>(method,args);
50 }
51 
55 }
dd4hep::sim::Geant4PythonAction::call
static int call(PyObject *method, PyObject *args)
Execute command in the python interpreter.
Definition: Geant4PythonAction.cpp:48
dd4hep::DDPython::evaluate
int evaluate(const std::string &cmd) const
Definition: DDPython.cpp:253
DECLARE_GEANT4ACTION
#define DECLARE_GEANT4ACTION(name)
Plugin defintion to create Geant4Action objects.
Definition: Factories.h:210
dd4hep::sim::Geant4PythonAction::exec
static int exec(const std::string &cmd)
Execute command in the python interpreter.
Definition: Geant4PythonAction.cpp:33
dd4hep::sim::Geant4PythonAction::runFile
static int runFile(const std::string &cmd)
Execute command in the python interpreter.
Definition: Geant4PythonAction.cpp:43
Geant4PythonAction.h
dd4hep::sim::Geant4PythonAction::eval
static int eval(const std::string &cmd)
Execute command in the python interpreter.
Definition: Geant4PythonAction.cpp:38
dd4hep::sim::Geant4PythonAction::prompt
static void prompt()
Invoke command prompt.
Definition: Geant4PythonAction.cpp:53
dd4hep::sim::Geant4PythonCall
Base class to initialize a multi-threaded or single threaded Geant4 application.
Definition: Geant4PythonCall.h:32
dd4hep::DDPython::execute
int execute(const std::string &cmd) const
Definition: DDPython.cpp:257
dd4hep::sim::Geant4Action
Default base class for all Geant 4 actions and derivates thereof.
Definition: Geant4Action.h:113
dd4hep::sim::Geant4PythonCall::execute
RETURN execute() const
Execute command in the python interpreter.
Definition: Geant4PythonCall.cpp:52
DDPython.h
Factories.h
dd4hep::sim
Namespace for the Geant4 based simulation part of the AIDA detector description toolkit.
Definition: Geant4Output2EDM4hep.cpp:49
dd4hep::DDPython::instance
static DDPython instance()
Object instantiator.
Definition: DDPython.cpp:190
dd4hep::DDPython::runFile
int runFile(const std::string &fname) const
Definition: DDPython.cpp:248
Geant4PythonCall.h
dd4hep::sim::Geant4PythonAction::Geant4PythonAction
Geant4PythonAction(Geant4Context *ctx, const std::string &nam)
Standard constructor.
Definition: Geant4PythonAction.cpp:26
dd4hep::sim::Geant4PythonAction
Base class to initialize a multi-threaded or single threaded Geant4 application.
Definition: Geant4PythonAction.h:33
dd4hep::DDPython::prompt
void prompt() const
Invoke command prompt.
Definition: DDPython.cpp:304
dd4hep::sim::Geant4Context
Generic context to extend user, run and event information.
Definition: Geant4Context.h:201