Commits

Anonymous committed 291efd7

re-organisation of source files

  • Participants
  • Parent commits a7f102b

Comments (0)

Files changed (21)

AthenaPython/AthenaPythonDict.h

-// -*- C++ -*-
-#ifndef ATHENAPYTHON_ATHENAPYTHONDICT_H
-#define ATHENAPYTHON_ATHENAPYTHONDICT_H
-
-// Python includes
-#include "Python.h"
-
-// hack to please gccxml...
-#ifdef PACKAGE_VERSION
- #undef PACKAGE_VERSION
-#endif
-
-#ifndef PACKAGE_VERSION
- #define PACKAGE_VERSION "unknown"
-#endif
-
-#include "AthenaPython/PyAthenaAlg.h"
-#include "AthenaPython/PyAthenaSvc.h"
-#include "AthenaPython/PyAthenaTool.h"
-#include "AthenaPython/PyAthenaAud.h"
-//#include "AthenaPython/PyAthenaBindings.h"
-
-#include "AthenaKernel/IProxyDict.h"
-#include "AthenaKernel/IClassIDSvc.h"
-#include "AthenaKernel/IThinningSvc.h"
-
-#include "SGTools/DataProxy.h"
-
-namespace StoreGateDict_dict {
-  struct tmp {
-    SG::DataProxy m_proxy;
-    std::vector<SG::DataProxy*> m_proxies;
-    std::vector<const SG::DataProxy*> m_constProxies;
-  };
-}
-
-// namespace AthenaPythonDict_dict {
-//   struct tmp {
-//     //
-//   };
-// }
-
-#endif // ATHENAPYTHON_ATHENAPYTHONDICT_H

AthenaPython/PyAthenaAlg.h

-///////////////////////// -*- C++ -*- /////////////////////////////
-// PyAthenaAlg.h 
-// Header file for class PyAthena::Alg
-// Author: S.Binet<binet@cern.ch>
-/////////////////////////////////////////////////////////////////// 
-#ifndef ATHENAPYTHON_PYATHENAALG_H 
-#define ATHENAPYTHON_PYATHENAALG_H 
-
-// STL includes
-#include <string>
-
-// FrameWork includes
-#include "GaudiKernel/Algorithm.h"
-
-// Forward declaration
-// Python
-struct _object;
-typedef _object PyObject;
-
-namespace PyAthena {
-
-class Alg : public ::Algorithm
-{ 
-  /////////////////////////////////////////////////////////////////// 
-  // Public methods: 
-  /////////////////////////////////////////////////////////////////// 
- public: 
-
-  // Copy constructor: 
-
-  /** constructor 
-   *  @param self python objects
-   *  @param name name of algorithm instance 
-   */
-  //Alg( PyObject* self , const std::string& name );
-  Alg( const std::string& name, ISvcLocator* pSvcLocator );
-
-  /// Destructor: 
-  virtual ~Alg(); 
-
-  // Assignment operator: 
-  //AlgorithmEx &operator=(const AlgorithmEx &alg); 
-
-  // Framework's Hooks
-  virtual StatusCode initialize();
-  virtual StatusCode reinitialize();
-  virtual StatusCode beginRun();
-  virtual StatusCode execute();
-  virtual StatusCode endRun();
-  virtual StatusCode finalize();
-
-  virtual StatusCode sysInitialize();
-
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
-  /////////////////////////////////////////////////////////////////// 
-  // Non-const methods: 
-  /////////////////////////////////////////////////////////////////// 
-
-  /////////////////////////////////////////////////////////////////// 
-  // Private data: 
-  /////////////////////////////////////////////////////////////////// 
- private: 
-
-  /// Default constructor: 
-  Alg();
-
-//   /// Constructor with parameters: 
-//   Alg( const std::string& name, ISvcLocator* pSvcLocator );
-
-  /// Pointer to self (from the python world)
-  PyObject* m_self;
-
-}; 
-
-// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
-} //> end namespace PyAthena
-
-#endif //> ATHENAPYTHON_PYATHENAALG_H

AthenaPython/PyAthenaAud.h

