DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
Geant4PythonCall.h
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 #ifndef DDG4_PYTHON_GEANT4PYTHONCALL_H
15 #define DDG4_PYTHON_GEANT4PYTHONCALL_H
16 
17 // ROOT include files
18 #include <TPyReturn.h>
19 
21 namespace dd4hep {
22 
24  namespace sim {
25 
27 
34  PyObject* m_callable;
36  PyObject* m_arguments;
37 
38  public:
42  virtual ~Geant4PythonCall();
43 
45  bool isValid() const { return m_callable != 0; }
46 
48  template <typename RETURN> RETURN execute() const;
49 
51  template <typename RETURN> RETURN execute(PyObject* callable) const;
52 
54  template <typename RETURN> RETURN execute(PyObject* callable, PyObject* args) const;
55 
57  void set(PyObject* callable, PyObject* args);
59  void set(PyObject* callable);
60  };
61  } // End namespace sim
62 } // End namespace dd4hep
63 #endif // DDG4_PYTHON_GEANT4PYTHONCALL_H
dd4hep::sim::Geant4PythonCall::Geant4PythonCall
Geant4PythonCall()
Standard constructor.
Definition: Geant4PythonCall.cpp:23
dd4hep::sim::Geant4PythonCall::isValid
bool isValid() const
Check if call is set.
Definition: Geant4PythonCall.h:45
dd4hep::sim::Geant4PythonCall
Base class to initialize a multi-threaded or single threaded Geant4 application.
Definition: Geant4PythonCall.h:32
dd4hep::sim::Geant4PythonCall::set
void set(PyObject *callable, PyObject *args)
Set the callback structures for callbacks with arguments.
Definition: Geant4PythonCall.cpp:36
dd4hep::sim::Geant4PythonCall::execute
RETURN execute() const
Execute command in the python interpreter.
Definition: Geant4PythonCall.cpp:52
dd4hep::sim::Geant4PythonCall::m_callable
PyObject * m_callable
Python callable reference.
Definition: Geant4PythonCall.h:34
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::sim::Geant4PythonCall::m_arguments
PyObject * m_arguments
Python arguments object.
Definition: Geant4PythonCall.h:36
dd4hep::sim::Geant4PythonCall::~Geant4PythonCall
virtual ~Geant4PythonCall()
Default destructor.
Definition: Geant4PythonCall.cpp:29