/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Simulation/G4Svc/G4Svc-00-01-52/other_src/Goofy.cpp

Go to the documentation of this file.
00001 #include "globals.hh"
00002 #include "G4Svc/Goofy.h"
00003 #include "G4Svc/GoofyMessenger.h"
00004 #include "G4Svc/ProjectMessenger.h"
00005 #include "G4Svc/RandomCenterMessenger.h"
00006 #include <cstdlib>
00007 #
00008 #include "G4UImanager.hh"
00009 #include "G4UIterminal.hh"
00010 
00011 
00012 Goofy::Goofy()
00013 {
00014 
00015         Banner();       
00016         
00017         theMessenger=new GoofyMessenger(this);
00018         theProject=new ProjectMessenger(this);
00019         theRandomCenter=new RandomCenterMessenger(this);
00020         
00021 }
00022 
00023 Goofy::Goofy(int npar, char* pars[])
00024 {
00025 
00026         Banner();       
00027 
00028         if (npar>1) for (int i=1;i<npar;i++) opts.push_back(pars[i]);   
00029         SetJobOptions();
00030         
00031         // Construct the default run manager
00032         
00033         theMessenger=new GoofyMessenger(this);
00034         theProject=new ProjectMessenger(this);
00035         theRandomCenter=new RandomCenterMessenger(this);
00036         
00037         G4UImanager * UI = G4UImanager::GetUIpointer(); 
00038         if (!initmacro.empty()) UI->ApplyCommand("/control/execute "+initmacro);
00039         
00040         else if (rm==Batch)
00041         {
00042         
00043         // check that a macro has been passed along
00044                 if (runmacro.empty())
00045                 {
00046                         std::cout<<" Batch mode selected but no macro file "
00047                                 <<"to run; Aborting!!!!"<<std::endl;
00048                         abort();
00049                 }
00050                 UI->ApplyCommand("/control/execute "+runmacro);
00051                 exit(0);
00052         }
00053 }
00054 
00055 Goofy::~Goofy()
00056 {
00057         delete theMessenger;
00058         delete theProject;
00059         delete theRandomCenter;
00060 }
00061 
00062 int Goofy::Shell(std::string s)
00063 {
00064         return system(s.c_str());
00065 }
00066 
00067 void Goofy::Banner()
00068 {
00069         std::cout<<std::endl<<std::endl<<
00070         "***********************************************************************"<<std::endl<<
00071         "***********************************************************************"<<std::endl<<  
00072         "**                                                                   **"<<std::endl<<
00073         "**      GGGGG      OOOOO      OOOOO    FFFFFFF    Y     Y            **"<<std::endl<<
00074         "**     G     G    O     O    O     O   F          Y     Y            **"<<std::endl<<
00075         "**     G          O     O    O     O   F           Y   Y             **"<<std::endl<<
00076         "**     G          O     O    O     O   FFFFF        YYY              **"<<std::endl<<
00077         "**     G   GGGG   O     O    O     O   F             Y               **"<<std::endl<<
00078         "**     G     G    O     O    O     O   F             Y               **"<<std::endl<<
00079         "**      GGGGG      OOOOO      OOOOO    F             Y               **"<<std::endl<<
00080         "**                                                                   **"<<std::endl<<
00081         "**                                                                   **"<<std::endl<<
00082         "**           The Geant4-based Object Oriented FollY                  **"<<std::endl<<
00083         "**                                                                   **"<<std::endl<<
00084         "**                                             Jan 10th, 2000        **"<<std::endl<<
00085         "**                                                                   **"<<std::endl<<
00086         "***********************************************************************"<<std::endl<<
00087         "***********************************************************************"<<std::endl<<  
00088         std::endl<<std::endl<<std::endl;
00089         
00090         char *greetings=getenv("GOOFY_GREETINGS");
00091         
00092         if (greetings)
00093         Shell("xv -wait 2 $GOOFY_GREETINGS");
00094 }
00095 
00096 
00097 void Goofy::SetJobOptions()
00098 {
00099         rm=Interactive;
00100         std::vector<std::string>::const_iterator it;
00101         
00102         it=find(opts.begin(),opts.end(),"-b");
00103         if (it!=opts.end()) rm=Batch;
00104         
00105         it=find(opts.begin(),opts.end(),"-i");
00106         if (it!=opts.end())
00107         {
00108                 it++;
00109                 initmacro=*it;
00110         }
00111         
00112         it=find(opts.begin(),opts.end(),"-m");
00113         if (it!=opts.end())
00114         {
00115                 it++;
00116                 runmacro=*it;
00117         }
00118 }

Generated on Tue Nov 29 23:14:33 2016 for BOSS_7.0.2 by  doxygen 1.4.7