-///////////////////////// -*- C++ -*- /////////////////////////////
-// PyAthenaAud.h 
-// Header file for class PyAthena::Aud
-// Author: S.Binet<binet@cern.ch>
-/////////////////////////////////////////////////////////////////// 
-#ifndef ATHENAPYTHON_PYATHENAAUD_H 
-#define ATHENAPYTHON_PYATHENAAUD_H 
-
-// STL includes
-#include <string>
-
-// FrameWork includes
-#include "GaudiKernel/Auditor.h"
-
-// Forward declaration
-class INamedInterface;
-// Python
-struct _object;
-typedef _object PyObject;
-
-namespace PyAthena {
-
-class Aud : public ::Auditor
-{ 
-
-  /////////////////////////////////////////////////////////////////// 
-  // Public methods: 
-  /////////////////////////////////////////////////////////////////// 
- public: 
-
-  // Copy constructor: 
-
-  /// Constructor with parameters: 
-  Aud( const std::string& name, ISvcLocator* svcLocator );
-
-  /// Destructor: 
-  virtual ~Aud(); 
-
-  /// Gaudi Aud Implementation
-  //@{
-  virtual StatusCode initialize();
-  virtual StatusCode sysInitialize();
-  //@}
-
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
-  /////////////////////////////////////////////////////////////////// 
-  // Non-const methods: 
-  /////////////////////////////////////////////////////////////////// 
-
-  virtual void beforeInitialize(INamedInterface* alg);
-  virtual void afterInitialize(INamedInterface* alg);
-  virtual void beforeReinitialize(INamedInterface* alg);
-  virtual void afterReinitialize(INamedInterface* alg);
-  virtual void beforeExecute(INamedInterface* alg);
-  virtual void afterExecute(INamedInterface* alg, const StatusCode&);
-  virtual void beforeBeginRun(INamedInterface* alg);
-  virtual void afterBeginRun(INamedInterface *alg);
-  virtual void beforeEndRun(INamedInterface* alg);
-  virtual void afterEndRun(INamedInterface *alg);
-  virtual void beforeFinalize(INamedInterface* alg);
-  virtual void afterFinalize(INamedInterface* alg);
-
-  /////////////////////////////////////////////////////////////////// 
-  // Private data: 
-  /////////////////////////////////////////////////////////////////// 
- private: 
-
-  /// Default constructor: 
-  Aud();
-
-  /// Pointer to self (from the python world)
-  PyObject* m_self;
-
-}; 
-
-// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
-} //> end namespace PyAthena
-
-#endif //> ATHENAPYTHON_PYATHENAAUD_H

AthenaPython/PyAthenaSvc.h

-///////////////////////// -*- C++ -*- /////////////////////////////
-// PyAthenaSvc.h 
-// Header file for class PyAthena::Svc
-// Author: S.Binet<binet@cern.ch>
-/////////////////////////////////////////////////////////////////// 
-#ifndef ATHENAPYTHON_PYATHENASVC_H 
-#define ATHENAPYTHON_PYATHENASVC_H 
-
-// STL includes
-#include <string>
-
-// FrameWork includes
-#include "GaudiKernel/Service.h"
-
-// Forward declaration
-// Python
-struct _object;
-typedef _object PyObject;
-
-namespace PyAthena {
-
-class Svc : public Service
-{ 
-
-  /////////////////////////////////////////////////////////////////// 
-  // Public methods: 
-  /////////////////////////////////////////////////////////////////// 
- public: 
-
-  // Copy constructor: 
-
-  /// Constructor with parameters: 
-  Svc( const std::string& name, ISvcLocator* svcLocator );
-
-  /// Destructor: 
-  virtual ~Svc(); 
-
-  /// Gaudi Service Implementation
-  //@{
-  virtual StatusCode initialize();
-  virtual StatusCode reinitialize();
-  virtual StatusCode beginRun();
-  virtual StatusCode endRun();
-  virtual StatusCode finalize();
-  virtual StatusCode queryInterface( const InterfaceID& riid, 
-                                     void** ppvInterface );
-  //@}
-
-  virtual StatusCode sysInitialize();
-
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
-  /////////////////////////////////////////////////////////////////// 
-  // Non-const methods: 
-  /////////////////////////////////////////////////////////////////// 
-
-  static const InterfaceID& interfaceID();
-
-  /////////////////////////////////////////////////////////////////// 
-  // Private data: 
-  /////////////////////////////////////////////////////////////////// 
- private: 
-
-  /// Default constructor: 
-  Svc();
-
-  /// Pointer to self (from the python world)
-  PyObject* m_self;
-
-}; 
-
-// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
-} //> end namespace PyAthena
-
-#endif //> ATHENAPYTHON_PYATHENASVC_H

AthenaPython/PyAthenaTool.h

-///////////////////////// -*- C++ -*- /////////////////////////////
-// PyAthenaTool.h 
-// Header file for class PyAthena::Tool
-// Author: S.Binet<binet@cern.ch>
-/////////////////////////////////////////////////////////////////// 
-#ifndef ATHENAPYTHON_PYATHENATOOL_H 
-#define ATHENAPYTHON_PYATHENATOOL_H 
-
-// STL includes
-#include <string>
-
-// FrameWork includes
-#include "GaudiKernel/AlgTool.h"
-
-// Forward declaration
-// Python
-struct _object;
-typedef _object PyObject;
-
-namespace PyAthena {
-
-class Tool : public ::AlgTool
-{ 
-
-  /////////////////////////////////////////////////////////////////// 
-  // Public methods: 
-  /////////////////////////////////////////////////////////////////// 
- public: 
-
-  // Copy constructor: 
-
-  /// Constructor with parameters: 
-  Tool( const std::string& type,
-	const std::string& name, 
-	const IInterface* parent );
-
-  /// Destructor: 
-  virtual ~Tool(); 
-
-  // Athena tool's Hooks
-  virtual StatusCode  initialize();
-  virtual StatusCode  finalize();
-
-  static const InterfaceID& interfaceID();
-
-  /// python binding
-  void setPyObject( PyObject *self );
-
-  /////////////////////////////////////////////////////////////////// 
-  // Const methods: 
-  ///////////////////////////////////////////////////////////////////
-
-  /////////////////////////////////////////////////////////////////// 
-  // Non-const methods: 
-  /////////////////////////////////////////////////////////////////// 
-
-  /////////////////////////////////////////////////////////////////// 
-  // Private data: 
-  /////////////////////////////////////////////////////////////////// 
- private: 
-
-  /// Default constructor: 
-  Tool();
-
-  /// Pointer to self (from the python world)
-  PyObject* m_self;
-
-}; 
-
-// I/O operators
-//////////////////////
-
-/////////////////////////////////////////////////////////////////// 
-// Inline methods: 
-/////////////////////////////////////////////////////////////////// 
-
-} //> end namespace PyAthena
-
-#endif //> ATHENAPYTHON_PYATHENATOOL_H

AthenaPython/selection.xml

 <lcgdict>
 
-  <class name="IProxyDict" />
-  <!-- <class name="SG::DataProxy" /> -->
-  <class name="std::vector<SG::DataProxy*>" />
-  <class name="std::vector<const SG::DataProxy*>" />
-
   <!-- Framework bindings -->
   <class name="IClassIDSvc" />
   <class name="IThinningSvc" />
 
-  <class name="PyAthena::Alg" />
-  <class name="PyAthena::Svc" />
-  <class name="PyAthena::Tool" />
-  <class name="PyAthena::Aud" />
-
   <!-- not yet
   <function name="AthenaInternal::queryInterface" />
   -->
+2007-12-14  Sebastien Binet  <binet@lblbox>
+
+	* tagging AthenaPython-00-00-02
+	* re-organisation of source files to prevent people from linking 
+	  against the AthenaPython component library.
+	* first steps towards a python COM which fits nicely into Gaudi's one
+	* R AthenaPython/AthenaPythonDict.h
+	* R AthenaPython/PyAthenaAlg.h
+	* R AthenaPython/PyAthenaAud.h
+	* R AthenaPython/PyAthenaSvc.h
+	* R AthenaPython/PyAthenaTool.h
+	* M AthenaPython/selection.xml
+	* M cmt/requirements
+	* M python/Configurables.py
+	* A src/AthenaPythonDict.h
+	* M src/PyAthenaAlg.cxx
+	* A src/PyAthenaAlg.h
+	* M src/PyAthenaAud.cxx
+	* A src/PyAthenaAud.h
+	* M src/PyAthenaSvc.cxx
+	* A src/PyAthenaSvc.h
+	* M src/PyAthenaTool.cxx
+	* A src/PyAthenaTool.h
+	* M src/PyAthenaUtils.cxx
+	* M src/PyAthenaUtils.h
+	* M src/components/AthenaPython_entries.cxx
+
 2007-11-20  Sebastien Binet  <binet@lblbox>
 
 	* fake ObjectProxy 'implementation'
 branches AthenaPython src src/components python
 
 library AthenaPython *.cxx components/*.cxx
-#apply_pattern installed_library
 apply_pattern component_library
-
 apply_pattern declare_python_modules files="*.py"
 
 
 #
 private
 use AtlasReflex		AtlasReflex-*		External
+use AtlasROOT		AtlasROOT-*		External
 
 apply_pattern lcgdict dict=AthenaPython selectionfile=selection.xml \
-   headerfiles="../AthenaPython/AthenaPythonDict.h"
-#   extralibfiles="../src/pyext/AthenaPythonPyExt.cxx"
-
-#macro_append AthenaPythonPyExt_pp_cppflags " -I$(Python_inc) "
-#macro_append AthenaPythonDict_shlibflags " $(Python_linkopts)"
+   headerfiles="../src/AthenaPythonDict.h"
 end_private

python/Configurables.py

 from AthenaCommon.Configurable import (ConfigurablePyAlgorithm,
                                        ConfigurableAlgTool,
                                        ConfigurableService)
-
-### Configurable base class for PyServices ---------------------------------
-class ConfigurablePyService( ConfigurableService ):
-   def __init__( self, name, **kwargs ):
-      super( ConfigurablePyService, self ).__init__( name )
-      self._jobOptName = name
-
-      for n, v in kwargs.items():
-         setattr(self, n, v)
-
-   def getDlls( self ):
-      return None
-
-   def getHandle( self ):
-      return None
-
-### Configurable base class for PyAlgTools ---------------------------------
-class ConfigurablePyAlgTool( ConfigurableAlgTool ):
-   def __init__( self, name, **kwargs ):
-      super( ConfigurablePyAlgTool, self ).__init__( name )
-      self._jobOptName = name
-
-      for n, v in kwargs.items():
-         setattr(self, n, v)
-
-   def getDlls( self ):
-      return None
-
-   def getHandle( self ):
-      return None
-
+### 
 class PyComponents(object):
+    """@c PyComponents is a placeholder where all factories for the python
+    components will be collected and stored for easy look-up and call from
+    the C++ side.
+    The @a PyComponents.instances dictionary will store for each instance name:
+      - the package name where the class of the component to be instantiated is
+        defined
+      - the class name of the component to be associated
+      - the arguments (and values) to pass to the __init__ method to properly
+        create the python component.
+    e.g.:
+     PyComponents.instances[ 'alg1' ] = {
+        'package' : 'MyAnaPkg',
+        'class'   : 'MyAna.MyPyAlg',
+        'kwargs'  : { 'OutputLevel' : 1,
+                      'EtaCut'      : 2.5,
+                      'PtCut'       : 20*GeV,
+                      }
+     }
+    All this boilerplate code will of course be done automatically for the user
+    as soon as she uses the (python) @PyConfigurable classes.
+    """
     instances = {}
     pass
 

src/AthenaPythonDict.h

+// -*- C++ -*-
+#ifndef ATHENAPYTHON_ATHENAPYTHONDICT_H
+#define ATHENAPYTHON_ATHENAPYTHONDICT_H
+
+#include "AthenaKernel/IClassIDSvc.h"
+#include "AthenaKernel/IThinningSvc.h"
+
+#endif // ATHENAPYTHON_ATHENAPYTHONDICT_H

src/PyAthenaAlg.cxx

 // Python includes
 #include "Python.h"
 
-// Package includes
+// AthenaPython includes
 #include "PyAthenaUtils.h"
-#include "AthenaPython/PyAthenaAlg.h"
+#include "PyAthenaAlg.h"
 
 // STL includes
 
 // FrameWork includes
-#include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/Property.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "AthenaKernel/IPyComponentMgr.h"
 
 
 // Constructors
 ////////////////
-/*
-Alg::Alg( PyObject* self, const std::string& name ) :
-  ::Algorithm( name, Gaudi::svcLocator() ),
-  m_self     ( self )
-{
-  //
-  // Property declaration
-  // 
-  //declareProperty( "Property", m_nProperty );
-
-  std::cout << "------> " << name << std::endl;
-
-  // The owner of this component is Python (as creator) therefore
-  // it should not be deleted by Gaudi (added an extra addRef()). 
-  addRef();
-  addRef();
-}
-*/
-
 Alg::Alg( const std::string& name, ISvcLocator* svcLocator ) :
   ::Algorithm( name, svcLocator ),
   m_self     ( 0 )
