64 subDir(dir), fICRU90(val) {
76 G4int atomicNumberIon,
77 G4int atomicNumberElem
80 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
82 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
84 return (iter == dedxMapElements.end()) ? false :
true;
90 G4int atomicNumberIon,
94 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
96 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
98 return (iter == dedxMapMaterials.end()) ? false :
true;
104 G4int atomicNumberIon,
105 G4int atomicNumberElem
108 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
110 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
112 return (iter != dedxMapElements.end()) ? iter->second :
nullptr;
118 G4int atomicNumberIon,
122 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
124 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
126 return (iter != dedxMapMaterials.end()) ? iter->second :
nullptr;
133 G4int atomicNumberIon,
134 G4int atomicNumberElem
137 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
139 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
141 return ( iter != dedxMapElements.end()) ?
142 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
149 G4int atomicNumberIon,
153 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
155 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
157 return (iter != dedxMapMaterials.end()) ?
158 (iter->second)->Value(kinEnergyPerNucleon) : 0.0;
165 G4int atomicNumberIon,
169 if(physicsVector ==
nullptr) {
170 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
172 "Pointer to vector is null-pointer.");
176 if(matIdentifier.empty()) {
177 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
182 if(atomicNumberIon <= 0) {
183 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
188 G4IonDEDXKeyMat mkey = std::make_pair(atomicNumberIon, matIdentifier);
190 if(dedxMapMaterials.count(mkey) == 1) {
192 ed <<
"Vector with Z1 = " << atomicNumberIon <<
", mat = "
194 <<
"already exists. Remove first before replacing.";
195 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for material",
200 dedxMapMaterials[mkey] = physicsVector;
209 G4int atomicNumberIon,
210 G4int atomicNumberElem
213 if(physicsVector ==
nullptr) {
214 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat037",
219 if(atomicNumberIon <= 0) {
220 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat038",
225 if(atomicNumberElem <= 0) {
226 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat039",
231 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
233 if(dedxMapElements.count(key) == 1) {
235 ed <<
"Vector with Z1 = " << atomicNumberIon <<
", Z= "
237 <<
"already exists. Remove first before replacing.";
238 G4Exception (
"G4IonStoppingData::AddPhysicsVector() for element",
"mat040",
243 dedxMapElements[key] = physicsVector;
251 G4int atomicNumberIon,
255 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
257 G4IonDEDXMapMat::iterator iter = dedxMapMaterials.find(key);
259 if(iter == dedxMapMaterials.end()) {
260 G4Exception (
"G4IonStoppingData::RemovePhysicsVector() for material",
268 dedxMapMaterials.erase(key);
271 delete physicsVector;
279 G4int atomicNumberIon,
280 G4int atomicNumberElem
282 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
284 G4IonDEDXMapElem::iterator iter = dedxMapElements.find(key);
286 if(iter == dedxMapElements.end()) {
287 G4Exception (
"G4IonStoppingData::RemovePhysicsVector() for element",
295 dedxMapElements.erase(key);
298 delete physicsVector;
306 G4int atomicNumberIon,
310 if(
IsApplicable(atomicNumberIon, matname) )
return true;
312 const char* path = std::getenv(
"G4LEDATA");
314 G4Exception(
"G4IonStoppingData::BuildPhysicsVector()",
"mat521",
319 std::ostringstream file;
320 G4String ww = (fICRU90 && (matname ==
"G4_WATER" ||
321 matname ==
"G4_AIR" ||
322 matname ==
"G4_GRAPHITE")) ?
"90" :
"73";
324 file << path <<
"/" << subDir << ww <<
"/z"
325 << atomicNumberIon <<
"_" << matname <<
".dat";
328 std::ifstream ifilestream( fileName );
330 if ( !ifilestream.is_open() )
return false;
334 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
340 physicsVector -> ScaleVector( MeV, MeV * cm2 /( 0.001 * g) );
341 physicsVector -> SetSpline(
true );
342 physicsVector -> FillSecondDerivatives();
346 delete physicsVector;
364 char* path = std::getenv(
"G4LEDATA");
366 G4Exception(
"G4IonStoppingData::BuildPhysicsVector()",
"mat522",
370 std::ostringstream file;
371 G4String ww = (fICRU90 && ZIon <= 18 &&
372 (ZElem == 1 || ZElem == 6 ||
373 ZElem == 7 || ZElem == 8)) ?
"90" :
"73";
375 file << path <<
"/" << subDir << ww <<
"/z"
376 << ZIon <<
"_" << ZElem <<
".dat";
379 std::ifstream ifilestream( fileName );
381 if ( !ifilestream.is_open() )
return false;
384 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
389 physicsVector -> ScaleVector( MeV, MeV * cm2 /( 0.001 * g) );
390 physicsVector -> SetSpline(
true );
391 physicsVector -> FillSecondDerivatives();
395 delete physicsVector;
408 G4IonDEDXMapMat::iterator iterMat = dedxMapMaterials.begin();
409 G4IonDEDXMapMat::iterator iterMat_end = dedxMapMaterials.end();
411 for(;iterMat != iterMat_end; iterMat++) {
415 if(vec != 0)
delete vec;
418 dedxMapMaterials.clear();
420 G4IonDEDXMapElem::iterator iterElem = dedxMapElements.begin();
421 G4IonDEDXMapElem::iterator iterElem_end = dedxMapElements.end();
423 for(;iterElem != iterElem_end; iterElem++) {
427 if(vec != 0)
delete vec;
430 dedxMapElements.clear();
437 G4IonDEDXMapMat::iterator iterMat = dedxMapMaterials.begin();
438 G4IonDEDXMapMat::iterator iterMat_end = dedxMapMaterials.end();
440 G4cout << std::setw(15) << std::right
442 << std::setw(25) << std::right
446 for(;iterMat != iterMat_end; iterMat++) {
447 G4IonDEDXKeyMat key = iterMat -> first;
450 G4int atomicNumberIon = key.first;
451 G4String matIdentifier = key.second;
453 if(physicsVector != 0) {
454 G4cout << std::setw(15) << std::right
456 << std::setw(25) << std::right
462 G4IonDEDXMapElem::iterator iterElem = dedxMapElements.begin();
463 G4IonDEDXMapElem::iterator iterElem_end = dedxMapElements.end();
465 G4cout << std::setw(15) << std::right
467 << std::setw(25) << std::right
468 <<
"Atomic nmb material"
471 for(;iterElem != iterElem_end; iterElem++) {
472 G4IonDEDXKeyElem key = iterElem -> first;
475 G4int atomicNumberIon = key.first;
476 G4int atomicNumberElem = key.second;
478 if(physicsVector != 0) {
479 G4cout << std::setw(15) << std::right
481 << std::setw(25) << std::right
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
G4PhysicsVector * GetPhysicsVector(G4int atomicNumberIon, G4int atomicNumberElem)
G4bool IsApplicable(G4int atomicNumberIon, G4int atomicNumberElem)
G4bool RemovePhysicsVector(G4int atomicNumberIon, const G4String &matIdentifier)
G4double GetDEDX(G4double kinEnergyPerNucleon, G4int atomicNumberIon, G4int atomicNumberElem)
G4bool AddPhysicsVector(G4PhysicsVector *physicsVector, G4int atomicNumberIon, const G4String &matIdentifier)
G4IonStoppingData(const G4String &dir, G4bool icru)
G4bool BuildPhysicsVector(G4int ionZ, const G4String &matName)
virtual ~G4IonStoppingData()