File indexing completed on 2026-09-21 08:30:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #include "G4PhysListFactory.hh"
0038 #include "G4RunManagerFactory.hh"
0039 #include "G4ScoringManager.hh"
0040 #include "G4Timer.hh"
0041 #include "G4UImanager.hh"
0042 #include "G4UImessenger.hh"
0043 #include "G4VModularPhysicsList.hh"
0044 #include "Randomize.hh"
0045 #include "globals.hh"
0046
0047 #include "ActionInitialization.hh"
0048 #include "DetectorConstruction.hh"
0049 #include "Dose.hh"
0050 #include "LET.hh"
0051 #include "Manager.hh"
0052 #include "PhysicsList.hh"
0053 #include "PrimaryGeneratorAction.hh"
0054 #include "RBE.hh"
0055 #include <time.h>
0056
0057
0058 #include "G4VisExecutive.hh"
0059
0060
0061
0062 #include "G4UIExecutive.hh"
0063
0064
0065 using namespace RadioBio;
0066
0067
0068 int main(int argc, char** argv)
0069 {
0070 G4UIExecutive* ui = nullptr;
0071 if (argc == 1) {
0072 ui = new G4UIExecutive(argc, argv);
0073 }
0074
0075
0076
0077 G4Timer* theTimer = new G4Timer();
0078
0079 theTimer->Start();
0080
0081
0082
0083
0084 CLHEP::RanluxEngine defaultEngine(1234567, 4);
0085 G4Random::setTheEngine(&defaultEngine);
0086 G4int seed = time(NULL);
0087 G4Random::setTheSeed(seed);
0088
0089
0090 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
0091
0092
0093 G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManager();
0094 scoringManager->SetVerboseLevel(1);
0095
0096
0097 G4VModularPhysicsList* phys = new PhysicsList();
0098
0099
0100 DetectorConstruction* det = new DetectorConstruction();
0101 runManager->SetUserInitialization(det);
0102
0103
0104 Manager* RBman = Manager::CreateInstance();
0105
0106
0107 Dose* dose = new Dose();
0108 RBman->Register(dose, "Dose");
0109
0110 LET* let = new LET();
0111 RBman->Register(let, "LET");
0112
0113 RBE* rbe = new RBE();
0114 RBman->Register(rbe, "RBE");
0115
0116
0117 runManager->SetUserInitialization(phys);
0118
0119
0120 runManager->SetUserInitialization(new ActionInitialization(det));
0121
0122
0123 G4ScoringManager::GetScoringManager();
0124
0125
0126
0127 G4VisManager* visManager = new G4VisExecutive;
0128 visManager->Initialize();
0129
0130
0131
0132 G4UImanager* UImanager = G4UImanager::GetUIpointer();
0133
0134 if (!ui) {
0135
0136 G4String command = "/control/execute ";
0137 G4String fileName = argv[1];
0138 UImanager->ApplyCommand(command + fileName);
0139 }
0140
0141 else {
0142
0143 UImanager->ApplyCommand("/control/execute macro/visualize.mac");
0144
0145 ui->SessionStart();
0146 delete ui;
0147 }
0148
0149
0150 RBman->StoreAll();
0151
0152
0153 theTimer->Stop();
0154
0155 G4cout << "The simulation took: " << theTimer->GetRealElapsed() << " s to run (real time)"
0156 << G4endl;
0157
0158 delete theTimer;
0159 delete runManager;
0160 }