Main Page   Namespace List   File List   Namespace Members   File Members  

GlastMain.cxx

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/GlastPolicy/src/GlastMain.cxx,v 1.2 2001/09/23 19:44:06 burnett Exp $
00002 
00003 // Include files
00004 #include "GaudiKernel/SmartIF.h"
00005 #include "GaudiKernel/Bootstrap.h"
00006 #include "GaudiKernel/IAppMgrUI.h"
00007 #include "GaudiKernel/IProperty.h"
00008 #include "GaudiKernel/IJobOptionsSvc.h"
00009 #include "GaudiKernel/System.h"
00010 //------------------------------------------------------------------------------
00011 //
00012 //  Package    : GlastPolicy
00013 //
00014 //  Description: generic Gaudi Main Program
00015 //
00016 //------------------------------------------------------------------------------
00025 // declare function that may reduce the execution priority
00026 void setPriority();
00027 
00028 int main( int argn, char** argc) {
00029     
00030     std::string joboptions_file="src/jobOptions.txt"; // default
00031     
00032     const char* job = ::getenv("JOBOPTIONS"); // check for env var
00033     
00034     if( argn>1 ) { joboptions_file = argc[1];} // priority to command arg.
00035     else if( job ) { joboptions_file = job; }
00036     std::cerr << "Starting Glast-Gaudi job with job options file " 
00037         << joboptions_file << std::endl;
00038     
00039     
00040     // Create an instance of an application manager
00041     IInterface* iface = Gaudi::createApplicationMgr();
00042     
00043     SmartIF<IProperty>     propMgr ( IID_IProperty, iface );
00044     SmartIF<IAppMgrUI>     appMgr  ( IID_IAppMgrUI, iface );
00045     
00046     // Set properties of algorithms and services
00047     StatusCode status = StatusCode::SUCCESS;
00048     if ( iface && propMgr == iface )    {
00049         status = propMgr->setProperty( "JobOptionsPath", joboptions_file );
00050     }
00051     else  return 2;
00052         
00053     // Run the application manager and process events
00054     if ( appMgr )   {
00055 #ifdef WIN32
00056         setPriority();
00057 #endif
00058         status = appMgr->run();
00059     }
00060     else   return 3;
00061     // All done - exit with 0 if success.
00062     return (status.isFailure()? 1 : 0);
00063     
00064 }

Generated at Wed Nov 14 20:41:44 2001 by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000