Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
iort_therapy.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4PhysListFactory.hh"
#include "G4VModularPhysicsList.hh"
#include "IORTEventAction.hh"
#include "IORTPhysicsList.hh"
#include "IORTDetectorSD.hh"
#include "IORTPrimaryGeneratorAction.hh"
#include "IORTRunAction.hh"
#include "IORTMatrix.hh"
#include "Randomize.hh"
#include "G4UImessenger.hh"
#include "globals.hh"
#include "IORTSteppingAction.hh"
#include "IORTAnalysisManager.hh"
#include "IORTGeometryController.hh"
#include "IORTGeometryMessenger.hh"
#include "IORTInteractionParameters.hh"
#include "G4ScoringManager.hh"
#include <ctime>
Include dependency graph for iort_therapy.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 88 of file iort_therapy.cc.

89 {
90  // Set the Random engine
92 
93  //imported from eliot_geant4.9.3p01// to create a different seed
94  G4int seed = time(NULL);
96  //imported from eliot_geant4.9.3p01
97 
98  G4RunManager* runManager = new G4RunManager;
99  // Geometry controller is responsible for instantiating the
100  // geometries. All geometry specific setup tasks are now in class
101  // IORTGeometryController.
102  IORTGeometryController *geometryController = new IORTGeometryController();
103 
104  // Connect the geometry controller to the G4 user interface
105  IORTGeometryMessenger *geometryMessenger = new IORTGeometryMessenger(geometryController);
106 
108  scoringManager->SetVerboseLevel(1);
109 
110 
111  // Initialize the default IORT geometry
112  geometryController->SetGeometry("default");
113 
114  // Initialize command based scoring
116 
117  // Initialize the physics
118  G4PhysListFactory factory;
119  G4VModularPhysicsList* phys = 0;
120  G4String physName = "";
121 
122  // Physics List name defined via environment variable
123  char* path = getenv("PHYSLIST");
124  if (path) { physName = G4String(path); }
125 
126  if(factory.IsReferencePhysList(physName))
127  {
128  phys = factory.GetReferencePhysList(physName);
129  }
130 
131  if(!phys) { phys = new IORTPhysicsList(); }
132 
133  runManager->SetUserInitialization(phys);
134 
135  // runManager -> SetUserInitialization(new IORTPhysicsList());
136 
137  // Initialize the primary particles
138  IORTPrimaryGeneratorAction *pPrimaryGenerator = new IORTPrimaryGeneratorAction();
139  runManager -> SetUserAction(pPrimaryGenerator);
140 
141  // Optional UserActions: run, event, stepping
142  IORTRunAction* pRunAction = new IORTRunAction();
143  runManager -> SetUserAction(pRunAction);
144 
145  IORTEventAction* pEventAction = new IORTEventAction();
146  runManager -> SetUserAction(pEventAction);
147 
148  IORTSteppingAction* steppingAction = new IORTSteppingAction(pRunAction);
149  runManager -> SetUserAction(steppingAction);
150 
151  // Interaction data: stopping powers
152  IORTInteractionParameters* pInteraction = new IORTInteractionParameters(true);
153 
154  // Initialize analysis
156  analysis -> book();
157 
158 
159 #ifdef G4VIS_USE
160  // Visualization manager
161  G4VisManager* visManager = new G4VisExecutive;
162  visManager -> Initialize();
163 #endif
164 
165  G4UImanager* UImanager = G4UImanager::GetUIpointer();
166  if (argc!=1) // batch mode
167  {
168  G4String command = "/control/execute ";
169  G4String fileName = argv[1];
170  UImanager->ApplyCommand(command+fileName);
171  }
172  else
173  { // interactive mode : define UI session
174 
175 
176 #ifdef G4UI_USE
177  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
178 #ifdef G4VIS_USE
179  if(factory.IsReferencePhysList(physName))
180  {
181  UImanager->ApplyCommand("/control/execute defaultMacroWithReferencePhysicsList.mac");
182  }
183  else
184  {
185  UImanager->ApplyCommand("/control/execute defaultMacro.mac");
186  }
187 
188 #endif
189  if (ui->IsGUI())
190  ui->SessionStart();
191  delete ui;
192 #endif
193  }
194 
195  // Job termination
196  // Store dose & fluence data to ASCII & ROOT files
197  if ( IORTMatrix * pMatrix = IORTMatrix::GetInstance() )
198  {
199  pMatrix -> TotalEnergyDeposit();
200  pMatrix -> StoreDoseFluenceAscii();
201  pMatrix -> StoreDoseFluenceRoot();
202  }
203 
204 
205  analysis -> flush(); // Finalize & write the root file
206 
207 #ifdef G4VIS_USE
208  delete visManager;
209 #endif
210 
211 
212  delete geometryMessenger;
213  delete geometryController;
214  delete pInteraction;
215  delete runManager;
216  return 0;
217 
218 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void Initialize()
Definition: errprop.cc:101
int G4int
Definition: G4Types.hh:78
static void setTheSeed(long seed, int lux=3)
Definition: Random.cc:231
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4VModularPhysicsList * GetReferencePhysList(const G4String &)
G4bool IsReferencePhysList(const G4String &)
long seed
Definition: chem4.cc:68
static IORTAnalysisManager * GetInstance()
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:270
static IORTMatrix * GetInstance()
Definition: IORTMatrix.cc:61
static G4ScoringManager * GetScoringManager()
G4bool IsGUI() const
void SetVerboseLevel(G4int vl)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447

Here is the call graph for this function: