| The Gaudi Framework v27r1

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

- File List
- File Members

GaudiMain.cpp
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //
3 // Description: Main Program for Gaudi applications
4 //
5 //------------------------------------------------------------------------------
6 #include "GaudiKernel/SmartIF.h"
7 #include "GaudiKernel/Bootstrap.h"
8 #include "GaudiKernel/IAppMgrUI.h"
9 #include "GaudiKernel/IProperty.h"
10 #include "GaudiKernel/Property.h"
11 #include "GaudiKernel/StatusCode.h"
12 #include <iostream>
13
14 extern "C" GAUDI_API int GaudiMain(int argc,char **argv) {
15 IInterface* iface = Gaudi::createApplicationMgr();
16 SmartIF<IAppMgrUI> appMgr ( iface );
17 auto propMgr = appMgr.as<IProperty>();
18
19 if( !appMgr || !propMgr ) {
20 std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
21 return 1;
22 }
23
24 // Get the input configuration file from arguments
25 std:: string opts = (argc>1) ? argv[1] : "jobOptions.txt";
26
27 propMgr->setProperty( "JobOptionsPath", opts ).ignore();
28
29 if( opts.compare( opts.length() - 3, 3, ".py" ) == 0 ) {
30 propMgr->setProperty( "EvtSel", "NONE" ).ignore();
31 propMgr->setProperty( "JobOptionsType", "NONE" ).ignore();
32 propMgr->setProperty( "DLLs", "['GaudiPython']" ).ignore();
33 propMgr->setProperty( "Runable", "PythonScriptingSvc" ).ignore();
34 }
35
36 // Run the application manager and process events
37 StatusCode sc = appMgr->run();
38 IntegerProperty returnCode("ReturnCode", 0);
39 propMgr->getProperty(&returnCode).ignore();
40 // Release Application Manager
41 propMgr.reset();
42 appMgr.reset();
43 // All done - exit
44 if (sc.isFailure() && returnCode.value() == 0) {
45 // propagate a valid error code in case of failure
46 returnCode.setValue(1);
47 }
48 return returnCode.value();
49 }
SmartIF< IAppMgrUI >
IAppMgrUI::run
virtual StatusCode run()=0
Run the complete job (from initialize to terminate)
IAppMgrUI.h
gaudirun.argv
list argv
Definition: gaudirun.py:227
std::endl
T endl(T...args)
Bootstrap.h
PropertyWithVerifier::setValue
bool setValue(const TYPE &value) override
implementation of PropertyWithValue::setValue
Definition: Property.h:406
merge_files.sc
int sc
Definition: merge_files.py:167
StatusCode::isFailure
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
std::string
STL class.
SimpleProperty< int >
SmartIF::as
SmartIF< IFace > as() const
return a new SmartIF instance to another interface
Definition: SmartIF.h:110
ana.opts
dictionary opts
Definition: ana.py:111
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:234
SmartIF.h
PropertyWithValue::value
const TYPE & value() const
explicit conversion
Definition: Property.h:341
std::string::length
T length(T...args)
IProperty.h
Property.h
IOTest.appMgr
tuple appMgr
Definition: IOTest.py:83
GaudiMain
GAUDI_API int GaudiMain(int argc, char **argv)
Definition: GaudiMain.cpp:14
SmartIF::reset
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:88
StatusCode.h
plotBacklogPyRoot.argc
tuple argc
Definition: plotBacklogPyRoot.py:128
IProperty
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:107
std::cout
std::string::compare
T compare(T...args)
Gaudi::createApplicationMgr
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)