102 G4int atomicNumberIon,
103 G4int atomicNumberElem
116 G4int atomicNumberIon,
130 G4int atomicNumberIon,
131 G4int atomicNumberElem
144 G4int atomicNumberIon,
159 G4int atomicNumberIon,
160 G4int atomicNumberElem
168 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
175 G4int atomicNumberIon,
184 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
191 G4int atomicNumberIon,
193 G4int atomicNumberElem
196 if(physicsVector ==
nullptr) {
197 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
199 "Pointer to vector is null-pointer.");
203 if(matIdentifier.empty()) {
204 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
209 if(atomicNumberIon <= 2) {
210 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
215 if(atomicNumberElem > 0) {
220 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
222 "Vector already exist, remove it before replacing.");
232 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
234 "Vector already exist, remove it before replacing.");
246 G4int atomicNumberIon,
258 G4Exception (
"G4ExtDEDXTable::RemovePhysicsVector() for material",
260 "Pointer to vector is null-pointer.");
264 physicsVector = (*iter).second;
268 G4IonDEDXMapElem::iterator
it;
272 if( (*it).second == physicsVector ) {
279 delete physicsVector;
291 std::ofstream ofilestream;
293 ofilestream.open( fileName, std::ios::out );
297 ed <<
"Cannot open file " << fileName;
298 G4Exception (
"G4IonStoppingData::StorePhysicsTable()",
311 for(;iterMat != iterMat_end; iterMat++) {
315 G4int atomicNumberIon = key.first;
316 G4String matIdentifier = key.second;
320 if(physicsVector !=
nullptr) {
321 ofilestream << atomicNumberIon <<
" " << matIdentifier;
323 if(atomicNumberElem > 0) ofilestream <<
" " << atomicNumberElem;
325 ofilestream <<
" # <Atomic number ion> <Material name> ";
327 if(atomicNumberElem > 0) ofilestream <<
"<Atomic number element>";
329 ofilestream << G4endl << physicsVector -> GetType() <<
G4endl;
331 physicsVector -> Store(ofilestream,
true);
335 G4Exception (
"G4IonStoppingData::StorePhysicsTable()",
350 std::ifstream ifilestream;
351 ifilestream.open( fileName,
std::ios::in|std::ios::binary );
352 if( ! ifilestream ) {
354 ed <<
"Cannot open file " << fileName;
355 G4Exception (
"G4IonStoppingData::RetrievePhysicsTable()",
361 G4int nmbVectors = 0;
362 ifilestream >> nmbVectors;
363 if( ifilestream.fail() || nmbVectors <= 0) {
364 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
365 <<
" File content of " << fileName <<
" ill-formated."
366 <<
" Nvectors= " << nmbVectors
372 for(
G4int i = 0; i<nmbVectors; ++i) {
376 while( line.empty() ) {
378 getline( ifilestream, line );
379 if( ifilestream.fail() ) {
380 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
381 <<
" File content of " << fileName <<
" ill-formated."
387 std::string::size_type
pos = line.find_first_of(
"#");
388 if(pos != std::string::npos && pos > 0) {
389 line = line.substr(0, pos);
393 std::istringstream headerstream( line );
395 std::string::size_type atomicNumberIon;
396 headerstream >> atomicNumberIon;
399 headerstream >> materialName;
401 if( headerstream.fail() || std::string::npos == atomicNumberIon) {
402 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
403 <<
" File content of " << fileName <<
" ill-formated "
404 <<
" (vector header)."
410 std::string::size_type atomicNumberMat;
411 headerstream >> atomicNumberMat;
413 if( headerstream.eof() || std::string::npos == atomicNumberMat) {
418 ifilestream >> vectorType;
422 if(physicsVector ==
nullptr) {
423 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable "
424 <<
" illegal physics Vector type " << vectorType
425 <<
" in " << fileName
431 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
432 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
433 <<
" File content of " << fileName <<
" ill-formated."
439 physicsVector -> SetSpline(
true);
443 materialName, (
G4int)atomicNumberMat) ) {
445 delete physicsVector;
462 switch (vectorType) {
491 return physicsVector;
500 G4int atomicNumber = 0;
505 for(;iter != iter_end; iter++) {
507 if( (*iter).second == physicsVector ) {
510 atomicNumber = key.second;
524 for(;iterMat != iterMat_end; iterMat++) {
528 if(vec != 0)
delete vec;
547 <<
"Atomic nmb material"
550 for(;iterMat != iterMat_end; iterMat++) {
554 G4int atomicNumberIon = key.first;
555 G4String matIdentifier = key.second;
559 if(physicsVector != 0) {
566 if(atomicNumberElem > 0)
G4cout << atomicNumberElem;