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

Added support for class aliases in the meta-module "Configurables"

From: Marco Clemencic <>

git-svn-id: svn+ssh:// 53ecefc3-a64d-0410-9bdf-b8581fa3287e
parent 4703c7d5
Package : Gaudi
Package manager : Marco Clemencic
! 2011-12-08 - Marco Clemencic
- Added support for class aliases in the meta-module "Configurables".
! 2011-11-01 - Marco Clemencic
- Moved core services out of GaudiSvc and into the new packages GaudiCoreSvc
and GaudiCommonSvc. (patch #1816)
......@@ -29,21 +29,32 @@ for package in packages :
#--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]
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',
'FileCatalog': 'Gaudi__MultiFileCatalog',
'IODataManager': 'Gaudi__IODataManager',
_gbl = globals() # optimization
# This would be nicer with dict comprehension (
# 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__
# remove temporaries
del _gbl, new
......@@ -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)
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