Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:37:34

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 //  \author Markus Frank
0011 //  \date   2015-11-03
0012 //
0013 //==========================================================================
0014 
0015 // Framework include files
0016 #include <DDG4/Factories.h>
0017 #include <DDG4/Python/Geant4PythonAction.h>
0018 #include <DDG4/Python/Geant4PythonCall.h>
0019 #include <DDG4/Python/DDPython.h>
0020 
0021 using namespace dd4hep::sim;
0022 
0023 DECLARE_GEANT4ACTION(Geant4PythonAction)
0024 
0025 /// Standard constructor, initializes variables
0026 Geant4PythonAction::Geant4PythonAction(Geant4Context* ctxt, const std::string& nam)
0027   : Geant4Action(ctxt,nam)
0028 {
0029   m_needsControl = true;
0030 }
0031 
0032 /// Execute command in the python interpreter. Directly forwarded to TPython.
0033 int Geant4PythonAction::exec(const std::string& cmd)   {
0034   return DDPython::instance().execute(cmd);
0035 }
0036 
0037 /// Execute command in the python interpreter.
0038 int Geant4PythonAction::eval(const std::string& cmd)   {
0039   return DDPython::instance().evaluate(cmd);
0040 }
0041  
0042 /// Execute command in the python interpreter.
0043 int Geant4PythonAction::runFile(const std::string& cmd)   {
0044   return DDPython::instance().runFile(cmd);
0045 }
0046 
0047 /// Execute command in the python interpreter.
0048 int Geant4PythonAction::call(PyObject* method, PyObject* args)  {
0049   return Geant4PythonCall().execute<int>(method,args);
0050 }
0051 
0052 /// Invoke command prompt
0053 void Geant4PythonAction::prompt()   {
0054   DDPython::instance().prompt();
0055 }