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