Loading...
Searching...
No Matches
Functions
radiobiology.cc File Reference
#include "G4PhysListFactory.hh"
#include "G4RunManagerFactory.hh"
#include "G4ScoringManager.hh"
#include "G4Timer.hh"
#include "G4UImanager.hh"
#include "G4UImessenger.hh"
#include "G4VModularPhysicsList.hh"
#include "Randomize.hh"
#include "globals.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "Dose.hh"
#include "LET.hh"
#include "Manager.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RBE.hh"
#include <time.h>
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 66 of file radiobiology.cc.

67{
68 G4UIExecutive* ui = nullptr;
69 if (argc == 1) {
70 ui = new G4UIExecutive(argc, argv);
71 }
72
73 // Instantiate the G4Timer object, to monitor the CPU time spent for
74 // the entire execution
75 G4Timer* theTimer = new G4Timer();
76 // Start the benchmark
77 theTimer->Start();
78
79 // Set the Random engine
80 // The following guarantees random generation also for different runs
81 // in multithread
82 CLHEP::RanluxEngine defaultEngine(1234567, 4);
83 G4Random::setTheEngine(&defaultEngine);
84 G4int seed = time(NULL);
85 G4Random::setTheSeed(seed);
86
87 // Create the run manager. Uses by default serial or parallel computation.
88 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
89
90 // Create Scoring manager
91 G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManager();
92 scoringManager->SetVerboseLevel(1);
93
94 // Creating PhysicsList
96
97 // Set mandatory initialization classes
99 runManager->SetUserInitialization(det);
100
101 // Creation of Manager
103
104 // Create and Register Radiobiological quantities
105 Dose* dose = new Dose();
106 RBman->Register(dose, "Dose");
107
108 LET* let = new LET();
109 RBman->Register(let, "LET");
110
111 RBE* rbe = new RBE();
112 RBman->Register(rbe, "RBE");
113
114 // Initialisation of physics
115 runManager->SetUserInitialization(phys);
116
117 // Initialisation of the Actions
118 runManager->SetUserInitialization(new ActionInitialization(det));
119
120 // Initialize command based scoring
121 G4ScoringManager::GetScoringManager();
122
123 // Initialise the Visualisation
124 //#ifdef G4VIS_USE
125 G4VisManager* visManager = new G4VisExecutive;
126 visManager->Initialize();
127 //#endif
128
129 //** Get the pointer to the User Interface manager
130 G4UImanager* UImanager = G4UImanager::GetUIpointer();
131
132 if (!ui) {
133 // batch mode
134 G4String command = "/control/execute ";
135 G4String fileName = argv[1];
136 UImanager->ApplyCommand(command + fileName);
137 }
138
139 else {
140 // UImanager -> ApplyCommand("/control/execute macro/MacroPablo.mac");
141 UImanager->ApplyCommand("/control/execute macro/visualize.mac");
142
143 ui->SessionStart();
144 delete ui;
145 }
146
147 // Save data in RadioBioManager
148 RBman->StoreAll();
149
150 // Stop the benchmark here
151 theTimer->Stop();
152
153 G4cout << "The simulation took: " << theTimer->GetRealElapsed() << " s to run (real time)"
154 << G4endl;
155
156 delete theTimer;
157 delete runManager;
158}
Action initialization class.
Mandatory class for the construction of geometry.
bool Register(VRadiobiologicalQuantity *, G4String)
Definition Manager.cc:153
static Manager * CreateInstance()
Definition Manager.cc:49

Applications | User Support | Publications | Collaboration