-{
-  std::cout << "------> " << name << std::endl;
-}
+{}
 
 // Destructor
 ///////////////
 { 
   MsgStream msg( msgSvc(), name() );
   msg << MSG::DEBUG << "Calling destructor" << endreq;
-  std::cout << "-----> PyAthena::Alg::~Alg()..." << std::endl;
   Py_XDECREF( m_self );
 }
 
 StatusCode 
 Alg::initialize()
 {
-  std::cout << "-----> PyAthena::Alg::initialize()..." << std::endl;
   MsgStream msg( msgSvc(), name() );
 
   msg << MSG::INFO 
     return StatusCode::FAILURE;
   }
 
-  return PyAthena::callPyMethod( m_self, "initialize" );
+  return PyAthena::callPyMethod( m_self, "sysInitialize" );
 }
 
 StatusCode 
     return StatusCode::FAILURE;
   }
 
-  return PyAthena::callPyMethod( m_self, "reinitialize" );
+  return PyAthena::callPyMethod( m_self, "sysReinitialize" );
 }
 
 StatusCode 
 Alg::beginRun()
 { 
-  return PyAthena::callPyMethod( m_self, "beginRun" );
+  return PyAthena::callPyMethod( m_self, "sysBeginRun" );
 }
 
 StatusCode 
 Alg::endRun()
 {
-  return PyAthena::callPyMethod( m_self, "endRun" );
+  return PyAthena::callPyMethod( m_self, "sysEndRun" );
 }
 
 StatusCode 
 Alg::finalize()
 {
-  std::cout << "-----> PyAthena::Alg::finalize()..." << std::endl;
   MsgStream msg( msgSvc(), name() );
   msg << MSG::INFO 
       << "Finalizing " << name() << "..." 
       << endreq;
 
-  return PyAthena::callPyMethod( m_self, "finalize" );
+  return PyAthena::callPyMethod( m_self, "sysFinalize" );
 }
 
 StatusCode 
 Alg::execute()
 {  
-  std::cout << "-----> PyAthena::Alg::execute()..." << std::endl;
 //   m_msg << MSG::DEBUG << "Executing " << name() << "..." 
 // 	<< endreq;
 
-  return PyAthena::callPyMethod( m_self, "execute" );
+  return PyAthena::callPyMethod( m_self, "sysExecute" );
 }
 
 StatusCode
 Alg::sysInitialize()
 {
-  std::cout << "-----> PyAthena::Alg::sysInitialize()..." << std::endl;
-
   ServiceHandle<IPyComponentMgr> pyMgr( "PyComponentMgr", name() );
   if ( !pyMgr.retrieve().isSuccess() ) {
     MsgStream msg( msgSvc(), name() );

src/PyAthenaAlg.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PyAthenaAlg.h 
+// Header file for class PyAthena::Alg
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef ATHENAPYTHON_PYATHENAALG_H 
+#define ATHENAPYTHON_PYATHENAALG_H 
+
+// STL includes
+#include <string>
+
+// FrameWork includes
+#include "GaudiKernel/Algorithm.h"
+
+// Forward declaration
+// Python
+struct _object;
+typedef _object PyObject;
+
+namespace PyAthena {
+
+class Alg : public ::Algorithm
+{ 
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  // Copy constructor: 
+
+  /** constructor 
+   *  @param self python objects
+   *  @param name name of algorithm instance 
+   */
+  //Alg( PyObject* self , const std::string& name );
+  Alg( const std::string& name, ISvcLocator* pSvcLocator );
+
+  /// Destructor: 
+  virtual ~Alg(); 
+
+  // Assignment operator: 
+  //AlgorithmEx &operator=(const AlgorithmEx &alg); 
+
+  // Framework's Hooks
+  virtual StatusCode initialize();
+  virtual StatusCode reinitialize();
+  virtual StatusCode beginRun();
+  virtual StatusCode execute();
+  virtual StatusCode endRun();
+  virtual StatusCode finalize();
+
+  virtual StatusCode sysInitialize();
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// Default constructor: 
+  Alg();
+
+//   /// Constructor with parameters: 
+//   Alg( const std::string& name, ISvcLocator* pSvcLocator );
+
+  /// Pointer to self (from the python world)
+  PyObject* m_self;
+
+}; 
+
+// I/O operators
+//////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+} //> end namespace PyAthena
+
+#endif //> ATHENAPYTHON_PYATHENAALG_H

src/PyAthenaAud.cxx

 // Python includes
 #include "Python.h"
 
-// Package includes
+// AthenaPython includes
 #include "PyAthenaUtils.h"
-#include "AthenaPython/PyAthenaAud.h"
+#include "PyAthenaAud.h"
 
 // STL includes
 
       << "Initializing " << name() << "..." 
       << endreq;
 
-  return PyAthena::callPyMethod( m_self, "initialize" );
+  return PyAthena::callPyMethod( m_self, "sysInitialize" );
 }
 
 StatusCode
 Aud::sysInitialize()
 {
-  std::cout << "-----> PyAthena::Aud::sysInitialize()..." << std::endl;
-
   ServiceHandle<IPyComponentMgr> pyMgr( "PyComponentMgr", name() );
   if ( !pyMgr.retrieve().isSuccess() ) {
     MsgStream msg( msgSvc(), name() );
 // Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
-void Aud::beforeInitialize( INamedInterface* /*component*/ )
+void Aud::beforeInitialize( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "beforeInitialize", component );
 }
 
-void Aud::afterInitialize( INamedInterface* /*component*/ )
+void Aud::afterInitialize( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "afterInitialize", component );
 }
 
-void Aud::beforeReinitialize( INamedInterface* /*component*/ )
+void Aud::beforeReinitialize( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "beforeReinitialize", component );
 }
 
-void Aud::afterReinitialize( INamedInterface* /*component*/ )
+void Aud::afterReinitialize( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "afterReinitialize", component );
 }
 
