Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
@@ -23,52 +23,81 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id$
// Translation of INCL4.2/ABLA V3
// ABLAXX statistical de-excitation model
// Pekka Kaitaniemi, HIP (translation)
// Christelle Schmidt, IPNL (fission code)
// Alain Boudard, CEA (contact person INCL/ABLA)
// Davide Mancusi, CEA (contact person INCL/ABLA)
// Aatos Heikkinen, HIP (project coordination)
//
#define ABLAXX_IN_GEANT4_MODE 1
#include "globals.hh"
#include "G4AblaDataFile.hh"
//#include "G4HadronicException.hh"
#include "globals.hh" // Needed for G4Exception.
#ifdef ABLAXX_IN_GEANT4_MODE
#include "globals.hh"
#else
#include "G4INCLGeant4Compat.hh"
#endif
#include <fstream>
#include <cmath>
#include <iostream>
#include <cstdlib>
G4AblaDataFile::G4AblaDataFile()
{
#ifdef ABLAXX_IN_GEANT4_MODE
G4AblaDataFile::G4AblaDataFile() {
#else
G4AblaDataFile::G4AblaDataFile(G4INCL::Config *config)
: G4AblaVirtualData(config) {
theConfig = config;
#endif
verboseLevel = 0;
}
G4AblaDataFile::~G4AblaDataFile()
{
}
/**
* Read all data from files.
*/
bool G4AblaDataFile::readData()
{
#ifdef ABLAXX_IN_GEANT4_MODE
if(!getenv("G4ABLADATA")) {
// throw G4HadronicException(__FILE__, __LINE__, "ERROR: Data
// missing. Set environment variable G4ABLA3.0 to point to the
// directory containing data files needed by INCL and ABLA
// models.");
G4String errorMessage1 = "ERROR: Data missing. Set environment variable G4ABLADATA\n";
G4String errorMessage2 = "\t to point to the directory containing data files needed\n";
G4String errorMessage3 = "\t by INCL and ABLA models.\n";
G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3;
G4Exception(errorMessage);
// G4String errorMessage1 = "ERROR: Data missing. Set environment variable G4ABLADATA\n";
// G4String errorMessage2 = "\t to point to the directory containing data files needed\n";
// G4String errorMessage3 = "\t by INCL and ABLA models.\n";
// G4String errorMessage = errorMessage1 + errorMessage2 + errorMessage3;
// G4Exception(errorMessage);
G4ExceptionDescription ed;
ed << " Data missing: set environment variable G4ABLADATA\n"
<< " to point to the directory containing data files needed\n"
<< " by the ABLA model" << G4endl;
G4Exception("G4AblaDataFile::readData()","ABLA_001",
FatalException, ed);
}
G4String dataPath(getenv("G4ABLADATA"));
#else
G4String dataPath(theConfig->getABLAv3pCxxDataFilePath().c_str());
#endif
G4String flAlphaFile(dataPath + "/flalpha.dat");
G4String frldmFile( dataPath + "/frldm.dat");
G4String vgsldFile( dataPath + "/vgsld.dat");
G4String pace2File( dataPath + "/pace2.dat");
if(verboseLevel > 1) {
G4cout <<"Data path = " << dataPath << G4endl;
G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl;
G4cout <<"FrldmFile = " << frldmFile << G4endl;
G4cout <<"VgsldFile = " << vgsldFile << G4endl;
G4cout <<"Pace2File = " << pace2File << G4endl;
// G4cout <<"Data path = " << dataPath << G4endl;
// G4cout <<"FlAlphaFile = " << flAlphaFile << G4endl;
// G4cout <<"FrldmFile = " << frldmFile << G4endl;
// G4cout <<"VgsldFile = " << vgsldFile << G4endl;
// G4cout <<"Pace2File = " << pace2File << G4endl;
}
std::ifstream flalphain(flAlphaFile.c_str());
@@ -81,37 +110,42 @@ bool G4AblaDataFile::readData()
std::filebuf *buf3 = vgsldin.rdbuf();
std::filebuf *buf4 = pace2in.rdbuf();
if (!((buf1->is_open()) && (buf2->is_open()) && (buf3->is_open()) && (buf4->is_open()))) {
G4Exception("ERROR: Data missing. Could not find ABLA data file in " + dataPath +
" defined by environment variable G4ABLADATA");
#ifdef ABLAXX_IN_GEANT4_MODE
G4ExceptionDescription ed;
ed << " Data missing: could not find ABLA data file in " << dataPath
<< "defined by environment variable G4ABLADATA" << G4endl;
G4Exception("G4AblaDataFile::readData()", "ABLA002", FatalException, ed);
#else
std::cerr << "Error opening file." << std::endl;
#endif
}
G4double flalpha, frldm, vgsld, pace2;
const G4int rows = 98;
const G4int cols = 153;
G4double fflalpha, ffrldm, fvgsld, fpace2;
const G4int rows = 99;
const G4int cols = 154;
const G4int massnumbers = 263;
for(int i = 0; i < rows; i++) {
for(int j = 0; j < cols; j++) {
setAlpha(j, i, 0.0);
setEcnz( j, i, 0.0);
setVgsld(j, i, 0.0);
setVgsld(j, i, 0.0);
}
}
for(int i = 0; i < rows; i++) {
for(int j = 0; j < cols; j++) {
flalphain >> flalpha;
frldmin >> frldm;
vgsldin >> vgsld;
setAlpha(j, i, flalpha);
setEcnz( j, i, frldm);
setVgsld(j, i, vgsld);
flalphain >> fflalpha;
frldmin >> ffrldm;
vgsldin >> fvgsld;
setAlpha(j, i, fflalpha);
setEcnz( j, i, ffrldm);
setVgsld(j, i, fvgsld);
}
}
flalphain.close();
frldmin.close();
vgsldin.close();
int A = 0, Zbegin = 0, Zend = 0;
G4String str1, str2, str3;
for(int i = 0; i < 500; i++) {
for(int j = 0; j < 500; j++) {
@@ -119,20 +153,23 @@ bool G4AblaDataFile::readData()
}
}
int A = 0, Zbegin = 0, Zend = 0;
for(int i = 0; i < massnumbers; i++) {
pace2in >> str1 >> A >> str2 >> Zbegin >> str3 >> Zend;
for(int j = Zbegin; j <= Zend; j++) {
pace2in >> pace2;
setPace2(A, j, pace2);
if(Zbegin >= 0 && Zbegin < getPaceCols() &&
A >= 0 && A < getPaceRows()) {
for(int j = Zbegin; j <= Zend; j++) {
pace2in >> fpace2;
setPace2(A, j, fpace2);
}
}
}
pace2in.close();
if(std::fabs(getPace2(A, Zend) - 114516.10) > 1e-6) {
G4cout <<"ERROR: Problem in parsing datafile " + pace2File << G4endl;
if(std::abs(getPace2(A, Zend) - 114516.10) > 1e-6) {
std::cerr << "ERROR: Problem in parsing datafile " + pace2File << std::endl;
return false;
}
return true;
}