BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
BossMain.cxx
Go to the documentation of this file.
1#define COMMON_MAIN_CPP
2
3// Include files
4#include "GaudiKernel/Bootstrap.h"
5#include "GaudiKernel/IAppMgrUI.h"
6#include "GaudiKernel/IProperty.h"
7#include "GaudiKernel/SmartIF.h"
8#include <fstream>
9#include <iostream>
10
11// RCS Id for identification of object version
12static const char* rcsid = "$Id: BossMain.cxx,v 1.4 2013/11/21 01:07:52 dengzy Exp $";
13
14//------------------------------------------------------------------------------
15//
16// Package : Boss Common
17//
18// Description: Main Program
19//
20//------------------------------------------------------------------------------
21
22int main( int argc, char* argv[] ) {
23
24 std::cout << std::endl
25 << "**************************************************" << std::endl
26 << " BOSS version: " << getenv( "BES_RELEASE" ) << std::endl
27 << "************** BESIII Collaboration **************" << std::endl
28 << std::endl;
29 // Create an instance of an application manager
30 IInterface* iface = Gaudi::createApplicationMgr();
31 SmartIF<IProperty> propMgr( iface );
32 SmartIF<IAppMgrUI> appMgr( iface );
33 if ( !appMgr.isValid() || !propMgr.isValid() )
34 {
35 std::cout << "Fatal error while creating the ApplicationMgr " << std::endl;
36 return 1;
37 }
38
39 // Get the input configuration file from arguments (defaulting to "jobOptions.txt")
40 std::string opts = ( argc > 1 ) ? argv[1] : "jobOptions.txt";
41 std::cout << "the jobOptions file is : " << opts << std::endl;
42 std::ifstream fin( opts.c_str() );
43 if ( fin.peek() == std::ifstream::traits_type::eof() )
44 {
45 std::cout << "ERROR! the jobOptions file is empty!" << std::endl;
46 exit( 1 );
47 }
48 std::string cont;
49 std::string temp;
50 while ( !fin.eof() )
51 {
52 fin >> temp;
53 cont += temp;
54 }
55 if ( cont.size() < 10 )
56 {
57 std::cout << "Please check your jobOptions." << std::endl;
58 exit( 1 );
59 }
60
61 propMgr->setProperty( "JobOptionsPath", opts );
62 if ( opts.substr( opts.length() - 3, 3 ) == ".py" )
63 {
64
65 // Python script specified - override defaults
66 propMgr->setProperty( "JobOptionsType", "NONE" );
67 propMgr->setProperty( "DLLs",
68 "['BossServices', 'GaudiPython', 'McEventSelector' ,'GaudiSvc']" );
69 propMgr->setProperty( "ExtSvc", "[ 'McEventSelector/EventSelector']" );
70 propMgr->setProperty( "Runable", "PythonScriptingSvc" );
71 propMgr->setProperty( "EventLoop", "BossEventLoopMgr" );
72 propMgr->setProperty( "OutStreamType", "BossOutputStream" );
73 }
74
75 // Run the application manager and process events
76 return ( appMgr->run().isSuccess() ) ? 0 : 1;
77}
EvtComplex cont(const EvtTensor4C &t1, const EvtTensor4C &t2)
int main()
Definition phokhara.cc:42