64 subDir(dir), fICRU90(val) {
76 G4int atomicNumberIon,
77 G4int atomicNumberElem
80 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
82 auto iter = dedxMapElements.find(key);
84 return iter != dedxMapElements.end();
90 G4int atomicNumberIon,
94 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
96 auto iter = dedxMapMaterials.find(key);
98 return iter != dedxMapMaterials.end();
104 G4int atomicNumberIon,
105 G4int atomicNumberElem
108 G4IonDEDXKeyElem key = std::make_pair(atomicNumberIon, atomicNumberElem);
110 auto iter = dedxMapElements.find(key);
112 return (iter != dedxMapElements.end()) ? iter->second :
nullptr;
118 G4int atomicNumberIon,
122 G4IonDEDXKeyMat key = std::make_pair(atomicNumberIon, matIdentifier);
124 auto 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 auto 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 auto 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 auto 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 auto 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,
317 G4Exception(
"G4IonStoppingData::BuildPhysicsVector()",
"mat521",
322 std::ostringstream file;
323 G4String ww = (fICRU90 && (matname ==
"G4_WATER" ||
324 matname ==
"G4_AIR" ||
325 matname ==
"G4_GRAPHITE")) ?
"90" :
"73";
327 file << path <<
"/" << subDir << ww <<
"/z"
328 << atomicNumberIon <<
"_" << matname <<
".dat";
331 std::ifstream ifilestream( fileName );
333 if(!ifilestream.is_open())
340 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
346 physicsVector -> ScaleVector( MeV, MeV * cm2 /( 0.001 * g) );
347 physicsVector -> FillSecondDerivatives();
351 delete physicsVector;
375 G4Exception(
"G4IonStoppingData::BuildPhysicsVector()",
"mat522",
379 std::ostringstream file;
380 G4String ww = (fICRU90 && ZIon <= 18 &&
381 (ZElem == 1 || ZElem == 6 ||
382 ZElem == 7 || ZElem == 8)) ?
"90" :
"73";
384 file << path <<
"/" << subDir << ww <<
"/z"
385 << ZIon <<
"_" << ZElem <<
".dat";
388 std::ifstream ifilestream( fileName );
390 if(!ifilestream.is_open())
396 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
401 physicsVector -> ScaleVector( MeV, MeV * cm2 /( 0.001 * g) );
402 physicsVector -> FillSecondDerivatives();
406 delete physicsVector;
418 auto iterMat = dedxMapMaterials.begin();
419 auto iterMat_end = dedxMapMaterials.end();
421 for(;iterMat != iterMat_end; iterMat++) {
428 dedxMapMaterials.clear();
430 auto iterElem = dedxMapElements.begin();
431 auto iterElem_end = dedxMapElements.end();
433 for(;iterElem != iterElem_end; iterElem++) {
440 dedxMapElements.clear();
446 auto iterMat = dedxMapMaterials.begin();
447 auto iterMat_end = dedxMapMaterials.end();
449 G4cout << std::setw(15) << std::right
451 << std::setw(25) << std::right
455 for(;iterMat != iterMat_end; iterMat++) {
456 G4IonDEDXKeyMat key = iterMat -> first;
459 G4int atomicNumberIon = key.first;
460 G4String matIdentifier = key.second;
462 if(physicsVector !=
nullptr)
464 G4cout << std::setw(15) << std::right << atomicNumberIon
465 << std::setw(25) << std::right << matIdentifier <<
G4endl;
469 auto iterElem = dedxMapElements.begin();
470 auto iterElem_end = dedxMapElements.end();
472 G4cout << std::setw(15) << std::right
474 << std::setw(25) << std::right
475 <<
"Atomic nmb material"
478 for(;iterElem != iterElem_end; iterElem++) {
479 G4IonDEDXKeyElem key = iterElem -> first;
482 G4int atomicNumberIon = key.first;
483 G4int atomicNumberElem = key.second;
485 if(physicsVector !=
nullptr)
487 G4cout << std::setw(15) << std::right << atomicNumberIon
488 << std::setw(25) << std::right << atomicNumberElem <<
G4endl;
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cout
~G4IonStoppingData() override
G4bool IsApplicable(G4int atomicNumberIon, G4int atomicNumberElem) override
G4bool BuildPhysicsVector(G4int ionZ, const G4String &matName) override
G4bool RemovePhysicsVector(G4int atomicNumberIon, const G4String &matIdentifier)
G4double GetDEDX(G4double kinEnergyPerNucleon, G4int atomicNumberIon, G4int atomicNumberElem)
G4bool AddPhysicsVector(G4PhysicsVector *physicsVector, G4int atomicNumberIon, const G4String &matIdentifier)
G4PhysicsVector * GetPhysicsVector(G4int atomicNumberIon, G4int atomicNumberElem) override
G4IonStoppingData(const G4String &dir, G4bool icru)