Index: snovis/trunk/applications/snovis_session.cc
===================================================================
--- snovis/trunk/applications/snovis_session.cc	(revision 204)
+++ snovis/trunk/applications/snovis_session.cc	(revision 208)
@@ -3,10 +3,11 @@
  */
 
+// snova :
 #include <snova/snova_mgr.h>
-
 #include <SNvertex/base_VG_factory.h>
 #include <SNvertex/CALO_basic_VG.h>
 #include <SNvertex/source_simple_VG.h>
 
+// Geant4 :
 #include <G4RunManager.hh>
 #include <G4UImanager.hh>
@@ -15,5 +16,5 @@
 #include <G4Lab/UIOnX.h> //UIOnX
 
-#include "Environment.h"
+// Lib :
 #include <Lib/Out.h>
 #include <Lib/sout.h>
@@ -22,5 +23,7 @@
 #include <Lib/smanip.h>
 
-using namespace snova;
+#include "Environment.h"
+
+//using namespace snova;
 
 namespace snovis {
@@ -54,6 +57,6 @@
 int main( int argc , char** argv ) 
 {
-  if(argc<=0) return 1;
-  if(!check_envs(argv[0])) return 1;
+  if(argc<=0) return EXIT_FAILURE;
+  if(!check_envs(argv[0])) return EXIT_FAILURE;
 
   Lib::Printer printer;
@@ -65,35 +68,27 @@
 	<< " Environment variable SNOVISROOT not defined."
 	<< Lib::endl;
-    return 1;
+    return EXIT_FAILURE;
   }
 
+  std::string params;
+
+  // We cd to $HOME/snovis/session :
   if(!Lib::dirmanip::goHome()) {
     out << "snovis_session : can't go home." << Lib::endl;
-    return 1;
-  } else if(!Lib::dirmanip::mkcd("OpenScientist")) {
-    out << "snovis_session : can't mkcd OpenScientist." << Lib::endl;
-    return 1;
+    return EXIT_FAILURE;
   } else if(!Lib::dirmanip::mkcd("snovis")) {
     out << "snovis_session : can't mkcd snovis." << Lib::endl;
-    return 1;
+    return EXIT_FAILURE;
   } else if(!Lib::dirmanip::mkcd("session")) {
     out << "snovis_session : can't mkcd session." << Lib::endl;
-    return 1;
+    return EXIT_FAILURE;
   } else {
-    std::string fs = Lib::System::fileSeparator();
-    std::string from = SNOVISROOT+fs+"scripts"+fs+"snova";
-    if(!Lib::fmanip::copy(from+fs+"snova.par",".")) {
-      out << "snovis_session : can't copy snova.par." << Lib::endl;
-      return 1;
-    } else if(!Lib::fmanip::copy(from+fs+"snemo.geom",".")) {
-      out << "snovis_session : can't copy snemo.geom." << Lib::endl;
-      return 1;
-    } else if(!Lib::fmanip::copy(from+fs+"example_Mo100.txt",".")) {
-      out << "snovis_session : can't copy example_Mo100.txt." << Lib::endl;
-      return 1;
+    // If there is a snova.par file found under 
+    //    $HOME/snovis/session :
+    // we take it, else we start with $SNOVISROOT/scripts/snova/snova.par
+    if(Lib::fmanip::exists("snova.par")) {
+      params = "snova.par";
     } else {
-      //std::string pwd;
-      //Lib::dirmanip::directory(pwd);
-      //out << pwd << Lib::endl;
+      params = "$SNOVISROOT/scripts/snova/snova.par";
     }
   }
@@ -103,57 +98,51 @@
   int error_code=EXIT_SUCCESS;
   try {
-
-    std::cout << "Hello, this is a sample program for class 'snova_mgr'!" << std::endl; 
+    //std::cerr << "snovis_session : startup" << std::endl; 
+    std::cerr << "snovis_session : startup : 000" << std::endl; 
   
-    bool        debug           = false;
-    std::string params_filename = snova::constants::DEF_PARAMS_FILENAME;
-    //std::string params_filename = SNOVISROOT+"/scripts/snova.par";
-    //G4String geom_filename = SNOVISROOT+"/scripts/snemo.geom";
-    std::string G4_macro        = "";
-    bool        visual_mode     = false;
-    
     // A snova manager:
     snovis::mgr my_snova_mgr;
 
     // Configure some properties of the snova manager:
-    my_snova_mgr.set_debug(debug);                     // debug verbosity
-    my_snova_mgr.set_params_filename(params_filename); // the main simulation configuration file
-    my_snova_mgr.set_G4_macro(G4_macro);               // run G4 macro
+    my_snova_mgr.set_debug(false);
+    my_snova_mgr.set_params_filename(params);
+    //my_snova_mgr.set_G4_macro(G4_macro);
 
     // Use a dedicated vertex generator factory:
     snemo::base_VG_factory my_VG_factory;
-    my_VG_factory.add("CALO_basic",    snemo::CALO_basic_VG::new_CALO_basic_VG );
-    my_VG_factory.add("source_simple", snemo::source_simple_VG::new_source_simple_VG );
+    my_VG_factory.add("CALO_basic",
+                      snemo::CALO_basic_VG::new_CALO_basic_VG );
+    my_VG_factory.add("source_simple",
+                      snemo::source_simple_VG::new_source_simple_VG);
     // <here you may add more functors in the factory internal map... >
-    //my_VG_factory.add("TC_nblocks", snemo::TC_nblocks_VG::new_TC_nblocks_VG ); // NOT AVAILABLE YET!
+    // NOT AVAILABLE YET!
+    //my_VG_factory.add("TC_nblocks",
+    //                  snemo::TC_nblocks_VG::new_TC_nblocks_VG );
 
     my_VG_factory.init();
-    if( debug ) my_VG_factory.dump(std::cerr);
+    //if( debug ) my_VG_factory.dump(std::cerr);
     my_snova_mgr.set_VG_factory(my_VG_factory);
 
     // Build the guts of the simulation process within the snova manager:
-    std::cerr << "prog_snova2: debug: " 
-	      << "Build the guts" << std::endl; 
-    my_snova_mgr.init(); // from this point 'set_XXXX' methods failed (manager is locked!)
+    //std::cerr << "snovis_session :" 
+    //          << " mgr.init..." << std::endl; 
+    my_snova_mgr.init();
 
     // Run the simulation:
-    std::cerr << "prog_snova2: debug: " 
-	      << "Run the simulation" << std::endl; 
     my_snova_mgr.run_sim(argc,argv,is_Mac_app?"Qt":"");
 
-    // Clean the snova manager
-    std::cerr << "prog_snova2: debug: " 
-	      << "Clean the snova manager" << std::endl; 
+    //std::cerr << "snovis_session :" 
+    //          << " mgr.reset..." << std::endl; 
     my_snova_mgr.reset(); // not mandatory for we do it in the d-tor.
 
-    std::cerr << "prog_snova2: debug: " 
-	      << "Done" << std::endl; 
+    //std::cerr << "snovis_session :" 
+    //          << " end." << std::endl; 
   }
   catch(std::exception & x){
-    std::cerr << "prog_snova2: error: " << x.what() << std::endl; 
+    std::cerr << "snovis_session : error : " << x.what() << std::endl; 
     error_code=EXIT_FAILURE;
   }
   catch(...){
-    std::cerr << "prog_snova2: error: " << "unexpected error!" << std::endl; 
+    std::cerr << "snovis_session : error : unexpected error!" << std::endl; 
     error_code=EXIT_FAILURE;
   }
