Import Geant4 10.3.0.beta source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4IonStoppingData.cc 83419 2014-08-21 15:31:56Z gcosmo $
|
||||
// $Id: G4IonStoppingData.cc 96794 2016-05-09 10:09:30Z gcosmo $
|
||||
//
|
||||
// ===========================================================================
|
||||
// GEANT4 class source file
|
||||
@@ -78,15 +78,13 @@ G4IonStoppingData::~G4IonStoppingData() {
|
||||
G4bool G4IonStoppingData::IsApplicable(
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
G4int atomicNumberElem // Atomic number of elemental material
|
||||
) {
|
||||
G4bool isApplicable = true;
|
||||
)
|
||||
{
|
||||
G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
|
||||
|
||||
G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
|
||||
|
||||
if(iter == dedxMapElements.end()) isApplicable = false;
|
||||
|
||||
return isApplicable;
|
||||
return (iter == dedxMapElements.end()) ? false : true;
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
@@ -94,15 +92,13 @@ G4bool G4IonStoppingData::IsApplicable(
|
||||
G4bool G4IonStoppingData::IsApplicable(
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
const G4String& matIdentifier // Name or chemical formula of material
|
||||
) {
|
||||
G4bool isApplicable = true;
|
||||
)
|
||||
{
|
||||
G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
|
||||
|
||||
G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
|
||||
|
||||
if(iter == dedxMapMaterials.end()) isApplicable = false;
|
||||
|
||||
return isApplicable;
|
||||
return (iter == dedxMapMaterials.end()) ? false : true;
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
@@ -110,17 +106,13 @@ G4bool G4IonStoppingData::IsApplicable(
|
||||
G4PhysicsVector* G4IonStoppingData::GetPhysicsVector(
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
G4int atomicNumberElem // Atomic number of elemental material
|
||||
) {
|
||||
|
||||
G4PhysicsVector* physVector = 0;
|
||||
|
||||
)
|
||||
{
|
||||
G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
|
||||
|
||||
G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
|
||||
|
||||
if(iter != dedxMapElements.end()) physVector = iter -> second;
|
||||
|
||||
return physVector;
|
||||
return (iter != dedxMapElements.end()) ? iter->second : nullptr;
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
@@ -128,17 +120,13 @@ G4PhysicsVector* G4IonStoppingData::GetPhysicsVector(
|
||||
G4PhysicsVector* G4IonStoppingData::GetPhysicsVector(
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
const G4String& matIdentifier // Name or chemical formula of material
|
||||
) {
|
||||
|
||||
G4PhysicsVector* physVector = 0;
|
||||
|
||||
)
|
||||
{
|
||||
G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
|
||||
|
||||
G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
|
||||
|
||||
if(iter != dedxMapMaterials.end()) physVector = iter -> second;
|
||||
|
||||
return physVector;
|
||||
return (iter != dedxMapMaterials.end()) ? iter->second : nullptr;
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
@@ -147,21 +135,14 @@ G4double G4IonStoppingData::GetDEDX(
|
||||
G4double kinEnergyPerNucleon, // Kinetic energy per nucleon
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
G4int atomicNumberElem // Atomic number of elemental material
|
||||
) {
|
||||
G4double dedx = 0;
|
||||
|
||||
)
|
||||
{
|
||||
G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
|
||||
|
||||
G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
|
||||
|
||||
if( iter != dedxMapElements.end() ) {
|
||||
G4PhysicsVector* physicsVector = iter -> second;
|
||||
|
||||
G4bool b;
|
||||
dedx = physicsVector -> GetValue( kinEnergyPerNucleon, b );
|
||||
}
|
||||
|
||||
return dedx;
|
||||
return ( iter != dedxMapElements.end()) ?
|
||||
(iter->second)->Value( kinEnergyPerNucleon) : 0.0;
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
@@ -170,21 +151,14 @@ G4double G4IonStoppingData::GetDEDX(
|
||||
G4double kinEnergyPerNucleon, // Kinetic energy per nucleon
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
const G4String& matIdentifier // Name or chemical formula of material
|
||||
) {
|
||||
G4double dedx = 0;
|
||||
|
||||
)
|
||||
{
|
||||
G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
|
||||
|
||||
G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
|
||||
|
||||
if(iter != dedxMapMaterials.end()) {
|
||||
G4PhysicsVector* physicsVector = iter -> second;
|
||||
|
||||
G4bool b;
|
||||
dedx = physicsVector -> GetValue( kinEnergyPerNucleon, b );
|
||||
}
|
||||
|
||||
return dedx;
|
||||
return (iter != dedxMapMaterials.end()) ?
|
||||
(iter->second)->Value(kinEnergyPerNucleon) : 0.0;
|
||||
}
|
||||
|
||||
// #########################################################################
|
||||
@@ -193,54 +167,37 @@ G4bool G4IonStoppingData::AddPhysicsVector(
|
||||
G4PhysicsVector* physicsVector, // Physics vector
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
const G4String& matIdentifier // Name of elemental material
|
||||
) {
|
||||
|
||||
if(physicsVector == 0) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: Pointer to vector"
|
||||
<< " is null-pointer."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
)
|
||||
{
|
||||
if(physicsVector == nullptr) {
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for material",
|
||||
"mat037", FatalException,
|
||||
"Pointer to vector is null-pointer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(matIdentifier.empty()) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: "
|
||||
<< "Cannot add physics vector. Invalid name."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for material",
|
||||
"mat038", FatalException, "Invalid name of the material.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(atomicNumberIon <= 0) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: "
|
||||
<< "Cannot add physics vector. Illegal atomic number."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for material",
|
||||
"mat039", FatalException, "Illegal atomic number.");
|
||||
return false;
|
||||
}
|
||||
|
||||
G4IonDEDXKeyMat mkey = std::make_pair(atomicNumberIon, matIdentifier);
|
||||
|
||||
if(dedxMapMaterials.count(mkey) == 1) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: "
|
||||
<< "Vector with Z1 = " << atomicNumberIon << ", mat = "
|
||||
<< matIdentifier
|
||||
<< "already exists. Remove first before replacing."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Vector with Z1 = " << atomicNumberIon << ", mat = "
|
||||
<< matIdentifier
|
||||
<< "already exists. Remove first before replacing.";
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for material",
|
||||
"mat040", FatalException, ed);
|
||||
return false;
|
||||
}
|
||||
|
||||
dedxMapMaterials[mkey] = physicsVector;
|
||||
@@ -254,52 +211,36 @@ G4bool G4IonStoppingData::AddPhysicsVector(
|
||||
G4PhysicsVector* physicsVector, // Physics vector
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
G4int atomicNumberElem // Atomic number of elemental material
|
||||
) {
|
||||
|
||||
if(physicsVector == 0) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: "
|
||||
<< "Pointer to vector is null-pointer."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
)
|
||||
{
|
||||
if(physicsVector == nullptr) {
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for element", "mat037",
|
||||
FatalException, "Pointer to vector is null-pointer.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(atomicNumberIon <= 0) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: "
|
||||
<< "Cannot add physics vector. Illegal atomic number."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for element", "mat038",
|
||||
FatalException, "Invalid ion number.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(atomicNumberElem <= 0) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: "
|
||||
<< "Atomic number of element < 0."
|
||||
<< G4endl;
|
||||
#endif
|
||||
return false;
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for element", "mat039",
|
||||
FatalException, "Illegal atomic number.");
|
||||
return false;
|
||||
}
|
||||
|
||||
G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
|
||||
|
||||
if(dedxMapElements.count(key) == 1) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::AddPhysicsVector() Error: "
|
||||
<< "Vector with Z1 = " << atomicNumberIon << ", Z2 = "
|
||||
<< atomicNumberElem
|
||||
<< " already exists. Remove first before replacing."
|
||||
<< G4endl;
|
||||
#endif
|
||||
return false;
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Vector with Z1 = " << atomicNumberIon << ", Z= "
|
||||
<< atomicNumberElem
|
||||
<< "already exists. Remove first before replacing.";
|
||||
G4Exception ("G4IonStoppingData::AddPhysicsVector() for element", "mat040",
|
||||
FatalException, ed);
|
||||
return false;
|
||||
}
|
||||
|
||||
dedxMapElements[key] = physicsVector;
|
||||
@@ -319,14 +260,9 @@ G4bool G4IonStoppingData::RemovePhysicsVector(
|
||||
G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
|
||||
|
||||
if(iter == dedxMapMaterials.end()) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::RemovePhysicsVector() Warning: "
|
||||
<< "Cannot remove physics vector. Vector not found."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
G4Exception ("G4IonStoppingData::RemovePhysicsVector() for material",
|
||||
"mat038", FatalException, "Invalid name of the material.");
|
||||
return false;
|
||||
}
|
||||
|
||||
G4PhysicsVector* physicsVector = (*iter).second;
|
||||
@@ -351,14 +287,9 @@ G4bool G4IonStoppingData::RemovePhysicsVector(
|
||||
G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
|
||||
|
||||
if(iter == dedxMapElements.end()) {
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
G4cerr << "G4IonStoppingData::RemovePhysicsVector() Warning: "
|
||||
<< "Cannot remove physics vector. Vector not found."
|
||||
<< G4endl;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
G4Exception ("G4IonStoppingData::RemovePhysicsVector() for element",
|
||||
"mat038", FatalException, "Invalid element.");
|
||||
return false;
|
||||
}
|
||||
|
||||
G4PhysicsVector* physicsVector = (*iter).second;
|
||||
@@ -428,8 +359,8 @@ G4bool G4IonStoppingData::BuildPhysicsVector(
|
||||
G4bool G4IonStoppingData::BuildPhysicsVector(
|
||||
G4int atomicNumberIon, // Atomic number of ion
|
||||
G4int atomicNumberElem // Atomic number of elemental material
|
||||
) {
|
||||
|
||||
)
|
||||
{
|
||||
if( IsApplicable(atomicNumberIon, atomicNumberElem) ) return true;
|
||||
|
||||
char* path = getenv("G4LEDATA");
|
||||
|
||||
Reference in New Issue
Block a user