Geant4.10
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
Ultra.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "UltraActionInitializer.hh"
#include "UltraDetectorConstruction.hh"
#include "UltraPhysicsList.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 61 of file Ultra.cc.

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

61  {
62 
63 //choose the Random engine from CLHEP
64 //(lets use C++ implementation of Jame's RANLUX generator)
65 
66  G4Random::setTheEngine(new CLHEP::RanluxEngine);
67 
68 #ifdef G4MULTITHREADED
69  G4MTRunManager* runManager = new G4MTRunManager;
70  //runManager->SetNumberOfThreads(2);
71 #else
72  G4RunManager* runManager = new G4RunManager;
73 #endif
74 
75  // UserInitialization classes - mandatory
77  UltraPhysicsList* list = new UltraPhysicsList();
78  runManager->SetUserInitialization(detector);
79  runManager->SetUserInitialization(list);
80 
81  // UserAction classes - optional
83 
84 #ifdef G4VIS_USE
85  // Visualization, if you choose to have it!
86  G4VisManager* visManager = new G4VisExecutive;
87  visManager->Initialize();
88 #endif
89 
90  //Initialize G4 kernel
91  runManager->Initialize();
92 
93  // Get the Pointer to the UI Manager
95 
96  // User interactions
97  // Define (G)UI for interactive mode
98  if(argc==1)
99  {
100 #ifdef G4UI_USE
101  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
102  ui->SessionStart();
103  delete ui;
104 #endif
105  }
106  else
107  // Batch mode
108  {
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UImanager->ApplyCommand(command+fileName);
112  }
113 
114 #ifdef G4VIS_USE
115  delete visManager;
116 #endif
117 
118  delete runManager;
119 
120  return 0;
121 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419