Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -38,851 +39,91 @@
|
||||
#include "G4INCLConfig.hh"
|
||||
#include "G4INCLParticleSpecies.hh"
|
||||
#include "G4INCLParticleTable.hh"
|
||||
#include "G4INCLGlobals.hh"
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
const G4int Config::randomSeedMin = 1;
|
||||
const G4int Config::randomSeedMax = ((1<<30)-1)+(1<<30); // 2^31-1
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
Config::Config() {
|
||||
init();
|
||||
}
|
||||
|
||||
Config::Config(G4int /*A*/, G4int /*Z*/, G4INCL::ParticleSpecies proj, G4double projectileE)
|
||||
{
|
||||
init();
|
||||
projectileSpecies = proj;
|
||||
projectileKineticEnergy = projectileE;
|
||||
}
|
||||
|
||||
// NOT used in Geant4 mode
|
||||
#if defined(HAS_BOOST_PROGRAM_OPTIONS) && !defined(INCLXX_IN_GEANT4_MODE)
|
||||
Config::Config(G4int argc, char *argv[], G4bool isFullRun) :
|
||||
runOptDesc("Run options"),
|
||||
hiddenOptDesc("Hidden options"),
|
||||
genericOptDesc("Generic options"),
|
||||
physicsOptDesc("Physics options"),
|
||||
naturalTarget(false)
|
||||
{
|
||||
const std::string suggestHelpMsg("You might want to run `INCLCascade --help' to get a help message.\n");
|
||||
|
||||
// Define the names of the de-excitation models
|
||||
const std::string theNoneName = "none";
|
||||
#ifdef INCL_DEEXCITATION_SMM
|
||||
const std::string theSMMName = "SMM";
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_GEMINIXX
|
||||
const std::string theGEMINIXXName = "GEMINIXX";
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLAXX
|
||||
const std::string theABLAv3pName = "ABLAv3p";
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLA07
|
||||
const std::string theABLA07Name = "ABLA07";
|
||||
#endif
|
||||
|
||||
// Define the default de-excitation model, in decreasing order of priority
|
||||
std::string defaultDeExcitationModel = theNoneName;
|
||||
#ifdef INCL_DEEXCITATION_SMM
|
||||
defaultDeExcitationModel = theSMMName;
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_GEMINIXX
|
||||
defaultDeExcitationModel = theGEMINIXXName;
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLAXX
|
||||
defaultDeExcitationModel = theABLAv3pName;
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLA07
|
||||
defaultDeExcitationModel = theABLA07Name;
|
||||
#endif
|
||||
|
||||
const std::string listSeparator = "\n \t";
|
||||
deExcitationModelList =
|
||||
listSeparator + theNoneName
|
||||
#ifdef INCL_DEEXCITATION_ABLA07
|
||||
+ listSeparator + theABLA07Name
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLAXX
|
||||
+ listSeparator + theABLAv3pName
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_GEMINIXX
|
||||
+ listSeparator + theGEMINIXXName
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_SMM
|
||||
+ listSeparator + theSMMName
|
||||
#endif
|
||||
;
|
||||
|
||||
// Append " (default)" to the name of the default model
|
||||
size_t defaultModelIndex = deExcitationModelList.find(defaultDeExcitationModel);
|
||||
if(defaultModelIndex!=std::string::npos) {
|
||||
deExcitationModelList = deExcitationModelList.substr(0, defaultModelIndex+defaultDeExcitationModel.size())
|
||||
+ " (default)"
|
||||
+ deExcitationModelList.substr(defaultModelIndex+defaultDeExcitationModel.size(), std::string::npos);
|
||||
}
|
||||
|
||||
// Spell out the G4bool values
|
||||
std::cout << std::boolalpha;
|
||||
|
||||
try {
|
||||
|
||||
// Hidden options
|
||||
hiddenOptDesc.add_options()
|
||||
("input-file", po::value<std::string>(&inputFileName), "input file")
|
||||
("impact-parameter", po::value<G4double>(&impactParameter)->default_value(-1.), "impact parameter")
|
||||
;
|
||||
|
||||
// Generic options
|
||||
std::stringstream verbosityDescription;
|
||||
verbosityDescription << "set verbosity level:\n"
|
||||
<< " 0: \tquiet, suppress all output messages\n"
|
||||
<< " " << InfoMsg << ": \tminimal logging\n"
|
||||
<< " " << FatalMsg << ": \tlog fatal error messages as well\n"
|
||||
<< " " << ErrorMsg << ": \tlog error messages as well\n"
|
||||
<< " " << WarningMsg << ": \tlog warning messages as well\n"
|
||||
<< " " << DebugMsg << ": \tlog debug messages as well\n"
|
||||
<< " " << DataBlockMsg << ": \tlog data-block messages as well";
|
||||
|
||||
genericOptDesc.add_options()
|
||||
("help,h", "produce this help message")
|
||||
("version", "print version string and exit")
|
||||
;
|
||||
|
||||
// Run-specific options
|
||||
std::stringstream randomSeed1Description, randomSeed2Description;
|
||||
randomSeed1Description << "first seed for the random-number generator (between "
|
||||
<< randomSeedMin << "and " << randomSeedMax << ")";
|
||||
randomSeed2Description << "second seed for the random-number generator (between "
|
||||
<< randomSeedMin << "and " << randomSeedMax << ")";
|
||||
|
||||
runOptDesc.add_options()
|
||||
("title", po::value<std::string>(&title)->default_value("INCL default run title"), "run title")
|
||||
("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")
|
||||
("suffix,s", po::value<std::string>(&fileSuffix), "suffix to be appended to generated output file names")
|
||||
("logfile,l", po::value<std::string>(&logFileName), "log file name. Defaults to `<output_root>.log'. Use `-' if you want to redirect logging to stdout")
|
||||
("number-shots,N", po::value<G4int>(&nShots), "* number of shots")
|
||||
("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.")
|
||||
("projectile,p", po::value<std::string>(&projectileString), "* projectile name:\n"
|
||||
" \tproton, p\n"
|
||||
" \tneutron, n\n"
|
||||
" \tpi+, piplus, pion+, pionplus\n"
|
||||
" \tpi0, pizero, pion0, pionzero\n"
|
||||
" \tpi-, piminus, pion-, pionminus\n"
|
||||
" \td, t, a, deuteron, triton, alpha\n"
|
||||
" \tHe-4, He4, 4He (and so on)")
|
||||
("energy,E", po::value<G4double>(&projectileKineticEnergy), "* total kinetic energy of the projectile, in MeV")
|
||||
("verbose-event", po::value<G4int>(&verboseEvent)->default_value(-1), "request verbose logging for the specified event only")
|
||||
("random-seed-1", po::value<G4int>(&randomSeed1)->default_value(666), randomSeed1Description.str().c_str())
|
||||
("random-seed-2", po::value<G4int>(&randomSeed2)->default_value(777), randomSeed2Description.str().c_str())
|
||||
#ifdef INCL_ROOT_USE
|
||||
("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.")
|
||||
#endif
|
||||
("inclxx-datafile-path", po::value<std::string>(&INCLXXDataFilePath)->default_value("../data/"),
|
||||
"path to the INCL++ data files")
|
||||
#ifdef INCL_DEEXCITATION_ABLA07
|
||||
("abla07-datafile-path", po::value<std::string>(&abla07DataFilePath)->default_value("../de-excitation/abla07/upstream/tables/"),
|
||||
"path to the ABLA07 data files")
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLAXX
|
||||
("ablav3p-cxx-datafile-path", po::value<std::string>(&ablav3pCxxDataFilePath)->default_value("../de-excitation/ablaxx/data/G4ABLA3.0/"),
|
||||
"path to the ABLAv3p data files")
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_GEMINIXX
|
||||
("geminixx-datafile-path", po::value<std::string>(&geminixxDataFilePath)->default_value("../de-excitation/geminixx/upstream/"),
|
||||
"path to the GEMINI++ data files")
|
||||
#endif
|
||||
("verbosity,v", po::value<G4int>(&verbosity)->default_value(4), verbosityDescription.str().c_str())
|
||||
;
|
||||
|
||||
// Physics options
|
||||
physicsOptDesc.add_options()
|
||||
("de-excitation,d", po::value<std::string>(&deExcitationString)->default_value(defaultDeExcitationModel.c_str()), ("which de-excitation model to use:" + deExcitationModelList).c_str())
|
||||
#ifdef INCL_DEEXCITATION_FERMI_BREAKUP
|
||||
("max-mass-fermi-breakup", po::value<G4int>(&maxMassFermiBreakUp)->default_value(18), "Maximum remnant mass for Fermi break-up. Default: 18.")
|
||||
#endif
|
||||
("pauli", po::value<std::string>(&pauliString)->default_value("strict-statistical"), "Pauli-blocking algorithm:\n"
|
||||
" \tstrict-statistical (default)\n"
|
||||
" \tstrict\n"
|
||||
" \tstatistical\n"
|
||||
" \tglobal\n"
|
||||
" \tnone")
|
||||
("cdpp", po::value<G4bool>(&CDPP)->default_value(true), "whether to apply CDPP after collisions:\n \ttrue, 1 (default)\n \tfalse, 0")
|
||||
("coulomb", po::value<std::string>(&coulombString)->default_value("non-relativistic"), "Coulomb-distortion algorithm:\n \tnon-relativistic (default)\n \tnone")
|
||||
("potential", po::value<std::string>(&potentialString)->default_value("isospin-energy"), "nucleon potential:\n \tisospin-energy-smooth\n \tisospin-energy (default)\n \tisospin\n \tconstant")
|
||||
("pion-potential", po::value<G4bool>(&pionPotential)->default_value("true"), "whether to use a pion potential:\n \ttrue, 1 (default)\n \tfalse, 0")
|
||||
("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")
|
||||
("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")
|
||||
("cluster-algorithm", po::value<std::string>(&clusterAlgorithmString)->default_value("intercomparison"), "clustering algorithm for production of composites:\n \tintercomparison (default)\n \tnone")
|
||||
("cluster-max-mass", po::value<G4int>(&clusterMaxMass)->default_value(8), "maximum mass of produced composites:\n \tminimum 2\n \tmaximum 12")
|
||||
("back-to-spectator", po::value<G4bool>(&backToSpectator)->default_value("true"), "whether to use back-to-spectator:\n \ttrue, 1 (default)\n \tfalse, 0")
|
||||
("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")
|
||||
("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")
|
||||
("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")
|
||||
("cutNN", po::value<G4double>(&cutNN)->default_value(1910.), "minimum CM energy for nucleon-nucleon collisions, in MeV. Default: 1910.")
|
||||
("rp-correlation", po::value<G4double>(&rpCorrelationCoefficient)->default_value(1.), "correlation coefficient for the r-p correlation. Default: 1 (full correlation).")
|
||||
("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).")
|
||||
("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).")
|
||||
("neutron-skin-thickness", po::value<G4double>(&neutronSkinThickness)->default_value(0.), "thickness of the neutron skin, in fm. Default: 0.")
|
||||
("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.")
|
||||
("refraction", po::value<G4bool>(&refraction)->default_value(false), "whether to use refraction when particles are transmitted. Default: false.")
|
||||
;
|
||||
|
||||
// Select options allowed on the command line
|
||||
po::options_description cmdLineOptions;
|
||||
cmdLineOptions.add(hiddenOptDesc).add(genericOptDesc).add(runOptDesc).add(physicsOptDesc);
|
||||
|
||||
// Select options allowed in config files
|
||||
po::options_description configFileOptions;
|
||||
configFileOptions.add(runOptDesc).add(physicsOptDesc);
|
||||
|
||||
// Select visible options
|
||||
po::options_description visibleOptions;
|
||||
visibleOptions.add(genericOptDesc).add(runOptDesc).add(physicsOptDesc);
|
||||
|
||||
// Declare input-file as a positional option (if we just provide a file
|
||||
// name on the command line, it should be interpreted as an input-file
|
||||
// option).
|
||||
po::positional_options_description p;
|
||||
p.add("input-file", 1);
|
||||
|
||||
// Disable guessing of option names
|
||||
G4int cmdstyle =
|
||||
po::command_line_style::default_style &
|
||||
~po::command_line_style::allow_guessing;
|
||||
|
||||
// Result of the option processing
|
||||
po::store(po::command_line_parser(argc, argv).
|
||||
style(cmdstyle).
|
||||
options(cmdLineOptions).positional(p).run(), variablesMap);
|
||||
po::notify(variablesMap);
|
||||
|
||||
// If an input file was specified, merge the options with the command-line
|
||||
// options.
|
||||
if(variablesMap.count("input-file")) {
|
||||
std::ifstream inputFileStream(inputFileName.c_str());
|
||||
if(!inputFileStream) {
|
||||
std::cerr << "Cannot open input file: " << inputFileName << std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
} else {
|
||||
// Merge options from the input file
|
||||
po::parsed_options parsedOptions = po::parse_config_file(inputFileStream, configFileOptions, true);
|
||||
|
||||
// Make sure that the unhandled options are all "*-datafile-path"
|
||||
std::vector<std::string> unhandledOptions =
|
||||
po::collect_unrecognized(parsedOptions.options, po::exclude_positional);
|
||||
G4bool ignoreNext = false;
|
||||
const std::string match = "-datafile-path";
|
||||
for(std::vector<std::string>::const_iterator i=unhandledOptions.begin(), e=unhandledOptions.end(); i!=e; ++i) {
|
||||
if(ignoreNext) {
|
||||
ignoreNext=false;
|
||||
continue;
|
||||
}
|
||||
if(i->rfind(match) == i->length()-match.length()) {
|
||||
std::cout << "Ignoring unrecognized option " << *i << std::endl;
|
||||
ignoreNext = true;
|
||||
} else {
|
||||
std::cerr << "Error: unrecognized option " << *i << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// Store the option values in the variablesMap
|
||||
po::store(parsedOptions, variablesMap);
|
||||
po::notify(variablesMap);
|
||||
}
|
||||
inputFileStream.close();
|
||||
}
|
||||
|
||||
// Process the options from the user-specific config file ~/.inclxxrc
|
||||
std::string configFileName;
|
||||
const char * const configFileVar = getenv("INCLXXRC");
|
||||
if(configFileVar)
|
||||
configFileName = configFileVar;
|
||||
else {
|
||||
const char * const homeDirectoryPointer = getenv("HOME");
|
||||
if(homeDirectoryPointer) { // Check if we can find the home directory
|
||||
std::string homeDirectory(homeDirectoryPointer);
|
||||
configFileName = homeDirectory + "/.inclxxrc";
|
||||
} else {
|
||||
std::cerr << "Could not determine the user's home directory. "
|
||||
<< "Are you running Linux, Unix or BSD?"<< std::endl;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
std::ifstream configFileStream(configFileName.c_str());
|
||||
std::cout << "Reading config file " << configFileName << std::endl;
|
||||
if(!configFileStream) {
|
||||
std::cout << "INCL++ config file " << configFileName
|
||||
<< " not found. Continuing the run regardless."
|
||||
<< std::endl;
|
||||
} else {
|
||||
// Merge options from the input file
|
||||
po::parsed_options parsedOptions = po::parse_config_file(configFileStream, configFileOptions, true);
|
||||
po::store(parsedOptions, variablesMap);
|
||||
|
||||
// Make sure that the unhandled options are all "*-datafile-path"
|
||||
std::vector<std::string> unhandledOptions =
|
||||
po::collect_unrecognized(parsedOptions.options, po::exclude_positional);
|
||||
G4bool ignoreNext = false;
|
||||
const std::string match = "-datafile-path";
|
||||
for(std::vector<std::string>::const_iterator i=unhandledOptions.begin(), e=unhandledOptions.end(); i!=e; ++i) {
|
||||
if(ignoreNext) {
|
||||
ignoreNext=false;
|
||||
continue;
|
||||
}
|
||||
if(i->rfind(match) == i->length()-match.length()) {
|
||||
std::cout << "Ignoring unrecognized option " << *i << std::endl;
|
||||
ignoreNext = true;
|
||||
} else {
|
||||
std::cerr << "Error: unrecognized option " << *i << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// Store the option values in the variablesMap
|
||||
po::store(parsedOptions, variablesMap);
|
||||
po::notify(variablesMap);
|
||||
}
|
||||
configFileStream.close();
|
||||
|
||||
/* *******************
|
||||
* Process the options
|
||||
* *******************/
|
||||
|
||||
// -h/--help: print the help message and exit successfully
|
||||
if(variablesMap.count("help")) {
|
||||
std::cout
|
||||
<< "Usage: INCLCascade [options] <input_file>" << std::endl
|
||||
<< 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
|
||||
<< visibleOptions << std::endl;
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
// --version: print the version string and exit successfully
|
||||
if(variablesMap.count("version")) {
|
||||
std::cout <<"INCL++ version " << getVersionString() << std::endl;
|
||||
std::exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
// Check if the required options are present
|
||||
if(isFullRun) {
|
||||
std::string missingOption("");
|
||||
if(!variablesMap.count("number-shots"))
|
||||
missingOption = "number-shots";
|
||||
else if(!variablesMap.count("target"))
|
||||
missingOption = "target";
|
||||
else if(!variablesMap.count("projectile"))
|
||||
missingOption = "projectile";
|
||||
else if(!variablesMap.count("energy"))
|
||||
missingOption = "energy";
|
||||
if(!missingOption.empty()) {
|
||||
std::cerr << "Required option " << missingOption << " is missing." << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
std::cout <<"Not performing a full run. This had better be a test..." << std::endl;
|
||||
}
|
||||
|
||||
// -p/--projectile: projectile species
|
||||
projectileSpecies = ParticleSpecies(projectileString);
|
||||
if(projectileSpecies.theType == G4INCL::UnknownParticle && isFullRun) {
|
||||
std::cerr << "Error: unrecognized particle type " << projectileString << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// -t/--target: target species
|
||||
if(variablesMap.count("target")) {
|
||||
targetSpecies = ParticleSpecies(targetString);
|
||||
if(targetSpecies.theType!=Composite) {
|
||||
std::cerr << "Unrecognized target. You specified: " << targetString << std::endl
|
||||
<< " The target nuclide must be specified in one of the following forms:" << std::endl
|
||||
<< " Fe56, 56Fe, Fe-56, 56-Fe, Fe_56, 56_Fe, Fe" << std::endl
|
||||
<< " You can also use IUPAC element names (such as Uuh)." << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
if(targetSpecies.theA==0)
|
||||
naturalTarget = true;
|
||||
}
|
||||
|
||||
// --pauli
|
||||
if(variablesMap.count("pauli")) {
|
||||
std::string pauliNorm = pauliString;
|
||||
std::transform(pauliNorm.begin(), pauliNorm.end(), pauliNorm.begin(), ::tolower);
|
||||
if(pauliNorm=="statistical")
|
||||
pauliType = StatisticalPauli;
|
||||
else if(pauliNorm=="strict")
|
||||
pauliType = StrictPauli;
|
||||
else if(pauliNorm=="strict-statistical")
|
||||
pauliType = StrictStatisticalPauli;
|
||||
else if(pauliNorm=="global")
|
||||
pauliType = GlobalPauli;
|
||||
else if(pauliNorm=="none")
|
||||
pauliType = NoPauli;
|
||||
else {
|
||||
std::cerr << "Unrecognized Pauli-blocking algorithm. Must be one of:" << std::endl
|
||||
<< " strict-statistical (default)" << std::endl
|
||||
<< " strict" << std::endl
|
||||
<< " statistical" << std::endl
|
||||
<< " global" << std::endl
|
||||
<< " none" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// --coulomb
|
||||
if(variablesMap.count("coulomb")) {
|
||||
std::string coulombNorm = coulombString;
|
||||
std::transform(coulombNorm.begin(), coulombNorm.end(), coulombNorm.begin(), ::tolower);
|
||||
if(coulombNorm=="non-relativistic")
|
||||
coulombType = NonRelativisticCoulomb;
|
||||
else if(coulombNorm=="none")
|
||||
coulombType = NoCoulomb;
|
||||
else {
|
||||
std::cerr << "Unrecognized Coulomb-distortion algorithm. Must be one of:" << std::endl
|
||||
<< " non-relativistic (default)" << std::endl
|
||||
<< " none" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// --potential
|
||||
if(variablesMap.count("potential")) {
|
||||
std::string potentialNorm = potentialString;
|
||||
std::transform(potentialNorm.begin(), potentialNorm.end(), potentialNorm.begin(), ::tolower);
|
||||
if(potentialNorm=="isospin-energy-smooth") {
|
||||
potentialType = IsospinEnergySmoothPotential;
|
||||
} else if(potentialNorm=="isospin-energy") {
|
||||
potentialType = IsospinEnergyPotential;
|
||||
} else if(potentialNorm=="isospin")
|
||||
potentialType = IsospinPotential;
|
||||
else if(potentialNorm=="constant")
|
||||
potentialType = ConstantPotential;
|
||||
else {
|
||||
std::cerr << "Unrecognized potential type. Must be one of:" << std::endl
|
||||
<< " isospin-energy-smooth" << std::endl
|
||||
<< " isospin-energy (default)" << std::endl
|
||||
<< " isospin" << std::endl
|
||||
<< " constant" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// --local-energy-BB
|
||||
if(variablesMap.count("local-energy-BB")) {
|
||||
std::string localEnergyBBNorm = localEnergyBBString;
|
||||
std::transform(localEnergyBBNorm.begin(), localEnergyBBNorm.end(), localEnergyBBNorm.begin(), ::tolower);
|
||||
if(localEnergyBBNorm=="always") {
|
||||
localEnergyBBType = AlwaysLocalEnergy;
|
||||
} else if(localEnergyBBNorm=="first-collision")
|
||||
localEnergyBBType = FirstCollisionLocalEnergy;
|
||||
else if(localEnergyBBNorm=="never")
|
||||
localEnergyBBType = NeverLocalEnergy;
|
||||
else {
|
||||
std::cerr << "Unrecognized local-energy-BB type. Must be one of:" << std::endl
|
||||
<< " always" << std::endl
|
||||
<< " first-collision (default)" << std::endl
|
||||
<< " never" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// --local-energy-pi
|
||||
if(variablesMap.count("local-energy-pi")) {
|
||||
std::string localEnergyPiNorm = localEnergyPiString;
|
||||
std::transform(localEnergyPiNorm.begin(), localEnergyPiNorm.end(), localEnergyPiNorm.begin(), ::tolower);
|
||||
if(localEnergyPiNorm=="always") {
|
||||
localEnergyPiType = AlwaysLocalEnergy;
|
||||
} else if(localEnergyPiNorm=="first-collision")
|
||||
localEnergyPiType = FirstCollisionLocalEnergy;
|
||||
else if(localEnergyPiNorm=="never")
|
||||
localEnergyPiType = NeverLocalEnergy;
|
||||
else {
|
||||
std::cerr << "Unrecognized local-energy-pi type. Must be one of:" << std::endl
|
||||
<< " always" << std::endl
|
||||
<< " first-collision" << std::endl
|
||||
<< " never (default)" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
// -d/--de-excitation
|
||||
if(variablesMap.count("de-excitation")) {
|
||||
std::string deExcitationNorm = deExcitationString;
|
||||
std::transform(deExcitationNorm.begin(),
|
||||
deExcitationNorm.end(),
|
||||
deExcitationNorm.begin(), ::tolower);
|
||||
if(deExcitationNorm=="none")
|
||||
deExcitationType = DeExcitationNone;
|
||||
#ifdef INCL_DEEXCITATION_ABLAXX
|
||||
else if(deExcitationNorm=="ablav3p")
|
||||
deExcitationType = DeExcitationABLAv3p;
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLA07
|
||||
else if(deExcitationNorm=="abla07")
|
||||
deExcitationType = DeExcitationABLA07;
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_SMM
|
||||
else if(deExcitationNorm=="smm")
|
||||
deExcitationType = DeExcitationSMM;
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_GEMINIXX
|
||||
else if(deExcitationNorm=="geminixx")
|
||||
deExcitationType = DeExcitationGEMINIXX;
|
||||
#endif
|
||||
else {
|
||||
std::cerr << "Unrecognized de-excitation model. "
|
||||
<< "Must be one of:" << std::endl
|
||||
<< deExcitationModelList << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
deExcitationType = DeExcitationNone;
|
||||
}
|
||||
|
||||
// --cluster-algorithm
|
||||
if(variablesMap.count("cluster-algorithm")) {
|
||||
std::string clusterAlgorithmNorm = clusterAlgorithmString;
|
||||
std::transform(clusterAlgorithmNorm.begin(),
|
||||
clusterAlgorithmNorm.end(),
|
||||
clusterAlgorithmNorm.begin(), ::tolower);
|
||||
if(clusterAlgorithmNorm=="none")
|
||||
clusterAlgorithmType = NoClusterAlgorithm;
|
||||
else if(clusterAlgorithmNorm=="intercomparison")
|
||||
clusterAlgorithmType = IntercomparisonClusterAlgorithm;
|
||||
else {
|
||||
std::cerr << "Unrecognized cluster algorithm. "
|
||||
<< "Must be one of:" << std::endl
|
||||
<< " intercomparison (default)" << std::endl
|
||||
<< " none" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
clusterAlgorithmType = IntercomparisonClusterAlgorithm;
|
||||
}
|
||||
|
||||
// --cluster-max-mass
|
||||
if(variablesMap.count("cluster-max-mass") && clusterMaxMass < 2 && clusterMaxMass > 12) {
|
||||
std::cerr << "Maximum cluster mass outside the allowed range. Must be between 2 and 12 (included)"
|
||||
<< std::endl
|
||||
<< suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// --separation-energies
|
||||
if(variablesMap.count("separation-energies")) {
|
||||
std::string separationEnergyNorm = separationEnergyString;
|
||||
std::transform(separationEnergyNorm.begin(),
|
||||
separationEnergyNorm.end(),
|
||||
separationEnergyNorm.begin(), ::tolower);
|
||||
if(separationEnergyNorm=="incl")
|
||||
separationEnergyType = INCLSeparationEnergy;
|
||||
else if(separationEnergyNorm=="real")
|
||||
separationEnergyType = RealSeparationEnergy;
|
||||
else if(separationEnergyNorm=="real-light")
|
||||
separationEnergyType = RealForLightSeparationEnergy;
|
||||
else {
|
||||
std::cerr << "Unrecognized separation-energies option. "
|
||||
<< "Must be one of:" << std::endl
|
||||
<< " INCL (default)" << std::endl
|
||||
<< " real" << std::endl
|
||||
<< " real-light" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
separationEnergyType = INCLSeparationEnergy;
|
||||
}
|
||||
|
||||
// --fermi-momentum
|
||||
if(variablesMap.count("fermi-momentum")) {
|
||||
std::string fermiMomentumNorm = fermiMomentumString;
|
||||
std::transform(fermiMomentumNorm.begin(),
|
||||
fermiMomentumNorm.end(),
|
||||
fermiMomentumNorm.begin(), ::tolower);
|
||||
if(fermiMomentumNorm=="constant")
|
||||
fermiMomentumType = ConstantFermiMomentum;
|
||||
else if(fermiMomentumNorm=="constant-light")
|
||||
fermiMomentumType = ConstantLightFermiMomentum;
|
||||
else if(fermiMomentumNorm=="mass-dependent")
|
||||
fermiMomentumType = MassDependentFermiMomentum;
|
||||
else {
|
||||
std::cerr << "Unrecognized fermi-momentum option. "
|
||||
<< "Must be one of:" << std::endl
|
||||
<< " constant (default)" << std::endl
|
||||
<< " constant-light" << std::endl
|
||||
<< " mass-dependent" << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
fermiMomentumType = ConstantFermiMomentum;
|
||||
}
|
||||
|
||||
// --rp-correlation / --rp-correlation-p / --rp-correlation-n
|
||||
if(variablesMap.count("rp-correlation")) {
|
||||
if(!variablesMap.count("rp-correlation-p") || variablesMap.find("rp-correlation-p")->second.defaulted())
|
||||
rpCorrelationCoefficientProton = rpCorrelationCoefficient;
|
||||
if(!variablesMap.count("rp-correlation-n") || variablesMap.find("rp-correlation-n")->second.defaulted())
|
||||
rpCorrelationCoefficientNeutron = rpCorrelationCoefficient;
|
||||
}
|
||||
|
||||
// -s/--suffix
|
||||
if(!variablesMap.count("suffix")) {
|
||||
// update the value in the variables_map
|
||||
variablesMap.insert(std::make_pair("suffix", po::variable_value(boost::any(fileSuffix), false)));
|
||||
}
|
||||
|
||||
// --output: construct a reasonable output file root if not specified
|
||||
if(!variablesMap.count("output") && isFullRun) {
|
||||
std::stringstream outputFileRootStream;
|
||||
// If an input file was specified, use its name as the output file root
|
||||
if(variablesMap.count("input-file"))
|
||||
outputFileRootStream << inputFileName << fileSuffix;
|
||||
else {
|
||||
outputFileRootStream.precision(0);
|
||||
outputFileRootStream.setf(std::ios::fixed, std::ios::floatfield);
|
||||
outputFileRootStream <<
|
||||
ParticleTable::getShortName(projectileSpecies) << "_" <<
|
||||
ParticleTable::getShortName(targetSpecies) << "_" <<
|
||||
projectileKineticEnergy;
|
||||
outputFileRootStream.precision(2);
|
||||
|
||||
// Append suffixes to the output file root for each explicitly specified CLI option
|
||||
typedef po::variables_map::const_iterator BPOVMIter;
|
||||
for(BPOVMIter i=variablesMap.begin(), e=variablesMap.end(); i!=e; ++i) {
|
||||
std::string const &name = i->first;
|
||||
// Only process CLI options
|
||||
if(name!="projectile"
|
||||
&& name!="target"
|
||||
&& name!="energy"
|
||||
&& name!="number-shots"
|
||||
&& name!="random-seed-1"
|
||||
&& name!="random-seed-2"
|
||||
&& name!="verbosity"
|
||||
&& name!="verbose-event"
|
||||
&& name!="suffix"
|
||||
#ifdef INCL_ROOT_USE
|
||||
&& name!="root-selection"
|
||||
#endif
|
||||
&& name!="inclxx-datafile-path"
|
||||
#ifdef INCL_DEEXCITATION_ABLA07
|
||||
&& name!="abla07-datafile-path"
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_ABLAXX
|
||||
&& name!="ablav3p-cxx-datafile-path"
|
||||
#endif
|
||||
#ifdef INCL_DEEXCITATION_GEMINIXX
|
||||
&& name!="geminixx-datafile-path"
|
||||
#endif
|
||||
) {
|
||||
po::variable_value v = i->second;
|
||||
if(!v.defaulted()) {
|
||||
const std::type_info &type = v.value().type();
|
||||
if(type==typeid(std::string))
|
||||
outputFileRootStream << "_" << name << "=" << v.as<std::string>();
|
||||
else if(type==typeid(G4float))
|
||||
outputFileRootStream << "_" << name << "=" << v.as<G4float>();
|
||||
else if(type==typeid(G4double))
|
||||
outputFileRootStream << "_" << name << "=" << v.as<G4double>();
|
||||
else if(type==typeid(G4int))
|
||||
outputFileRootStream << "_" << name << "=" << v.as<G4int>();
|
||||
else if(type==typeid(G4bool))
|
||||
outputFileRootStream << "_" << name << "=" << v.as<G4bool>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
outputFileRootStream << fileSuffix;
|
||||
}
|
||||
|
||||
// update the variable
|
||||
outputFileRoot = outputFileRootStream.str();
|
||||
// update the value in the variables_map
|
||||
variablesMap.insert(std::make_pair("output", po::variable_value(boost::any(outputFileRoot), false)));
|
||||
}
|
||||
|
||||
// -l/--logfile
|
||||
if(!variablesMap.count("logfile")) {
|
||||
// update the variable
|
||||
logFileName = outputFileRoot + ".log";
|
||||
// update the value in the variables_map
|
||||
variablesMap.insert(std::make_pair("logfile", po::variable_value(boost::any(logFileName), false)));
|
||||
}
|
||||
|
||||
// --random-seed-1 and 2
|
||||
if(!variablesMap.count("random-seed-1")) {
|
||||
if(randomSeed1<randomSeedMin || randomSeed1>randomSeedMax) {
|
||||
std::cerr << "Invalid value for random-seed-1. "
|
||||
<< "Allowed range: [" << randomSeedMin << ", " << randomSeedMax << "]." << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
if(!variablesMap.count("random-seed-2")) {
|
||||
if(randomSeed2<randomSeedMin || randomSeed2>randomSeedMax) {
|
||||
std::cerr << "Invalid value for random-seed-2. "
|
||||
<< "Allowed range: [" << randomSeedMin << ", " << randomSeedMax << "]." << std::endl;
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch(std::exception& e)
|
||||
{
|
||||
std::cerr << e.what() << "\n";
|
||||
std::cerr << suggestHelpMsg;
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
}
|
||||
#else
|
||||
Config::Config(G4int /*argc*/, char * /*argv*/ [], G4bool /*isFullRun*/)
|
||||
{
|
||||
init();
|
||||
}
|
||||
#endif
|
||||
|
||||
Config::~Config()
|
||||
{}
|
||||
Config::~Config() {}
|
||||
|
||||
void Config::init() {
|
||||
verbosity = 1;
|
||||
inputFileName = "";
|
||||
title = "INCL default run title";
|
||||
nShots = 1000;
|
||||
naturalTarget = false;
|
||||
projectileString = "proton";
|
||||
projectileSpecies = G4INCL::Proton;
|
||||
projectileKineticEnergy = 1000.0;
|
||||
verboseEvent = -1;
|
||||
randomSeed1 = 666;
|
||||
randomSeed2 = 777;
|
||||
pauliString = "strict-statistical";
|
||||
pauliType = StrictStatisticalPauli;
|
||||
CDPP = true;
|
||||
coulombString = "non-relativistic";
|
||||
coulombType = NonRelativisticCoulomb;
|
||||
potentialString = "isospin-energy";
|
||||
potentialType = IsospinEnergyPotential;
|
||||
pionPotential = true;
|
||||
localEnergyBBString = "first-collision";
|
||||
localEnergyBBType = FirstCollisionLocalEnergy;
|
||||
localEnergyPiString = "first-collision";
|
||||
localEnergyPiType = FirstCollisionLocalEnergy;
|
||||
deExcitationString = "none";
|
||||
deExcitationType = DeExcitationNone;
|
||||
clusterAlgorithmString = "intercomparison";
|
||||
clusterAlgorithmType = IntercomparisonClusterAlgorithm;
|
||||
clusterMaxMass = 8;
|
||||
backToSpectator = true;
|
||||
useRealMasses = true;
|
||||
impactParameter = -1.;
|
||||
separationEnergyString = "INCL";
|
||||
separationEnergyType = INCLSeparationEnergy;
|
||||
fermiMomentumString = "constant";
|
||||
fermiMomentumType = ConstantFermiMomentum;
|
||||
cutNN = 1910.;
|
||||
verbosity = 1;
|
||||
logFileName = "-";
|
||||
inputFileName = "";
|
||||
title = "INCL default run title";
|
||||
nShots = 1000;
|
||||
naturalTarget = false;
|
||||
projectileString = "proton";
|
||||
projectileSpecies = G4INCL::Proton;
|
||||
projectileKineticEnergy = 1000.0;
|
||||
verboseEvent = -1;
|
||||
randomSeeds = "";
|
||||
randomSeedVector.push_back(666);
|
||||
randomSeedVector.push_back(777);
|
||||
randomSeedVector.push_back(1234);
|
||||
pauliString = "strict-statistical";
|
||||
pauliType = StrictStatisticalPauli;
|
||||
CDPP = true;
|
||||
coulombString = "non-relativistic";
|
||||
coulombType = NonRelativisticCoulomb;
|
||||
potentialString = "isospin-energy";
|
||||
potentialType = IsospinEnergyPotential;
|
||||
pionPotential = true;
|
||||
localEnergyBBString = "first-collision";
|
||||
localEnergyBBType = FirstCollisionLocalEnergy;
|
||||
localEnergyPiString = "first-collision";
|
||||
localEnergyPiType = FirstCollisionLocalEnergy;
|
||||
deExcitationString = "none";
|
||||
deExcitationType = DeExcitationNone;
|
||||
clusterAlgorithmString = "intercomparison";
|
||||
clusterAlgorithmType = IntercomparisonClusterAlgorithm;
|
||||
clusterMaxMass = 8;
|
||||
backToSpectator = true;
|
||||
useRealMasses = true;
|
||||
impactParameter = -1.;
|
||||
separationEnergyString = "INCL";
|
||||
separationEnergyType = INCLSeparationEnergy;
|
||||
fermiMomentumString = "constant";
|
||||
fermiMomentumType = ConstantFermiMomentum;
|
||||
fermiMomentum = -1.;
|
||||
cutNN = 1910.;
|
||||
#ifdef INCL_DEEXCITATION_FERMI_BREAKUP
|
||||
maxMassFermiBreakUp = 18;
|
||||
maxMassFermiBreakUp = 16;
|
||||
maxChargeFermiBreakUp = 8;
|
||||
#endif
|
||||
rpCorrelationCoefficient = 1.;
|
||||
rpCorrelationCoefficientProton = 1.;
|
||||
rpCorrelationCoefficientNeutron = 1.;
|
||||
neutronSkinThickness = 0.;
|
||||
neutronSkinAdditionalDiffuseness = 0.;
|
||||
refraction=false;
|
||||
rpCorrelationCoefficient = 1.;
|
||||
rpCorrelationCoefficientProton = 1.;
|
||||
rpCorrelationCoefficientNeutron = 1.;
|
||||
neutronSkin = 0.;
|
||||
neutronHalo = 0.;
|
||||
refraction=false;
|
||||
phaseSpaceGenerator = "Raubold-Lynch";
|
||||
phaseSpaceGeneratorType = RauboldLynchType;
|
||||
cascadeAction = "default";
|
||||
cascadeActionType = DefaultActionType;
|
||||
randomNumberGenerator = "Ranecu";
|
||||
rngType = RanecuType;
|
||||
autosaveFrequency = 10000;
|
||||
crossSectionsString = "multipions";
|
||||
crossSectionsType = MultiPionsCrossSections;
|
||||
}
|
||||
|
||||
std::string Config::summary() {
|
||||
std::stringstream message;
|
||||
message << "INCL++ version " << getVersionString() << std::endl;
|
||||
message << "INCL++ version " << getVersionString() << '\n';
|
||||
if(projectileSpecies.theType != Composite)
|
||||
message << "Projectile: " << ParticleTable::getName(projectileSpecies) << std::endl;
|
||||
message << "Projectile: " << ParticleTable::getName(projectileSpecies) << '\n';
|
||||
else
|
||||
message << "Projectile: composite, A=" << projectileSpecies.theA << ", Z=" << projectileSpecies.theZ << std::endl;
|
||||
message << " energy = " << projectileKineticEnergy << std::endl;
|
||||
message << "Projectile: composite, A=" << projectileSpecies.theA << ", Z=" << projectileSpecies.theZ << '\n';
|
||||
message << " energy = " << projectileKineticEnergy << '\n';
|
||||
if(targetSpecies.theA>0)
|
||||
message << "Target: A = " << targetSpecies.theA << " Z = " << targetSpecies.theZ << std::endl;
|
||||
message << "Target: A = " << targetSpecies.theA << " Z = " << targetSpecies.theZ << '\n';
|
||||
else
|
||||
message << "Target: natural isotopic composition, Z = " << targetSpecies.theZ << std::endl;
|
||||
message << "Number of requested shots = " << nShots << std::endl;
|
||||
message << "Target: natural isotopic composition, Z = " << targetSpecies.theZ << '\n';
|
||||
message << "Number of requested shots = " << nShots << '\n';
|
||||
return message.str();
|
||||
}
|
||||
|
||||
#if defined(HAS_BOOST_PROGRAM_OPTIONS) && !defined(INCLXX_IN_GEANT4_MODE)
|
||||
std::string const Config::echo() const {
|
||||
std::stringstream ss;
|
||||
ss << "###########################\n"
|
||||
<< "### Start of input echo ###\n"
|
||||
<< "###########################\n\n"
|
||||
<< "# You may re-use this snippet of the log file as an input file!\n"
|
||||
<< "# Options marked with a * are compulsory.\n"
|
||||
<< "\n### Run options\n" << echoOptionsDescription(runOptDesc)
|
||||
<< "\n### Physics options\n" << echoOptionsDescription(physicsOptDesc)
|
||||
<< "\n# the projectile nuclide was parsed as Z=" << projectileSpecies.theZ
|
||||
<< ", A=" << projectileSpecies.theA
|
||||
<< "\n# the target nuclide was parsed as Z=" << targetSpecies.theZ;
|
||||
if(targetSpecies.theA>0)
|
||||
ss << ", A=" << targetSpecies.theA;
|
||||
else
|
||||
ss << ", natural target";
|
||||
ss << "\n\n#########################\n"
|
||||
<< "### End of input echo ###\n"
|
||||
<< "#########################" << std::endl;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string Config::echoOptionsDescription(const po::options_description &aDesc) const {
|
||||
typedef std::vector< boost::shared_ptr< po::option_description > > OptVector;
|
||||
typedef std::vector< boost::shared_ptr< po::option_description > >::const_iterator OptIter;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::boolalpha;
|
||||
OptVector const &anOptVect = aDesc.options();
|
||||
for(OptIter opt=anOptVect.begin(), e=anOptVect.end(); opt!=e; ++opt) {
|
||||
std::string description = (*opt)->description();
|
||||
String::wrap(description);
|
||||
String::replaceAll(description, "\n", "\n# ");
|
||||
ss << "\n# " << description << std::endl;
|
||||
const std::string &name = (*opt)->long_name();
|
||||
ss << name << " = ";
|
||||
po::variable_value const &value = variablesMap.find(name)->second;
|
||||
std::type_info const &type = value.value().type();
|
||||
if(type == typeid(std::string)) {
|
||||
const std::string svalue = value.as<std::string>();
|
||||
if(svalue.empty())
|
||||
ss << "\"\"";
|
||||
else
|
||||
ss << svalue;
|
||||
} else if(type == typeid(G4int))
|
||||
ss << value.as<G4int>();
|
||||
else if(type == typeid(G4float))
|
||||
ss << value.as<G4float>();
|
||||
else if(type == typeid(G4double))
|
||||
ss << value.as<G4double>();
|
||||
else if(type == typeid(G4bool))
|
||||
ss << value.as<G4bool>();
|
||||
ss << '\n';
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -58,22 +59,31 @@ namespace G4INCL {
|
||||
for(Int_t i=0; i<nParticles; ++i) {
|
||||
// determine the particle mass from the kinetic energy and the momentum;
|
||||
// this ensures consistency with the masses uses by the models
|
||||
const Double_t mass = std::max(
|
||||
0.5 * (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]-EKin[i]*EKin[i]) / EKin[i],
|
||||
0.0);
|
||||
Double_t mass;
|
||||
if(EKin[i]>0.) {
|
||||
mass = std::max(
|
||||
0.5 * (px[i]*px[i]+py[i]*py[i]+pz[i]*pz[i]-EKin[i]*EKin[i]) / EKin[i],
|
||||
0.0);
|
||||
} else {
|
||||
INCL_WARN("Particle with null kinetic energy in fillInverseKinematics, cannot determine its mass:\n"
|
||||
<< " A=" << A[i] << ", Z=" << Z[i] << '\n'
|
||||
<< " EKin=" << EKin[i] << ", px=" << px[i] << ", py=" << py[i] << ", pz=" << pz[i] << '\n'
|
||||
<< " Falling back to the mass from the INCL ParticleTable" << '\n');
|
||||
mass = ParticleTable::getRealMass(A[i], Z[i]);
|
||||
}
|
||||
|
||||
const Double_t ETot = EKin[i] + mass;
|
||||
const Double_t ETotPrime = gamma*(ETot - beta*pz[i]);
|
||||
EKinPrime[i] = ETotPrime - mass;
|
||||
pzPrime[i] = -gamma*(pz[i] - beta*ETot);
|
||||
const Double_t pPrime = std::sqrt(px[i]*px[i] + py[i]*py[i] + pzPrime[i]*pzPrime[i]);
|
||||
const Double_t cosThetaPrime = pzPrime[i]/pPrime;
|
||||
const Double_t cosThetaPrime = (pPrime>0.) ? (pzPrime[i]/pPrime) : 1.;
|
||||
if(cosThetaPrime>=1.)
|
||||
thetaPrime[i] = 0.;
|
||||
else if(cosThetaPrime<=-1.)
|
||||
thetaPrime[i] = 180.;
|
||||
else
|
||||
thetaPrime[i] = 180.*std::acos(cosThetaPrime)/Math::pi;
|
||||
thetaPrime[i] = Math::toDegrees(Math::arcCos(cosThetaPrime));
|
||||
}
|
||||
}
|
||||
#endif // INCL_INVERSE_KINEMATICS
|
||||
@@ -95,8 +105,8 @@ namespace G4INCL {
|
||||
pznorm = 1.;
|
||||
else if(pznorm<-1.)
|
||||
pznorm = -1.;
|
||||
theta[nParticles] = 180.*std::acos(pznorm)/G4INCL::Math::pi;
|
||||
phi[nParticles] = 180.*std::atan2(pyRem[remnantIndex],pxRem[remnantIndex])/G4INCL::Math::pi;
|
||||
theta[nParticles] = Math::toDegrees(Math::arcCos(pznorm));
|
||||
phi[nParticles] = Math::toDegrees(std::atan2(pyRem[remnantIndex],pxRem[remnantIndex]));
|
||||
|
||||
EKin[nParticles] = EKinRem[remnantIndex];
|
||||
origin[nParticles] = -1; // Origin: cascade
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -38,16 +39,24 @@
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
FinalState::FinalState() :
|
||||
totalEnergyBeforeInteraction(0.0), validity(ValidFS),
|
||||
blockedDelta(NULL)
|
||||
{
|
||||
FinalState::FinalState() {
|
||||
reset();
|
||||
}
|
||||
|
||||
FinalState::~FinalState()
|
||||
{
|
||||
}
|
||||
|
||||
void FinalState::reset() {
|
||||
totalEnergyBeforeInteraction = 0.0;
|
||||
validity = ValidFS;
|
||||
outgoing.clear();
|
||||
created.clear();
|
||||
destroyed.clear();
|
||||
modified.clear();
|
||||
entering.clear();
|
||||
}
|
||||
|
||||
void FinalState::addModifiedParticle(Particle *p)
|
||||
{
|
||||
modified.push_back(p);
|
||||
@@ -100,19 +109,19 @@ namespace G4INCL {
|
||||
|
||||
std::string FinalState::print() const {
|
||||
std::stringstream ss;
|
||||
ss << "Modified particles:" << std::endl;
|
||||
ss << "Modified particles:" << '\n';
|
||||
for(ParticleIter iter=modified.begin(), e=modified.end(); iter!=e; ++iter)
|
||||
ss << (*iter)->print();
|
||||
ss << "Outgoing particles:" << std::endl;
|
||||
ss << "Outgoing particles:" << '\n';
|
||||
for(ParticleIter iter=outgoing.begin(), e=outgoing.end(); iter!=e; ++iter)
|
||||
ss << (*iter)->print();
|
||||
ss << "Destroyed particles:" << std::endl;
|
||||
ss << "Destroyed particles:" << '\n';
|
||||
for(ParticleIter iter=destroyed.begin(), e=destroyed.end(); iter!=e; ++iter)
|
||||
ss << (*iter)->print();
|
||||
ss << "Created particles:" << std::endl;
|
||||
ss << "Created particles:" << '\n';
|
||||
for(ParticleIter iter=created.begin(), e=created.end(); iter!=e; ++iter)
|
||||
ss << (*iter)->print();
|
||||
ss << "Entering particles:" << std::endl;
|
||||
ss << "Entering particles:" << '\n';
|
||||
for(ParticleIter iter=entering.begin(), e=entering.end(); iter!=e; ++iter)
|
||||
ss << (*iter)->print();
|
||||
return ss.str();
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -36,6 +37,9 @@
|
||||
|
||||
#include "G4INCLGlobals.hh"
|
||||
#include "G4INCLParticle.hh"
|
||||
#ifdef HAVE_WORDEXP
|
||||
#include <wordexp.h>
|
||||
#endif
|
||||
|
||||
namespace G4INCL {
|
||||
namespace Math {
|
||||
@@ -50,6 +54,21 @@ namespace G4INCL {
|
||||
const G4double gcdfa5 = 1.061405429;
|
||||
const G4double gcdfp = 0.3275911;
|
||||
|
||||
// constants for the inverse Gaussian CDF approximation
|
||||
const G4double igcdfc1 = 2.515517;
|
||||
const G4double igcdfc2 = 0.802853;
|
||||
const G4double igcdfc3 = 0.010328;
|
||||
const G4double igcdfd1 = 1.432788;
|
||||
const G4double igcdfd2 = 0.189269;
|
||||
const G4double igcdfd3 = 0.001308;
|
||||
|
||||
G4double inverseGaussianCDFRational(const G4double t) {
|
||||
// Abramowitz and Stegun formula 26.2.23.
|
||||
// The absolute value of the error should be less than 4.5 e-4.
|
||||
return t - ((igcdfc3*t + igcdfc2)*t + igcdfc1) /
|
||||
(((igcdfd3*t + igcdfd2)*t + igcdfd1)*t + 1.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
G4double gaussianCDF(const G4double x)
|
||||
@@ -68,6 +87,23 @@ namespace G4INCL {
|
||||
G4double gaussianCDF(const G4double x, const G4double x0, const G4double sigma) {
|
||||
return gaussianCDF((x-x0)/sigma);
|
||||
}
|
||||
|
||||
G4double inverseGaussianCDF(G4double x) {
|
||||
if (x < 0.5)
|
||||
return -inverseGaussianCDFRational( std::sqrt(-2.0*std::log(x)) );
|
||||
else
|
||||
return inverseGaussianCDFRational( std::sqrt(-2.0*std::log(1.-x)) );
|
||||
}
|
||||
|
||||
G4double arcSin(const G4double x) {
|
||||
// assert(x>-1.000001 && x<1.000001);
|
||||
return ((x > 1.) ? 0. : ((x<-1.) ? pi : std::asin(x)));
|
||||
}
|
||||
|
||||
G4double arcCos(const G4double x) {
|
||||
// assert(x>-1.000001 && x<1.000001);
|
||||
return ((x > 1.) ? 0. : ((x<-1.) ? pi : std::acos(x)));
|
||||
}
|
||||
}
|
||||
|
||||
namespace ParticleConfig {
|
||||
@@ -110,7 +146,43 @@ namespace G4INCL {
|
||||
cur_max_pos += to_len - from_len;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> tokenize(std::string const &str, const std::string &delimiters) {
|
||||
size_t startPos = 0, endPos;
|
||||
std::vector<std::string> tokens;
|
||||
do {
|
||||
endPos = str.find_first_of(delimiters, startPos);
|
||||
std::string token = str.substr(startPos, endPos-startPos);
|
||||
tokens.push_back(token);
|
||||
startPos = str.find_first_not_of(delimiters, endPos);
|
||||
} while(endPos!=std::string::npos);
|
||||
|
||||
return tokens;
|
||||
}
|
||||
|
||||
G4bool isInteger(std::string const &str) {
|
||||
const size_t pos = str.find_first_not_of("0123456789");
|
||||
return (pos==std::string::npos);
|
||||
}
|
||||
|
||||
std::string expandPath(std::string const &path) {
|
||||
#ifdef HAVE_WORDEXP
|
||||
wordexp_t expansionResult;
|
||||
std::string result;
|
||||
G4int err = wordexp(path.c_str(), &expansionResult, WRDE_NOCMD);
|
||||
if(err)
|
||||
result = path;
|
||||
else
|
||||
result = expansionResult.we_wordv[0];
|
||||
wordfree(&expansionResult);
|
||||
return result;
|
||||
#else
|
||||
// no-op if wordexp.h is not found
|
||||
return path;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif // INCLXX_IN_GEANT4_MODE
|
||||
|
||||
}
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -66,12 +67,13 @@ namespace G4INCL {
|
||||
}
|
||||
|
||||
IAvatar::~IAvatar() {
|
||||
INCL_DEBUG("destroying avatar " << this << std::endl);
|
||||
}
|
||||
|
||||
std::string IAvatar::toString() {
|
||||
std::stringstream entry;
|
||||
std::stringstream particleString;
|
||||
ParticleList pl = getParticles();
|
||||
ParticleList const &pl = getParticles();
|
||||
G4int numberOfParticles = 0;
|
||||
for(ParticleIter i=pl.begin(), e=pl.end(); i!=e; ++i) {
|
||||
numberOfParticles++;
|
||||
@@ -85,21 +87,24 @@ namespace G4INCL {
|
||||
return entry.str();
|
||||
}
|
||||
|
||||
G4INCL::FinalState* IAvatar::getFinalState()
|
||||
{
|
||||
INCL_DEBUG("Random seeds before preInteraction: " << Random::getSeeds() << std::endl);
|
||||
preInteraction();
|
||||
INCL_DEBUG("Random seeds before getChannel: " << Random::getSeeds() << std::endl);
|
||||
IChannel *c = getChannel();
|
||||
if( !c ) {
|
||||
return NULL;
|
||||
}
|
||||
INCL_DEBUG("Random seeds before getFinalState: " << Random::getSeeds() << std::endl);
|
||||
FinalState *fs = c->getFinalState();
|
||||
INCL_DEBUG("Random seeds before postInteraction: " << Random::getSeeds() << std::endl);
|
||||
fs = postInteraction(fs);
|
||||
delete c;
|
||||
FinalState *IAvatar::getFinalState() {
|
||||
FinalState *fs = new FinalState;
|
||||
fillFinalState(fs);
|
||||
return fs;
|
||||
}
|
||||
|
||||
void IAvatar::fillFinalState(FinalState *fs) {
|
||||
INCL_DEBUG("Random seeds before preInteraction: " << Random::getSeeds() << '\n');
|
||||
preInteraction();
|
||||
INCL_DEBUG("Random seeds before getChannel: " << Random::getSeeds() << '\n');
|
||||
IChannel *c = getChannel();
|
||||
if( !c )
|
||||
return;
|
||||
INCL_DEBUG("Random seeds before getFinalState: " << Random::getSeeds() << '\n');
|
||||
c->fillFinalState(fs);
|
||||
INCL_DEBUG("Random seeds before postInteraction: " << Random::getSeeds() << '\n');
|
||||
postInteraction(fs);
|
||||
delete c;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-9
@@ -24,23 +24,33 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
/*
|
||||
* ThreeVector.cc
|
||||
* \file G4INCLIChannel.cc
|
||||
*
|
||||
* \date 4 June 2009
|
||||
* \author Pekka Kaitaniemi
|
||||
* \date 2nd October 2014
|
||||
* \author Davide Mancusi
|
||||
*/
|
||||
|
||||
#include "G4INCLThreeVector.hh"
|
||||
#include "G4INCLIChannel.hh"
|
||||
#include "G4INCLFinalState.hh"
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
FinalState *IChannel::getFinalState() {
|
||||
FinalState *fs = new FinalState;
|
||||
fillFinalState(fs);
|
||||
return fs;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -46,7 +47,7 @@
|
||||
#include <cstdlib>
|
||||
#include "G4INCLIFunction1D.hh"
|
||||
#include "G4INCLLogger.hh"
|
||||
#include "G4INCLInverseInterpolationTable.hh"
|
||||
#include "G4INCLInvFInterpolationTable.hh"
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
@@ -119,27 +120,31 @@ namespace G4INCL {
|
||||
return thePrimitive;
|
||||
}
|
||||
|
||||
InverseInterpolationTable *IFunction1D::inverseCDFTable(const G4int nNodes) const {
|
||||
InterpolationTable *IFunction1D::inverseCDFTable(IFunction1D::ManipulatorFunc fWrap, const G4int nNodes) const {
|
||||
class InverseCDF : public IFunction1D {
|
||||
public:
|
||||
InverseCDF(IFunction1D const * const f) :
|
||||
InverseCDF(IFunction1D const * const f, ManipulatorFunc fw) :
|
||||
IFunction1D(f->getXMinimum(), f->getXMaximum()),
|
||||
theFunction(f),
|
||||
normalisation(1./theFunction->integrate(xMin,xMax))
|
||||
normalisation(1./theFunction->integrate(xMin,xMax)),
|
||||
fWrap(fw)
|
||||
{}
|
||||
|
||||
G4double operator()(const G4double x) const {
|
||||
return std::min(1., normalisation * theFunction->integrate(xMin,x));
|
||||
if(fWrap)
|
||||
return fWrap(std::min(1., normalisation * theFunction->integrate(xMin,x)));
|
||||
else
|
||||
return std::min(1., normalisation * theFunction->integrate(xMin,x));
|
||||
}
|
||||
private:
|
||||
IFunction1D const * const theFunction;
|
||||
const G4double normalisation;
|
||||
} *theInverseCDF = new InverseCDF(this);
|
||||
ManipulatorFunc fWrap;
|
||||
} *theInverseCDF = new InverseCDF(this, fWrap);
|
||||
|
||||
InverseInterpolationTable *theTable = new InverseInterpolationTable(*theInverseCDF, nNodes);
|
||||
InterpolationTable *theTable = new InvFInterpolationTable(*theInverseCDF, nNodes);
|
||||
delete theInverseCDF;
|
||||
return theTable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
+32
-58
@@ -24,76 +24,61 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
/** \file G4INCLInverseInterpolationTable.cc
|
||||
* \brief Simple interpolation table for the inverse of a IFunction1D functor
|
||||
/** \file G4INCLInterpolationTable.cc
|
||||
* \brief Simple interpolation table
|
||||
*
|
||||
* \date 17 July 2012
|
||||
* \date 30 January 2014
|
||||
* \author Davide Mancusi
|
||||
*/
|
||||
|
||||
// #include <cassert>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include "G4INCLInverseInterpolationTable.hh"
|
||||
#include "G4INCLInterpolationTable.hh"
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
InverseInterpolationTable::InverseInterpolationTable(IFunction1D const &f, const unsigned int nNodes) {
|
||||
// assert(nNodes>2);
|
||||
InterpolationTable::InterpolationTable() : IFunction1D() {}
|
||||
|
||||
const G4double x0 = f.getXMinimum();
|
||||
const G4double x1 = f.getXMaximum();
|
||||
|
||||
// Build the nodes
|
||||
G4double last = f(x0);
|
||||
InterpolationNode firstNode(last, x0, 0.);
|
||||
nodes.push_back(firstNode);
|
||||
G4int skippedNodes = 0;
|
||||
for(unsigned i = 1; i < nNodes; i++) {
|
||||
const G4double xi = x0 + i*(x1-x0)/((G4double)(nNodes-1));
|
||||
// Make sure that the x vector is sorted (corresponding to a monotonous
|
||||
// function)
|
||||
const G4double value = f(xi);
|
||||
if(value <= last) {
|
||||
++skippedNodes;
|
||||
continue;
|
||||
}
|
||||
InterpolationNode node(value, xi, 0.);
|
||||
nodes.push_back(node);
|
||||
last = value;
|
||||
}
|
||||
|
||||
// assert(nNodes==nodes.size()+skippedNodes);
|
||||
|
||||
// Initialise the "derivative" values
|
||||
initDerivatives();
|
||||
setFunctionDomain();
|
||||
}
|
||||
|
||||
InverseInterpolationTable::InverseInterpolationTable(std::vector<G4double> const &x, std::vector<G4double> const &y) {
|
||||
InterpolationTable::InterpolationTable(std::vector<G4double> const &x, std::vector<G4double> const &y)
|
||||
: IFunction1D(x.front(), x.back())
|
||||
{
|
||||
// assert(x.size()==y.size());
|
||||
// Assert that the x vector is sorted (corresponding to a monotonous
|
||||
// function
|
||||
// Assert that the x vector is sorted
|
||||
// assert(std::adjacent_find(nodes.begin(), nodes.end(), std::greater<InterpolationNode>()) == nodes.end());
|
||||
|
||||
for(unsigned i = 0; i < x.size(); ++i)
|
||||
nodes.push_back(InterpolationNode(x.at(i), y.at(i), 0.));
|
||||
|
||||
initDerivatives();
|
||||
setFunctionDomain();
|
||||
}
|
||||
|
||||
void InverseInterpolationTable::initDerivatives() {
|
||||
std::vector<G4double> InterpolationTable::getNodeAbscissae() const {
|
||||
std::vector<G4double> x(nodes.size());
|
||||
std::transform(nodes.begin(), nodes.end(), x.begin(),
|
||||
std::mem_fun_ref(&InterpolationNode::getX));
|
||||
return x;
|
||||
}
|
||||
|
||||
std::vector<G4double> InterpolationTable::getNodeValues() const {
|
||||
std::vector<G4double> y(nodes.size());
|
||||
std::transform(nodes.begin(), nodes.end(), y.begin(),
|
||||
std::mem_fun_ref(&InterpolationNode::getY));
|
||||
return y;
|
||||
}
|
||||
|
||||
void InterpolationTable::initDerivatives() {
|
||||
for(unsigned i = 0; i < nodes.size()-1; i++) {
|
||||
if((nodes.at(i+1).getX() - nodes.at(i).getX()) == 0.0) // Safeguard against division by zero
|
||||
nodes[i].setYPrime(0.0);
|
||||
@@ -103,18 +88,7 @@ namespace G4INCL {
|
||||
nodes.back().setYPrime(nodes.at(nodes.size()-2).getYPrime()); // Duplicate the last value
|
||||
}
|
||||
|
||||
void InverseInterpolationTable::setFunctionDomain() {
|
||||
// Set the function domain
|
||||
if(nodes.front()>nodes.back()) {
|
||||
xMin = nodes.back().getX();
|
||||
xMax = nodes.front().getX();
|
||||
} else {
|
||||
xMin = nodes.front().getX();
|
||||
xMax = nodes.back().getX();
|
||||
}
|
||||
}
|
||||
|
||||
G4double InverseInterpolationTable::operator()(const G4double x) const {
|
||||
G4double InterpolationTable::operator()(const G4double x) const {
|
||||
// Find the relevant interpolation bin
|
||||
InterpolationNode xNode(x,0.,0.);
|
||||
std::vector<InterpolationNode>::const_iterator iter =
|
||||
@@ -131,7 +105,7 @@ namespace G4INCL {
|
||||
return previousIter->getY() + previousIter->getYPrime()*dx;
|
||||
}
|
||||
|
||||
std::string InverseInterpolationTable::print() const {
|
||||
std::string InterpolationTable::print() const {
|
||||
std::string message;
|
||||
for(std::vector<InterpolationNode>::const_iterator n=nodes.begin(), e=nodes.end(); n!=e; ++n)
|
||||
message += n->print();
|
||||
@@ -0,0 +1,83 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
/** \file G4INCLInvFInterpolationTable.cc
|
||||
* \brief Simple interpolation table for the inverse of a IFunction1D functor
|
||||
*
|
||||
* \date 17 July 2012
|
||||
* \author Davide Mancusi
|
||||
*/
|
||||
|
||||
// #include <cassert>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include "G4INCLInvFInterpolationTable.hh"
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
InvFInterpolationTable::InvFInterpolationTable(IFunction1D const &f, const unsigned int nNodes) {
|
||||
// assert(nNodes>2);
|
||||
|
||||
const G4double x0 = f.getXMinimum();
|
||||
const G4double x1 = f.getXMaximum();
|
||||
|
||||
// Build the nodes
|
||||
G4double last = f(x0);
|
||||
InterpolationNode firstNode(last, x0, 0.);
|
||||
nodes.push_back(firstNode);
|
||||
G4int skippedNodes = 0;
|
||||
for(unsigned i = 1; i < nNodes; i++) {
|
||||
const G4double xi = x0 + i*(x1-x0)/((G4double)(nNodes-1));
|
||||
// Make sure that the x vector is sorted (corresponding to a monotonous
|
||||
// function)
|
||||
const G4double value = f(xi);
|
||||
if(value <= last) {
|
||||
++skippedNodes;
|
||||
continue;
|
||||
}
|
||||
InterpolationNode node(value, xi, 0.);
|
||||
nodes.push_back(node);
|
||||
last = value;
|
||||
}
|
||||
|
||||
// assert(nNodes==nodes.size()+skippedNodes);
|
||||
|
||||
// Initialise the "derivative" values
|
||||
initDerivatives();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -60,23 +61,21 @@ namespace G4INCL {
|
||||
return std::string("Unknown");
|
||||
}
|
||||
|
||||
void LoggerSlave::logMessage(const MessageType type, const std::string &fileName, const G4int lineNumber, std::string const &s) const {
|
||||
if(type==InfoMsg) {
|
||||
(*logStream) << s;
|
||||
return;
|
||||
void LoggerSlave::logMessage(const MessageType type, const std::string &fileName, const G4int lineNumber, std::string const &s, const G4bool prefixHash) const {
|
||||
std::string cont = (prefixHash ? "\n# " : "\n");
|
||||
std::string header = (prefixHash ? "# " : "");
|
||||
if(type!=InfoMsg) {
|
||||
std::stringstream headerss;
|
||||
headerss << typeToString(type) << " [";
|
||||
cont += headerss.str();
|
||||
headerss <<
|
||||
fileName.substr(fileName.find_last_of("/")+1) <<
|
||||
":" << lineNumber << "] ";
|
||||
header += headerss.str();
|
||||
cont.append(header.size() - cont.size() - 1, '.');
|
||||
cont += "] ";
|
||||
}
|
||||
|
||||
std::stringstream headerss;
|
||||
headerss << typeToString(type) << " [";
|
||||
std::string cont("\n");
|
||||
cont += headerss.str();
|
||||
headerss <<
|
||||
fileName.substr(fileName.find_last_of("/")+1) <<
|
||||
":" << lineNumber << "] ";
|
||||
std::string header = headerss.str();
|
||||
cont.append(header.size() - cont.size() - 1, '.');
|
||||
cont += "] ";
|
||||
|
||||
std::string message(s);
|
||||
String::replaceAll(message, "\n", cont, s.size()-2);
|
||||
(*logStream) << header << message;
|
||||
@@ -87,10 +86,10 @@ namespace G4INCL {
|
||||
void LoggerSlave::logDataBlock(const std::string &block, const std::string &fileName, const G4int lineNumber) const {
|
||||
(*logStream) << typeToString(DataBlockMsg) << " [" <<
|
||||
fileName.substr(fileName.find_last_of("/")+1) <<
|
||||
":" << lineNumber << "] " << std::endl
|
||||
":" << lineNumber << "] " << '\n'
|
||||
<< "BEGINDATA"
|
||||
<< block
|
||||
<< "ENDDATA" << std::endl;
|
||||
<< "ENDDATA" << '\n';
|
||||
}
|
||||
|
||||
namespace Logger {
|
||||
@@ -99,11 +98,15 @@ namespace G4INCL {
|
||||
G4ThreadLocal LoggerSlave *theLoggerSlave = NULL;
|
||||
}
|
||||
|
||||
void logMessage(const MessageType type, std::string const &fileName, const G4int lineNumber, std::string const &s) {
|
||||
theLoggerSlave->logMessage(type, fileName, lineNumber, s);
|
||||
void logMessage(const MessageType type, std::string const &fileName, const G4int lineNumber, std::string const &s, const G4bool prefixHash) {
|
||||
if(theLoggerSlave)
|
||||
theLoggerSlave->logMessage(type, fileName, lineNumber, s, prefixHash);
|
||||
}
|
||||
|
||||
void flush() { theLoggerSlave->flush(); }
|
||||
void flush() {
|
||||
if(theLoggerSlave)
|
||||
theLoggerSlave->flush();
|
||||
}
|
||||
|
||||
void dataBlock(const std::string &block, const std::string &fileName, const G4int lineNumber) {
|
||||
theLoggerSlave->logDataBlock(block, fileName, lineNumber);
|
||||
@@ -111,15 +114,27 @@ namespace G4INCL {
|
||||
|
||||
void setLoggerSlave(LoggerSlave * const logger) { theLoggerSlave = logger; }
|
||||
|
||||
void setVerbosityLevel(G4int lvl) { theLoggerSlave->setVerbosityLevel(lvl); }
|
||||
void setVerbosityLevel(G4int lvl) {
|
||||
if(theLoggerSlave)
|
||||
theLoggerSlave->setVerbosityLevel(lvl);
|
||||
}
|
||||
|
||||
G4int getVerbosityLevel() { return theLoggerSlave->getVerbosityLevel(); }
|
||||
G4int getVerbosityLevel() {
|
||||
if(theLoggerSlave)
|
||||
return theLoggerSlave->getVerbosityLevel();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void deleteLoggerSlave() {
|
||||
delete theLoggerSlave;
|
||||
theLoggerSlave=NULL;
|
||||
}
|
||||
|
||||
void initialize(Config const * const theConfig) {
|
||||
setLoggerSlave(new LoggerSlave(theConfig->getLogFileName(), theConfig->getVerbosity()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#else // defined(INCL_DEBUG_LOG) && !defined(INCLXX_IN_GEANT4_MODE)
|
||||
|
||||
+9
-7
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -43,6 +44,7 @@
|
||||
|
||||
#include "G4INCLNaturalIsotopicDistributions.hh"
|
||||
#include "G4INCLRandom.hh"
|
||||
#include "G4INCLLogger.hh"
|
||||
// #include <cassert>
|
||||
#include <utility>
|
||||
#include <iostream>
|
||||
@@ -87,7 +89,7 @@ namespace G4INCL {
|
||||
if(i!=theDistributions.end())
|
||||
return i->second;
|
||||
else {
|
||||
INCL_FATAL("Requested natural isotopic distribution for synthetic element Z = " << Z << std::endl);
|
||||
INCL_FATAL("Requested natural isotopic distribution for synthetic element Z = " << Z << '\n');
|
||||
return theDistributions.begin()->second;
|
||||
}
|
||||
}
|
||||
@@ -388,7 +390,7 @@ namespace G4INCL {
|
||||
};
|
||||
|
||||
// Cool hack to get the size of an array in C++
|
||||
template<typename T, ::std::size_t N> inline ::std::size_t sizeOfArray(const T(&)[ N ] ) {
|
||||
template<typename T, ::std::size_t N> ::std::size_t sizeOfArray(const T(&)[ N ] ) {
|
||||
return N;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -124,12 +125,12 @@ namespace G4INCL {
|
||||
|
||||
// File name
|
||||
std::string fileName(path + "/walletlifetime.dat");
|
||||
INCL_DEBUG("Reading real nuclear masses from file " << fileName << std::endl);
|
||||
INCL_DEBUG("Reading real nuclear masses from file " << fileName << '\n');
|
||||
|
||||
// Open the file stream
|
||||
std::ifstream massTableIn(fileName.c_str());
|
||||
if(!massTableIn.good()) {
|
||||
std::cerr << "Cannot open " << fileName << " data file." << std::endl;
|
||||
std::cerr << "Cannot open " << fileName << " data file." << '\n';
|
||||
std::abort();
|
||||
return;
|
||||
}
|
||||
@@ -142,11 +143,11 @@ namespace G4INCL {
|
||||
records.push_back(record);
|
||||
}
|
||||
massTableIn.close();
|
||||
INCL_DEBUG("Read " << records.size() << " nuclear masses" << std::endl);
|
||||
INCL_DEBUG("Read " << records.size() << " nuclear masses" << '\n');
|
||||
|
||||
// determine the max A
|
||||
AMax = std::max_element(records.begin(), records.end(), compareA)->A;
|
||||
INCL_DEBUG("Max A in nuclear-mass table = " << AMax << std::endl);
|
||||
INCL_DEBUG("Max A in nuclear-mass table = " << AMax << '\n');
|
||||
ZMaxArray = new G4int[AMax+1];
|
||||
std::fill(ZMaxArray, ZMaxArray+AMax+1, 0);
|
||||
theTable = new G4double*[AMax+1];
|
||||
@@ -173,7 +174,7 @@ namespace G4INCL {
|
||||
if(A>AMax || Z>ZMaxArray[A]) {
|
||||
INCL_DEBUG("Real mass unavailable for isotope A=" << A << ", Z=" << Z
|
||||
<< ", using Weizsaecker's formula"
|
||||
<< std::endl);
|
||||
<< '\n');
|
||||
return getWeizsaeckerMass(A,Z);
|
||||
}
|
||||
|
||||
@@ -181,7 +182,7 @@ namespace G4INCL {
|
||||
if(mass<0.) {
|
||||
INCL_DEBUG("Real mass unavailable for isotope A=" << A << ", Z=" << Z
|
||||
<< ", using Weizsaecker's formula"
|
||||
<< std::endl);
|
||||
<< '\n');
|
||||
return getWeizsaeckerMass(A,Z);
|
||||
} else
|
||||
return mass;
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -93,7 +94,7 @@ namespace G4INCL {
|
||||
ID = nextID;
|
||||
nextID++;
|
||||
if(theEnergy <= 0.0) {
|
||||
INCL_WARN("Particle with energy " << theEnergy << " created." << std::endl);
|
||||
INCL_WARN("Particle with energy " << theEnergy << " created." << '\n');
|
||||
}
|
||||
setType(t);
|
||||
setMass(getInvariantMass());
|
||||
@@ -118,7 +119,7 @@ namespace G4INCL {
|
||||
nextID++;
|
||||
setType(t);
|
||||
if( isResonance() ) {
|
||||
INCL_ERROR("Cannot create resonance without specifying its momentum four-vector." << std::endl);
|
||||
INCL_ERROR("Cannot create resonance without specifying its momentum four-vector." << '\n');
|
||||
}
|
||||
G4double energy = std::sqrt(theMomentum.mag2() + theMass*theMass);
|
||||
theEnergy = energy;
|
||||
@@ -129,7 +130,7 @@ namespace G4INCL {
|
||||
const G4double p2 = theMomentum.mag2();
|
||||
G4double newp2 = theEnergy*theEnergy - theMass*theMass;
|
||||
if( newp2<0.0 ) {
|
||||
INCL_ERROR("Particle has E^2 < m^2." << std::endl << print());
|
||||
INCL_ERROR("Particle has E^2 < m^2." << '\n' << print());
|
||||
newp2 = 0.0;
|
||||
theEnergy = theMass;
|
||||
}
|
||||
@@ -142,4 +143,28 @@ namespace G4INCL {
|
||||
theEnergy = std::sqrt(theMomentum.mag2() + theMass*theMass);
|
||||
return theEnergy;
|
||||
}
|
||||
|
||||
void ParticleList::rotatePositionAndMomentum(const G4double angle, const ThreeVector &axis) const {
|
||||
for(const_iterator i=begin(), e=end(); i!=e; ++i) {
|
||||
(*i)->rotatePositionAndMomentum(angle, axis);
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleList::rotatePosition(const G4double angle, const ThreeVector &axis) const {
|
||||
for(const_iterator i=begin(), e=end(); i!=e; ++i) {
|
||||
(*i)->rotatePosition(angle, axis);
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleList::rotateMomentum(const G4double angle, const ThreeVector &axis) const {
|
||||
for(const_iterator i=begin(), e=end(); i!=e; ++i) {
|
||||
(*i)->rotateMomentum(angle, axis);
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleList::boost(const ThreeVector &b) const {
|
||||
for(const_iterator i=begin(), e=end(); i!=e; ++i) {
|
||||
(*i)->boost(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -243,13 +244,16 @@ namespace G4INCL {
|
||||
|
||||
G4ThreadLocal G4double rpCorrelationCoefficient[UnknownParticle];
|
||||
|
||||
G4ThreadLocal G4double neutronSkinThickness = 0.0;
|
||||
G4ThreadLocal G4double neutronSkinAdditionalDiffuseness = 0.0;
|
||||
G4ThreadLocal G4double neutronSkin = 0.0;
|
||||
G4ThreadLocal G4double neutronHalo = 0.0;
|
||||
|
||||
#ifdef INCLXX_IN_GEANT4_MODE
|
||||
G4ThreadLocal G4IonTable *theG4IonTable;
|
||||
#endif
|
||||
|
||||
/// \brief Default value for constant Fermi momentum
|
||||
G4ThreadLocal G4double constantFermiMomentum = 0.0;
|
||||
|
||||
/// \brief Transform a IUPAC char to an char representing an integer digit
|
||||
char iupacToInt(char c) {
|
||||
return (char)(((G4int)'0')+elementIUPACDigits.find(c));
|
||||
@@ -298,7 +302,9 @@ namespace G4INCL {
|
||||
theRealPiZeroMass = theG4ParticleTable->FindParticle("pi0")->GetPDGMass() / MeV;
|
||||
#endif
|
||||
|
||||
effectiveDeltaDecayThreshold = theRealNeutronMass + theRealChargedPiMass + 0.5;
|
||||
minDeltaMass = theRealNeutronMass + theRealChargedPiMass + 0.5;
|
||||
minDeltaMass2 = minDeltaMass*minDeltaMass;
|
||||
minDeltaMassRndm = std::atan((minDeltaMass-effectiveDeltaMass)*2./effectiveDeltaWidth);
|
||||
|
||||
// Initialise the separation-energy function
|
||||
if(!theConfig || theConfig->getSeparationEnergyType()==INCLSeparationEnergy)
|
||||
@@ -308,21 +314,28 @@ namespace G4INCL {
|
||||
else if(theConfig->getSeparationEnergyType()==RealForLightSeparationEnergy)
|
||||
getSeparationEnergy = getSeparationEnergyRealForLight;
|
||||
else {
|
||||
INCL_FATAL("Unrecognized separation-energy type in ParticleTable initialization: " << theConfig->getSeparationEnergyType() << std::endl);
|
||||
std::abort();
|
||||
INCL_FATAL("Unrecognized separation-energy type in ParticleTable initialization: " << theConfig->getSeparationEnergyType() << '\n');
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialise the Fermi-momentum function
|
||||
if(!theConfig || theConfig->getFermiMomentumType()==ConstantFermiMomentum)
|
||||
if(!theConfig || theConfig->getFermiMomentumType()==ConstantFermiMomentum) {
|
||||
getFermiMomentum = ParticleTable::getFermiMomentumConstant;
|
||||
else if(theConfig->getFermiMomentumType()==ConstantLightFermiMomentum)
|
||||
if(theConfig) {
|
||||
const G4double aFermiMomentum = theConfig->getFermiMomentum();
|
||||
if(aFermiMomentum>0.)
|
||||
constantFermiMomentum = aFermiMomentum;
|
||||
else
|
||||
constantFermiMomentum = PhysicalConstants::Pf;
|
||||
} else {
|
||||
constantFermiMomentum = PhysicalConstants::Pf;
|
||||
}
|
||||
} else if(theConfig->getFermiMomentumType()==ConstantLightFermiMomentum)
|
||||
getFermiMomentum = ParticleTable::getFermiMomentumConstantLight;
|
||||
else if(theConfig->getFermiMomentumType()==MassDependentFermiMomentum)
|
||||
getFermiMomentum = ParticleTable::getFermiMomentumMassDependent;
|
||||
else {
|
||||
INCL_FATAL("Unrecognized Fermi-momentum type in ParticleTable initialization: " << theConfig->getFermiMomentumType() << std::endl);
|
||||
std::abort();
|
||||
INCL_FATAL("Unrecognized Fermi-momentum type in ParticleTable initialization: " << theConfig->getFermiMomentumType() << '\n');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -335,8 +348,8 @@ namespace G4INCL {
|
||||
|
||||
// Initialise the neutron-skin parameters
|
||||
if(theConfig) {
|
||||
neutronSkinThickness = theConfig->getNeutronSkinThickness();
|
||||
neutronSkinAdditionalDiffuseness = theConfig->getNeutronSkinAdditionalDiffuseness();
|
||||
neutronSkin = theConfig->getNeutronSkin();
|
||||
neutronHalo = theConfig->getNeutronHalo();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -457,7 +470,7 @@ namespace G4INCL {
|
||||
} else if(pt == PiZero) {
|
||||
return piZeroMass;
|
||||
} else {
|
||||
INCL_ERROR("getMass : Unknown particle type." << std::endl);
|
||||
INCL_ERROR("getMass : Unknown particle type." << '\n');
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -478,7 +491,7 @@ namespace G4INCL {
|
||||
return theRealPiZeroMass;
|
||||
break;
|
||||
default:
|
||||
INCL_ERROR("Particle::getRealMass : Unknown particle type." << std::endl);
|
||||
INCL_ERROR("Particle::getRealMass : Unknown particle type." << '\n');
|
||||
return 0.0;
|
||||
break;
|
||||
}
|
||||
@@ -594,7 +607,7 @@ namespace G4INCL {
|
||||
if(thisRMS>0.0)
|
||||
return thisRMS;
|
||||
else {
|
||||
INCL_DEBUG("getNuclearRadius: Radius for nucleus A = " << A << " Z = " << Z << " is not available" << std::endl
|
||||
INCL_DEBUG("getNuclearRadius: Radius for nucleus A = " << A << " Z = " << Z << " is not available" << '\n'
|
||||
<< "returning radius for C12");
|
||||
return positionRMS[6][12];
|
||||
}
|
||||
@@ -603,10 +616,10 @@ namespace G4INCL {
|
||||
const G4double theDiffusenessParameter = getSurfaceDiffuseness(t, A, Z);
|
||||
// The formula yields the nuclear RMS radius based on the parameters of
|
||||
// the nuclear-density function
|
||||
return 1.581*theDiffusenessParameter*
|
||||
(2.+5.*theRadiusParameter)/(2.+3.*theRadiusParameter);
|
||||
return 1.225*theDiffusenessParameter*
|
||||
std::sqrt((2.+5.*theRadiusParameter)/(2.+3.*theRadiusParameter));
|
||||
} else {
|
||||
INCL_ERROR("getNuclearRadius: No radius for nucleus A = " << A << " Z = " << Z << std::endl);
|
||||
INCL_ERROR("getNuclearRadius: No radius for nucleus A = " << A << " Z = " << Z << '\n');
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -621,7 +634,7 @@ namespace G4INCL {
|
||||
// phenomenological radius fit
|
||||
G4double r0 = (2.745e-4 * A + 1.063) * std::pow(A, 1.0/3.0);
|
||||
if(t==Neutron)
|
||||
r0 += neutronSkinThickness;
|
||||
r0 += neutronSkin;
|
||||
return r0;
|
||||
} else if(A < 6 && A >= 2) {
|
||||
if(Z<clusterTableZSize && Z>=0) {
|
||||
@@ -629,12 +642,12 @@ namespace G4INCL {
|
||||
if(thisRMS>0.0)
|
||||
return thisRMS;
|
||||
else {
|
||||
INCL_DEBUG("getRadiusParameter: Radius for nucleus A = " << A << " Z = " << Z << " is not available" << std::endl
|
||||
INCL_DEBUG("getRadiusParameter: Radius for nucleus A = " << A << " Z = " << Z << " is not available" << '\n'
|
||||
<< "returning radius for C12");
|
||||
return positionRMS[6][12];
|
||||
}
|
||||
} else {
|
||||
INCL_DEBUG("getRadiusParameter: Radius for nucleus A = " << A << " Z = " << Z << " is not available" << std::endl
|
||||
INCL_DEBUG("getRadiusParameter: Radius for nucleus A = " << A << " Z = " << Z << " is not available" << '\n'
|
||||
<< "returning radius for C12");
|
||||
return positionRMS[6][12];
|
||||
}
|
||||
@@ -642,7 +655,7 @@ namespace G4INCL {
|
||||
return mediumRadius[A-1];
|
||||
// return 1.581*mediumDiffuseness[A-1]*(2.+5.*mediumRadius[A-1])/(2.+3.*mediumRadius[A-1]);
|
||||
} else {
|
||||
INCL_ERROR("getRadiusParameter: No radius for nucleus A = " << A << " Z = " << Z << std::endl);
|
||||
INCL_ERROR("getRadiusParameter: No radius for nucleus A = " << A << " Z = " << Z << '\n');
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -656,7 +669,7 @@ namespace G4INCL {
|
||||
} else if(A >= 2) {
|
||||
return getNuclearRadius(t, A, Z) + 4.5;
|
||||
} else {
|
||||
INCL_ERROR("getMaximumNuclearRadius : No maximum radius for nucleus A = " << A << " Z = " << Z << std::endl);
|
||||
INCL_ERROR("getMaximumNuclearRadius : No maximum radius for nucleus A = " << A << " Z = " << Z << '\n');
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -665,17 +678,17 @@ namespace G4INCL {
|
||||
if(A >= 28) {
|
||||
G4double a = 1.63e-4 * A + 0.510;
|
||||
if(t==Neutron)
|
||||
a += neutronSkinAdditionalDiffuseness;
|
||||
a += neutronHalo;
|
||||
return a;
|
||||
} else if(A < 28 && A >= 19) {
|
||||
return mediumDiffuseness[A-1];
|
||||
} else if(A < 19 && A >= 6) {
|
||||
return mediumDiffuseness[A-1];
|
||||
} else if(A < 6 && A >= 2) {
|
||||
INCL_ERROR("getSurfaceDiffuseness: was called for A = " << A << " Z = " << Z << std::endl);
|
||||
INCL_ERROR("getSurfaceDiffuseness: was called for A = " << A << " Z = " << Z << '\n');
|
||||
return 0.0;
|
||||
} else {
|
||||
INCL_ERROR("getSurfaceDiffuseness: No diffuseness for nucleus A = " << A << " Z = " << Z << std::endl);
|
||||
INCL_ERROR("getSurfaceDiffuseness: No diffuseness for nucleus A = " << A << " Z = " << Z << '\n');
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -691,7 +704,7 @@ namespace G4INCL {
|
||||
else if(t==Neutron)
|
||||
return theINCLNeutronSeparationEnergy;
|
||||
else {
|
||||
INCL_ERROR("ParticleTable::getSeparationEnergyINCL : Unknown particle type." << std::endl);
|
||||
INCL_ERROR("ParticleTable::getSeparationEnergyINCL : Unknown particle type." << '\n');
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -703,7 +716,7 @@ namespace G4INCL {
|
||||
else if(t==Neutron)
|
||||
return (*getTableParticleMass)(Neutron) + (*getTableMass)(A-1,Z) - (*getTableMass)(A,Z);
|
||||
else {
|
||||
INCL_ERROR("ParticleTable::getSeparationEnergyReal : Unknown particle type." << std::endl);
|
||||
INCL_ERROR("ParticleTable::getSeparationEnergyReal : Unknown particle type." << '\n');
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
@@ -726,7 +739,7 @@ namespace G4INCL {
|
||||
|
||||
std::string getElementName(const G4int Z) {
|
||||
if(Z<1) {
|
||||
INCL_WARN("getElementName called with Z<1" << std::endl);
|
||||
INCL_WARN("getElementName called with Z<1" << '\n');
|
||||
return elementTable[0];
|
||||
} else if(Z<elementTableSize)
|
||||
return elementTable[Z];
|
||||
@@ -778,7 +791,7 @@ namespace G4INCL {
|
||||
}
|
||||
|
||||
G4double getFermiMomentumConstant(const G4int /*A*/, const G4int /*Z*/) {
|
||||
return PhysicalConstants::Pf;
|
||||
return constantFermiMomentum;
|
||||
}
|
||||
|
||||
G4double getFermiMomentumConstantLight(const G4int A, const G4int Z) {
|
||||
@@ -803,16 +816,57 @@ namespace G4INCL {
|
||||
return rpCorrelationCoefficient[t];
|
||||
}
|
||||
|
||||
G4double getNeutronSkinThickness() { return neutronSkinThickness; }
|
||||
G4double getNeutronSkin() { return neutronSkin; }
|
||||
|
||||
G4double getNeutronSkinAdditionalDiffuseness() { return neutronSkinAdditionalDiffuseness; }
|
||||
G4double getNeutronHalo() { return neutronHalo; }
|
||||
|
||||
G4ThreadLocal G4double effectiveDeltaDecayThreshold = 0.;
|
||||
G4ThreadLocal G4double minDeltaMass = 0.;
|
||||
G4ThreadLocal G4double minDeltaMass2 = 0.;
|
||||
G4ThreadLocal G4double minDeltaMassRndm = 0.;
|
||||
G4ThreadLocal NuclearMassFn getTableMass = NULL;
|
||||
G4ThreadLocal ParticleMassFn getTableParticleMass = NULL;
|
||||
G4ThreadLocal SeparationEnergyFn getSeparationEnergy = NULL;
|
||||
G4ThreadLocal FermiMomentumFn getFermiMomentum = NULL;
|
||||
|
||||
ParticleType getPionType(const G4int isosp) {
|
||||
// assert(isosp == -2 || isosp == 0 || isosp == 2);
|
||||
if (isosp == -2) {
|
||||
return PiMinus;
|
||||
}
|
||||
else if (isosp == 0) {
|
||||
return PiZero;
|
||||
}
|
||||
else {
|
||||
return PiPlus;
|
||||
}
|
||||
}
|
||||
|
||||
ParticleType getNucleonType(const G4int isosp) {
|
||||
// assert(isosp == -1 || isosp == 1);
|
||||
if (isosp == -1) {
|
||||
return Neutron;
|
||||
}
|
||||
else {
|
||||
return Proton;
|
||||
}
|
||||
}
|
||||
|
||||
ParticleType getDeltaType(const G4int isosp) {
|
||||
// assert(isosp == -3 || isosp == -1 || isosp == 1 || isosp == 3);
|
||||
if (isosp == -3) {
|
||||
return DeltaMinus;
|
||||
}
|
||||
else if (isosp == -1) {
|
||||
return DeltaZero;
|
||||
}
|
||||
else if (isosp == 1) {
|
||||
return DeltaPlus;
|
||||
}
|
||||
else {
|
||||
return DeltaPlusPlus;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ParticleTable
|
||||
} // namespace G4INCL
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -45,22 +46,40 @@
|
||||
#include "G4INCLGlobals.hh"
|
||||
// #include <cassert>
|
||||
|
||||
#include "G4INCLRanecu.hh"
|
||||
#include "G4INCLRanecu3.hh"
|
||||
#include "G4INCLGeant4Random.hh"
|
||||
#include "G4INCLLogger.hh"
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
namespace Random {
|
||||
|
||||
namespace {
|
||||
|
||||
G4ThreadLocal IRandomGenerator* theGenerator;
|
||||
G4ThreadLocal IRandomGenerator* theGenerator = NULL;
|
||||
|
||||
#ifdef INCL_COUNT_RND_CALLS
|
||||
G4ThreadLocal unsigned long long nCalls;
|
||||
#endif
|
||||
|
||||
G4ThreadLocal SeedVector *savedSeeds = NULL;
|
||||
|
||||
G4ThreadLocal Adapter *theAdapter = NULL;
|
||||
|
||||
}
|
||||
|
||||
void setGenerator(G4INCL::IRandomGenerator *aGenerator) {
|
||||
if(isInitialized()) {
|
||||
INCL_ERROR("INCL random number generator already initialized." << std::endl);
|
||||
INCL_ERROR("INCL random number generator already initialized." << '\n');
|
||||
} else {
|
||||
#ifdef INCL_COUNT_RND_CALLS
|
||||
nCalls = 0;
|
||||
#endif
|
||||
theGenerator = aGenerator;
|
||||
}
|
||||
if(!theAdapter)
|
||||
theAdapter = new Adapter();
|
||||
}
|
||||
|
||||
void setSeeds(const SeedVector &sv) {
|
||||
@@ -72,6 +91,9 @@ namespace G4INCL {
|
||||
}
|
||||
|
||||
G4double shoot() {
|
||||
#ifdef INCL_COUNT_RND_CALLS
|
||||
nCalls++;
|
||||
#endif
|
||||
return theGenerator->flat();
|
||||
}
|
||||
|
||||
@@ -89,11 +111,6 @@ namespace G4INCL {
|
||||
return r;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T shootInteger(T n) {
|
||||
return static_cast<T>(shoot1() * n);
|
||||
}
|
||||
|
||||
G4double gauss(G4double sigma) {
|
||||
// generate a Gaussian random number with standard deviation sigma
|
||||
// uses the flat() and flat0() methods
|
||||
@@ -152,7 +169,11 @@ namespace G4INCL {
|
||||
|
||||
void deleteGenerator() {
|
||||
delete theGenerator;
|
||||
theGenerator = 0;
|
||||
theGenerator = NULL;
|
||||
delete savedSeeds;
|
||||
savedSeeds = NULL;
|
||||
delete theAdapter;
|
||||
theAdapter = NULL;
|
||||
}
|
||||
|
||||
G4bool isInitialized() {
|
||||
@@ -160,6 +181,53 @@ namespace G4INCL {
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef INCL_COUNT_RND_CALLS
|
||||
/// \brief Return the number of calls to the RNG
|
||||
unsigned long long getNumberOfCalls() {
|
||||
return nCalls;
|
||||
}
|
||||
#endif
|
||||
|
||||
void saveSeeds() {
|
||||
if(!savedSeeds)
|
||||
savedSeeds = new SeedVector;
|
||||
|
||||
(*savedSeeds) = theGenerator->getSeeds();
|
||||
}
|
||||
|
||||
SeedVector getSavedSeeds() {
|
||||
if(!savedSeeds)
|
||||
savedSeeds = new SeedVector;
|
||||
|
||||
return *savedSeeds;
|
||||
}
|
||||
|
||||
void initialize(Config const * const
|
||||
#ifndef INCLXX_IN_GEANT4_MODE
|
||||
theConfig
|
||||
#endif
|
||||
) {
|
||||
#ifdef INCLXX_IN_GEANT4_MODE
|
||||
Random::setGenerator(new Geant4RandomGenerator());
|
||||
#else // INCLXX_IN_GEANT4_MODE
|
||||
RNGType rng = theConfig->getRNGType();
|
||||
if(rng == RanecuType)
|
||||
setGenerator(new Ranecu(theConfig->getRandomSeeds()));
|
||||
else if(rng == Ranecu3Type)
|
||||
setGenerator(new Ranecu3(theConfig->getRandomSeeds()));
|
||||
else
|
||||
setGenerator(NULL);
|
||||
#endif // INCLXX_IN_GEANT4_MODE
|
||||
}
|
||||
|
||||
G4int Adapter::operator()(const G4int n) const {
|
||||
return shootInteger(n);
|
||||
}
|
||||
|
||||
Adapter const &getAdapter() {
|
||||
return *theAdapter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -46,12 +47,6 @@
|
||||
namespace G4INCL {
|
||||
namespace Random {
|
||||
|
||||
long SeedVector::at(const size_t i) const { return theSeeds.at(i); }
|
||||
long &SeedVector::operator[](const size_t i) { return theSeeds[i]; }
|
||||
size_t SeedVector::size() const { return theSeeds.size(); }
|
||||
void SeedVector::resize(const size_t n) { theSeeds.resize(n); }
|
||||
void SeedVector::push_back(const long val) { theSeeds.push_back(val); }
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, SeedVector const &sv) {
|
||||
if(sv.size()<=0)
|
||||
return out;
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -62,16 +63,16 @@ namespace G4INCL {
|
||||
// A. Padal, J. Sempau Computer Physics Cummunications 175 (2006) 440-450
|
||||
G4double uscale=1.0/2.147483563e9;
|
||||
|
||||
long i1=iseed1/53668;
|
||||
G4int i1=iseed1/53668;
|
||||
iseed1=40014*(iseed1-i1*53668)-i1*12211;
|
||||
|
||||
if(iseed1 < 0) iseed1 = iseed1 + 2147483563;
|
||||
|
||||
long i2=iseed2/52774;
|
||||
G4int i2=iseed2/52774;
|
||||
iseed2=40692*(iseed2-i2*52774)-i2*3791;
|
||||
if(iseed2 < 0) iseed2=iseed2+2147483399;
|
||||
|
||||
long iz=iseed1-iseed2;
|
||||
G4int iz=iseed1-iseed2;
|
||||
if(iz < 1) iz=iz+2147483562;
|
||||
|
||||
return iz*uscale;
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
/*
|
||||
* G4INCLRanecu3.cc
|
||||
*
|
||||
* \date 7 juin 2009
|
||||
* \author Pekka Kaitaniemi
|
||||
*/
|
||||
|
||||
#include "G4INCLRanecu3.hh"
|
||||
|
||||
namespace G4INCL {
|
||||
|
||||
Ranecu3::Ranecu3() :
|
||||
iseed1(666),
|
||||
iseed2(777),
|
||||
iseed3(1234),
|
||||
i1(0), i2(0), i3(0), iz(0),
|
||||
uscale(1.0/2.147483563e9),
|
||||
m1(2147483563), m2(2147483399), m3(2147482739),
|
||||
a1(40014), a2(40692), a3(45742),
|
||||
q1(m1/a1), q2(m2/a2), q3(m3/a3),
|
||||
r1(m1%a1), r2(m2%a2), r3(m3%a3)
|
||||
{
|
||||
}
|
||||
|
||||
Ranecu3::Ranecu3(const Random::SeedVector &sv) :
|
||||
i1(0), i2(0), i3(0), iz(0),
|
||||
uscale(1.0/2.147483563e9),
|
||||
m1(2147483563), m2(2147483399), m3(2147482739),
|
||||
a1(53668), a2(52774), a3(46947),
|
||||
q1(m1/a1), q2(m2/a2), q3(m3/a3),
|
||||
r1(m1%a1), r2(m2%a2), r3(m3%a3)
|
||||
{
|
||||
setSeeds(sv);
|
||||
}
|
||||
|
||||
Ranecu3::~Ranecu3() {}
|
||||
|
||||
G4double Ranecu3::flat()
|
||||
{
|
||||
i1=iseed1/q1;
|
||||
iseed1=a1*(iseed1-i1*q1)-i1*r1;
|
||||
if(iseed1 < 0) iseed1 = iseed1 + m1;
|
||||
|
||||
i2=iseed2/q2;
|
||||
iseed2=a2*(iseed2-i2*q2)-i2*r2;
|
||||
if(iseed2 < 0) iseed2 = iseed2 + m2;
|
||||
|
||||
i3=iseed3/q3;
|
||||
iseed3=a3*(iseed3-i3*q3)-i3*r3;
|
||||
if(iseed3 < 0) iseed3 = iseed3 + m3;
|
||||
|
||||
iz = iseed1 - iseed2 + iseed3;
|
||||
if(iz < 1) iz = iz + 2147483562;
|
||||
|
||||
return iz*uscale;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,11 +24,12 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
// INCL++ intra-nuclear cascade model
|
||||
// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
|
||||
// Davide Mancusi, CEA
|
||||
// Alain Boudard, CEA
|
||||
// Sylvie Leray, CEA
|
||||
// Joseph Cugnon, University of Liege
|
||||
// Alain Boudard, CEA-Saclay, France
|
||||
// Joseph Cugnon, University of Liege, Belgium
|
||||
// Jean-Christophe David, CEA-Saclay, France
|
||||
// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
|
||||
// Sylvie Leray, CEA-Saclay, France
|
||||
// Davide Mancusi, CEA-Saclay, France
|
||||
//
|
||||
#define INCLXX_IN_GEANT4_MODE 1
|
||||
|
||||
@@ -91,7 +92,7 @@ namespace G4INCL {
|
||||
G4int iterations=0;
|
||||
do {
|
||||
if(iterations > maxIterations) {
|
||||
INCL_DEBUG("Could not bracket the root." << std::endl);
|
||||
INCL_DEBUG("Could not bracket the root." << '\n');
|
||||
return std::make_pair((G4double) 1.,(G4double) -1.);
|
||||
}
|
||||
|
||||
@@ -133,7 +134,7 @@ namespace G4INCL {
|
||||
f->cleanUp(true);
|
||||
return Solution(0.,y_at_zero);
|
||||
} else {
|
||||
INCL_DEBUG("Root-finding algorithm could not bracket the root." << std::endl);
|
||||
INCL_DEBUG("Root-finding algorithm could not bracket the root." << '\n');
|
||||
f->cleanUp(false);
|
||||
return Solution();
|
||||
}
|
||||
@@ -154,7 +155,7 @@ namespace G4INCL {
|
||||
for(G4int iterations=0; std::abs(y) > toleranceY; iterations++) {
|
||||
|
||||
if(iterations > maxIterations) {
|
||||
INCL_DEBUG("Root-finding algorithm did not converge." << std::endl);
|
||||
INCL_DEBUG("Root-finding algorithm did not converge." << '\n');
|
||||
f->cleanUp(false);
|
||||
return Solution();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user