GaudiMain.cpp File Reference
#include "GaudiKernel/SmartIF.h"
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/IAppMgrUI.h"
#include "GaudiKernel/IProperty.h"
#include "GaudiKernel/Property.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.

14  {
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 }
bool isFailure() const
Test for a status code of FAILURE.
Definition: StatusCode.h:86
list argv
Definition: gaudirun.py:227
dictionary opts
Definition: ana.py:111
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Definition of the basic interface.
Definition: IInterface.h:234
tuple appMgr
Definition: IOTest.py:83
The IProperty is the basic interface for all components which have properties that can be set or get...
Definition: IProperty.h:21
GAUDI_API IAppMgrUI * createApplicationMgr(const std::string &dllname, const std::string &factname)