Upgrading your packages to use Gaudi v9
Introduction

Transient Data Store

Services
Algorithms and Services
Other Components

Loading Libraries
<packageName>_load
<packageName>_dll

Auditors

Introduction

This page will discuss the facts you need to know to upgrade your packages to use Gaudi v9.  For the most part - the migration to v9 is transparent.  Most of the features here can be ignored - but beware - some things that are optional now...will be required when we upgrade to the next version of Gaudi.

Transient Data Store

User Defined Data Objects
Our data objects, defined in the GlastEvent package required a minor modification.  The DataObject base class no longer accepts parameters as part of its constructor.  So our derived data objects's contructors now look like this:
Event() : DataObject() { }
previously we passed a name along to the DataObject

Services

The call used to obtain access to a service has been simplified.  While the old method will work - it is obsolete and will be phased out by the next release of Gaudi.

Algorithms and Services

Algorithms and Services no longer need to use the serviceLocator( ) to access services.  A new method called service( ) is provided to all Gaudi algorithms and services.  The call goes like this:
IIncidentSvc* incsvc = 0;
StatusCode sc = service("IncidentSvc", incSvc, true);
Where the first parameter is the name of the service, the second is a variable which is a pointer to the interface of you are interested in, and the third parameter is optional - true means that the service will be loaded if it is not already.  This is actually important.  Gaudi no longer loads its default services - rather either the jobOptions file must specify them all - or our routines which rely upon certain services must force them to be loaded by providing this third parameter.

All Gaudi algorithms have methods to access the standard Gaudi services:
IAuditorSvc* auditorSvc() const;
IChronoStatSvc* chronoSvc() const;
IDataProviderSvc* detSvc() const;
IConversionSvc* detCnvSvc() const;
IDataProviderSvc* eventSvc() const;
IConversionSvc* eventCnvSvc() const;
IHistogramSvc* histoSvc() const;
IMessageSvc* msgSvc() const;
INTupleSvc* ntupleSvc() const;
IRndmGenSvc* randSvc() const;
IToolSvc* toolSvc() const;
Note that the longer form of the names are now obsolete (e.g. messageSvc( ), use msgSvc( ) instead).  While the long names are still supported - they may not be in upcoming versions of Gaudi.

Other Components

Component other than algorithms and services (Tools, Converters) do not have access to the service routine.  They must continue to use the serviceLocator( ) interface to access services.  For example:

IService *isvc = 0; 
StatusCode sc = serviceLocator( )->getService("GlastDetSvc", isvc, true); 
if (sc.isSuccess() ) { 
  sc = isvc->queryInterface(IID_IGlastDetSvc, (void**)&m_detSvc); 
}

Loading Shareable Libraries

Each of our packages that creates a shareable library that Gaudi recognizes, requires 2 special source files:
<packageName>_load.cxx and <packageName>_dll.cxx.  These files are used by Gaudi to load the shareable libraries at runtime.  

The form for these files has been greatly simplified.  Gaudi  now provides standard macros that define all of the required pieces.  In effect, we just have to fill in the blanks.

<packageName>_load.cxx
There are 2 required components.  An include file:
#include "GaudiKernel/DeclareFactoryEntries.h"
and a method named:
DECLARE_FACTORY_ENTRIES(<packageName>)
The method contains declarations for each Gaudi algorithm, service, converter, converter service, tool, etc..  All possibilities are defined in the DeclareFactoryEntries.h file.  Here are the most common:
DECLARE_ALGORITHM(x)
DECLARE_ALGTOOL(x) 
DECLARE_AUDITOR(x) 
DECLARE_CONVERTER(x) 
DECLARE_GENERIC_CONVERTER(x) 
DECLARE_OBJECT(x) 
DECLARE_SERVICE(x) 
DECLARE_TOOL(x) 

Here is an example from the GuiSvc package:
#include "GaudiKernel/DeclareFactoryEntries.h"
DECLARE_FACTORY_ENTRIES(GuiSvc) {
    DECLARE_SERVICE( GuiSvc); 
}

<packageName>_dll.cxx
There are 2 required components:
An include file and a macro where we supply the name of the package.

Here is an example from the GlastSvc package:
#include "GaudiKernel/LoadFactoryEntries.h" LOAD_FACTORY_ENTRIES(GlastSvc)

Auditors

Gaudi provides an Auditor Service. It "provides a set of auditors that can be sued to provide monitoring of various characteristics of the execution of Algorithms."

NameAuditor - 

ChronoAuditor - monitors cpu usage of an algorithm  Reports total and per event average cpu usage at the end of the job.

MemoryAuditor (only available on Linux) - monitors state of memory during algorithm execution
Will provide a warning if memory is allocated without being released.  Note that if an algorithm puts data on the TDS - warnings will be generated, since the algorithm should not delete the created object.

MemStatAuditor - prints a table of memory usage at the end of job.

You can activate the auditors through the jobOptions file, for example:

ApplicationMgr.DLLs += { "GaudiAud" };
AuditorSvc.Auditors = { "ChronoAuditor" };

By default, only the execute method of algorithms is enabled.  The can be changed through the jobOptions file:
algName.AuditInitialize = true;
algName.AuditExecute = false;
algName.AuditFinalize = true;

User defined auditors can be created - perhaps one for checking memory usage on Windows?  See section 11.7.3 of the Gaudi Developer's Guide for details.

 

Back to GLAST Gaudi Home    Back to GLAST Software Home

H. Kelly Last Modified:  2002-12-02 11:37:27 -0800