Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nanobeam.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
Include dependency graph for nanobeam.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 43 of file nanobeam.cc.

43  {
44 
45  // Choose the Random engine
46 
47  G4Random::setTheEngine(new CLHEP::RanecuEngine);
48 
49  // Construct the default run manager
50 
51 #ifdef G4MULTITHREADED
52  G4MTRunManager* runManager = new G4MTRunManager;
53 
54  // By default, only one thread for aberration coefficient calculation ("coef*" macros)
55  //
56  // For high statistics (no aberration coefficient calculation, "image*" & "grid*" macros),
57  // switch to more threads
58 
59  runManager->SetNumberOfThreads(1);
60  //runManager->SetNumberOfThreads(2);
61 
62 #else
63  G4RunManager* runManager = new G4RunManager;
64 #endif
65 
66 
67  //
68  // Set mandatory initialization classes
69 
71 
72  runManager->SetUserInitialization(detector);
73 
74  runManager->SetUserInitialization(new PhysicsList);
75 
76  // User action initialization
77 
78  runManager->SetUserInitialization(new ActionInitialization(detector));
79 
80  // Initialize G4 kernel
81 
82  runManager->Initialize();
83 
84  // Get the pointer to the User Interface manager
85 
86  G4UImanager* UImanager = G4UImanager::GetUIpointer();
87 
88  if (argc==1) // Define UI session for interactive mode.
89  {
90 #ifdef _WIN32
92 #else
93  G4UIsession * session = new G4UIterminal(new G4UItcsh);
94 #endif
95  UImanager->ApplyCommand("/control/execute default.mac");
96  session->SessionStart();
97  delete session;
98  }
99  else // Batch mode
100  {
101  G4String command = "/control/execute ";
102  G4String fileName = argv[1];
103  UImanager->ApplyCommand(command+fileName);
104  }
105 
106  //
107 
108  delete runManager;
109 
110  return 0;
111 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:46
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
static G4UIterminal * session
virtual void Initialize()
Detector construction class to define materials and geometry.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
Physics list class.
Definition: PhysicsList.hh:47

Here is the call graph for this function: