Commit 3d78f04d authored by Marco Clemencic's avatar Marco Clemencic
Browse files

Merge GAUDI_newpack into trunk

* split of GaudiSvc in smaller modules
* removed GaudiPoolDb
* imported RootCnv from LHCb
  * started conversion of examples

From: Marco Clemencic <marco.clemencic@cern.ch>


git-svn-id: svn+ssh://svn.cern.ch/reps/gaudi/Gaudi/trunk@6735 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parents 24778327 7d3c171e
Package : Gaudi
Package manager : Marco Clemencic
! 2011-12-08 - Marco Clemencic
- Added support for class aliases in the meta-module "Configurables".
- Added a ConfigurableUser to setup the persistency via RootCnv:
from Configurables import GaudiPersistency
GaudiPersistency()
! 2011-11-01 - Marco Clemencic
- Moved core services out of GaudiSvc and into the new packages GaudiCoreSvc
and GaudiCommonSvc. (patch #1816)
Added GaudiCoreSvc and GaudiCommonSvc to the list of known modules in
Gaudi.Configuration.
- Added minimalistic tests to verify that all the required services are
available.
- Minor fix to the test gaudi.bug_39809: it was implicitly requiring the build
of GaudiAlg to work.
================================ Gaudi v22r5 =================================
! 2011-10-27 - Marco Clemencic
- Fixed bug #86980: gaudirun.py should prevent the import of GaudiPython
......
......@@ -11,8 +11,8 @@ from GaudiKernel.Configurable import Configurable
from GaudiKernel.ConfigurableMeta import ConfigurableMeta
__all__ = []
packages = ['GaudiSvc', 'GaudiAlg', 'GaudiAud', 'GaudiPoolDb', 'RootHistCnv',
'GaudiUtils' ]
packages = ['GaudiCoreSvc', 'GaudiCommonSvc', 'GaudiSvc', 'GaudiAlg',
'GaudiAud', 'GaudiPoolDb', 'RootHistCnv', 'GaudiUtils']
#--Loop open all listed packages and populate __all__ with the names and
# the local scope with the Configurable classes
......@@ -29,21 +29,32 @@ for package in packages :
pass
#--Fix some of the name idiosyncrasies in Gaudi
def addConfigurableAs(ori, new) :
gbl = globals()
if ori in gbl: # do the aliasing only if the original is available
gbl[new] = gbl[ori]
__all__.append(new)
gbl[new].DefaultedName = new
aliases = {
'EventDataSvc': 'EvtDataSvc',
'DetectorDataSvc': 'DetDataSvc',
'HistogramDataSvc': 'HistogramSvc',
'HbookHistSvc': 'HbookCnv__PersSvc',
'RootHistSvc': 'RootHistCnv__PersSvc',
'EventPersistencySvc': 'EvtPersistencySvc',
'DetectorPersistencySvc': 'DetPersistencySvc',
'HistogramPersistencySvc': 'HistogramPersistencySvc',
'FileRecordPersistencySvc': 'PersistencySvc',
addConfigurableAs('EvtDataSvc','EventDataSvc')
addConfigurableAs('DetDataSvc','DetectorDataSvc')
addConfigurableAs('HistogramSvc','HistogramDataSvc')
addConfigurableAs('HbookCnv__PersSvc','HbookHistSvc')
addConfigurableAs('RootHistCnv__PersSvc','RootHistSvc')
addConfigurableAs('EvtPersistencySvc','EventPersistencySvc')
addConfigurableAs('DetPersistencySvc','DetectorPersistencySvc')
addConfigurableAs('HistogramPersistencySvc','HistogramPersistencySvc')
'FileCatalog': 'Gaudi__MultiFileCatalog',
'IODataManager': 'Gaudi__IODataManager',
}
addConfigurableAs('Gaudi__MultiFileCatalog','FileCatalog')
addConfigurableAs('Gaudi__IODataManager','IODataManager')
_gbl = globals() # optimization
# This would be nicer with dict comprehension (http://www.python.org/dev/peps/pep-0274)
# but it is available only in Python 2.7
aliases = dict([(new, _gbl[old])
for new, old in aliases.items()
if old in _gbl]) # do the aliasing only if the original is available
# change the default name
for new in aliases:
aliases[new].DefaultedName = new
# update globals and __all__
_gbl.update(aliases)
__all__.extend(aliases)
# remove temporaries
del _gbl, new
......@@ -116,3 +116,26 @@ def setCustomMainLoop(runner):
# change the mainLoop function
from Gaudi.Main import gaudimain
gaudimain.mainLoop = lambda _self, app, nevt: runner(app, nevt)
class GaudiPersistency(ConfigurableUser):
"""Configurable to enable ROOT-based persistency.
Note: it requires Gaudi::RootCnvSvc (package RootCnv).
"""
__slots__ = {}
def __apply_configuration__(self):
"""Apply low-level configuration"""
from Configurables import (PersistencySvc,
Gaudi__RootCnvSvc as RootCnvSvc,
ApplicationMgr,
FileRecordDataSvc,
EventPersistencySvc,
IODataManager,
FileCatalog)
cnvSvcs = [ RootCnvSvc() ]
EventPersistencySvc().CnvServices += cnvSvcs
PersistencySvc("FileRecordPersistencySvc").CnvServices += cnvSvcs
app = ApplicationMgr()
app.SvcOptMapping += [ FileCatalog(), IODataManager() ]
app.ExtSvc += [ FileRecordDataSvc() ]
......@@ -19,6 +19,7 @@ class _ConfigurablesModule(object):
def __getattr__(self, name):
# trigger the load of the configurables database
from Gaudi.Configuration import confDbGetConfigurable, cfgDb
from Gaudi.CommonGaudiConfigurables import aliases
# return value
retval = None
# handle the special cases (needed for modules): __all__, __path__
......@@ -28,6 +29,8 @@ class _ConfigurablesModule(object):
retval == None
elif name in cfgDb.keys(): # ignore private names
retval = confDbGetConfigurable(name)
elif name in aliases: # special case of aliases
retval = aliases[name]
elif self.ignoreMissingConfigurables:
import logging
logging.getLogger(__configurables_module_fullname__).warning('Configurable class %s not in database', name)
......
......@@ -5,7 +5,7 @@
<argument name="args"><set><text>-v</text><text>-n</text></set></argument>
<argument name="options"><text>
from Gaudi.Configuration import *
from Configurables import MyTool
from Configurables import DataStreamTool as MyTool
pub = MyTool("Public")
pub.addTool(MyTool,"Private")
......
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program"><text>Gaudi.exe</text></argument>
<argument name="args"><set><text>../options/empty.opts</text></set></argument>
<argument name="validator"><text>
countErrorLines()
</text></argument>
<argument name="use_temp_dir"><enumeral>true</enumeral></argument>
</extension>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE extension PUBLIC '-//QM/2.3/Extension//EN' 'http://www.codesourcery.com/qm/dtds/2.3/-//qm/2.3/extension//en.dtd'>
<extension class="GaudiTest.GaudiExeTest" kind="test">
<argument name="program"><text>gaudirun.py</text></argument>
<argument name="validator"><text>
countErrorLines()
</text></argument>
<argument name="use_temp_dir"><enumeral>true</enumeral></argument>
</extension>
......@@ -27,7 +27,6 @@
#include "GaudiKernel/StatEntity.h"
#include "GaudiKernel/ICounterSummarySvc.h"
#include "GaudiKernel/IUpdateManagerSvc.h"
#include "GaudiKernel/TransientFastContainer.h"
#include "GaudiKernel/HashMap.h"
// ============================================================================
// forward declarations
......@@ -98,9 +97,9 @@ protected: // few actual data types
/// a pointer to the CounterSummarySvc
ICounterSummarySvc* m_counterSummarySvc;
///list of counters to declare. Set by property CounterList. This can be a regular expression.
std::vector<std::string> m_counterList;
std::vector<std::string> m_counterList;
//list of stat entities to write. Set by property StatEntityList. This can be a regular expression.
std::vector<std::string> m_statEntityList;
std::vector<std::string> m_statEntityList;
public:
// ==========================================================================
/** @brief Templated access to the data in Gaudi Transient Store
......@@ -315,8 +314,6 @@ public:
const bool create = true ) const ;
/// Short-cut to locate the Update Manager Service.
inline IUpdateManagerSvc * updMgrSvc() const;
/// Short-cut to locate the Fast Containers Service.
inline IDataProviderSvc * fastContainersSvc() const;
public:
/** Print the error message and return with the given StatusCode.
*
......@@ -661,13 +658,6 @@ public:
* @endcode
*/
inline StatusCode runUpdate() { return updMgrSvc()->update(this); }
/// Return a new TransientFastContainer for objects of type T.
/// The container is created if it is not in the transient store.
/// If a container with the same name but a different type
template <class T>
TransientFastContainer<T> * getFastContainer
( const std::string &location,
typename TransientFastContainer<T>::size_type initial=0);
public:
/// Algorithm constructor
GaudiCommon ( const std::string & name,
......@@ -736,18 +726,18 @@ public:
// ==========================================================================
public:
// ==========================================================================
/// get the list of aquired tools
const AlgTools& tools () const { return m_tools ; } // get all tools
/// get the list of aquired services
const Services& services () const { return m_services ; } // get all services
/// get the list of aquired tools
const AlgTools& tools () const { return m_tools ; } // get all tools
/// get the list of aquired services
const Services& services () const { return m_services ; } // get all services
// ==========================================================================
private:
// ==========================================================================
/// handler for "ErrorPrint" property
/// handler for "ErrorPrint" property
void printErrorHandler ( Property& /* theProp */ ) ; // "ErrorPrint"
/// handler for "PropertiesPrint" property
/// handler for "PropertiesPrint" property
void printPropsHandler ( Property& /* theProp */ ) ; // "PropertiesPrint"
/// handler for "StatPrint" property
/// handler for "StatPrint" property
void printStatHandler ( Property& /* theProp */ ) ; // "StatPrint"
// ==========================================================================
public:
......@@ -794,8 +784,6 @@ private:
// ==========================================================================
/// Pointer to the Update Manager Service instance
mutable IUpdateManagerSvc* m_updMgrSvc;
/// Pointer to the service providing transient fast containers
mutable IDataProviderSvc* m_fastContainersSvc;
// ==========================================================================
/// insert the actual C++ type of the algorithm in the messages?
bool m_typePrint ;
......
......@@ -202,50 +202,6 @@ GaudiCommon<PBASE>::updMgrSvc() const
return m_updMgrSvc ;
}
// ============================================================================
// Short-cut to get a pointer to the
// ============================================================================
template <class PBASE>
inline IDataProviderSvc *
GaudiCommon<PBASE>::fastContainersSvc() const
{
if ( !m_fastContainersSvc )
{ m_fastContainersSvc = svc<IDataProviderSvc>("FastContainersSvc",true); }
return m_fastContainersSvc ;
}
// ============================================================================
// Get a fast container
// ============================================================================
template < class PBASE >
template < class T >
inline TransientFastContainer<T> *
GaudiCommon<PBASE>::getFastContainer( const std::string &location,
typename TransientFastContainer<T>::size_type initial )
{
typedef TransientFastContainer<T> container_type;
IDataProviderSvc* svc = fastContainersSvc();
Assert( 0 != svc , "getFastContainer(): cannot get FastContainersSvc" );
container_type *ptr = NULL;
SmartDataPtr<container_type> obj( svc, location );
if (!obj){
ptr = new container_type(initial);
StatusCode status = svc->registerObject(location,ptr);
if ( !status.isSuccess() ){
Exception("getFastContainer(): cannot register '" +
System::typeinfoName( typeid( *ptr ) ) +
"' at address '" + location + "'" , status );
}
} else {
ptr = obj;
if ( !ptr ){
Exception("getFastContainer(): No valid container at '" + location + "'");
}
}
return ptr;
}
// ============================================================================
// predefined configurable message stream for the effective printouts
// ============================================================================
template <class PBASE>
......@@ -307,6 +263,6 @@ inline void GaudiCommon<PBASE>::Assert( const bool ok ,
std::string ( __FILE__ ) + "']" , code ) )
// ============================================================================
// The END
// The END
// ============================================================================
#endif // GAUDIALG_GAUDICOMMONIMP_H
......@@ -21,3 +21,7 @@ library GaudiAlg components/*.cpp -import=AIDA -import=Boost -no_stat
# ============== patterns =====================================================
apply_pattern linker_library library="GaudiAlgLib"
apply_pattern component_library library="GaudiAlg"
private
macro_append Boost_linkopts " $(Boost_linkopts_regex) "
end_private
Package: GaudiAlg
Package manager : Marco Clemencic
! 2011-12-05 - Marco Clemencic
- Removed the unused FastContainerSvc.
! 2011-12-01 - Chris Jones
- Fixed bug #85377: GaudiTuple tuple does not undestand ulonglong
Update TupleObj to properly support different data types.
Update TupleObj to properly support different data types.
=============================== GaudiAlg v13r8 ===============================
! 2011-08-08 - Marco Clemencic
......
......@@ -66,7 +66,6 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
m_msgLevel = MSG::NIL;
m_msgStream = 0;
m_updMgrSvc = 0;
m_fastContainersSvc = 0;
m_typePrint = true;
m_propsPrint = false;
m_statPrint = true;
......@@ -92,26 +91,26 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
// job options
// print error counters at finalization ?
this->declareProperty
( "ErrorsPrint" , m_errorsPrint ,
"Print the statistics of errors/warnings/exceptions")
this->declareProperty
( "ErrorsPrint" , m_errorsPrint ,
"Print the statistics of errors/warnings/exceptions")
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printErrorHandler, this ) ;
// print properties at initialization?
this->declareProperty
this->declareProperty
( "PropertiesPrint" , m_propsPrint ,
"Print the properties of the component ")
"Print the properties of the component ")
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printPropsHandler, this ) ;
// print statistical counters at finalization ?
this->declareProperty
( "StatPrint" , m_statPrint ,
"Print the table of counters" )
this->declareProperty
( "StatPrint" , m_statPrint ,
"Print the table of counters" )
-> declareUpdateHandler
( &GaudiCommon<PBASE>::printStatHandler, this ) ;
( &GaudiCommon<PBASE>::printStatHandler, this ) ;
// insert the actual C++ type of the algorithm or tool in the messages?
this->declareProperty
( "TypePrint" , m_typePrint ,
this->declareProperty
( "TypePrint" , m_typePrint ,
"Add the actal C++ component type into the messages" ) ;
// context
this->declareProperty ( "Context" , m_context ) ;
......@@ -139,7 +138,7 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
this->declareProperty
( "UseEfficiencyRowFormat" , m_useEffFormat ,
"Use the special format for printout of efficiency counters" ) ;
//declare the list of simple counters to write.
this->declareProperty(
......@@ -151,7 +150,7 @@ GaudiCommon<PBASE>::initGaudiCommonConstructor( const IInterface * parent )
"StatEntityList",
m_statEntityList=std::vector<std::string>(0),
"RegEx list, of StatEntity counters for CounterSummary.");
// add handler for message level changes
this->outputLevelProperty().declareUpdateHandler( &GaudiCommon<PBASE>::msgLevelHandler, this );
......@@ -247,12 +246,12 @@ StatusCode GaudiCommon<PBASE>::
// Check rootInTES ends with a /
if ( !m_rootInTES.empty() &&
m_rootInTES.substr(m_rootInTES.size()-1) != "/" ) m_rootInTES += "/";
//Set up the CounterSummarySvc May need to be changed
this->svcLoc()->service("CounterSummarySvc",m_counterSummarySvc,false).ignore() ;
if (msgLevel(MSG::DEBUG))
{
if (m_counterSummarySvc==NULL )
if (m_counterSummarySvc==NULL )
debug() << "could not locate CounterSummarySvc, no counter summary will be made" << endmsg;
else debug() << "found CounterSummarySvc OK" << endmsg;
}
......@@ -325,14 +324,14 @@ StatusCode GaudiCommon<PBASE>::
debug() << endmsg;
}
while ( !m_services.empty() ) { sc = sc && releaseSvc( m_services.begin()->second ) ; }
//release the CounterSummarySvc manually
if(m_counterSummarySvc)
if(m_counterSummarySvc)
{
m_counterSummarySvc->release();
m_counterSummarySvc=NULL;
}
// format printout
if ( !m_errors.empty() || !m_warnings.empty() || !m_exceptions.empty() )
{
......@@ -798,7 +797,7 @@ DataObject* GaudiCommon<PBASE>::put ( IDataProviderSvc* svc ,
template < class PBASE >
void GaudiCommon<PBASE>::printErrorHandler ( Property& /* theProp */ )
{
// no action if not yet initialized
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> errorsPrint() ) { this -> printErrors () ; }
}
......@@ -808,7 +807,7 @@ void GaudiCommon<PBASE>::printErrorHandler ( Property& /* theProp */ )
template < class PBASE >
void GaudiCommon<PBASE>::printPropsHandler ( Property& /* theProp */ )
{
// no action if not yet initialized
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> propsPrint() ) { this -> printProps ( MSG::ALWAYS ) ; }
}
......@@ -818,7 +817,7 @@ void GaudiCommon<PBASE>::printPropsHandler ( Property& /* theProp */ )
template < class PBASE >
void GaudiCommon<PBASE>::printStatHandler ( Property& /* theProp */ )
{
// no action if not yet initialized
// no action if not yet initialized
if ( this -> FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
if ( this -> statPrint() ) { this -> printStat ( MSG::ALWAYS ) ; }
}
......@@ -826,7 +825,7 @@ void GaudiCommon<PBASE>::printStatHandler ( Property& /* theProp */ )
// ============================================================================
// The END
// The END
// ============================================================================
Package: GaudiAud
Package manager : David Quarrie, Marco Clemencic
! 2011-11-01 - Marco Clemencic
- Backward compatible changes to prevent a segfault when generating the
Configurables.
=============================== GaudiAud v9r4 ================================
! 2011-04-15 - Marco Clemencic
- Synchronized with patch #4820.
......
......@@ -14,7 +14,21 @@ DECLARE_AUDITOR_FACTORY(ChronoAuditor)
ChronoAuditor::ChronoAuditor(const std::string& name, ISvcLocator* pSvcLocator)
: CommonAuditor(name, pSvcLocator) {
}
ChronoAuditor::~ChronoAuditor() {}
StatusCode ChronoAuditor::initialize() {
StatusCode sc = CommonAuditor::initialize();
if (UNLIKELY(sc.isFailure())) return sc;
m_chronoSvc = serviceLocator()->service("ChronoStatSvc");
if (UNLIKELY(!m_chronoSvc.get())) {
MsgStream log(msgSvc(), name());
log << MSG::ERROR << "Cannot get ChronoStatSvc" << endmsg;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
void ChronoAuditor::i_before(CustomEventTypeRef evt, const std::string& caller)
......
......@@ -15,6 +15,10 @@ class ChronoAuditor : virtual public CommonAuditor {
public:
ChronoAuditor(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~ChronoAuditor();
virtual StatusCode initialize();
private:
/// Default (catch-all) "before" Auditor hook
virtual void i_before(CustomEventTypeRef evt, const std::string& caller);
......
......@@ -19,7 +19,21 @@ DECLARE_AUDITOR_FACTORY(MemStatAuditor)
MemStatAuditor::MemStatAuditor(const std::string& name, ISvcLocator* pSvcLocator) :
MemoryAuditor(name, pSvcLocator), m_vSize(-1.)
{
}
MemStatAuditor::~MemStatAuditor() {}
StatusCode MemStatAuditor::initialize() {
StatusCode sc = CommonAuditor::initialize();
if (UNLIKELY(sc.isFailure())) return sc;
m_stat = serviceLocator()->service("ChronoStatSvc");
if (UNLIKELY(!m_stat.get())) {
MsgStream log(msgSvc(), name());
log << MSG::ERROR << "Cannot get ChronoStatSvc" << endmsg;
return StatusCode::FAILURE;
}
return StatusCode::SUCCESS;
}
void MemStatAuditor::i_before(CustomEventTypeRef /*evt*/, const std::string& /*caller*/) {
......
......@@ -15,7 +15,9 @@
class MemStatAuditor:public MemoryAuditor {
public:
MemStatAuditor(const std::string& name, ISvcLocator* pSvcLocator);
virtual ~MemStatAuditor();
virtual StatusCode initialize();
private:
/// Re-implement i_before to avoid monitoring the memory usage before a function.
virtual void i_before(CustomEventTypeRef evt, const std::string& caller);
......
# ============================================================================
# Created : 2011-10-31
# Maintainer : Marco Clemencic
# ============================================================================
package GaudiCommonSvc
version v1r0
# ============================================================================
# Structure, i.e. directories to process.
# ============================================================================
branches doc src cmt
# ============================================================================
# Used packages. Specify the version, * at the end specifies 'any revision'
# Put as many lines as needed, with all packages, without the '#'
# ============================================================================
use GaudiKernel *
use AIDA * LCG_Interfaces -no_auto_imports
use Boost * LCG_Interfaces -no_auto_imports
use ROOT * LCG_Interfaces -no_auto_imports
include_path none
# ============================================================================
# Component library building rule
# ============================================================================
library GaudiCommonSvc -no_static -import=AIDA -import=Boost -import=ROOT \
DataSvc/*.cpp \
HistogramSvc/*.cpp \
PersistencySvc/*.cpp \
*.cpp
# ============================================================================
# define component library link options
# ============================================================================
apply_pattern component_library library=GaudiCommonSvc
private
macro_append Boost_linkopts " $(Boost_linkopts_system) $(Boost_linkopts_filesystem) "
#macro_append ROOT_linkopts " -lHist -lReflex -lMatrix -lGraf" \
# target-winxp " libHist.lib libReflex.lib libMatrix.lib libGraf.lib" \
# target-mac104 " -lHist -lReflex -lMatrix -lGraf"
macro_append ROOT_linkopts " -lHist" \
target-winxp " libHist.lib" \
target-mac104 " -lHist"
end_private
################################################################################
# Package: GaudiCommonSvc
# Maintainer: Marco Clemencic
# Description: standard and commonly used components
################################################################################
! 2011-12-06 - Marco Clemencic
- Moved AlgContextSvc from GaudiMonitor to GaudiCommonSvc.
- Removed unnecessary grouping in src directory.
! 2011-11-01 - Marco Clemencic
- Moved core services out of GaudiSvc and into the new packages GaudiCoreSvc
and GaudiCommonSvc. (patch #1816)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment