Changeset 147 for snovis


Ignore:
Timestamp:
Feb 9, 2007, 9:23:17 PM (17 years ago)
Author:
barrand
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • snovis/trunk/applications/snovis_session.cc

    r98 r147  
    1414// G4Lab :
    1515#include <G4Lab/UIOnX.h> //UIOnX
     16
    1617#include "Environment.h"
     18#include <Lib/Out.h>
     19#include <Lib/sout.h>
     20#include <Lib/fmanip.h>
     21#include <Lib/dirmanip.h>
     22#include <Lib/smanip.h>
    1723
    1824using namespace snova;
     
    2430    virtual ~mgr(){}
    2531  public:
    26     void run_sim(int argc , char** argv) {
     32    void run_sim(int argc , char** argv,const std::string& aGUI = "") {
    2733      G4UImanager* UI = G4UImanager::GetUIpointer(); 
    2834
     
    3945      G4UIsession* session =
    4046        new G4Lab::UIOnX(*runManager,gui,argc,argv); //UIOnX
     47      session->createUI(aGUI);
    4148      session->SessionStart();
    4249      delete session;
     
    5057  if(!check_envs(argv[0])) return 1;
    5158
    52   //std::string params_filename = snova::constants::DEF_PARAMS_FILENAME;
     59  Lib::Printer printer;
     60  Lib::Out out(printer);
     61
    5362  std::string SNOVISROOT;
    5463  if(!Lib::System::getenv("SNOVISROOT",SNOVISROOT)) {
    55     G4cout << "snovis_session :"
    56            << " Environment variable SNOVISROOT not defined."
    57            << G4endl;
     64    out << "snovis_session :"
     65        << " Environment variable SNOVISROOT not defined."
     66        << Lib::endl;
    5867    return 1;
    5968  }
     69
     70  if(!Lib::dirmanip::goHome()) {
     71    out << "snovis_session : can't go home." << Lib::endl;
     72    return 1;
     73  } else if(!Lib::dirmanip::mkcd("OpenScientist")) {
     74    out << "snovis_session : can't mkcd OpenScientist." << Lib::endl;
     75    return 1;
     76  } else if(!Lib::dirmanip::mkcd("snovis")) {
     77    out << "snovis_session : can't mkcd snovis." << Lib::endl;
     78    return 1;
     79  } else if(!Lib::dirmanip::mkcd("session")) {
     80    out << "snovis_session : can't mkcd session." << Lib::endl;
     81    return 1;
     82  } else {
     83    std::string fs = Lib::System::fileSeparator();
     84    std::string from = SNOVISROOT+fs+"scripts"+fs+"snova";
     85    if(!Lib::fmanip::copy(from+fs+"snova.par",".")) {
     86      out << "snovis_session : can't copy snova.par." << Lib::endl;
     87      return 1;
     88    } else if(!Lib::fmanip::copy(from+fs+"snemo.geom",".")) {
     89      out << "snovis_session : can't copy snemo.geom." << Lib::endl;
     90      return 1;
     91    } else if(!Lib::fmanip::copy(from+fs+"example_Mo100.txt",".")) {
     92      out << "snovis_session : can't copy example_Mo100.txt." << Lib::endl;
     93      return 1;
     94    } else {
     95      //std::string pwd;
     96      //Lib::dirmanip::directory(pwd);
     97      //out << pwd << Lib::endl;
     98    }
     99  }
     100
     101  bool is_Mac_app = Lib::main::isMacApp(aArgv[0]);
    60102
    61103  int error_code=EXIT_SUCCESS;
     
    65107 
    66108    bool        debug           = false;
    67     //std::string params_filename = snova::constants::DEF_PARAMS_FILENAME;
    68     std::string params_filename = SNOVISROOT+"/scripts/snova.par";
     109    std::string params_filename = snova::constants::DEF_PARAMS_FILENAME;
     110    //std::string params_filename = SNOVISROOT+"/scripts/snova.par";
    69111    //G4String geom_filename = SNOVISROOT+"/scripts/snemo.geom";
    70112    std::string G4_macro        = "";
     
    99141    std::cerr << "prog_snova2: debug: "
    100142              << "Run the simulation" << std::endl;
    101     my_snova_mgr.run_sim(argc,argv);
     143    my_snova_mgr.run_sim(argc,argv,is_Mac_app?"Qt":"");
    102144
    103145    // Clean the snova manager
Note: See TracChangeset for help on using the changeset viewer.