Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:04:25

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 #ifndef DDG4_PYTHON_GEANT4PYTHONCALL_H
0015 #define DDG4_PYTHON_GEANT4PYTHONCALL_H
0016 
0017 // ROOT include files
0018 #include <TPyReturn.h>
0019 
0020 /// Namespace for the AIDA detector description toolkit
0021 namespace dd4hep {
0022 
0023   /// Namespace for the Geant4 based simulation part of the AIDA detector description toolkit
0024   namespace sim {
0025 
0026     /// Base class to initialize a multi-threaded or single threaded Geant4 application
0027     /**
0028      *  \author  M.Frank
0029      *  \version 1.0
0030      *  \ingroup DD4HEP_SIMULATION
0031      */
0032     class Geant4PythonCall   {
0033       /// Python callable reference
0034       PyObject* m_callable;
0035       /// Python arguments object
0036       PyObject* m_arguments;
0037 
0038     public:
0039       /// Standard constructor
0040       Geant4PythonCall();
0041       /// Default destructor
0042       virtual ~Geant4PythonCall();
0043 
0044       /// Check if call is set
0045       bool isValid()  const {  return m_callable != 0;  }
0046 
0047       /// Execute command in the python interpreter.
0048       template <typename RETURN> RETURN execute() const;
0049 
0050       /// Execute command in the python interpreter.
0051       template <typename RETURN> RETURN execute(PyObject* callable) const;
0052 
0053       /// Execute command in the python interpreter.
0054       template <typename RETURN> RETURN execute(PyObject* callable, PyObject* args) const;
0055 
0056       /// Set the callback structures for callbacks with arguments
0057       void set(PyObject* callable, PyObject* args);
0058       /// Set the callback structures for callbacks without arguments
0059       void set(PyObject* callable);
0060     };
0061   }    // End namespace sim
0062 }      // End namespace dd4hep
0063 #endif // DDG4_PYTHON_GEANT4PYTHONCALL_H