Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
microbeam.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"

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 53 of file microbeam.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIsession::SessionStart(), and G4RunManager::SetUserInitialization().

53  {
54 
55  // Choose the Random engine
56 
57  G4Random::setTheEngine(new CLHEP::RanecuEngine);
58 
59  // Construct the default run manager
60 
61 #ifdef G4MULTITHREADED
62  G4MTRunManager* runManager = new G4MTRunManager;
63  // runManager->SetNumberOfThreads(2);
64 #else
65  G4RunManager* runManager = new G4RunManager;
66 #endif
67 
68  // Set mandatory user initialization classes
69 
71  runManager->SetUserInitialization(detector);
72 
73  runManager->SetUserInitialization(new PhysicsList);
74 
75  // User action initialization
76 
77  runManager->SetUserInitialization(new ActionInitialization(detector));
78 
79  // Initialize G4 kernel
80 
81  runManager->Initialize();
82 
83 #ifdef G4VIS_USE
84  G4VisManager* visManager = new G4VisExecutive;
85  visManager->Initialize();
86 #endif
87 
88  // Get the pointer to the User Interface manager
89 
90  G4UImanager* UImanager = G4UImanager::GetUIpointer();
91 
92  if (argc==1) // Define UI session for interactive mode.
93  {
94 #ifdef _WIN32
95  G4UIsession * session = new G4UIterminal();
96 #else
97  G4UIsession * session = new G4UIterminal(new G4UItcsh);
98 #endif
99  UImanager->ApplyCommand("/control/execute microbeam.mac");
100  session->SessionStart();
101  delete session;
102  }
103  else // Batch mode
104  {
105  G4String command = "/control/execute ";
106  G4String fileName = argv[1];
107  UImanager->ApplyCommand(command+fileName);
108  }
109 
110 #ifdef G4VIS_USE
111  delete visManager;
112 #endif
113  delete runManager;
114 
115  return 0;
116 
117 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419