File indexing completed on 2025-02-23 09:22:08
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 #include "ActionInitialization.hh"
0030 #include "DetectorConstruction.hh"
0031 #include "PhysicsList.hh"
0032
0033 #ifdef G4MULTITHREADED
0034 # include "G4MTRunManager.hh"
0035 #else
0036 # include "G4RunManager.hh"
0037 #endif
0038 #include "G4UIExecutive.hh"
0039 #include "G4UImanager.hh"
0040 #include "G4VisExecutive.hh"
0041
0042 using namespace scavenger;
0043
0044
0045
0046 int main(int argc, char** argv)
0047 {
0048 G4UIExecutive* pUi = nullptr;
0049 if (argc == 1) {
0050 pUi = new G4UIExecutive(argc, argv);
0051 }
0052
0053 if (argc > 2) {
0054 G4int change_seed(0);
0055 change_seed = std::stoi(argv[2]);
0056 long enterseed = change_seed;
0057 G4Random::setTheSeed(enterseed);
0058 G4Random::showEngineStatus();
0059 G4cout << "Used seed : " << change_seed << G4endl;
0060 }
0061
0062 #ifdef G4MULTITHREADED
0063 std::unique_ptr<G4MTRunManager> pRunManager(new G4MTRunManager);
0064 pRunManager->SetNumberOfThreads(2);
0065 #else
0066 std::unique_ptr<G4RunManager> pRunManager(new G4RunManager);
0067 #endif
0068
0069
0070 pRunManager->SetUserInitialization(new PhysicsList());
0071 pRunManager->SetUserInitialization(new DetectorConstruction());
0072 pRunManager->SetUserInitialization(new ActionInitialization());
0073
0074
0075 std::unique_ptr<G4VisManager> pVisuManager(new G4VisExecutive);
0076 pVisuManager->Initialize();
0077
0078
0079 auto pUImanager = G4UImanager::GetUIpointer();
0080
0081
0082 if (pUi == nullptr) {
0083
0084 pUImanager->ApplyCommand("/control/macroPath ../");
0085 G4String command = "/control/execute ";
0086 G4String fileName = argv[1];
0087 pUImanager->ApplyCommand(command + fileName);
0088 }
0089 else {
0090
0091 pUImanager->ApplyCommand("/control/execute vis.mac");
0092 pUi->SessionStart();
0093 delete pUi;
0094 }
0095 return 0;
0096 }
0097
0098