| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Functions
GaudiMain.cpp File Reference
`#include "GaudiKernel/Bootstrap.h"`
`#include "GaudiKernel/IAppMgrUI.h"`
`#include "GaudiKernel/IProperty.h"`
`#include "GaudiKernel/Property.h"`
`#include "GaudiKernel/SmartIF.h"`
`#include "GaudiKernel/StatusCode.h"`
`#include <iostream>`
Include dependency graph for GaudiMain.cpp:

Go to the source code of this file.

## Functions
GAUDI_API int | GaudiMain (int argc, char **argv)

## Function Documentation

GAUDI_API int GaudiMain | ( | int | argc,
|  | char ** | argv
| ) |  |

Definition at line 14 of file GaudiMain.cpp.

15 {
16 IInterface* iface = Gaudi::createApplicationMgr();
17 SmartIF<IAppMgrUI> appMgr( iface );
18 auto propMgr = appMgr.as<IProperty>();
19
20 if ( !appMgr || !propMgr ) {
21 std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
22 return 1;
23 }
24
25 // Get the input configuration file from arguments
26 std::string opts = ( argc > 1 ) ? argv[1] : "jobOptions.txt";
27
28 propMgr->setProperty( "JobOptionsPath", opts ).ignore();
29
30 if ( opts.compare( opts.length() - 3, 3, ".py" ) == 0 ) {
31 propMgr->setProperty( "EvtSel", "NONE" ).ignore();
32 propMgr->setProperty( "JobOptionsType", "NONE" ).ignore();
33 propMgr->setProperty( "DLLs", "['GaudiPython']" ).ignore();
34 propMgr->setProperty( "Runable", "PythonScriptingSvc" ).ignore();
35 }
36
37 // Run the application manager and process events
38 StatusCode sc = appMgr->run();
39 Gaudi::Property<int> returnCode( "ReturnCode", 0 );
40 propMgr->getProperty( &returnCode ).ignore();
41 // Release Application Manager
42 propMgr.reset();
43 appMgr.reset();
44 // All done - exit
45 if ( sc.isFailure() && returnCode == 0 ) {
46 // propagate a valid error code in case of failure
47 returnCode.setValue( 1 );
48 }
49 return returnCode.value();
50 }
SmartIF< IAppMgrUI >
Gaudi::Property
Implementation of property with value of concrete type.
Definition: Property.h:319
gaudirun.argv
list argv
Definition: gaudirun.py:235
std::endl
T endl(T...args)
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:61
gaudirun.opts
opts
Definition: gaudirun.py:244
std::string
STL class.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IInterface
Definition of the basic interface.
Definition: IInterface.h:277
plotBacklogPyRoot.argc
argc
Definition: plotBacklogPyRoot.py:138
std::string::length
T length(T...args)
IOTest.appMgr
appMgr
Definition: IOTest.py:94
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:20
std::cout
std::string::compare
T compare(T...args)
Gaudi::createApplicationMgr
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)