Geant4 Cross Reference |
1 // ******************************************* 1 // ******************************************************************** 2 // * License and Disclaimer 2 // * License and Disclaimer * 3 // * 3 // * * 4 // * The Geant4 software is copyright of th 4 // * The Geant4 software is copyright of the Copyright Holders of * 5 // * the Geant4 Collaboration. It is provided 5 // * the Geant4 Collaboration. It is provided under the terms and * 6 // * conditions of the Geant4 Software License 6 // * conditions of the Geant4 Software License, included in the file * 7 // * LICENSE and available at http://cern.ch/ 7 // * LICENSE and available at http://cern.ch/geant4/license . These * 8 // * include a list of copyright holders. 8 // * include a list of copyright holders. * 9 // * 9 // * * 10 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 11 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 12 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 13 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 14 // * use. Please see the license in the file 14 // * use. Please see the license in the file LICENSE and URL above * 15 // * for the full disclaimer and the limitatio 15 // * for the full disclaimer and the limitation of liability. * 16 // * 16 // * * 17 // * This code implementation is the result 17 // * This code implementation is the result of the scientific and * 18 // * technical work of the GEANT4 collaboratio 18 // * technical work of the GEANT4 collaboration. * 19 // * By using, copying, modifying or distri 19 // * By using, copying, modifying or distributing the software (or * 20 // * any work based on the software) you ag 20 // * any work based on the software) you agree to acknowledge its * 21 // * use in resulting scientific publicati 21 // * use in resulting scientific publications, and indicate your * 22 // * acceptance of all terms of the Geant4 Sof 22 // * acceptance of all terms of the Geant4 Software license. * 23 // ******************************************* 23 // ******************************************************************** 24 // 24 // 25 // particle_hp -- source file 25 // particle_hp -- source file 26 // J.P. Wellisch, Nov-1996 26 // J.P. Wellisch, Nov-1996 27 // A prototype of the low energy neutron trans 27 // A prototype of the low energy neutron transport model. 28 // 28 // 29 // 080901 Avoiding troubles which caused by G4 << 29 //080901 Avoiding troubles which caused by G4PhysicsVecotor of length 0 by T. Koi 30 // 30 // 31 // P. Arce, June-2014 Conversion neutron_hp to 31 // P. Arce, June-2014 Conversion neutron_hp to particle_hp 32 // 32 // 33 #include "G4ParticleHPIsoData.hh" 33 #include "G4ParticleHPIsoData.hh" 34 << 35 #include "G4Neutron.hh" << 36 #include "G4ParticleHPDataUsed.hh" << 37 #include "G4ParticleHPManager.hh" 34 #include "G4ParticleHPManager.hh" 38 #include "G4Alpha.hh" << 35 #include "G4ParticleHPDataUsed.hh" 39 #include "G4Deuteron.hh" << 36 #include "G4Neutron.hh" 40 #include "G4He3.hh" << 41 #include "G4Proton.hh" << 42 #include "G4Triton.hh" << 43 //#include <stdlib.h> << 44 #include <fstream> << 45 << 46 void G4ParticleHPIsoData::FillChannelData(G4Pa << 47 { << 48 if (theChannelData != nullptr) { << 49 G4Exception("G4ParticleHPIsoData::FillChan << 50 FatalException, "Inconsistency << 51 } << 52 theChannelData = new G4ParticleHPVector; << 53 for (G4int i = 0; i < aBuffer->GetVectorLeng << 54 theChannelData->SetPoint(i, aBuffer->GetPo << 55 } << 56 theChannelData->Hash(); << 57 } << 58 37 59 G4bool G4ParticleHPIsoData::Init(G4int A, G4in << 38 //G4bool G4ParticleHPIsoData::Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType) 60 const G4Strin << 39 G4bool G4ParticleHPIsoData::Init(G4int A, G4int Z, G4int M, G4double abun, G4String dirName, G4String aFSType) 61 { << 40 { 62 theChannelData = nullptr; << 41 theChannelData = 0; 63 G4double abundance = abun / 100.; << 42 G4double abundance = abun/100.; 64 G4String filename; << 43 G4String filename; 65 G4bool result = true; << 44 G4bool result = true; 66 G4ParticleHPDataUsed aFile = theNames.GetNam << 45 //G4ParticleHPDataUsed aFile = theNames.GetName(A, Z, dirName, aFSType, result); 67 filename = aFile.GetName(); << 46 G4ParticleHPDataUsed aFile = theNames.GetName(A, Z, M, dirName, aFSType, result); 68 << 47 filename = aFile.GetName(); 69 std::istringstream theChannel(filename, std: << 48 // if(filename=="") return false; 70 auto man = G4ParticleHPManager::GetInstance( << 49 //std::ifstream theChannel(filename); 71 man->GetDataStream(filename, theChannel); << 50 std::istringstream theChannel(filename,std::ios::in); >> 51 G4ParticleHPManager::GetInstance()->GetDataStream(filename,theChannel); 72 52 73 #ifdef G4PHPDEBUG 53 #ifdef G4PHPDEBUG 74 if (man->GetDEBUG()) << 54 if(getenv("G4ParticleHPDebug")) G4cout << "G4ParticleHPIsoData::Init = "<< filename <<" "<< A << " " << Z <<G4endl; 75 G4cout << "G4ParticleHPIsoData::Init = " < << 76 #endif 55 #endif 77 << 56 78 if (Z == 1 && (aFile.GetZ() != Z || aFile.Ge << 57 if(Z==1 && (aFile.GetZ()!=Z || std::abs(aFile.GetA()-A)>0.0001) ) 79 if (man->GetDEBUG()) << 80 G4cout << "Skipped = " << filename << " << 81 // 080901 TKDB No more necessary below pro << 82 } << 83 if (!theChannel) { /*theChannel.close()*/ << 84 return false; << 85 } << 86 // accommodating deficiencie of some compile << 87 if (theChannel.eof()) { /*theChannel.close() << 88 return false; << 89 } << 90 G4int dummy; << 91 theChannel >> dummy >> dummy; << 92 theChannelData = new G4ParticleHPVector; << 93 G4int nData; << 94 theChannel >> nData; << 95 theChannelData->Init(theChannel, nData, CLHE << 96 return result; << 97 } << 98 << 99 void G4ParticleHPIsoData::Init(G4int A, G4int << 100 G4ParticleDefin << 101 // fill PhysicsVector for this Isotope << 102 { << 103 auto man = G4ParticleHPManager::GetInstance( << 104 << 105 G4String baseName = man->GetParticleHPPath(p << 106 << 107 G4String dirName; << 108 if (projectile == G4Neutron::Neutron()) { << 109 dirName = baseName + "/Fission"; << 110 if (Z > 87) // TK Modifed for ENDF VII.0 << 111 { 58 { 112 Init(A, Z, M, abun, dirName, "/CrossSect << 59 if(getenv("G4ParticleHPDebug")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl; >> 60 //080901 TKDB No more necessary below protection, cross sections set to 0 in G4ParticleHPNames >> 61 //And below two lines causes trouble with G4PhysicsVector >> 62 //theChannel.close(); >> 63 //return false; 113 } 64 } 114 else { << 65 if(!theChannel) {/*theChannel.close()*/; return false;} 115 theChannelData = new G4ParticleHPVector; << 66 // accommodating deficiencie of some compilers 116 } << 67 if(theChannel.eof()) {/*theChannel.close()*/; return false;} 117 theFissionData = theChannelData; << 68 if(!theChannel) {/*theChannel.close()*/; return false;} 118 theChannelData = nullptr; // fast fix for << 69 G4int dummy; >> 70 theChannel >> dummy >> dummy; >> 71 theChannelData = new G4ParticleHPVector; >> 72 G4int nData; >> 73 theChannel >> nData; >> 74 theChannelData->Init(theChannel, nData, CLHEP::eV, abundance*CLHEP::barn); >> 75 // G4cout << "Channel Data Statistics: "<<theChannelData->GetVectorLength()<<G4endl; >> 76 // G4cout << "Channel data"<<G4endl; >> 77 // G4int hpw; >> 78 // G4cin >> hpw; >> 79 // theChannelData->Dump(); >> 80 // theChannel.close(); >> 81 return result; >> 82 } >> 83 >> 84 //void G4ParticleHPIsoData::Init(G4int A, G4int Z, G4double abun) //fill PhysicsVector for this Isotope >> 85 void G4ParticleHPIsoData::Init(G4int A, G4int Z, G4int M,G4double abun, G4ParticleDefinition* projectile, const char* dataDirVariable ) //fill PhysicsVector for this Isotope >> 86 { >> 87 G4String dirName; >> 88 >> 89 G4String baseName = getenv(dataDirVariable); >> 90 if( projectile == G4Neutron::Neutron() ){ >> 91 dirName = baseName+"/Fission"; >> 92 //if(Z>89) >> 93 if(Z>87) //TK Modifed for ENDF VII.0 >> 94 { >> 95 //Init(A, Z, abun, dirName, "/CrossSection/"); >> 96 Init(A, Z, M, abun, dirName, "/CrossSection"); >> 97 } >> 98 else >> 99 { >> 100 theChannelData = new G4ParticleHPVector; >> 101 } >> 102 theFissionData = theChannelData; >> 103 theChannelData = 0; // fast fix for double delete; revisit later. @@@@@@@ 119 104 120 dirName = baseName + "/Capture"; << 105 dirName = baseName+"/Capture"; 121 Init(A, Z, M, abun, dirName, "/CrossSectio << 106 //Init(A, Z, abun, dirName, "/CrossSection/"); 122 theCaptureData = theChannelData; << 107 Init(A, Z, M, abun, dirName, "/CrossSection"); 123 theChannelData = nullptr; << 108 theCaptureData = theChannelData; >> 109 theChannelData = 0; >> 110 >> 111 dirName = baseName+"/Elastic"; >> 112 //Init(A, Z, abun, dirName, "/CrossSection/"); >> 113 Init(A, Z, M, abun, dirName, "/CrossSection"); >> 114 theElasticData = theChannelData; >> 115 theChannelData = 0; >> 116 } 124 117 125 dirName = baseName + "/Elastic"; << 118 dirName = baseName+"/Inelastic"; >> 119 //Init(A, Z, abun, dirName, "/CrossSection/"); 126 Init(A, Z, M, abun, dirName, "/CrossSectio 120 Init(A, Z, M, abun, dirName, "/CrossSection"); 127 theElasticData = theChannelData; << 121 theInelasticData = theChannelData; 128 theChannelData = nullptr; << 122 theChannelData = 0; >> 123 >> 124 // if(theInelasticData!=0) G4cout << "Inelastic Data Statistics: "<<theInelasticData->GetVectorLength()<<G4endl; >> 125 // if(theElasticData!=0) G4cout << "Elastic Data Statistics: "<<theElasticData->GetVectorLength()<<G4endl; >> 126 // if(theCaptureData!=0) G4cout << "Capture Data Statistics: "<<theCaptureData->GetVectorLength()<<G4endl; >> 127 // if(theFissionData!=0) G4cout << "Fission Data Statistics: "<<theFissionData->GetVectorLength()<<G4endl; >> 128 // G4cout << "Inelastic data"<<G4endl; >> 129 // if(theInelasticData!=0) theInelasticData->Dump(); >> 130 // G4cout << "Elastic data"<<G4endl; >> 131 // if(theElasticData!=0) theElasticData->Dump(); >> 132 // G4cout << "Capture data"<<G4endl; >> 133 // if(theCaptureData!=0) theCaptureData->Dump(); >> 134 // G4cout << "Fission data"<<G4endl; >> 135 // if(theFissionData!=0) theFissionData->Dump(); >> 136 >> 137 } >> 138 >> 139 G4String G4ParticleHPIsoData::GetName(G4int A, G4int Z, G4String base, G4String rest) >> 140 { >> 141 G4bool dbool; >> 142 return (theNames.GetName(A, Z, base, rest, dbool)).GetName(); 129 } 143 } 130 144 131 dirName = baseName + "/Inelastic"; << 132 Init(A, Z, M, abun, dirName, "/CrossSection" << 133 theInelasticData = theChannelData; << 134 theChannelData = nullptr; << 135 } << 136 << 137 G4String G4ParticleHPIsoData::GetName(G4int A, << 138 { << 139 G4bool dbool; << 140 return (theNames.GetName(A, Z, base, rest, d << 141 } << 142 145