64 #ifdef G4MULTITHREADED 65 #include "G4MTRunManager.hh" 67 #include "G4RunManager.hh" 68 #endif // G4MULTITHREADED 70 #include "G4UImanager.hh" 71 #include "QGSP_BIC_HP.hh" 72 #include "Randomize.hh" 74 #include "FFDetectorConstruction.hh" 75 #include "FFActionInitialization.hh" 77 #include "G4VisExecutive.hh" 78 #include "G4UIExecutive.hh" 83 int main(
int argc,
char* argv[])
86 unsigned int numberOfThreads = 1;
89 G4String outputFileName =
"FF_Neutron_HP.out";
90 G4UImanager* UIManager = NULL;
92 char makeFissionFragments[] =
"G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS";
93 char useWendtFission[] =
"G4NEUTRON_HP_USE_WENDT_FISSION_MODEL";
95 char Force[] =
"G4FORCENUMBEROFTHREADS";
96 if(std::getenv(Force) != NULL) {
97 char doNotForce[]=
"G4FORCENUMBEROFTHREADS=1";
102 G4cout <<
"#### Starting: " << argv[0] <<
" ####" << G4endl;
106 if(std::getenv(makeFissionFragments) == NULL)
108 G4cerr << G4endl <<
"!!!!" << G4endl;
109 G4cerr <<
"!!!! Error in example" << argv[0] << G4endl;
110 G4cerr <<
"!!!! The \"" << makeFissionFragments <<
"\" " 111 "environment variable is not set!" << G4endl;
112 G4cerr <<
"!!!! Please set it in order to use this example." << G4endl;
113 G4cerr <<
"!!!!" << G4endl << G4endl;
120 if(std::getenv(useWendtFission) == NULL)
122 G4cout << G4endl <<
"!!!!" << G4endl;
123 G4cout <<
"!!!! Warning in example" << argv[0] << G4endl;
124 G4cout <<
"!!!! The \"" << useWendtFission <<
"\" " 125 "environment variable is not set!" << G4endl;
126 G4cout <<
"!!!! Please set it if you wish to use this fission model, " 127 "otherwise the default fission model will be used" << G4endl;
128 G4cout <<
"!!!!" << G4endl << G4endl;
137 if(argv[i][0] !=
'-')
139 G4cerr << G4endl <<
"!!!!" << G4endl;
140 G4cerr <<
"!!!! Error in argument " << i + 1 << G4endl;
141 G4cerr <<
"!!!! A command-line option was expected, but \"" 142 << argv[i] <<
"\" was found" << G4endl;
143 G4cerr <<
"!!!! " << argv[0] <<
" will now terminate" << G4endl;
144 G4cerr <<
"!!!!" << G4endl << G4endl;
152 G4cerr << G4endl <<
"!!!!" << G4endl;
153 G4cerr <<
"!!!! Error in argument " << i + 2 << G4endl;
154 G4cerr <<
"!!!! An argument was expected, but \"" << argv[i + 1]
155 <<
"\" was found" << G4endl;
156 G4cerr <<
"!!!! Ensure that a space is used to separate the " 157 "option and argument" << G4endl;
158 G4cerr <<
"!!!! " << argv[0] <<
" will now terminate" << G4endl;
159 G4cerr <<
"!!!!" << G4endl << G4endl;
167 scriptFileName =
"/control/execute ";
168 scriptFileName.append(argv[i + 1]);
172 outputFileName = argv[i + 1];
176 result = sscanf(argv[i + 1],
181 G4cerr << G4endl <<
"!!!!" << G4endl;
182 G4cerr <<
"!!!! Error in argument " << i + 2 << G4endl;
183 G4cerr <<
"!!!! An positive number was expected, but \"" 184 << argv[i + 1] <<
"\" was found" << G4endl;
185 G4cerr <<
"!!!! " << argv[0] <<
" will now terminate" 187 G4cerr <<
"!!!!" << G4endl << G4endl;
194 G4cout << G4endl <<
"!!!!" << G4endl;
195 G4cout <<
"!!!! Warning for command " << i + 1 << G4endl;
196 G4cout <<
"!!!! \"" << argv[i] <<
"\" is not a valid command" 198 G4cout <<
"!!!! " << argv[0] <<
" will ignore \"" << argv[i]
199 <<
"\" and \"" << argv[i + 1] <<
"\"" << G4endl;
200 G4cout <<
"!!!!" << G4endl << G4endl;
205 G4UIExecutive* ui =
nullptr;
206 if (scriptFileName.length() == 0) {
207 ui =
new G4UIExecutive(argc, argv);
213 const G4long
seed = 62737819;
215 G4cout <<
"MT RNG Seed: " << seed << G4endl;
217 G4Random::setTheEngine(
new CLHEP::MTwistEngine(seed));
221 #ifdef G4MULTITHREADED 223 G4MTRunManager*
const runManager =
new G4MTRunManager();
224 runManager->SetNumberOfThreads(numberOfThreads);
226 G4cout <<
"Multithreading enabled" << G4endl;
227 G4cout <<
" Threads requested: " << numberOfThreads << G4endl;
228 G4cout <<
" Threads started: " << runManager->GetNumberOfThreads()
232 G4RunManager*
const runManager =
new G4RunManager();
233 #endif // G4MULTITHREADED 236 runManager->SetUserInitialization(
new FFDetectorConstruction());
237 runManager->SetUserInitialization(
new QGSP_BIC_HP());
238 runManager->SetUserInitialization(
new FFActionInitialization());
241 runManager->Initialize();
244 G4VisManager* visManager =
new G4VisExecutive();
245 visManager->Initialize();
248 UIManager = G4UImanager::GetUIpointer();
253 UIManager->ApplyCommand(scriptFileName);
int main(int argc, char *argv[])