File indexing completed on 2026-08-01 08:26:47
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
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065 #include "FFActionInitialization.hh"
0066 #include "FFDetectorConstruction.hh"
0067 #include "QGSP_BIC_HP.hh"
0068
0069 #include "G4ParticleHPManager.hh"
0070 #include "G4RunManagerFactory.hh"
0071 #include "G4UIExecutive.hh"
0072 #include "G4UImanager.hh"
0073 #include "G4VisExecutive.hh"
0074 #include "Randomize.hh"
0075 #include "globals.hh"
0076
0077
0078
0079 int main(int argc, char* argv[])
0080 {
0081 int result;
0082 unsigned int numberOfThreads = 1;
0083
0084 G4String scriptFileName = "";
0085 G4String outputFileName = "FF_Neutron_HP.out";
0086 G4UImanager* UIManager = NULL;
0087
0088
0089 G4ParticleHPManager::GetInstance()->SetProduceFissionFragments(true);
0090
0091 char Force[] = "G4FORCENUMBEROFTHREADS";
0092 if (std::getenv(Force) != NULL) {
0093 char doNotForce[] = "G4FORCENUMBEROFTHREADS=1";
0094 putenv(doNotForce);
0095 }
0096
0097
0098 G4cout << "#### Starting: " << argv[0] << " ####" << G4endl;
0099
0100
0101 for (int i = 1; i < argc; i += 2) {
0102
0103 if (argv[i][0] != '-') {
0104 G4cerr << G4endl << "!!!!" << G4endl;
0105 G4cerr << "!!!! Error in argument " << i + 1 << G4endl;
0106 G4cerr << "!!!! A command-line option was expected, but \"" << argv[i] << "\" was found"
0107 << G4endl;
0108 G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
0109 G4cerr << "!!!!" << G4endl << G4endl;
0110
0111 return EXIT_FAILURE;
0112 }
0113
0114
0115 if (!(i + 1 < argc)) {
0116 G4cerr << G4endl << "!!!!" << G4endl;
0117 G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
0118 G4cerr << "!!!! An argument was expected, but \"" << argv[i + 1] << "\" was found" << G4endl;
0119 G4cerr << "!!!! Ensure that a space is used to separate the "
0120 "option and argument"
0121 << G4endl;
0122 G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
0123 G4cerr << "!!!!" << G4endl << G4endl;
0124
0125 return EXIT_FAILURE;
0126 }
0127
0128 switch (argv[i][1]) {
0129 case 'i':
0130 scriptFileName = "/control/execute ";
0131 scriptFileName.append(argv[i + 1]);
0132 break;
0133
0134 case 'o':
0135 outputFileName = argv[i + 1];
0136 break;
0137
0138 case 'n':
0139 result = sscanf(argv[i + 1], "%u", &numberOfThreads);
0140 if (result != 1) {
0141 G4cerr << G4endl << "!!!!" << G4endl;
0142 G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
0143 G4cerr << "!!!! An positive number was expected, but \"" << argv[i + 1] << "\" was found"
0144 << G4endl;
0145 G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
0146 G4cerr << "!!!!" << G4endl << G4endl;
0147
0148 return EXIT_FAILURE;
0149 }
0150 break;
0151
0152 default:
0153 G4cout << G4endl << "!!!!" << G4endl;
0154 G4cout << "!!!! Warning for command " << i + 1 << G4endl;
0155 G4cout << "!!!! \"" << argv[i] << "\" is not a valid command" << G4endl;
0156 G4cout << "!!!! " << argv[0] << " will ignore \"" << argv[i] << "\" and \"" << argv[i + 1]
0157 << "\"" << G4endl;
0158 G4cout << "!!!!" << G4endl << G4endl;
0159 }
0160 }
0161
0162
0163 G4UIExecutive* ui = nullptr;
0164 if (scriptFileName.length() == 0) {
0165 ui = new G4UIExecutive(argc, argv);
0166 }
0167
0168
0169
0170
0171 const G4long seed = 62737819;
0172 #ifndef NDEBUG
0173 G4cout << "MT RNG Seed: " << seed << G4endl;
0174 #endif
0175 G4Random::setTheEngine(new CLHEP::MTwistEngine(seed));
0176
0177
0178 auto* runManager = G4RunManagerFactory::CreateRunManager();
0179 runManager->SetNumberOfThreads(numberOfThreads);
0180 G4cout << " Threads requested: " << numberOfThreads << G4endl;
0181 G4cout << " Threads started: " << runManager->GetNumberOfThreads() << G4endl;
0182
0183
0184 runManager->SetUserInitialization(new FFDetectorConstruction());
0185 runManager->SetUserInitialization(new QGSP_BIC_HP());
0186 runManager->SetUserInitialization(new FFActionInitialization());
0187
0188
0189 runManager->Initialize();
0190
0191
0192 G4VisManager* visManager = new G4VisExecutive();
0193 visManager->Initialize();
0194
0195
0196 UIManager = G4UImanager::GetUIpointer();
0197
0198 if (!ui) {
0199
0200 UIManager->ApplyCommand(scriptFileName);
0201 }
0202 else {
0203
0204 ui->SessionStart();
0205 delete ui;
0206 }
0207
0208
0209
0210
0211
0212 delete visManager;
0213 delete runManager;
0214
0215 return 0;
0216 }