-void Aud::beforeExecute( INamedInterface* /*component*/ )
+void Aud::beforeExecute( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "beforeExecute", component );
 }
 
-void Aud::afterExecute( INamedInterface* /*component*/, const StatusCode& ) 
+void Aud::afterExecute( INamedInterface* component, const StatusCode& sc ) 
 {
-  return;
+  return PyAthena::pyAudit( m_self, "afterExecute", component, sc );
 }
 
-void Aud::beforeBeginRun( INamedInterface* /*component*/ )
+void Aud::beforeBeginRun( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "beforeBeginRun", component );
 }
 
-void Aud::afterBeginRun( INamedInterface* /*component*/ )
+void Aud::afterBeginRun( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "afterBeginRun", component );
 }
 
-void Aud::beforeEndRun( INamedInterface* /*component*/ )
+void Aud::beforeEndRun( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "beforeEndRun", component );
 }
 
-void Aud::afterEndRun( INamedInterface* /*component*/ )
+void Aud::afterEndRun( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "afterEndRun", component );
 }
 
-void Aud::beforeFinalize( INamedInterface* /*component*/ )
+void Aud::beforeFinalize( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "beforeFinalize", component );
 }
 
-void Aud::afterFinalize( INamedInterface* /*component*/ )
+void Aud::afterFinalize( INamedInterface* component )
 {
-  return;
+  return PyAthena::pyAudit( m_self, "afterFinalize", component );
 }
 
 /////////////////////////////////////////////////////////////////// 
 // Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
-} //> end namespace AthenaPython
+} //> end namespace PyAthena
 

