103 G4int atomicNumberIon,
104 G4int atomicNumberElem
117 G4int atomicNumberIon,
131 G4int atomicNumberIon,
132 G4int atomicNumberElem
145 G4int atomicNumberIon,
160 G4int atomicNumberIon,
161 G4int atomicNumberElem
169 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
176 G4int atomicNumberIon,
185 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
192 G4int atomicNumberIon,
194 G4int atomicNumberElem
197 if(physicsVector ==
nullptr) {
198 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
200 "Pointer to vector is null-pointer.");
204 if(matIdentifier.empty()) {
205 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
210 if(atomicNumberIon <= 2) {
211 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
216 if(atomicNumberElem > 0) {
221 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
223 "Vector already exist, remove it before replacing.");
233 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
235 "Vector already exist, remove it before replacing.");
247 G4int atomicNumberIon,
259 G4Exception (
"G4ExtDEDXTable::RemovePhysicsVector() for material",
261 "Pointer to vector is null-pointer.");
265 physicsVector = (*iter).second;
269 G4IonDEDXMapElem::iterator it;
273 if( (*it).second == physicsVector ) {
280 delete physicsVector;
292 std::ofstream ofilestream;
294 ofilestream.open( fileName, std::ios::out );
298 ed <<
"Cannot open file " << fileName;
299 G4Exception (
"G4IonStoppingData::StorePhysicsTable()",
312 for(;iterMat != iterMat_end; iterMat++) {
316 G4int atomicNumberIon = key.first;
317 G4String matIdentifier = key.second;
321 if(physicsVector !=
nullptr) {
322 ofilestream << atomicNumberIon <<
" " << matIdentifier;
324 if(atomicNumberElem > 0) ofilestream <<
" " << atomicNumberElem;
326 ofilestream <<
" # <Atomic number ion> <Material name> ";
328 if(atomicNumberElem > 0) ofilestream <<
"<Atomic number element>";
330 ofilestream << G4endl << physicsVector -> GetType() <<
G4endl;
332 physicsVector -> Store(ofilestream,
true);
336 G4Exception (
"G4IonStoppingData::StorePhysicsTable()",
351 std::ifstream ifilestream;
352 ifilestream.open( fileName,
std::ios::in|std::ios::binary );
353 if( ! ifilestream ) {
355 ed <<
"Cannot open file " << fileName;
356 G4Exception (
"G4IonStoppingData::RetrievePhysicsTable()",
362 G4int nmbVectors = 0;
363 ifilestream >> nmbVectors;
364 if( ifilestream.fail() || nmbVectors <= 0) {
365 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
366 <<
" File content of " << fileName <<
" ill-formated."
367 <<
" Nvectors= " << nmbVectors
373 for(
G4int i = 0; i<nmbVectors; ++i) {
377 while( line.empty() ) {
379 getline( ifilestream, line );
380 if( ifilestream.fail() ) {
381 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
382 <<
" File content of " << fileName <<
" ill-formated."
388 std::string::size_type
pos = line.find_first_of(
"#");
389 if(pos != std::string::npos && pos > 0) {
390 line = line.substr(0, pos);
394 std::istringstream headerstream( line );
396 std::string::size_type atomicNumberIon;
397 headerstream >> atomicNumberIon;
400 headerstream >> materialName;
402 if( headerstream.fail() || std::string::npos == atomicNumberIon) {
403 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
404 <<
" File content of " << fileName <<
" ill-formated "
405 <<
" (vector header)."
411 std::string::size_type atomicNumberMat;
412 headerstream >> atomicNumberMat;
414 if( headerstream.eof() || std::string::npos == atomicNumberMat) {
419 ifilestream >> vectorType;
423 if(physicsVector ==
nullptr) {
424 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable "
425 <<
" illegal physics Vector type " << vectorType
426 <<
" in " << fileName
432 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
433 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
434 <<
" File content of " << fileName <<
" ill-formated."
440 physicsVector -> SetSpline(
true);
444 materialName, (
G4int)atomicNumberMat) ) {
446 delete physicsVector;
463 switch (vectorType) {
492 return physicsVector;
501 G4int atomicNumber = 0;
506 for(;iter != iter_end; iter++) {
508 if( (*iter).second == physicsVector ) {
511 atomicNumber = key.second;
525 for(;iterMat != iterMat_end; iterMat++) {
529 if(vec != 0)
delete vec;
548 <<
"Atomic nmb material"
551 for(;iterMat != iterMat_end; iterMat++) {
555 G4int atomicNumberIon = key.first;
556 G4String matIdentifier = key.second;
560 if(physicsVector != 0) {
567 if(atomicNumberElem > 0)
G4cout << atomicNumberElem;
G4bool RetrievePhysicsTable(const G4String &fileName)
G4PhysicsLogVector G4PhysicsLnVector
std::ostringstream G4ExceptionDescription
static const G4double pos
G4double GetDEDX(G4double kinEnergyPerNucleon, G4int atomicNumberIon, G4int atomicNumberElem)
std::pair< G4int, G4String > G4IonDEDXKeyMat
static constexpr double second
G4IonDEDXMapMat dedxMapMaterials
G4bool RemovePhysicsVector(G4int atomicNumberIon, const G4String &matIdentifier)
virtual ~G4ExtDEDXTable()
G4PhysicsVector * CreatePhysicsVector(G4int vectorType)
std::pair< G4int, G4int > G4IonDEDXKeyElem
virtual G4bool BuildPhysicsVector(G4int ionZ, const G4String &matName)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
G4IonDEDXMapElem dedxMapElements
G4bool AddPhysicsVector(G4PhysicsVector *physicsVector, G4int atomicNumberIon, const G4String &matIdenfier, G4int atomicNumberElem=0)
G4bool StorePhysicsTable(const G4String &fileName)
virtual G4PhysicsVector * GetPhysicsVector(G4int atomicNumberIon, G4int atomicNumberElem)
G4int FindAtomicNumberElement(G4PhysicsVector *physicsVector)
virtual G4bool IsApplicable(G4int atomicNumberIon, G4int atomicNumberElem)