65 subDir( leDirectory ) {
79 G4int atomicNumberIon,
80 G4int atomicNumberElem
83 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
85 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
87 return (iter == dedxMapElements.end()) ?
false :
true;
93 G4int atomicNumberIon,
97 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
99 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
101 return (iter == dedxMapMaterials.end()) ?
false :
true;
107 G4int atomicNumberIon,
108 G4int atomicNumberElem
111 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
113 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
115 return (iter != dedxMapElements.end()) ? iter->second :
nullptr;
121 G4int atomicNumberIon,
125 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
127 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
129 return (iter != dedxMapMaterials.end()) ? iter->second :
nullptr;
136 G4int atomicNumberIon,
137 G4int atomicNumberElem
140 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
142 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
144 return ( iter != dedxMapElements.end()) ?
145 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
152 G4int atomicNumberIon,
156 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
158 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
160 return (iter != dedxMapMaterials.end()) ?
161 (iter->second)->Value(kinEnergyPerNucleon) : 0.0;
168 G4int atomicNumberIon,
172 if(physicsVector ==
nullptr) {
173 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
175 "Pointer to vector is null-pointer.");
179 if(matIdentifier.empty()) {
180 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
185 if(atomicNumberIon <= 0) {
186 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
191 G4IonDEDXKeyMat mkey = std::make_pair(atomicNumberIon, matIdentifier);
193 if(dedxMapMaterials.count(mkey) == 1) {
195 ed <<
"Vector with Z1 = " << atomicNumberIon <<
", mat = "
197 <<
"already exists. Remove first before replacing.";
198 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
203 dedxMapMaterials[mkey] = physicsVector;
212 G4int atomicNumberIon,
213 G4int atomicNumberElem
216 if(physicsVector ==
nullptr) {
217 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat037",
222 if(atomicNumberIon <= 0) {
223 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat038",
228 if(atomicNumberElem <= 0) {
229 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat039",
234 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
236 if(dedxMapElements.count(key) == 1) {
238 ed <<
"Vector with Z1 = " << atomicNumberIon <<
", Z= "
240 <<
"already exists. Remove first before replacing.";
241 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat040",
246 dedxMapElements[key] = physicsVector;
254 G4int atomicNumberIon,
258 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
260 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
262 if(iter == dedxMapMaterials.end()) {
263 G4Exception (
"G4IonStoppingData::RemovePhysicsVector() for material",
271 dedxMapMaterials.erase(key);
274 delete physicsVector;
282 G4int atomicNumberIon,
283 G4int atomicNumberElem
285 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
287 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
289 if(iter == dedxMapElements.end()) {
290 G4Exception (
"G4IonStoppingData::RemovePhysicsVector() for element",
298 dedxMapElements.erase(key);
301 delete physicsVector;
309 G4int atomicNumberIon,
313 if(
IsApplicable(atomicNumberIon, matIdentifier) )
return true;
315 char* path = getenv(
"G4LEDATA");
317 G4Exception(
"G4IonStoppingData::BuildPhysicsVector()",
"mat521",
322 std::ostringstream file;
324 file << path <<
"/" << subDir <<
"/z"
325 << atomicNumberIon <<
"_" << matIdentifier
330 std::ifstream ifilestream( fileName );
332 if ( !ifilestream.is_open() )
return false;
336 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
342 physicsVector -> ScaleVector(
MeV,
MeV *
cm2 /( 0.001 *
g) );
343 physicsVector -> SetSpline(
true );
344 physicsVector -> FillSecondDerivatives();
348 delete physicsVector;
360 G4int atomicNumberIon,
361 G4int atomicNumberElem
364 if(
IsApplicable(atomicNumberIon, atomicNumberElem) )
return true;
366 char* path = getenv(
"G4LEDATA");
368 G4Exception(
"G4IonStoppingData::BuildPhysicsVector()",
"mat522",
372 std::ostringstream file;
374 file << path <<
"/" << subDir <<
"/z"
375 << atomicNumberIon <<
"_" << atomicNumberElem
380 std::ifstream ifilestream( fileName );
382 if ( !ifilestream.is_open() )
return false;
386 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
392 physicsVector -> ScaleVector(
MeV,
MeV *
cm2 /( 0.001 *
g) );
393 physicsVector -> SetSpline(
true );
394 physicsVector -> FillSecondDerivatives();
398 delete physicsVector;
411 G4IonDEDXMapMat::iterator iterMat = dedxMapMaterials.begin();
412 G4IonDEDXMapMat::iterator iterMat_end = dedxMapMaterials.end();
414 for(;iterMat != iterMat_end; iterMat++) {
418 if(vec != 0)
delete vec;
421 dedxMapMaterials.clear();
423 G4IonDEDXMapElem::iterator iterElem = dedxMapElements.begin();
424 G4IonDEDXMapElem::iterator iterElem_end = dedxMapElements.end();
426 for(;iterElem != iterElem_end; iterElem++) {
430 if(vec != 0)
delete vec;
433 dedxMapElements.clear();
440 G4IonDEDXMapMat::iterator iterMat = dedxMapMaterials.begin();
441 G4IonDEDXMapMat::iterator iterMat_end = dedxMapMaterials.end();
449 for(;iterMat != iterMat_end; iterMat++) {
450 G4IonDEDXKeyMat key = iterMat ->
first;
453 G4int atomicNumberIon = key.first;
454 G4String matIdentifier = key.second;
456 if(physicsVector != 0) {
465 G4IonDEDXMapElem::iterator iterElem = dedxMapElements.begin();
466 G4IonDEDXMapElem::iterator iterElem_end = dedxMapElements.end();
471 <<
"Atomic nmb material"
474 for(;iterElem != iterElem_end; iterElem++) {
475 G4IonDEDXKeyElem key = iterElem ->
first;
478 G4int atomicNumberIon = key.first;
479 G4int atomicNumberElem = key.second;
481 if(physicsVector != 0) {
G4bool BuildPhysicsVector(G4int ionZ, const G4String &matName)
std::ostringstream G4ExceptionDescription
static constexpr double cm2
static constexpr double second
G4bool AddPhysicsVector(G4PhysicsVector *physicsVector, G4int atomicNumberIon, const G4String &matIdentifier)
G4GLOB_DLL std::ostream G4cout
G4IonStoppingData(const G4String &leDirectory)
G4bool IsApplicable(G4int atomicNumberIon, G4int atomicNumberElem)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4bool RemovePhysicsVector(G4int atomicNumberIon, const G4String &matIdentifier)
virtual ~G4IonStoppingData()
G4double GetDEDX(G4double kinEnergyPerNucleon, G4int atomicNumberIon, G4int atomicNumberElem)
static constexpr double MeV
G4PhysicsVector * GetPhysicsVector(G4int atomicNumberIon, G4int atomicNumberElem)