/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Control/BossCommon/BossCommon-01-04-19/src/BossMain.cxx

Go to the documentation of this file.
00001 #define COMMON_MAIN_CPP
00002 
00003 
00004 // Include files
00005 #include "GaudiKernel/SmartIF.h"
00006 #include "GaudiKernel/Bootstrap.h"
00007 #include "GaudiKernel/IAppMgrUI.h"
00008 #include "GaudiKernel/IProperty.h"
00009 #include <iostream>
00010 #include <fstream>
00011 
00012 // RCS Id for identification of object version
00013 static const char* rcsid = "$Id: BossMain.cxx,v 1.4 2013/11/21 01:07:52 dengzy Exp $";
00014 
00015 
00016 //------------------------------------------------------------------------------
00017 //
00018 //  Package    : Boss Common
00019 //
00020 //  Description: Main Program
00021 //
00022 //------------------------------------------------------------------------------
00023 
00024 
00025 int main( int argc, char* argv[] ) {
00026 
00027   
00028 
00029   std::cout<<std::endl
00030      << "**************************************************" << std::endl
00031      << "               BOSS version: "<<getenv("BES_RELEASE") << std::endl
00032      << "************** BESIII Collaboration **************" << std::endl
00033      << std::endl;
00034   // Create an instance of an application manager
00035   IInterface* iface = Gaudi::createApplicationMgr();
00036   SmartIF<IProperty> propMgr (  iface );
00037   SmartIF<IAppMgrUI> appMgr  (  iface );
00038   if( !appMgr.isValid() || !propMgr.isValid() ) {
00039     std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
00040     return 1;
00041   }
00042 
00043   // Get the input configuration file from arguments (defaulting to "jobOptions.txt")
00044   std:: string opts = (argc>1) ? argv[1] : "jobOptions.txt";
00045   std::cout<<"the jobOptions file is : " <<opts<<std::endl;
00046   std::ifstream fin(opts.c_str());
00047   if(fin.peek()==std::ifstream::traits_type::eof())
00048   {
00049     std::cout<<"ERROR! the jobOptions file is empty!"<<std::endl;
00050     exit(1);
00051   }
00052   std::string cont;
00053   std::string temp;
00054   while(!fin.eof())
00055   {
00056     fin>>temp;
00057     cont+=temp;
00058   }
00059   if(cont.size()<10)
00060   {
00061     std::cout<<"Please check your jobOptions."<<std::endl;
00062     exit(1);
00063   }
00064       
00065 
00066   propMgr->setProperty( "JobOptionsPath", opts );
00067   if( opts.substr( opts.length() - 3, 3 ) == ".py" ) {
00068 
00069     // Python script specified - override defaults
00070     propMgr->setProperty( "JobOptionsType", "NONE" );
00071     propMgr->setProperty( "DLLs",
00072        "['BossServices', 'GaudiPython', 'McEventSelector' ,'GaudiSvc']" );
00073     propMgr->setProperty( "ExtSvc",
00074        "[ 'McEventSelector/EventSelector']" );
00075     propMgr->setProperty( "Runable",        "PythonScriptingSvc" );
00076     propMgr->setProperty( "EventLoop",      "BossEventLoopMgr" );
00077     propMgr->setProperty( "OutStreamType",  "BossOutputStream" );
00078   }
00079 
00080   // Run the application manager and process events
00081   return (appMgr->run().isSuccess()) ? 0 : 1;
00082 }

Generated on Tue Nov 29 22:57:58 2016 for BOSS_7.0.2 by  doxygen 1.4.7