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