Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gammaknife.cc File Reference
Include dependency graph for gammaknife.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 77 of file gammaknife.cc.

78 {
79 
80  G4Random::setTheEngine(new CLHEP::RanecuEngine);
81  G4int seconds = time(NULL);
82  G4Random::setTheSeed(seconds);
83 
84 #ifdef G4MULTITHREADED
85  G4MTRunManager * runManager = new G4MTRunManager;
86 #else
87  G4RunManager * runManager = new G4RunManager;
88 #endif
89 
90  G4ScoringManager::GetScoringManager(); // This enables scoring
91 
92  // Initialize the geometry
94  runManager -> SetUserInitialization(detector);
95 
96  // Initialize the physics
97  G4PhysListFactory factory;
98  G4VModularPhysicsList* phys = 0;
99  G4String physName = "";
100 
101  // Physics List name defined via environment variable
102  char* path = getenv("PHYSLIST");
103  if (path) { physName = G4String(path); }
104 
105  if(physName != "" && factory.IsReferencePhysList(physName))
106  {
107  phys = factory.GetReferencePhysList(physName);
108  }
109 
110  if(!phys) { phys = new GammaKnifePhysicsList(); }
111 
112  runManager->SetUserInitialization(phys);
113 
114 
116  runManager->SetUserInitialization(actionInitialization);
117 
118  GammaKnifeController* controller = new GammaKnifeController( detector );
119  controller->ReadFile("MachineAngle.in"); // pre-load default
120 
121  // Initialize G4 kernel
122  //
123  runManager->Initialize();
124 
125 #ifdef G4VIS_USE
126  // Visualization manager
127  G4VisManager* visManager = new G4VisExecutive;
128  visManager -> Initialize();
129 #endif
130 
131  // Get the pointer to the User Interface manager
132  G4UImanager* UImanager = G4UImanager::GetUIpointer();
133 
134  if (argc!=1) {
135  // batch mode
136  G4String command = "/control/execute ";
137  G4String fileName = argv[1];
138  UImanager->ApplyCommand(command+fileName);
139  }
140  else {
141  // interactive mode : define UI session
142 #ifdef G4UI_USE
143  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
144 #ifdef G4VIS_USE
145  UImanager->ApplyCommand("/control/execute defaultMacro.mac");
146 #else
147  UImanager->ApplyCommand("/control/execute batch.mac");
148 #endif
149  ui->SessionStart();
150  delete ui;
151 #endif
152  }
153 
154  // Job termination
155 #ifdef G4VIS_USE
156  delete visManager;
157 #endif
158 
159  delete runManager;
160  delete controller;
161 
162  return 0;
163 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void ReadFile(std::string fileName)
void Initialize()
Definition: errprop.cc:101
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
G4bool IsReferencePhysList(const G4String &)
virtual void Initialize()
static G4ScoringManager * GetScoringManager()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: