13 #include "GaudiKernel/Bootstrap.h"
14 #include "GaudiKernel/IProperty.h"
15 #include "GaudiKernel/ISvcLocator.h"
16 #include "GaudiKernel/IAppMgrUI.h"
17 #include "GaudiKernel/SmartIF.h"
18 #include "GaudiKernel/ModuleIncident.h"
19 #include "GaudiKernel/PathResolver.h"
29 bool initGaudi(
const std::string& jobOptsFile, ISvcLocator*& pSvcLoc) {
31 std::string jobOptsPath;
32 if (!jobOptsFile.empty()) {
34 if (jobOptsPath.empty()) {
35 std::cout <<
"\n\nCannot find job opts " << jobOptsFile << std::endl;
38 std::cout <<
"\n\nInitializing Gaudi ApplicationMgr using job opts " << jobOptsPath << std::endl;
43 SmartIF<IAppMgrUI> appMgr = Gaudi::createApplicationMgr();
44 if(!appMgr.isValid()) {
45 std::cout <<
"Fatal error while creating the ApplicationMgr " << std::endl;
49 SmartIF<IProperty> propMgr(appMgr);
50 SmartIF<ISvcLocator> svcLoc(appMgr);
51 if(!svcLoc.isValid() || !propMgr.isValid()) {
52 std::cout <<
"Fatal error while retrieving AppMgr interfaces " << std::endl;
57 pSvcLoc = svcLoc.get();
59 propMgr->setProperty(
"EvtSel",
"NONE" ).
60 orThrow(
"Cannnot set EvtSel property",
"initGaudi");
61 if (jobOptsFile.empty()) {
62 propMgr->setProperty(
"JobOptionsType",
"NONE" ).
63 orThrow(
"Cannnot set JobOptionsType property",
"initGaudi");
65 propMgr->setProperty(
"JobOptionsType",
"FILE" ).
66 orThrow(
"Cannnot set JobOptionsType property",
"initGaudi");
67 propMgr->setProperty(
"JobOptionsPath", jobOptsPath ).
68 orThrow(
"Cannnot set JobOptionsPath property",
"initGaudi");
71 if (appMgr->configure().isSuccess() && appMgr->initialize().isSuccess()) {
72 std::cout<<
"ApplicationMgr Ready"<<std::endl;
75 std::cout <<
"Fatal error while initializing the AppMgr" << std::endl;
96 ModuleLoadedIncident inc2 (
"",
"");