00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // neutron_hp -- source file 00027 // J.P. Wellisch, Nov-1996 00028 // A prototype of the low energy neutron transport model. 00029 // 00030 //080901 Avoiding troubles which caused by G4PhysicsVecotor of length 0 by T. Koi 00031 // 00032 #include "G4NeutronHPIsoData.hh" 00033 #include "G4SystemOfUnits.hh" 00034 #include "G4NeutronHPDataUsed.hh" 00035 00036 //G4bool G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun, G4String dirName, G4String aFSType) 00037 G4bool G4NeutronHPIsoData::Init(G4int A, G4int Z, G4int M, G4double abun, G4String dirName, G4String aFSType) 00038 { 00039 theChannelData = 0; 00040 G4double abundance = abun/100.; 00041 G4String filename; 00042 G4bool result = true; 00043 //G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, dirName, aFSType, result); 00044 G4NeutronHPDataUsed aFile = theNames.GetName(A, Z, M, dirName, aFSType, result); 00045 filename = aFile.GetName(); 00046 // if(filename=="") return false; 00047 std::ifstream theChannel(filename); 00048 00049 if(Z==1 && (aFile.GetZ()!=Z || std::abs(aFile.GetA()-A)>0.0001) ) 00050 { 00051 if(getenv("NeutronHPNamesLogging")) G4cout << "Skipped = "<< filename <<" "<<A<<" "<<Z<<G4endl; 00052 //080901 TKDB No more necessary below protection, cross sections set to 0 in G4NeutronHPNames 00053 //And below two lines causes trouble with G4PhysicsVector 00054 //theChannel.close(); 00055 //return false; 00056 } 00057 if(!theChannel) {theChannel.close(); return false;} 00058 // accommodating deficiencie of some compilers 00059 if(theChannel.eof()) {theChannel.close(); return false;} 00060 if(!theChannel) {theChannel.close(); return false;} 00061 G4int dummy; 00062 theChannel >> dummy >> dummy; 00063 theChannelData = new G4NeutronHPVector; 00064 G4int nData; 00065 theChannel >> nData; 00066 theChannelData->Init(theChannel, nData, eV, abundance*barn); 00067 // G4cout << "Channel Data Statistics: "<<theChannelData->GetVectorLength()<<G4endl; 00068 // G4cout << "Channel data"<<G4endl; 00069 // G4int hpw; 00070 // G4cin >> hpw; 00071 // theChannelData->Dump(); 00072 theChannel.close(); 00073 return result; 00074 } 00075 00076 //void G4NeutronHPIsoData::Init(G4int A, G4int Z, G4double abun) //fill PhysicsVector for this Isotope 00077 void G4NeutronHPIsoData::Init(G4int A, G4int Z, G4int M, G4double abun) //fill PhysicsVector for this Isotope 00078 { 00079 G4String dirName; 00080 if(!getenv("G4NEUTRONHPDATA")) 00081 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files."); 00082 G4String baseName = getenv("G4NEUTRONHPDATA"); 00083 dirName = baseName+"/Fission"; 00084 //if(Z>89) 00085 if(Z>87) //TK Modifed for ENDF VII.0 00086 { 00087 //Init(A, Z, abun, dirName, "/CrossSection/"); 00088 Init(A, Z, M, abun, dirName, "/CrossSection"); 00089 } 00090 else 00091 { 00092 theChannelData = new G4NeutronHPVector; 00093 } 00094 theFissionData = theChannelData; 00095 theChannelData = 0; // fast fix for double delete; revisit later. @@@@@@@ 00096 dirName = baseName+"/Capture"; 00097 //Init(A, Z, abun, dirName, "/CrossSection/"); 00098 Init(A, Z, M, abun, dirName, "/CrossSection"); 00099 theCaptureData = theChannelData; 00100 theChannelData = 0; 00101 dirName = baseName+"/Elastic"; 00102 //Init(A, Z, abun, dirName, "/CrossSection/"); 00103 Init(A, Z, M, abun, dirName, "/CrossSection"); 00104 theElasticData = theChannelData; 00105 theChannelData = 0; 00106 dirName = baseName+"/Inelastic"; 00107 //Init(A, Z, abun, dirName, "/CrossSection/"); 00108 Init(A, Z, M, abun, dirName, "/CrossSection"); 00109 theInelasticData = theChannelData; 00110 theChannelData = 0; 00111 00112 // if(theInelasticData!=0) G4cout << "Inelastic Data Statistics: "<<theInelasticData->GetVectorLength()<<G4endl; 00113 // if(theElasticData!=0) G4cout << "Elastic Data Statistics: "<<theElasticData->GetVectorLength()<<G4endl; 00114 // if(theCaptureData!=0) G4cout << "Capture Data Statistics: "<<theCaptureData->GetVectorLength()<<G4endl; 00115 // if(theFissionData!=0) G4cout << "Fission Data Statistics: "<<theFissionData->GetVectorLength()<<G4endl; 00116 // G4cout << "Inelastic data"<<G4endl; 00117 // if(theInelasticData!=0) theInelasticData->Dump(); 00118 // G4cout << "Elastic data"<<G4endl; 00119 // if(theElasticData!=0) theElasticData->Dump(); 00120 // G4cout << "Capture data"<<G4endl; 00121 // if(theCaptureData!=0) theCaptureData->Dump(); 00122 // G4cout << "Fission data"<<G4endl; 00123 // if(theFissionData!=0) theFissionData->Dump(); 00124 00125 } 00126 00127 G4String G4NeutronHPIsoData::GetName(G4int A, G4int Z, G4String base, G4String rest) 00128 { 00129 G4bool dbool; 00130 return (theNames.GetName(A, Z, base, rest, dbool)).GetName(); 00131 } 00132