jour3b.cc File Reference

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"

Include dependency graph for jour3b.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 28 of file jour3b.cc.

00028                                {
00029  
00030   //my Verbose output class
00031   G4VSteppingVerbose::SetInstance(new SteppingVerbose);
00032     
00033   //Construct the default run manager
00034   G4RunManager* runManager = new G4RunManager;
00035 
00036   //set mandatory initialization classes
00037   //
00038   DetectorConstruction* detector  = new DetectorConstruction();
00039   runManager->SetUserInitialization(detector);
00040     
00041   PhysicsList* physics            = new PhysicsList();
00042   runManager->SetUserInitialization(physics);
00043     
00044   PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
00045   runManager->SetUserAction(primary);
00046   
00047   //set user action classes
00048   //
00049   RunAction* run_action = new RunAction(detector);
00050   runManager->SetUserAction(run_action);
00051   //
00052   SteppingAction* step_action = new SteppingAction(detector, run_action);
00053   runManager->SetUserAction(step_action);  
00054 
00055   //Initialize Geant4 kernel
00056   //
00057   runManager->Initialize();
00058 
00059   //get the pointer to the User Interface manager 
00060   G4UImanager* UI = G4UImanager::GetUIpointer();  
00061 
00062   if (argc!=1) {        // Batch mode 
00063     G4String command = "/control/execute ";
00064     G4String fileName = argv[1];
00065     UI->ApplyCommand(command+fileName);
00066   }
00067   
00068   else {                // Define UI terminal for interactive mode
00069          
00070 #ifdef G4VIS_USE
00071     G4VisManager* visManager = new G4VisExecutive;
00072     visManager->Initialize();
00073 #endif
00074      
00075     G4UIsession* session = 0;
00076 #ifdef G4UI_USE_TCSH
00077     session = new G4UIterminal(new G4UItcsh);      
00078 #else
00079     session = new G4UIterminal();
00080 #endif
00081     UI->ApplyCommand( "/control/execute vis.mac");                      
00082     session->SessionStart();
00083     delete session;
00084     
00085 #ifdef G4VIS_USE
00086     delete visManager;
00087 #endif    
00088   }
00089 
00090  //job termination
00091  //
00092  delete runManager;
00093  return 0;
00094 }


Generated on Fri Nov 21 10:20:24 2008 for jour3b by  doxygen 1.5.7.1