src/PyAthenaAud.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PyAthenaAud.h 
+// Header file for class PyAthena::Aud
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef ATHENAPYTHON_PYATHENAAUD_H 
+#define ATHENAPYTHON_PYATHENAAUD_H 
+
+// STL includes
+#include <string>
+
+// FrameWork includes
+#include "GaudiKernel/Auditor.h"
+
+// Forward declaration
+class INamedInterface;
+// Python
+struct _object;
+typedef _object PyObject;
+
+namespace PyAthena {
+
+class Aud : public ::Auditor
+{ 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  // Copy constructor: 
+
+  /// Constructor with parameters: 
+  Aud( const std::string& name, ISvcLocator* svcLocator );
+
+  /// Destructor: 
+  virtual ~Aud(); 
+
+  /// Gaudi Aud Implementation
+  //@{
+  virtual StatusCode initialize();
+  virtual StatusCode sysInitialize();
+  //@}
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  virtual void beforeInitialize(INamedInterface* alg);
+  virtual void afterInitialize(INamedInterface* alg);
+  virtual void beforeReinitialize(INamedInterface* alg);
+  virtual void afterReinitialize(INamedInterface* alg);
+  virtual void beforeExecute(INamedInterface* alg);
+  virtual void afterExecute(INamedInterface* alg, const StatusCode&);
+  virtual void beforeBeginRun(INamedInterface* alg);
+  virtual void afterBeginRun(INamedInterface *alg);
+  virtual void beforeEndRun(INamedInterface* alg);
+  virtual void afterEndRun(INamedInterface *alg);
+  virtual void beforeFinalize(INamedInterface* alg);
+  virtual void afterFinalize(INamedInterface* alg);
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// Default constructor: 
+  Aud();
+
+  /// Pointer to self (from the python world)
+  PyObject* m_self;
+
+}; 
+
+// I/O operators
+//////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+} //> end namespace PyAthena
+
+#endif //> ATHENAPYTHON_PYATHENAAUD_H

src/PyAthenaSvc.cxx

 // Python includes
 #include "Python.h"
 
-// Package includes
+// AthenaPython includes
 #include "PyAthenaUtils.h"
-#include "AthenaPython/PyAthenaSvc.h"
+#include "PyAthenaSvc.h"
 
 // STL includes
 
 // FrameWork includes
-#include "GaudiKernel/Bootstrap.h"
 #include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/Property.h"
 #include "GaudiKernel/ServiceHandle.h"
 #include "AthenaKernel/IPyComponentMgr.h"
 
 
 // Constructors
 ////////////////
-//   Svc::Svc( PyObject* self, const std::string& name ) : 
-//   ::Service( name, Gaudi::svcLocator() ),
-//   m_self   ( self )
-// {
-//   //
-//   // Property declaration
-//   // 
-//   //declareProperty( "Property", m_nProperty );
-
-//   // The owner of this component Algorithm is Python (as creator) therefore
-//   // it should not be deleted by Gaudi (added an extra addRef()). 
-//   addRef();
-//   addRef();
-// }
-
 Svc::Svc( const std::string& name, ISvcLocator* svcLocator ) :
   ::Service( name, svcLocator ),
   m_self   ( 0 )
     return StatusCode::FAILURE;
   }
 
-  return PyAthena::callPyMethod( m_self, "initialize" );
+  return PyAthena::callPyMethod( m_self, "sysInitialize" );
 }
 
 StatusCode 
     return StatusCode::FAILURE;
   }
 
-  return PyAthena::callPyMethod( m_self, "reinitialize" );
+  return PyAthena::callPyMethod( m_self, "sysReinitialize" );
 }
 
 StatusCode 
       << "Finalizing " << name() << "..." 
       << endreq;
 
