Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FissionFragment.cc File Reference

Main program of the FissionFragment example. More...

#include "globals.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "QGSP_BIC_HP.hh"
#include "Randomize.hh"
#include "FFDetectorConstruction.hh"
#include "FFActionInitialization.hh"
Include dependency graph for FissionFragment.cc:

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

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

Definition at line 88 of file FissionFragment.cc.

89 {
90  int result;
91  unsigned int numberOfThreads = 1;
92 
93  G4String scriptFileName = "";
94  G4String outputFileName = "FF_Neutron_HP.out";
95  G4UImanager* UIManager = NULL;
96 
97  char makeFissionFragments[] = "G4NEUTRONHP_PRODUCE_FISSION_FRAGMENTS";
98  char useWendtFission[] = "G4NEUTRON_HP_USE_WENDT_FISSION_MODEL";
99 
100  char Force[] = "G4FORCENUMBEROFTHREADS";
101  if(getenv(Force) != NULL) {
102  char doNotForce[]="G4FORCENUMBEROFTHREADS=1";
103  putenv(doNotForce);
104  }
105 
106  // Indicate the example is starting
107  G4cout << "#### Starting: " << argv[0] << " ####" << G4endl;
108 
109  // Verify that NeutronHP is going to create fission fragments
110  // Throw and error if it isn't.
111  if(getenv(makeFissionFragments) == NULL)
112  {
113  G4cerr << G4endl << "!!!!" << G4endl;
114  G4cerr << "!!!! Error in example" << argv[0] << G4endl;
115  G4cerr << "!!!! The \"" << makeFissionFragments << "\" "
116  "environment variable is not set!" << G4endl;
117  G4cerr << "!!!! Please set it in order to use this example." << G4endl;
118  G4cerr << "!!!!" << G4endl << G4endl;
119 
120  return EXIT_FAILURE;
121  }
122 
123  // We are trying to use the Wendt fission model in Neutron_HP
124  // Warn the user if the appropriate environment variable is not set up
125  if(getenv(useWendtFission) == NULL)
126  {
127  G4cout << G4endl << "!!!!" << G4endl;
128  G4cout << "!!!! Warning in example" << argv[0] << G4endl;
129  G4cout << "!!!! The \"" << useWendtFission << "\" "
130  "environment variable is not set!" << G4endl;
131  G4cout << "!!!! Please set it if you wish to use this fission model, "
132  "otherwise the default fission model will be used" << G4endl;
133  G4cout << "!!!!" << G4endl << G4endl;
134  }
135 
136  // Parse the command line arguments, if any
137  for(int i = 1;
138  i < argc;
139  i += 2)
140  {
141  // Ensure that this is actually a command
142  if(argv[i][0] != '-')
143  {
144  G4cerr << G4endl << "!!!!" << G4endl;
145  G4cerr << "!!!! Error in argument " << i + 1 << G4endl;
146  G4cerr << "!!!! A command-line option was expected, but \""
147  << argv[i] << "\" was found" << G4endl;
148  G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
149  G4cerr << "!!!!" << G4endl << G4endl;
150 
151  return EXIT_FAILURE;
152  }
153 
154  // Ensure that the command-line option has an associated argument
155  if(!(i + 1 < argc))
156  {
157  G4cerr << G4endl << "!!!!" << G4endl;
158  G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
159  G4cerr << "!!!! An argument was expected, but \"" << argv[i + 1]
160  << "\" was found" << G4endl;
161  G4cerr << "!!!! Ensure that a space is used to separate the "
162  "option and argument" << G4endl;
163  G4cerr << "!!!! " << argv[0] << " will now terminate" << G4endl;
164  G4cerr << "!!!!" << G4endl << G4endl;
165 
166  return EXIT_FAILURE;
167  }
168 
169  switch(argv[i][1])
170  {
171  case 'i':
172  scriptFileName = "/control/execute ";
173  scriptFileName.append(argv[i + 1]);
174  break;
175 
176  case 'o':
177  outputFileName = argv[i + 1];
178  break;
179 
180  case 'n':
181  result = sscanf(argv[i + 1],
182  "%u",
183  &numberOfThreads);
184  if(result != 1)
185  {
186  G4cerr << G4endl << "!!!!" << G4endl;
187  G4cerr << "!!!! Error in argument " << i + 2 << G4endl;
188  G4cerr << "!!!! An positive number was expected, but \""
189  << argv[i + 1] << "\" was found" << G4endl;
190  G4cerr << "!!!! " << argv[0] << " will now terminate"
191  << G4endl;
192  G4cerr << "!!!!" << G4endl << G4endl;
193 
194  return EXIT_FAILURE;
195  }
196  break;
197 
198  default:
199  G4cout << G4endl << "!!!!" << G4endl;
200  G4cout << "!!!! Warning for command " << i + 1 << G4endl;
201  G4cout << "!!!! \"" << argv[i] << "\" is not a valid command"
202  << G4endl;
203  G4cout << "!!!! " << argv[0] << " will ignore \"" << argv[i]
204  << "\" and \"" << argv[i + 1] << "\"" << G4endl;
205  G4cout << "!!!!" << G4endl << G4endl;
206  }
207  }
208 
209  // Set the Random engine
210  // A seed of 62737819 produced a maximum number of 67 events on the
211  // author's system before timing out the nightly test
212  const G4long seed = 62737819;
213 #ifndef NDEBUG
214  G4cout << "MT RNG Seed: " << seed << G4endl;
215 #endif // NDEBUG
216  G4Random::setTheEngine(new CLHEP::MTwistEngine(seed));
217 
218 // The 'runManger' type must be declared here at initialization to provide for
219 // 'SetNumberOfThreads()' method required for multithreading
220 #ifdef G4MULTITHREADED
221  // Initialize the multithreaded run manager
222  G4MTRunManager* const runManager = new G4MTRunManager();
223  runManager->SetNumberOfThreads(numberOfThreads);
224 
225  G4cout << "Multithreading enabled" << G4endl;
226  G4cout << " Threads requested: " << numberOfThreads << G4endl;
227  G4cout << " Threads started: " << runManager->GetNumberOfThreads()
228  << G4endl;
229 #else
230  // Multithreading not available
231  G4RunManager* const runManager = new G4RunManager();
232 #endif // G4MULTITHREADED
233 
234  // Set mandatory initialization classes
236  runManager->SetUserInitialization(new QGSP_BIC_HP());
238 
239  // Initialize the Geant4 kernel
240  runManager->Initialize();
241 
242 #ifdef G4VIS_USE
243  // Initialize visualization
244  G4VisManager* visManager = new G4VisExecutive();
245  visManager->Initialize();
246 #endif
247 
248  // Get the pointer to the User Interface manager
249  UIManager = G4UImanager::GetUIpointer();
250 
251  if(scriptFileName.length() != 0)
252  {
253  // Batch mode
254  UIManager->ApplyCommand(scriptFileName);
255  } else
256  {
257  // Interactive mode
258 #ifdef G4UI_USE
259  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
260  ui->SessionStart();
261  delete ui;
262 #endif
263  }
264 
265  // Job termination
266  // Free the store: user actions, physics_list and detector_description are
267  // owned and deleted by the run manager, so they should not be deleted
268  // in the main() program !
269 #ifdef G4VIS_USE
270  delete visManager;
271 #endif
272  delete runManager;
273 
274  return 0;
275 }
G4double G4ParticleHPJENDLHEData::G4double result
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
TQGSP_BIC_HP< G4VModularPhysicsList > QGSP_BIC_HP
Definition: QGSP_BIC_HP.hh:63
void SetNumberOfThreads(G4int n)
long G4long
Definition: G4Types.hh:80
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4GLOB_DLL std::ostream G4cout
long seed
Definition: chem4.cc:68
G4int GetNumberOfThreads() const
void Initialize()
G4String & append(const G4String &)
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function: