Geant4.10
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
microelectronics.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 52 of file microelectronics.cc.

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

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