33 #define INCLXX_IN_GEANT4_MODE 1
63 #if defined(HAS_BOOST_PROGRAM_OPTIONS) && !defined(INCLXX_IN_GEANT4_MODE)
65 runOptDesc(
"Run options"),
66 hiddenOptDesc(
"Hidden options"),
67 genericOptDesc(
"Generic options"),
68 physicsOptDesc(
"Physics options"),
73 const std::string suggestHelpMsg(
"You might want to run `INCLCascade --help' to get a help message.\n");
76 const std::string theNoneName =
"none";
77 #ifdef INCL_DEEXCITATION_SMM
78 const std::string theSMMName =
"SMM";
80 #ifdef INCL_DEEXCITATION_GEMINIXX
81 const std::string theGEMINIXXName =
"GEMINIXX";
83 #ifdef INCL_DEEXCITATION_ABLAXX
84 const std::string theABLAv3pName =
"ABLAv3p";
86 #ifdef INCL_DEEXCITATION_ABLA07
87 const std::string theABLA07Name =
"ABLA07";
91 std::string defaultDeExcitationModel = theNoneName;
92 #ifdef INCL_DEEXCITATION_SMM
93 defaultDeExcitationModel = theSMMName;
95 #ifdef INCL_DEEXCITATION_GEMINIXX
96 defaultDeExcitationModel = theGEMINIXXName;
98 #ifdef INCL_DEEXCITATION_ABLAXX
99 defaultDeExcitationModel = theABLAv3pName;
101 #ifdef INCL_DEEXCITATION_ABLA07
102 defaultDeExcitationModel = theABLA07Name;
105 const std::string listSeparator =
"\n \t";
107 listSeparator + theNoneName
108 #ifdef INCL_DEEXCITATION_ABLA07
109 + listSeparator + theABLA07Name
111 #ifdef INCL_DEEXCITATION_ABLAXX
112 + listSeparator + theABLAv3pName
114 #ifdef INCL_DEEXCITATION_GEMINIXX
115 + listSeparator + theGEMINIXXName
117 #ifdef INCL_DEEXCITATION_SMM
118 + listSeparator + theSMMName
124 if(defaultModelIndex!=std::string::npos) {
127 +
deExcitationModelList.substr(defaultModelIndex+defaultDeExcitationModel.size(), std::string::npos);
131 std::cout << std::boolalpha;
136 hiddenOptDesc.add_options()
137 (
"input-file", po::value<std::string>(&
inputFileName),
"input file")
138 (
"impact-parameter", po::value<G4double>(&
impactParameter)->default_value(-1.),
"impact parameter")
142 std::stringstream verbosityDescription;
143 verbosityDescription <<
"set verbosity level:\n"
144 <<
" 0: \tquiet, suppress all output messages\n"
145 <<
" " <<
InfoMsg <<
": \tminimal logging\n"
146 <<
" " <<
FatalMsg <<
": \tlog fatal error messages as well\n"
147 <<
" " <<
ErrorMsg <<
": \tlog error messages as well\n"
148 <<
" " <<
WarningMsg <<
": \tlog warning messages as well\n"
149 <<
" " <<
DebugMsg <<
": \tlog debug messages as well\n"
150 <<
" " <<
DataBlockMsg <<
": \tlog data-block messages as well";
152 genericOptDesc.add_options()
153 (
"help,h",
"produce this help message")
154 (
"version",
"print version string and exit")
158 std::stringstream randomSeed1Description, randomSeed2Description;
159 randomSeed1Description <<
"first seed for the random-number generator (between "
161 randomSeed2Description <<
"second seed for the random-number generator (between "
164 runOptDesc.add_options()
165 (
"title", po::value<std::string>(&
title)->default_value(
"INCL default run title"),
"run title")
166 (
"output,o", po::value<std::string>(&
outputFileRoot),
"root for generating output file names. File-specific suffixes (.root, .out, etc.) will be appended to this root. Defaults to the input file name, if given; otherwise, defaults to a string composed of the explicitly specified options and of a customisable suffix, if provided using the -s option")
167 (
"suffix,s", po::value<std::string>(&
fileSuffix),
"suffix to be appended to generated output file names")
168 (
"logfile,l", po::value<std::string>(&
logFileName),
"log file name. Defaults to `<output_root>.log'. Use `-' if you want to redirect logging to stdout")
169 (
"number-shots,N", po::value<G4int>(&
nShots),
"* number of shots")
170 (
"target,t", po::value<std::string>(&
targetString),
"* target nuclide. Can be specified as Fe56, 56Fe, Fe-56, 56-Fe, Fe_56, 56_Fe or Fe. If the mass number is omitted, natural target composition is assumed.")
171 (
"projectile,p", po::value<std::string>(&
projectileString),
"* projectile name:\n"
174 " \tpi+, piplus, pion+, pionplus\n"
175 " \tpi0, pizero, pion0, pionzero\n"
176 " \tpi-, piminus, pion-, pionminus\n"
177 " \td, t, a, deuteron, triton, alpha\n"
178 " \tHe-4, He4, 4He (and so on)")
179 (
"energy,E", po::value<G4double>(&
projectileKineticEnergy),
"* total kinetic energy of the projectile, in MeV")
180 (
"verbose-event", po::value<G4int>(&
verboseEvent)->default_value(-1),
"request verbose logging for the specified event only")
181 (
"random-seed-1", po::value<G4int>(&
randomSeed1)->default_value(666), randomSeed1Description.str().c_str())
182 (
"random-seed-2", po::value<G4int>(&
randomSeed2)->default_value(777), randomSeed2Description.str().c_str())
184 (
"root-selection", po::value<std::string>(&rootSelectionString)->default_value(
""),
"ROOT selection for abridged output ROOT tree. For example: \"A==1 && Z==0 && theta<3\" selects only events where a neutron is scattered in the forward direction.")
186 (
"inclxx-datafile-path", po::value<std::string>(&
INCLXXDataFilePath)->default_value(
"../data/"),
187 "path to the INCL++ data files")
188 #ifdef INCL_DEEXCITATION_ABLA07
189 (
"abla07-datafile-path", po::value<std::string>(&abla07DataFilePath)->default_value(
"../de-excitation/abla07/upstream/tables/"),
190 "path to the ABLA07 data files")
192 #ifdef INCL_DEEXCITATION_ABLAXX
193 (
"ablav3p-cxx-datafile-path", po::value<std::string>(&ablav3pCxxDataFilePath)->default_value(
"../de-excitation/ablaxx/data/G4ABLA3.0/"),
194 "path to the ABLAv3p data files")
196 #ifdef INCL_DEEXCITATION_GEMINIXX
197 (
"geminixx-datafile-path", po::value<std::string>(&geminixxDataFilePath)->default_value(
"../de-excitation/geminixx/upstream/"),
198 "path to the GEMINI++ data files")
200 (
"verbosity,v", po::value<G4int>(&
verbosity)->default_value(4), verbosityDescription.str().c_str())
204 physicsOptDesc.add_options()
206 #ifdef INCL_DEEXCITATION_FERMI_BREAKUP
207 (
"max-mass-fermi-breakup", po::value<G4int>(&maxMassFermiBreakUp)->default_value(18),
"Maximum remnant mass for Fermi break-up. Default: 18.")
209 (
"pauli", po::value<std::string>(&
pauliString)->default_value(
"strict-statistical"),
"Pauli-blocking algorithm:\n"
210 " \tstrict-statistical (default)\n"
215 (
"cdpp", po::value<G4bool>(&
CDPP)->default_value(
true),
"whether to apply CDPP after collisions:\n \ttrue, 1 (default)\n \tfalse, 0")
216 (
"coulomb", po::value<std::string>(&
coulombString)->default_value(
"non-relativistic"),
"Coulomb-distortion algorithm:\n \tnon-relativistic (default)\n \tnone")
217 (
"potential", po::value<std::string>(&
potentialString)->default_value(
"isospin-energy"),
"nucleon potential:\n \tisospin-energy-smooth\n \tisospin-energy (default)\n \tisospin\n \tconstant")
218 (
"pion-potential", po::value<G4bool>(&
pionPotential)->default_value(
"true"),
"whether to use a pion potential:\n \ttrue, 1 (default)\n \tfalse, 0")
219 (
"local-energy-BB", po::value<std::string>(&
localEnergyBBString)->default_value(
"first-collision"),
"local energy in baryon-baryon collisions:\n \talways\n \tfirst-collision (default)\n \tnever")
220 (
"local-energy-pi", po::value<std::string>(&
localEnergyPiString)->default_value(
"first-collision"),
"local energy in pi-N collisions and in delta decays:\n \talways\n \tfirst-collision (default)\n \tnever")
221 (
"cluster-algorithm", po::value<std::string>(&
clusterAlgorithmString)->default_value(
"intercomparison"),
"clustering algorithm for production of composites:\n \tintercomparison (default)\n \tnone")
222 (
"cluster-max-mass", po::value<G4int>(&
clusterMaxMass)->default_value(8),
"maximum mass of produced composites:\n \tminimum 2\n \tmaximum 12")
223 (
"back-to-spectator", po::value<G4bool>(&
backToSpectator)->default_value(
"true"),
"whether to use back-to-spectator:\n \ttrue, 1 (default)\n \tfalse, 0")
224 (
"use-real-masses", po::value<G4bool>(&
useRealMasses)->default_value(
"true"),
"whether to use real masses for the outgoing particle energies:\n \ttrue, 1 (default)\n \tfalse, 0")
225 (
"separation-energies", po::value<std::string>(&
separationEnergyString)->default_value(
"INCL"),
"how to assign the separation energies of the INCL nucleus:\n \tINCL (default)\n \treal\n \treal-light")
226 (
"fermi-momentum", po::value<std::string>(&
fermiMomentumString)->default_value(
"constant"),
"how to assign the Fermi momentum of the INCL nucleus:\n \tconstant (default)\n \tconstant-light\n \tmass-dependent\n \t[a positive value]")
227 (
"cutNN", po::value<G4double>(&
cutNN)->default_value(1910.),
"minimum CM energy for nucleon-nucleon collisions, in MeV. Default: 1910.")
228 (
"rp-correlation", po::value<G4double>(&
rpCorrelationCoefficient)->default_value(1.),
"correlation coefficient for the r-p correlation. Default: 1 (full correlation).")
229 (
"rp-correlation-p", po::value<G4double>(&
rpCorrelationCoefficientProton)->default_value(1.),
"correlation coefficient for the proton r-p correlation. Overrides the value specified using the rp-correlation option. Default: 1 (full correlation).")
230 (
"rp-correlation-n", po::value<G4double>(&
rpCorrelationCoefficientNeutron)->default_value(1.),
"correlation coefficient for the neutron r-p correlation. Overrides the value specified using the rp-correlation option. Default: 1 (full correlation).")
231 (
"neutron-skin-thickness", po::value<G4double>(&
neutronSkinThickness)->default_value(0.),
"thickness of the neutron skin, in fm. Default: 0.")
232 (
"neutron-skin-additional-diffuseness", po::value<G4double>(&
neutronSkinAdditionalDiffuseness)->default_value(0.),
"additional diffuseness of the neutron density distribution (with respect to the proton diffuseness), in fm. Default: 0.")
233 (
"refraction", po::value<G4bool>(&
refraction)->default_value(
false),
"whether to use refraction when particles are transmitted. Default: false.")
237 po::options_description cmdLineOptions;
238 cmdLineOptions.add(hiddenOptDesc).add(genericOptDesc).add(runOptDesc).add(physicsOptDesc);
241 po::options_description configFileOptions;
242 configFileOptions.add(runOptDesc).add(physicsOptDesc);
245 po::options_description visibleOptions;
246 visibleOptions.add(genericOptDesc).add(runOptDesc).add(physicsOptDesc);
251 po::positional_options_description p;
252 p.add(
"input-file", 1);
256 po::command_line_style::default_style &
257 ~po::command_line_style::allow_guessing;
260 po::store(po::command_line_parser(argc, argv).
262 options(cmdLineOptions).positional(p).run(), variablesMap);
263 po::notify(variablesMap);
267 if(variablesMap.count(
"input-file")) {
269 if(!inputFileStream) {
270 std::cerr <<
"Cannot open input file: " <<
inputFileName << std::endl;
271 std::exit(EXIT_FAILURE);
274 po::parsed_options parsedOptions = po::parse_config_file(inputFileStream, configFileOptions,
true);
277 std::vector<std::string> unhandledOptions =
278 po::collect_unrecognized(parsedOptions.options, po::exclude_positional);
279 G4bool ignoreNext =
false;
280 const std::string match =
"-datafile-path";
281 for(std::vector<std::string>::const_iterator i=unhandledOptions.begin(), e=unhandledOptions.end(); i!=e; ++i) {
286 if(i->rfind(match) == i->length()-match.length()) {
287 std::cout <<
"Ignoring unrecognized option " << *i << std::endl;
290 std::cerr <<
"Error: unrecognized option " << *i << std::endl;
291 std::cerr << suggestHelpMsg;
292 std::exit(EXIT_FAILURE);
297 po::store(parsedOptions, variablesMap);
298 po::notify(variablesMap);
300 inputFileStream.close();
304 std::string configFileName;
305 const char *
const configFileVar = getenv(
"INCLXXRC");
307 configFileName = configFileVar;
309 const char *
const homeDirectoryPointer = getenv(
"HOME");
310 if(homeDirectoryPointer) {
311 std::string homeDirectory(homeDirectoryPointer);
312 configFileName = homeDirectory +
"/.inclxxrc";
314 std::cerr <<
"Could not determine the user's home directory. "
315 <<
"Are you running Linux, Unix or BSD?"<< std::endl;
316 std::exit(EXIT_FAILURE);
320 std::ifstream configFileStream(configFileName.c_str());
321 std::cout <<
"Reading config file " << configFileName << std::endl;
322 if(!configFileStream) {
323 std::cout <<
"INCL++ config file " << configFileName
324 <<
" not found. Continuing the run regardless."
328 po::parsed_options parsedOptions = po::parse_config_file(configFileStream, configFileOptions,
true);
329 po::store(parsedOptions, variablesMap);
332 std::vector<std::string> unhandledOptions =
333 po::collect_unrecognized(parsedOptions.options, po::exclude_positional);
334 G4bool ignoreNext =
false;
335 const std::string match =
"-datafile-path";
336 for(std::vector<std::string>::const_iterator i=unhandledOptions.begin(), e=unhandledOptions.end(); i!=e; ++i) {
341 if(i->rfind(match) == i->length()-match.length()) {
342 std::cout <<
"Ignoring unrecognized option " << *i << std::endl;
345 std::cerr <<
"Error: unrecognized option " << *i << std::endl;
346 std::cerr << suggestHelpMsg;
347 std::exit(EXIT_FAILURE);
352 po::store(parsedOptions, variablesMap);
353 po::notify(variablesMap);
355 configFileStream.close();
362 if(variablesMap.count(
"help")) {
364 <<
"Usage: INCLCascade [options] <input_file>" << std::endl
365 << std::endl <<
"Options marked with a * are compulsory, i.e. they must be provided either on\nthe command line or in the input file." << std::endl
366 << visibleOptions << std::endl;
367 std::exit(EXIT_SUCCESS);
371 if(variablesMap.count(
"version")) {
373 std::exit(EXIT_SUCCESS);
378 std::string missingOption(
"");
379 if(!variablesMap.count(
"number-shots"))
380 missingOption =
"number-shots";
381 else if(!variablesMap.count(
"target"))
382 missingOption =
"target";
383 else if(!variablesMap.count(
"projectile"))
384 missingOption =
"projectile";
385 else if(!variablesMap.count(
"energy"))
386 missingOption =
"energy";
387 if(!missingOption.empty()) {
388 std::cerr <<
"Required option " << missingOption <<
" is missing." << std::endl;
389 std::cerr << suggestHelpMsg;
390 std::exit(EXIT_FAILURE);
393 std::cout <<
"Not performing a full run. This had better be a test..." << std::endl;
399 std::cerr <<
"Error: unrecognized particle type " <<
projectileString << std::endl;
400 std::cerr << suggestHelpMsg;
401 std::exit(EXIT_FAILURE);
405 if(variablesMap.count(
"target")) {
408 std::cerr <<
"Unrecognized target. You specified: " <<
targetString << std::endl
409 <<
" The target nuclide must be specified in one of the following forms:" << std::endl
410 <<
" Fe56, 56Fe, Fe-56, 56-Fe, Fe_56, 56_Fe, Fe" << std::endl
411 <<
" You can also use IUPAC element names (such as Uuh)." << std::endl;
412 std::cerr << suggestHelpMsg;
413 std::exit(EXIT_FAILURE);
420 if(variablesMap.count(
"pauli")) {
422 std::transform(pauliNorm.begin(), pauliNorm.end(), pauliNorm.begin(), ::tolower);
423 if(pauliNorm==
"statistical")
425 else if(pauliNorm==
"strict")
427 else if(pauliNorm==
"strict-statistical")
429 else if(pauliNorm==
"global")
431 else if(pauliNorm==
"none")
434 std::cerr <<
"Unrecognized Pauli-blocking algorithm. Must be one of:" << std::endl
435 <<
" strict-statistical (default)" << std::endl
436 <<
" strict" << std::endl
437 <<
" statistical" << std::endl
438 <<
" global" << std::endl
439 <<
" none" << std::endl;
440 std::cerr << suggestHelpMsg;
441 std::exit(EXIT_FAILURE);
446 if(variablesMap.count(
"coulomb")) {
448 std::transform(coulombNorm.begin(), coulombNorm.end(), coulombNorm.begin(), ::tolower);
449 if(coulombNorm==
"non-relativistic")
451 else if(coulombNorm==
"none")
454 std::cerr <<
"Unrecognized Coulomb-distortion algorithm. Must be one of:" << std::endl
455 <<
" non-relativistic (default)" << std::endl
456 <<
" none" << std::endl;
457 std::cerr << suggestHelpMsg;
458 std::exit(EXIT_FAILURE);
463 if(variablesMap.count(
"potential")) {
465 std::transform(potentialNorm.begin(), potentialNorm.end(), potentialNorm.begin(), ::tolower);
466 if(potentialNorm==
"isospin-energy-smooth") {
468 }
else if(potentialNorm==
"isospin-energy") {
470 }
else if(potentialNorm==
"isospin")
472 else if(potentialNorm==
"constant")
475 std::cerr <<
"Unrecognized potential type. Must be one of:" << std::endl
476 <<
" isospin-energy-smooth" << std::endl
477 <<
" isospin-energy (default)" << std::endl
478 <<
" isospin" << std::endl
479 <<
" constant" << std::endl;
480 std::cerr << suggestHelpMsg;
481 std::exit(EXIT_FAILURE);
486 if(variablesMap.count(
"local-energy-BB")) {
488 std::transform(localEnergyBBNorm.begin(), localEnergyBBNorm.end(), localEnergyBBNorm.begin(), ::tolower);
489 if(localEnergyBBNorm==
"always") {
491 }
else if(localEnergyBBNorm==
"first-collision")
493 else if(localEnergyBBNorm==
"never")
496 std::cerr <<
"Unrecognized local-energy-BB type. Must be one of:" << std::endl
497 <<
" always" << std::endl
498 <<
" first-collision (default)" << std::endl
499 <<
" never" << std::endl;
500 std::cerr << suggestHelpMsg;
501 std::exit(EXIT_FAILURE);
506 if(variablesMap.count(
"local-energy-pi")) {
508 std::transform(localEnergyPiNorm.begin(), localEnergyPiNorm.end(), localEnergyPiNorm.begin(), ::tolower);
509 if(localEnergyPiNorm==
"always") {
511 }
else if(localEnergyPiNorm==
"first-collision")
513 else if(localEnergyPiNorm==
"never")
516 std::cerr <<
"Unrecognized local-energy-pi type. Must be one of:" << std::endl
517 <<
" always" << std::endl
518 <<
" first-collision" << std::endl
519 <<
" never (default)" << std::endl;
520 std::cerr << suggestHelpMsg;
521 std::exit(EXIT_FAILURE);
526 if(variablesMap.count(
"de-excitation")) {
528 std::transform(deExcitationNorm.begin(),
529 deExcitationNorm.end(),
530 deExcitationNorm.begin(), ::tolower);
531 if(deExcitationNorm==
"none")
533 #ifdef INCL_DEEXCITATION_ABLAXX
534 else if(deExcitationNorm==
"ablav3p")
537 #ifdef INCL_DEEXCITATION_ABLA07
538 else if(deExcitationNorm==
"abla07")
541 #ifdef INCL_DEEXCITATION_SMM
542 else if(deExcitationNorm==
"smm")
545 #ifdef INCL_DEEXCITATION_GEMINIXX
546 else if(deExcitationNorm==
"geminixx")
550 std::cerr <<
"Unrecognized de-excitation model. "
551 <<
"Must be one of:" << std::endl
553 std::cerr << suggestHelpMsg;
554 std::exit(EXIT_FAILURE);
561 if(variablesMap.count(
"cluster-algorithm")) {
563 std::transform(clusterAlgorithmNorm.begin(),
564 clusterAlgorithmNorm.end(),
565 clusterAlgorithmNorm.begin(), ::tolower);
566 if(clusterAlgorithmNorm==
"none")
568 else if(clusterAlgorithmNorm==
"intercomparison")
571 std::cerr <<
"Unrecognized cluster algorithm. "
572 <<
"Must be one of:" << std::endl
573 <<
" intercomparison (default)" << std::endl
574 <<
" none" << std::endl;
575 std::cerr << suggestHelpMsg;
576 std::exit(EXIT_FAILURE);
583 if(variablesMap.count(
"cluster-max-mass") && clusterMaxMass < 2 && clusterMaxMass > 12) {
584 std::cerr <<
"Maximum cluster mass outside the allowed range. Must be between 2 and 12 (included)"
587 std::exit(EXIT_FAILURE);
591 if(variablesMap.count(
"separation-energies")) {
593 std::transform(separationEnergyNorm.begin(),
594 separationEnergyNorm.end(),
595 separationEnergyNorm.begin(), ::tolower);
596 if(separationEnergyNorm==
"incl")
598 else if(separationEnergyNorm==
"real")
600 else if(separationEnergyNorm==
"real-light")
603 std::cerr <<
"Unrecognized separation-energies option. "
604 <<
"Must be one of:" << std::endl
605 <<
" INCL (default)" << std::endl
606 <<
" real" << std::endl
607 <<
" real-light" << std::endl;
608 std::cerr << suggestHelpMsg;
609 std::exit(EXIT_FAILURE);
616 if(variablesMap.count(
"fermi-momentum")) {
618 std::transform(fermiMomentumNorm.begin(),
619 fermiMomentumNorm.end(),
620 fermiMomentumNorm.begin(), ::tolower);
621 if(fermiMomentumNorm==
"constant")
623 else if(fermiMomentumNorm==
"constant-light")
625 else if(fermiMomentumNorm==
"mass-dependent")
632 if(errno || *tail!=
'\0') {
633 std::cerr <<
"Unrecognized fermi-momentum option. "
634 <<
"Must be one of:" << std::endl
635 <<
" constant (default)" << std::endl
636 <<
" constant-light" << std::endl
637 <<
" mass-dependent" << std::endl
638 <<
" [a postiive value]" << std::endl;
639 std::cerr << suggestHelpMsg;
640 std::exit(EXIT_FAILURE);
643 std::cerr <<
"Values passed to fermi-momentum must be positive." << std::endl;
644 std::cerr << suggestHelpMsg;
645 std::exit(EXIT_FAILURE);
654 if(variablesMap.count(
"rp-correlation")) {
655 if(!variablesMap.count(
"rp-correlation-p") || variablesMap.find(
"rp-correlation-p")->second.defaulted())
657 if(!variablesMap.count(
"rp-correlation-n") || variablesMap.find(
"rp-correlation-n")->second.defaulted())
662 if(!variablesMap.count(
"suffix")) {
664 variablesMap.insert(std::make_pair(
"suffix", po::variable_value(boost::any(
fileSuffix),
false)));
668 if(!variablesMap.count(
"output") && isFullRun) {
669 std::stringstream outputFileRootStream;
671 if(variablesMap.count(
"input-file"))
674 outputFileRootStream.precision(0);
675 outputFileRootStream.setf(std::ios::fixed, std::ios::floatfield);
676 outputFileRootStream <<
680 outputFileRootStream.precision(2);
683 typedef po::variables_map::const_iterator BPOVMIter;
684 for(BPOVMIter i=variablesMap.begin(), e=variablesMap.end(); i!=e; ++i) {
687 if(name!=
"projectile"
690 && name!=
"number-shots"
691 && name!=
"random-seed-1"
692 && name!=
"random-seed-2"
694 && name!=
"verbose-event"
697 && name!=
"root-selection"
699 && name!=
"inclxx-datafile-path"
700 #ifdef INCL_DEEXCITATION_ABLA07
701 && name!=
"abla07-datafile-path"
703 #ifdef INCL_DEEXCITATION_ABLAXX
704 && name!=
"ablav3p-cxx-datafile-path"
706 #ifdef INCL_DEEXCITATION_GEMINIXX
707 && name!=
"geminixx-datafile-path"
710 po::variable_value v = i->second;
712 const std::type_info &type = v.value().type();
713 if(type==
typeid(std::string))
714 outputFileRootStream <<
"_" << name <<
"=" << v.as<std::string>();
716 outputFileRootStream <<
"_" << name <<
"=" << v.as<
G4float>();
718 outputFileRootStream <<
"_" << name <<
"=" << v.as<
G4double>();
719 else if(type==
typeid(
G4int))
720 outputFileRootStream <<
"_" << name <<
"=" << v.as<
G4int>();
721 else if(type==
typeid(
G4bool))
722 outputFileRootStream <<
"_" << name <<
"=" << v.as<
G4bool>();
733 variablesMap.insert(std::make_pair(
"output", po::variable_value(boost::any(
outputFileRoot),
false)));
737 if(!variablesMap.count(
"logfile")) {
741 variablesMap.insert(std::make_pair(
"logfile", po::variable_value(boost::any(
logFileName),
false)));
745 if(!variablesMap.count(
"random-seed-1")) {
746 if(randomSeed1<randomSeedMin || randomSeed1>randomSeedMax) {
747 std::cerr <<
"Invalid value for random-seed-1. "
748 <<
"Allowed range: [" <<
randomSeedMin <<
", " << randomSeedMax <<
"]." << std::endl;
749 std::cerr << suggestHelpMsg;
750 std::exit(EXIT_FAILURE);
753 if(!variablesMap.count(
"random-seed-2")) {
754 if(randomSeed2<randomSeedMin || randomSeed2>randomSeedMax) {
755 std::cerr <<
"Invalid value for random-seed-2. "
756 <<
"Allowed range: [" <<
randomSeedMin <<
", " << randomSeedMax <<
"]." << std::endl;
757 std::cerr << suggestHelpMsg;
758 std::exit(EXIT_FAILURE);
763 catch(std::exception& e)
765 std::cerr << e.what() <<
"\n";
766 std::cerr << suggestHelpMsg;
767 std::exit(EXIT_FAILURE);
784 title =
"INCL default run title";
789 projectileKineticEnergy = 1000.0;
819 #ifdef INCL_DEEXCITATION_FERMI_BREAKUP
820 maxMassFermiBreakUp = 18;
831 std::stringstream message;
837 message <<
" energy = " << projectileKineticEnergy << std::endl;
841 message <<
"Target: natural isotopic composition, Z = " <<
targetSpecies.
theZ << std::endl;
842 message <<
"Number of requested shots = " <<
nShots << std::endl;
843 return message.str();
846 #if defined(HAS_BOOST_PROGRAM_OPTIONS) && !defined(INCLXX_IN_GEANT4_MODE)
847 std::string
const Config::echo()
const {
848 std::stringstream ss;
849 ss <<
"###########################\n"
850 <<
"### Start of input echo ###\n"
851 <<
"###########################\n\n"
852 <<
"# You may re-use this snippet of the log file as an input file!\n"
853 <<
"# Options marked with a * are compulsory.\n"
854 <<
"\n### Run options\n" << echoOptionsDescription(runOptDesc)
855 <<
"\n### Physics options\n" << echoOptionsDescription(physicsOptDesc)
862 ss <<
", natural target";
863 ss <<
"\n\n#########################\n"
864 <<
"### End of input echo ###\n"
865 <<
"#########################" << std::endl;
870 std::string Config::echoOptionsDescription(
const po::options_description &aDesc)
const {
871 typedef std::vector< boost::shared_ptr< po::option_description > > OptVector;
872 typedef std::vector< boost::shared_ptr< po::option_description > >::const_iterator OptIter;
874 std::stringstream ss;
875 ss << std::boolalpha;
876 OptVector
const &anOptVect = aDesc.options();
877 for(OptIter opt=anOptVect.begin(), e=anOptVect.end(); opt!=e; ++opt) {
878 std::string description = (*opt)->description();
881 ss <<
"\n# " << description << std::endl;
882 const std::string &name = (*opt)->long_name();
884 po::variable_value
const &value = variablesMap.find(name)->second;
885 std::type_info
const &type = value.value().type();
886 if(type ==
typeid(std::string)) {
887 const std::string svalue = value.as<std::string>();
892 }
else if(type ==
typeid(
G4int))
893 ss << value.as<
G4int>();
894 else if(type ==
typeid(
G4float))
898 else if(type ==
typeid(
G4bool))
std::string fermiMomentumString
LocalEnergyType localEnergyPiType
std::string separationEnergyString
ClusterAlgorithmType clusterAlgorithmType
std::string potentialString
std::string localEnergyBBString
PotentialType potentialType
FermiMomentumType fermiMomentumType
std::string localEnergyPiString
~Config()
Default destructor.
std::string clusterAlgorithmString
std::string outputFileRoot
static const G4int randomSeedMin
std::string coulombString
static std::string const getVersionString()
Get the INCL version string.
LocalEnergyType localEnergyBBType
G4double rpCorrelationCoefficientProton
std::string deExcitationModelList
G4double neutronSkinAdditionalDiffuseness
G4double rpCorrelationCoefficient
ParticleSpecies targetSpecies
G4double neutronSkinThickness
G4double projectileKineticEnergy
Config()
Default constructor.
std::string deExcitationString
void init()
Initialise the members.
static const G4int randomSeedMax
void replaceAll(std::string &str, const std::string &from, const std::string &to, const size_t maxPosition=std::string::npos)
std::string summary()
Return a summary of the run configuration.
std::string projectileString
G4double rpCorrelationCoefficientNeutron
std::string INCLXXDataFilePath
std::string inputFileName
DeExcitationType deExcitationType
SeparationEnergyType separationEnergyType
std::string getShortName(const ParticleType t)
Get the short INCL name of the particle.
std::string getName(const ParticleType t)
Get the native INCL name of the particle.
void wrap(std::string &str, const size_t lineLength=78, const std::string &separators=" \t")
ParticleSpecies projectileSpecies