BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Goofy.cpp
Go to the documentation of this file.
1#include "G4Svc/Goofy.h"
2#include "G4Svc/GoofyMessenger.h"
3#include "G4Svc/ProjectMessenger.h"
4#include "G4Svc/RandomCenterMessenger.h"
5#include "globals.hh"
6#include <cstdlib>
7#
8#include "G4UImanager.hh"
9#include "G4UIterminal.hh"
10
12
13 Banner();
14
15 theMessenger = new GoofyMessenger( this );
16 theProject = new ProjectMessenger( this );
17 theRandomCenter = new RandomCenterMessenger( this );
18}
19
20Goofy::Goofy( int npar, char* pars[] ) {
21
22 Banner();
23
24 if ( npar > 1 )
25 for ( int i = 1; i < npar; i++ ) opts.push_back( pars[i] );
26 SetJobOptions();
27
28 // Construct the default run manager
29
30 theMessenger = new GoofyMessenger( this );
31 theProject = new ProjectMessenger( this );
32 theRandomCenter = new RandomCenterMessenger( this );
33
34 G4UImanager* UI = G4UImanager::GetUIpointer();
35 if ( !initmacro.empty() ) UI->ApplyCommand( "/control/execute " + initmacro );
36
37 else if ( rm == Batch )
38 {
39
40 // check that a macro has been passed along
41 if ( runmacro.empty() )
42 {
43 std::cout << " Batch mode selected but no macro file "
44 << "to run; Aborting!!!!" << std::endl;
45 abort();
46 }
47 UI->ApplyCommand( "/control/execute " + runmacro );
48 exit( 0 );
49 }
50}
51
53 delete theMessenger;
54 delete theProject;
55 delete theRandomCenter;
56}
57
58int Goofy::Shell( std::string s ) { return system( s.c_str() ); }
59
60void Goofy::Banner() {
61 std::cout
62 << std::endl
63 << std::endl
64 << "***********************************************************************" << std::endl
65 << "***********************************************************************" << std::endl
66 << "** **" << std::endl
67 << "** GGGGG OOOOO OOOOO FFFFFFF Y Y **" << std::endl
68 << "** G G O O O O F Y Y **" << std::endl
69 << "** G O O O O F Y Y **" << std::endl
70 << "** G O O O O FFFFF YYY **" << std::endl
71 << "** G GGGG O O O O F Y **" << std::endl
72 << "** G G O O O O F Y **" << std::endl
73 << "** GGGGG OOOOO OOOOO F Y **" << std::endl
74 << "** **" << std::endl
75 << "** **" << std::endl
76 << "** The Geant4-based Object Oriented FollY **" << std::endl
77 << "** **" << std::endl
78 << "** Jan 10th, 2000 **" << std::endl
79 << "** **" << std::endl
80 << "***********************************************************************" << std::endl
81 << "***********************************************************************" << std::endl
82 << std::endl
83 << std::endl
84 << std::endl;
85
86 char* greetings = getenv( "GOOFY_GREETINGS" );
87
88 if ( greetings ) Shell( "xv -wait 2 $GOOFY_GREETINGS" );
89}
90
91void Goofy::SetJobOptions() {
92 rm = Interactive;
93 std::vector<std::string>::const_iterator it;
94
95 it = find( opts.begin(), opts.end(), "-b" );
96 if ( it != opts.end() ) rm = Batch;
97
98 it = find( opts.begin(), opts.end(), "-i" );
99 if ( it != opts.end() )
100 {
101 it++;
102 initmacro = *it;
103 }
104
105 it = find( opts.begin(), opts.end(), "-m" );
106 if ( it != opts.end() )
107 {
108 it++;
109 runmacro = *it;
110 }
111}
@ Interactive
Definition Goofy.h:11
@ Batch
Definition Goofy.h:11
XmlRpcServer s
static int Shell(std::string s)
Definition Goofy.cpp:58
~Goofy()
Definition Goofy.cpp:52
Goofy()
Definition Goofy.cpp:11