Loading...
Searching...
No Matches
Functions
FissionFragment.cc File Reference

Main program of the FissionFragment example. More...

#include "globals.hh"
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "QGSP_BIC_HP.hh"
#include "Randomize.hh"
#include "FFDetectorConstruction.hh"
#include "FFActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "G4ParticleHPManager.hh"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Main program of the FissionFragment example.

Author
B. Wendt (bryce.nosp@m.n.li.nosp@m.nn.we.nosp@m.ndt@.nosp@m.cern..nosp@m.ch)
Date
June 06, 2014

Application demonstrating the Fission Fragment model as used within the neutron_hp model. It demostrates the capability for fission product containment by the cladding in a water moderated sub-critical assembly. It could also be further extended to calculate the effective multiplication factor of the subcritical assembly for various loading schemes.

Definition in file FissionFragment.cc.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 82 of file FissionFragment.cc.

83{
84 int result;
85 unsigned int numberOfThreads = 1;
86
87 G4String scriptFileName = "";
88 G4String outputFileName = "FF_Neutron_HP.out";
89 G4UImanager* UIManager = NULL;
90
91 // Activate production of fission fragments in neutronHP
92 G4ParticleHPManager::GetInstance()->SetProduceFissionFragments( true );
93
94 char Force[] = "G4FORCENUMBEROFTHREADS";
95 if(std::getenv(Force) != NULL) {
96 char doNotForce[]="G4FORCENUMBEROFTHREADS=1";
97 putenv(doNotForce);
98 }
99
100 // Indicate the example is starting
101 G4cout << "#### Starting: " << argv[0] << " ####" << G4endl;
102
103 // Parse the command line arguments, if any
104 for(int i = 1;
105 i < argc;
106 i += 2)
107 {
108 // Ensure that this is actually a command
109 if(argv[i][0] != '-')
110 {
111 G4cerr << G4endl << "!!!!" << G4endl;
112 G4cerr << "!!!! Error in argument " << i + 1 << G4endl;
113 G4cerr << "!!!! A command-line option was expected, but \""
114 << argv[i] << "\" was found" << G4endl;
115 G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
116 G4cerr << "!!!!" << G4endl << G4endl;
117
118 return EXIT_FAILURE;
119 }
120
121 // Ensure that the command-line option has an associated argument
122 if(!(i + 1 < argc))
123 {
124 G4cerr << G4endl << "!!!!" << G4endl;
125 G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
126 G4cerr << "!!!! An argument was expected, but \"" << argv[i + 1]
127 << "\" was found" << G4endl;
128 G4cerr << "!!!! Ensure that a space is used to separate the "
129 "option and argument" << G4endl;
130 G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
131 G4cerr << "!!!!" << G4endl << G4endl;
132
133 return EXIT_FAILURE;
134 }
135
136 switch(argv[i][1])
137 {
138 case 'i':
139 scriptFileName = "/control/execute ";
140 scriptFileName.append(argv[i + 1]);
141 break;
142
143 case 'o':
144 outputFileName = argv[i + 1];
145 break;
146
147 case 'n':
148 result = sscanf(argv[i + 1],
149 "%u",
150 &numberOfThreads);
151 if(result != 1)
152 {
153 G4cerr << G4endl << "!!!!" << G4endl;
154 G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
155 G4cerr << "!!!! An positive number was expected, but \""
156 << argv[i + 1] << "\" was found" << G4endl;
157 G4cerr << "!!!! " << argv[0] << " will now terminate"
158 << G4endl;
159 G4cerr << "!!!!" << G4endl << G4endl;
160
161 return EXIT_FAILURE;
162 }
163 break;
164
165 default:
166 G4cout << G4endl << "!!!!" << G4endl;
167 G4cout << "!!!! Warning for command " << i + 1 << G4endl;
168 G4cout << "!!!! \"" << argv[i] << "\" is not a valid command"
169 << G4endl;
170 G4cout << "!!!! " << argv[0] << " will ignore \"" << argv[i]
171 << "\" and \"" << argv[i + 1] << "\"" << G4endl;
172 G4cout << "!!!!" << G4endl << G4endl;
173 }
174 }
175
176 // Instantiate G4UIExecutive if interactive mode
177 G4UIExecutive* ui = nullptr;
178 if (scriptFileName.length() == 0) {
179 ui = new G4UIExecutive(argc, argv);
180 }
181
182 // Set the Random engine
183 // A seed of 62737819 produced a maximum number of 67 events on the
184 // author's system before timing out the nightly test
185 const G4long seed = 62737819;
186#ifndef NDEBUG
187 G4cout << "MT RNG Seed: " << seed << G4endl;
188#endif // NDEBUG
189 G4Random::setTheEngine(new CLHEP::MTwistEngine(seed));
190
191 // Initialize the multithreaded run manager
192 auto* runManager = G4RunManagerFactory::CreateRunManager();
193 runManager->SetNumberOfThreads(numberOfThreads);
194 G4cout << " Threads requested: " << numberOfThreads << G4endl;
195 G4cout << " Threads started: " << runManager->GetNumberOfThreads() << G4endl;
196
197 // Set mandatory initialization classes
198 runManager->SetUserInitialization(new FFDetectorConstruction());
199 runManager->SetUserInitialization(new QGSP_BIC_HP());
200 runManager->SetUserInitialization(new FFActionInitialization());
201
202 // Initialize the Geant4 kernel
203 runManager->Initialize();
204
205 // Initialize visualization
206 G4VisManager* visManager = new G4VisExecutive();
207 visManager->Initialize();
208
209 // Get the pointer to the User Interface manager
210 UIManager = G4UImanager::GetUIpointer();
211
212 if(!ui)
213 {
214 // Batch mode
215 UIManager->ApplyCommand(scriptFileName);
216 } else
217 {
218 // Interactive mode
219 ui->SessionStart();
220 delete ui;
221 }
222
223 // Job termination
224 // Free the store: user actions, physics_list and detector_description are
225 // owned and deleted by the run manager, so they should not be deleted
226 // in the main() program !
227 delete visManager;
228 delete runManager;
229
230 return 0;
231}

Applications | User Support | Publications | Collaboration