411 std::ifstream ifilestream;
412 ifilestream.open( fileName,
std::ios::in|std::ios::binary );
413 if( ! ifilestream ) {
415 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() " 416 <<
" Cannot open file "<< fileName
423 G4int nmbVectors = 0;
424 ifilestream >> nmbVectors;
425 if( ifilestream.fail() || nmbVectors <= 0) {
426 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() " 427 <<
" File content of " << fileName <<
" ill-formated." 428 <<
" Nvectors= " << nmbVectors
434 for(
G4int i = 0; i<nmbVectors; ++i) {
438 while( line.empty() ) {
440 getline( ifilestream, line );
441 if( ifilestream.fail() ) {
443 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() " 444 <<
" File content of " << fileName <<
" ill-formated." 451 std::string::size_type
pos = line.find_first_of(
"#");
452 if(pos != std::string::npos && pos > 0) {
453 line = line.substr(0, pos);
457 std::istringstream headerstream( line );
459 std::string::size_type atomicNumberIon;
460 headerstream >> atomicNumberIon;
463 headerstream >> materialName;
465 if( headerstream.fail() || std::string::npos == atomicNumberIon) {
468 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() " 469 <<
" File content of " << fileName <<
" ill-formated " 470 <<
" (vector header)." 477 std::string::size_type atomicNumberMat;
478 headerstream >> atomicNumberMat;
480 if( headerstream.eof() || std::string::npos == atomicNumberMat) {
485 ifilestream >> vectorType;
489 if(physicsVector == 0) {
491 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable " 492 <<
" illegal physics Vector type " << vectorType
493 <<
" in " << fileName
500 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
503 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() " 504 <<
" File content of " << fileName <<
" ill-formated." 511 physicsVector -> SetSpline(
true);
515 materialName, (
G4int)atomicNumberMat) ) {
517 delete physicsVector;
G4PhysicsVector * CreatePhysicsVector(G4int vectorType)
G4GLOB_DLL std::ostream G4cout
G4bool AddPhysicsVector(G4PhysicsVector *physicsVector, G4int atomicNumberIon, const G4String &matIdenfier, G4int atomicNumberElem=0)
static const G4double pos