99 G4int atomicNumberIon,
100 G4int atomicNumberElem
113 G4int atomicNumberIon,
127 G4int atomicNumberIon,
128 G4int atomicNumberElem
141 G4int atomicNumberIon,
156 G4int atomicNumberIon,
157 G4int atomicNumberElem
165 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
172 G4int atomicNumberIon,
181 (iter->second)->Value( kinEnergyPerNucleon) : 0.0;
188 G4int atomicNumberIon,
190 G4int atomicNumberElem
193 if(physicsVector ==
nullptr) {
194 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
196 "Pointer to vector is null-pointer.");
200 if(matIdentifier.empty()) {
201 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
206 if(atomicNumberIon <= 2) {
207 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
212 if(atomicNumberElem > 0) {
217 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
219 "Vector already exist, remove it before replacing.");
229 G4Exception (
"G4ExtDEDXTable::AddPhysicsVector() for material",
231 "Vector already exist, remove it before replacing.");
243 G4int atomicNumberIon,
255 G4Exception (
"G4ExtDEDXTable::RemovePhysicsVector() for material",
257 "Pointer to vector is null-pointer.");
261 physicsVector = (*iter).second;
265 G4IonDEDXMapElem::iterator it;
269 if( (*it).second == physicsVector ) {
276 delete physicsVector;
288 std::ofstream ofilestream;
290 ofilestream.open( fileName, std::ios::out );
294 ed <<
"Cannot open file " << fileName;
295 G4Exception (
"G4IonStoppingData::StorePhysicsTable()",
308 for(;iterMat != iterMat_end; iterMat++) {
312 G4int atomicNumberIon = key.first;
313 G4String matIdentifier = key.second;
317 if(physicsVector !=
nullptr) {
318 ofilestream << atomicNumberIon <<
" " << matIdentifier;
320 if(atomicNumberElem > 0) ofilestream <<
" " << atomicNumberElem;
322 ofilestream <<
" # <Atomic number ion> <Material name> ";
324 if(atomicNumberElem > 0) ofilestream <<
"<Atomic number element>";
326 ofilestream <<
G4endl << physicsVector -> GetType() <<
G4endl;
328 physicsVector -> Store(ofilestream,
true);
332 G4Exception (
"G4IonStoppingData::StorePhysicsTable()",
347 std::ifstream ifilestream;
348 ifilestream.open( fileName, std::ios::in|std::ios::binary );
349 if( ! ifilestream ) {
351 ed <<
"Cannot open file " << fileName;
352 G4Exception (
"G4IonStoppingData::RetrievePhysicsTable()",
358 G4int nmbVectors = 0;
359 ifilestream >> nmbVectors;
360 if( ifilestream.fail() || nmbVectors <= 0) {
361 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
362 <<
" File content of " << fileName <<
" ill-formated."
363 <<
" Nvectors= " << nmbVectors
369 for(
G4int i = 0; i<nmbVectors; ++i) {
373 while( line.empty() ) {
375 getline( ifilestream, line );
376 if( ifilestream.fail() ) {
377 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
378 <<
" File content of " << fileName <<
" ill-formated."
384 std::string::size_type
pos = line.find_first_of(
"#");
385 if(
pos != std::string::npos &&
pos > 0) {
386 line = line.substr(0,
pos);
390 std::istringstream headerstream( line );
392 std::string::size_type atomicNumberIon;
393 headerstream >> atomicNumberIon;
396 headerstream >> materialName;
398 if( headerstream.fail() || std::string::npos == atomicNumberIon) {
399 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
400 <<
" File content of " << fileName <<
" ill-formated "
401 <<
" (vector header)."
407 std::string::size_type atomicNumberMat;
408 headerstream >> atomicNumberMat;
410 if( headerstream.eof() || std::string::npos == atomicNumberMat) {
415 ifilestream >> vectorType;
419 if(physicsVector ==
nullptr) {
420 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable "
421 <<
" illegal physics Vector type " << vectorType
422 <<
" in " << fileName
428 if( !physicsVector -> Retrieve(ifilestream,
true) ) {
429 G4cout <<
"G4ExtDEDXTable::RetrievePhysicsTable() "
430 <<
" File content of " << fileName <<
" ill-formated."
435 physicsVector -> FillSecondDerivatives();
439 materialName, (
G4int)atomicNumberMat) ) {
441 delete physicsVector;
458 switch (vectorType) {
475 return physicsVector;
484 G4int atomicNumber = 0;
489 for(;iter != iter_end; ++iter) {
491 if( (*iter).second == physicsVector ) {
494 atomicNumber = key.second;
508 for(;iterMat != iterMat_end; ++iterMat) {
512 if(vec != 0)
delete vec;
526 G4cout << std::setw(15) << std::right
528 << std::setw(25) << std::right
530 << std::setw(25) << std::right
531 <<
"Atomic nmb material"
534 for(;iterMat != iterMat_end; ++iterMat) {
538 G4int atomicNumberIon = key.first;
539 G4String matIdentifier = key.second;
543 if(physicsVector != 0) {
544 G4cout << std::setw(15) << std::right
546 << std::setw(25) << std::right
548 << std::setw(25) << std::right;
550 if(atomicNumberElem > 0)
G4cout << atomicNumberElem;
static const G4double pos
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
@ T_G4PhysicsLinearVector
static constexpr double second
G4GLOB_DLL std::ostream G4cout
virtual G4PhysicsVector * GetPhysicsVector(G4int atomicNumberIon, G4int atomicNumberElem)
virtual G4bool BuildPhysicsVector(G4int ionZ, const G4String &matName)
virtual G4bool IsApplicable(G4int atomicNumberIon, G4int atomicNumberElem)
G4double GetDEDX(G4double kinEnergyPerNucleon, G4int atomicNumberIon, G4int atomicNumberElem)
G4IonDEDXMapMat dedxMapMaterials
G4bool StorePhysicsTable(const G4String &fileName)
std::pair< G4int, G4String > G4IonDEDXKeyMat
G4bool RemovePhysicsVector(G4int atomicNumberIon, const G4String &matIdentifier)
G4bool AddPhysicsVector(G4PhysicsVector *physicsVector, G4int atomicNumberIon, const G4String &matIdenfier, G4int atomicNumberElem=0)
std::pair< G4int, G4int > G4IonDEDXKeyElem
G4PhysicsVector * CreatePhysicsVector(G4int vectorType)
virtual ~G4ExtDEDXTable()
G4int FindAtomicNumberElement(G4PhysicsVector *physicsVector)
G4bool RetrievePhysicsTable(const G4String &fileName)
G4IonDEDXMapElem dedxMapElements