-  return PyAthena::callPyMethod( m_self, "finalize" );
+  return PyAthena::callPyMethod( m_self, "sysFinalize" );
 }
 
 StatusCode 
 Svc::beginRun()
 {
-  MsgStream msg( msgSvc(), name() );
-  msg << MSG::INFO 
-      << "beginRun " << name() << "..." 
-      << endreq;
-
-  return PyAthena::callPyMethod( m_self, "beginRun" );
+  return PyAthena::callPyMethod( m_self, "sysBeginRun" );
 }
 
 StatusCode 
 Svc::endRun()
 {
-  MsgStream msg( msgSvc(), name() );
-  msg << MSG::INFO 
-      << "endRun " << name() << "..." 
-      << endreq;
-
-  return PyAthena::callPyMethod( m_self, "endRun" );
+  return PyAthena::callPyMethod( m_self, "sysEndRun" );
 }
 
 // Query the interfaces.
 {
   if ( interfaceID().versionMatch(riid) )    {
     *ppvInterface = static_cast<PyAthena::Svc*>(this);
-  } else if ( 0 != m_self && m_self != Py_None ) {
-    return PyAthena::queryInterface( m_self, riid, ppvInterface );
+//   } else if ( 0 != m_self && m_self != Py_None ) {
+//     return PyAthena::queryInterface( m_self, riid, ppvInterface );
   } else  {
     // Interface is not directly available: try out a base class
     return ::Service::queryInterface(riid, ppvInterface);
 StatusCode
 Svc::sysInitialize()
 {
-  std::cout << "-----> PyAthena::Svc::sysInitialize()..." << std::endl;
-
   ServiceHandle<IPyComponentMgr> pyMgr( "PyComponentMgr", name() );
   if ( !pyMgr.retrieve().isSuccess() ) {
     MsgStream msg( msgSvc(), name() );

src/PyAthenaSvc.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PyAthenaSvc.h 
+// Header file for class PyAthena::Svc
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef ATHENAPYTHON_PYATHENASVC_H 
+#define ATHENAPYTHON_PYATHENASVC_H 
+
+// STL includes
+#include <string>
+
+// FrameWork includes
+#include "GaudiKernel/Service.h"
+
+// Forward declaration
+// Python
+struct _object;
+typedef _object PyObject;
+
+namespace PyAthena {
+
+class Svc : public Service
+{ 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  // Copy constructor: 
+
+  /// Constructor with parameters: 
+  Svc( const std::string& name, ISvcLocator* svcLocator );
+
+  /// Destructor: 
+  virtual ~Svc(); 
+
+  /// Gaudi Service Implementation
+  //@{
+  virtual StatusCode initialize();
+  virtual StatusCode reinitialize();
+  virtual StatusCode beginRun();
+  virtual StatusCode endRun();
+  virtual StatusCode finalize();
+  virtual StatusCode queryInterface( const InterfaceID& riid, 
+                                     void** ppvInterface );
+  //@}
+
+  virtual StatusCode sysInitialize();
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  static const InterfaceID& interfaceID();
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// Default constructor: 
+  Svc();
+
+  /// Pointer to self (from the python world)
+  PyObject* m_self;
+
+}; 
+
+// I/O operators
+//////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+} //> end namespace PyAthena
+
+#endif //> ATHENAPYTHON_PYATHENASVC_H

src/PyAthenaTool.cxx

 // Python includes
 #include "Python.h"
 
-// Package includes
-#include "AthenaPython/PyAthenaTool.h"
+// AthenaPython includes
+#include "PyAthenaTool.h"
+#include "PyAthenaUtils.h"
 
 // STL includes
 
 // FrameWork includes
 #include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/Property.h"
+#include "GaudiKernel/ServiceHandle.h"
+#include "AthenaKernel/IPyComponentMgr.h"
 
 namespace PyAthena {
 
   Py_XDECREF( m_self );
 }
 
-// Athena Algorithm's Hooks
+// Athena AlgTool's Hooks
 ////////////////////////////
 StatusCode Tool::initialize()
 {
       << "Initializing " << name() << "..." 
       << endreq;
 
-  return ::AlgTool::initialize();
+  return PyAthena::callPyMethod( m_self, "sysInitialize" );
 }
 
 StatusCode Tool::finalize()
       << "Finalizing " << name() << "..." 
       << endreq;
 
-  return ::AlgTool::finalize();
+  return PyAthena::callPyMethod( m_self, "sysFinalize" );
 }
 
 const InterfaceID& 
   return _IID; 
 }
 
-void Tool::setPyObject( PyObject *self )
-{ m_self = self; }  
+StatusCode
+Tool::sysInitialize()
+{
+  ServiceHandle<IPyComponentMgr> pyMgr( "PyComponentMgr", name() );
+  if ( !pyMgr.retrieve().isSuccess() ) {
+    MsgStream msg( msgSvc(), name() );
+    msg << MSG::ERROR
+	<< "Could not retrieve service [" << pyMgr.typeAndName() << "] !!"
+	<< endreq;
+    return StatusCode::FAILURE;
+  }
+
+  // first retrieve our python object cousin...
+  m_self = pyMgr->pyObject( name() );
+
+  if ( m_self == Py_None ) {
+    MsgStream msg( msgSvc(), name() );
+    msg << MSG::ERROR
+	<< "Wrapped PyObject is NONE !"
+	<< endreq;
+    return StatusCode::FAILURE;
+  }
+
+  // re-route to usual sysInit...
+  return ::AlgTool::sysInitialize();
+}
 
 /////////////////////////////////////////////////////////////////// 
 // Const methods: 
 // Non-const methods: 
 /////////////////////////////////////////////////////////////////// 
 
-} //> end namespace Package
+} //> end namespace PyAthena

src/PyAthenaTool.h

+///////////////////////// -*- C++ -*- /////////////////////////////
+// PyAthenaTool.h 
+// Header file for class PyAthena::Tool
+// Author: S.Binet<binet@cern.ch>
+/////////////////////////////////////////////////////////////////// 
+#ifndef ATHENAPYTHON_PYATHENATOOL_H 
+#define ATHENAPYTHON_PYATHENATOOL_H 
+
+// STL includes
+#include <string>
+
+// FrameWork includes
+#include "GaudiKernel/AlgTool.h"
+
+// Forward declaration
+// Python
+struct _object;
+typedef _object PyObject;
+
+namespace PyAthena {
+
+class Tool : public ::AlgTool
+{ 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Public methods: 
+  /////////////////////////////////////////////////////////////////// 
+ public: 
+
+  // Copy constructor: 
+
+  /// Constructor with parameters: 
+  Tool( const std::string& type,
+	const std::string& name, 
+	const IInterface* parent );
+
+  /// Destructor: 
+  virtual ~Tool(); 
+
+  // Athena tool's Hooks
+  virtual StatusCode  initialize();
+  virtual StatusCode  sysInitialize();
+  virtual StatusCode  finalize();
+
+  static const InterfaceID& interfaceID();
+
+  /////////////////////////////////////////////////////////////////// 
+  // Const methods: 
+  ///////////////////////////////////////////////////////////////////
+
+  /////////////////////////////////////////////////////////////////// 
+  // Non-const methods: 
+  /////////////////////////////////////////////////////////////////// 
+
+  /////////////////////////////////////////////////////////////////// 
+  // Private data: 
+  /////////////////////////////////////////////////////////////////// 
+ private: 
+
+  /// Default constructor: 
+  Tool();
+
+  /// Pointer to self (from the python world)
+  PyObject* m_self;
+
+}; 
+
+// I/O operators
+//////////////////////
+
+/////////////////////////////////////////////////////////////////// 
+// Inline methods: 
+/////////////////////////////////////////////////////////////////// 
+
+} //> end namespace PyAthena
+
+#endif //> ATHENAPYTHON_PYATHENATOOL_H

src/PyAthenaUtils.cxx

 // Python includes
 #include "Python.h"
 
-// Package includes
-//#include "AthenaPython/PyAthenaBindings.h"
+// AthenaPython includes
 #include "PyAthenaUtils.h"
 
 // Framework includes
 #include "GaudiKernel/IInterface.h"
+#include "GaudiKernel/INamedInterface.h"
+#include "GaudiKernel/StatusCode.h"
 
 // Reflex includes
 #include "Reflex/Type.h"
   return sc;
 }
 
+  /// helper function for PyAthena::Aud
+void PyAthena::pyAudit( PyObject* /*self*/, 
+			const char* /*method*/, INamedInterface* /*component*/ )
+{
+  return;
+}
+
+  /// helper function for PyAthena::Aud
+void PyAthena::pyAudit( PyObject* /*self*/, const char* /*method*/, 
+			INamedInterface* /*component*/, const StatusCode& )
+{
+  return;
+}
+

src/PyAthenaUtils.h

 
 // Forward declaration
 class InterfaceID;
+class INamedInterface;
+class StatusCode;
 // Python
 struct _object;
 typedef _object PyObject;
 
   /// little hack while waiting for proper API in PyROOT
   void ObjectProxy_AsVoidPtr( PyObject*, void*& );
+
+  /// helper function for PyAthena::Aud
+  void pyAudit( PyObject* self, 
+		const char* method, INamedInterface* component );
+
+  /// helper function for PyAthena::Aud
+  void pyAudit( PyObject* self, const char* method, 
+		INamedInterface* component, const StatusCode& sc );
 }
 
 #endif // ATHENAPYTHON_PYATHENAUTILS_H 

src/components/AthenaPython_entries.cxx

-#include "AthenaPython/PyAthenaAlg.h"
-#include "AthenaPython/PyAthenaSvc.h"
-#include "AthenaPython/PyAthenaTool.h"
-#include "AthenaPython/PyAthenaAud.h"
+#include "../PyAthenaAlg.h"
+#include "../PyAthenaSvc.h"
+#include "../PyAthenaTool.h"
+#include "../PyAthenaAud.h"
 #include "../PyComponentMgr.h"
 
 #include "GaudiKernel/DeclareFactoryEntries.h"
 
-// DECLARE_NAMESPACE_TOOL_FACTORY( PyAthena, Tool )
-DECLARE_NAMESPACE_SERVICE_FACTORY( PyAthena, Svc )
+DECLARE_NAMESPACE_TOOL_FACTORY     ( PyAthena, Tool )
 DECLARE_NAMESPACE_ALGORITHM_FACTORY( PyAthena, Alg )
-DECLARE_NAMESPACE_AUDITOR_FACTORY( PyAthena, Aud )
-
-DECLARE_NAMESPACE_SERVICE_FACTORY( PyAthena, PyComponentMgr )
+DECLARE_NAMESPACE_AUDITOR_FACTORY  ( PyAthena, Aud )
+DECLARE_NAMESPACE_SERVICE_FACTORY  ( PyAthena, Svc )
+DECLARE_NAMESPACE_SERVICE_FACTORY  ( PyAthena, PyComponentMgr )
 
 DECLARE_FACTORY_ENTRIES( AthenaPython ) {
 
-//   DECLARE_NAMESPACE_TOOL( PyAthena, Tool )
-  DECLARE_NAMESPACE_SERVICE( PyAthena, Svc )
-  DECLARE_NAMESPACE_ALGORITHM( PyAthena, Alg )
-  DECLARE_NAMESPACE_AUDITOR( PyAthena, Aud )
-
-  DECLARE_NAMESPACE_SERVICE( PyAthena, PyComponentMgr )
+  DECLARE_NAMESPACE_TOOL     ( PyAthena, Tool )
+  DECLARE_NAMESPACE_ALGORITHM( PyAthena, Alg  )
+  DECLARE_NAMESPACE_AUDITOR  ( PyAthena, Aud  )
+  DECLARE_NAMESPACE_SERVICE  ( PyAthena, Svc  )
+  DECLARE_NAMESPACE_SERVICE  ( PyAthena, PyComponentMgr )
 }