Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // ------------------------------------------- 26 // ------------------------------------------------------------------- 27 // 27 // 28 // GEANT4 Class file 28 // GEANT4 Class file 29 // 29 // 30 // 30 // 31 // File name: G4NeutronCaptureXS 31 // File name: G4NeutronCaptureXS 32 // 32 // 33 // Author Ivantchenko, Geant4, 3-Aug-09 33 // Author Ivantchenko, Geant4, 3-Aug-09 34 // 34 // 35 // Modifications: 35 // Modifications: 36 // 36 // 37 37 38 #include <fstream> 38 #include <fstream> 39 #include <sstream> 39 #include <sstream> 40 #include <thread> 40 #include <thread> 41 41 42 #include "G4SystemOfUnits.hh" 42 #include "G4SystemOfUnits.hh" 43 #include "G4NeutronCaptureXS.hh" 43 #include "G4NeutronCaptureXS.hh" 44 #include "G4Material.hh" 44 #include "G4Material.hh" 45 #include "G4Element.hh" 45 #include "G4Element.hh" 46 #include "G4PhysicsLogVector.hh" 46 #include "G4PhysicsLogVector.hh" 47 #include "G4DynamicParticle.hh" 47 #include "G4DynamicParticle.hh" 48 #include "G4ElementTable.hh" 48 #include "G4ElementTable.hh" 49 #include "G4IsotopeList.hh" 49 #include "G4IsotopeList.hh" 50 #include "G4HadronicParameters.hh" 50 #include "G4HadronicParameters.hh" 51 #include "Randomize.hh" 51 #include "Randomize.hh" 52 #include "G4Log.hh" 52 #include "G4Log.hh" 53 #include "G4AutoLock.hh" 53 #include "G4AutoLock.hh" 54 54 55 G4ElementData* G4NeutronCaptureXS::data = null 55 G4ElementData* G4NeutronCaptureXS::data = nullptr; 56 G4String G4NeutronCaptureXS::gDataDirectory = 56 G4String G4NeutronCaptureXS::gDataDirectory = ""; 57 57 58 static std::once_flag applyOnce; 58 static std::once_flag applyOnce; 59 59 60 namespace 60 namespace 61 { 61 { 62 G4Mutex neutronCaptureXSMutex = G4MUTEX_INIT 62 G4Mutex neutronCaptureXSMutex = G4MUTEX_INITIALIZER; 63 const G4int MAXZCAPTURE = 92; << 64 } 63 } 65 64 66 G4NeutronCaptureXS::G4NeutronCaptureXS() 65 G4NeutronCaptureXS::G4NeutronCaptureXS() 67 : G4VCrossSectionDataSet(Default_Name()), 66 : G4VCrossSectionDataSet(Default_Name()), 68 emax(20*CLHEP::MeV), elimit(1.0e-5*CLHEP::e << 67 emax(20*CLHEP::MeV), elimit(1.0e-10*CLHEP::eV) 69 { 68 { 70 verboseLevel = 0; 69 verboseLevel = 0; 71 if (verboseLevel > 0) { 70 if (verboseLevel > 0) { 72 G4cout << "G4NeutronCaptureXS::G4NeutronC 71 G4cout << "G4NeutronCaptureXS::G4NeutronCaptureXS: Initialise for Z < " 73 << MAXZCAPTURE << G4endl; 72 << MAXZCAPTURE << G4endl; 74 } 73 } 75 logElimit = G4Log(elimit); 74 logElimit = G4Log(elimit); 76 if (nullptr == data) { 75 if (nullptr == data) { 77 data = new G4ElementData(MAXZCAPTURE+1); << 76 data = new G4ElementData(MAXZCAPTURE); 78 data->SetName("nCapture"); 77 data->SetName("nCapture"); 79 FindDirectoryPath(); 78 FindDirectoryPath(); 80 } 79 } 81 } 80 } 82 81 83 void G4NeutronCaptureXS::CrossSectionDescripti 82 void G4NeutronCaptureXS::CrossSectionDescription(std::ostream& outFile) const 84 { 83 { 85 outFile << "G4NeutronCaptureXS calculates th 84 outFile << "G4NeutronCaptureXS calculates the neutron capture cross sections\n" 86 << "on nuclei using data from the hi 85 << "on nuclei using data from the high precision neutron database.\n" 87 << "These data are simplified and sm 86 << "These data are simplified and smoothed over the resonance region\n" 88 << "in order to reduce CPU time. G4N 87 << "in order to reduce CPU time. G4NeutronCaptureXS is set to zero\n" 89 << "above 20 MeV for all targets. Fo 88 << "above 20 MeV for all targets. For Z > 92 the cross section of\n" 90 << "Uranium is used.\n"; 89 << "Uranium is used.\n"; 91 } 90 } 92 91 93 G4bool 92 G4bool 94 G4NeutronCaptureXS::IsElementApplicable(const 93 G4NeutronCaptureXS::IsElementApplicable(const G4DynamicParticle*, 95 G4int, const G4Material*) 94 G4int, const G4Material*) 96 { 95 { 97 return true; 96 return true; 98 } 97 } 99 98 100 G4bool 99 G4bool 101 G4NeutronCaptureXS::IsIsoApplicable(const G4Dy 100 G4NeutronCaptureXS::IsIsoApplicable(const G4DynamicParticle*, 102 G4int, G4int, 101 G4int, G4int, 103 const G4Element*, const G4Material 102 const G4Element*, const G4Material*) 104 { 103 { 105 return true; 104 return true; 106 } 105 } 107 106 108 G4double 107 G4double 109 G4NeutronCaptureXS::GetElementCrossSection(con 108 G4NeutronCaptureXS::GetElementCrossSection(const G4DynamicParticle* aParticle, 110 G4int Z, const G4Material*) 109 G4int Z, const G4Material*) 111 { 110 { 112 G4double xs = 0.0; 111 G4double xs = 0.0; 113 G4double ekin = aParticle->GetKineticEnergy( 112 G4double ekin = aParticle->GetKineticEnergy(); 114 if (ekin < emax) { 113 if (ekin < emax) { 115 xs = ElementCrossSection(ekin, aParticle-> 114 xs = ElementCrossSection(ekin, aParticle->GetLogKineticEnergy(), Z); 116 } 115 } 117 return xs; 116 return xs; 118 } 117 } 119 118 120 G4double 119 G4double 121 G4NeutronCaptureXS::ComputeCrossSectionPerElem 120 G4NeutronCaptureXS::ComputeCrossSectionPerElement(G4double ekin, G4double loge, 122 const G4ParticleDefi 121 const G4ParticleDefinition*, 123 const G4Element* elm 122 const G4Element* elm, 124 const G4Material*) 123 const G4Material*) 125 { 124 { 126 G4double xs = 0.0; 125 G4double xs = 0.0; 127 if (ekin < emax) { 126 if (ekin < emax) { 128 xs = ElementCrossSection(ekin, loge, elm-> 127 xs = ElementCrossSection(ekin, loge, elm->GetZasInt()); 129 } 128 } 130 return xs; 129 return xs; 131 } 130 } 132 131 133 G4double 132 G4double 134 G4NeutronCaptureXS::ElementCrossSection(G4doub << 133 G4NeutronCaptureXS::ElementCrossSection(G4double ekin, G4double loge, G4int ZZ) 135 { 134 { 136 G4int Z = std::min(ZZ, MAXZCAPTURE); << 135 G4int Z = std::min(ZZ, MAXZCAPTURE-1); 137 G4double ekin = eKin; << 136 G4double logEkin = loge; 138 G4double logEkin = logE; << 137 if (ekin < elimit) { ekin = elimit; logEkin = logElimit; } 139 if (ekin < elimit) { << 140 ekin = elimit; << 141 logEkin = logElimit; << 142 } << 143 138 144 auto pv = GetPhysicsVector(Z); 139 auto pv = GetPhysicsVector(Z); 145 const G4double e0 = pv->Energy(0); << 140 const G4double e1 = pv->Energy(1); 146 G4double xs = (ekin >= e0) ? pv->LogVectorVa << 141 G4double xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin) 147 : (*pv)[0]*std::sqrt(e0/ekin); << 142 : (*pv)[1]*std::sqrt(e1/ekin); 148 143 149 #ifdef G4VERBOSE 144 #ifdef G4VERBOSE 150 if (verboseLevel > 1){ 145 if (verboseLevel > 1){ 151 G4cout << "Ekin= " << ekin/CLHEP::MeV 146 G4cout << "Ekin= " << ekin/CLHEP::MeV 152 << " ElmXScap(b)= " << xs/CLHEP::b 147 << " ElmXScap(b)= " << xs/CLHEP::barn << G4endl; 153 } 148 } 154 #endif 149 #endif 155 return xs; 150 return xs; 156 } 151 } 157 152 158 G4double 153 G4double 159 G4NeutronCaptureXS::ComputeIsoCrossSection(G4d 154 G4NeutronCaptureXS::ComputeIsoCrossSection(G4double ekin, G4double loge, 160 const G4ParticleDefinition* 155 const G4ParticleDefinition*, 161 G4int Z, G4int A, 156 G4int Z, G4int A, 162 const G4Isotope*, const G4E 157 const G4Isotope*, const G4Element*, 163 const G4Material*) 158 const G4Material*) 164 { 159 { 165 return IsoCrossSection(ekin, loge, Z, A); 160 return IsoCrossSection(ekin, loge, Z, A); 166 } 161 } 167 162 168 G4double 163 G4double 169 G4NeutronCaptureXS::GetIsoCrossSection(const G 164 G4NeutronCaptureXS::GetIsoCrossSection(const G4DynamicParticle* aParticle, 170 G4int Z, G4int A, 165 G4int Z, G4int A, 171 const G4Isotope*, const G4Eleme 166 const G4Isotope*, const G4Element*, 172 const G4Material*) 167 const G4Material*) 173 { 168 { 174 return IsoCrossSection(aParticle->GetKinetic 169 return IsoCrossSection(aParticle->GetKineticEnergy(), 175 aParticle->GetLogKine 170 aParticle->GetLogKineticEnergy(), 176 Z, A); 171 Z, A); 177 } 172 } 178 173 179 G4double G4NeutronCaptureXS::IsoCrossSection(G 174 G4double G4NeutronCaptureXS::IsoCrossSection(G4double eKin, G4double logE, 180 G 175 G4int ZZ, G4int A) 181 { 176 { 182 G4double xs = 0.0; 177 G4double xs = 0.0; 183 if (eKin > emax) { return xs; } 178 if (eKin > emax) { return xs; } 184 179 185 G4int Z = std::min(ZZ, MAXZCAPTURE); << 180 G4int Z = std::min(ZZ, MAXZCAPTURE-1); 186 G4double ekin = eKin; 181 G4double ekin = eKin; 187 G4double logEkin = logE; 182 G4double logEkin = logE; 188 if (ekin < elimit) { 183 if (ekin < elimit) { 189 ekin = elimit; 184 ekin = elimit; 190 logEkin = logElimit; 185 logEkin = logElimit; 191 } 186 } 192 187 193 auto pv = GetPhysicsVector(Z); 188 auto pv = GetPhysicsVector(Z); 194 if (pv == nullptr) { return xs; } 189 if (pv == nullptr) { return xs; } 195 190 196 // use isotope x-section if possible << 197 if (data->GetNumberOfComponents(Z) > 0) { 191 if (data->GetNumberOfComponents(Z) > 0) { 198 G4PhysicsVector* pviso = data->GetComponen 192 G4PhysicsVector* pviso = data->GetComponentDataByID(Z, A); 199 if(pviso != nullptr) { 193 if(pviso != nullptr) { 200 const G4double e0 = pviso->Energy(0); << 194 const G4double e1 = pviso->Energy(1); 201 xs = (ekin >= e0) ? pviso->LogVectorValu << 195 xs = (ekin >= e1) ? pviso->LogVectorValue(ekin, logEkin) 202 : (*pviso)[0]*std::sqrt(e0/ekin); << 196 : (*pviso)[1]*std::sqrt(e1/ekin); 203 #ifdef G4VERBOSE 197 #ifdef G4VERBOSE 204 if(verboseLevel > 0) { 198 if(verboseLevel > 0) { 205 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(M 199 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV 206 << " xs(b)= " << xs/barn 200 << " xs(b)= " << xs/barn 207 << " Z= " << Z << " A= " << A << G4 201 << " Z= " << Z << " A= " << A << G4endl; 208 } 202 } 209 #endif 203 #endif 210 return xs; 204 return xs; 211 } 205 } 212 } 206 } 213 // isotope data are not available or applica 207 // isotope data are not available or applicable 214 const G4double e0 = pv->Energy(0); << 208 const G4double e1 = pv->Energy(1); 215 xs = (ekin >= e0) ? pv->LogVectorValue(ekin, << 209 xs = (ekin >= e1) ? pv->LogVectorValue(ekin, logEkin) 216 : (*pv)[0]*std::sqrt(e0/ekin); << 210 : (*pv)[1]*std::sqrt(e1/ekin); 217 #ifdef G4VERBOSE 211 #ifdef G4VERBOSE 218 if (verboseLevel > 0) { 212 if (verboseLevel > 0) { 219 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin 213 G4cout << "G4NeutronCaptureXS::IsoXS: Ekin(MeV)= " << ekin/MeV 220 << " xs(b)= " << xs/barn 214 << " xs(b)= " << xs/barn 221 << " Z= " << Z << " A= " << A << " no i 215 << " Z= " << Z << " A= " << A << " no iso XS" << G4endl; 222 } 216 } 223 #endif 217 #endif 224 return xs; 218 return xs; 225 } 219 } 226 220 227 const G4Isotope* 221 const G4Isotope* 228 G4NeutronCaptureXS::SelectIsotope(const G4Elem 222 G4NeutronCaptureXS::SelectIsotope(const G4Element* anElement, 229 G4double kinEnergy, G4double logE) 223 G4double kinEnergy, G4double logE) 230 { 224 { 231 G4int nIso = (G4int)anElement->GetNumberOfIs 225 G4int nIso = (G4int)anElement->GetNumberOfIsotopes(); 232 const G4Isotope* iso = anElement->GetIsotope 226 const G4Isotope* iso = anElement->GetIsotope(0); 233 227 234 //G4cout << "SelectIsotope NIso= " << nIso < 228 //G4cout << "SelectIsotope NIso= " << nIso << G4endl; 235 if(1 == nIso) { return iso; } 229 if(1 == nIso) { return iso; } 236 230 237 // more than 1 isotope 231 // more than 1 isotope 238 G4int Z = anElement->GetZasInt(); 232 G4int Z = anElement->GetZasInt(); 239 if (nullptr == data->GetElementData(Z)) { In 233 if (nullptr == data->GetElementData(Z)) { InitialiseOnFly(Z); } 240 234 241 const G4double* abundVector = anElement->Get 235 const G4double* abundVector = anElement->GetRelativeAbundanceVector(); 242 G4double q = G4UniformRand(); 236 G4double q = G4UniformRand(); 243 G4double sum = 0.0; 237 G4double sum = 0.0; 244 238 245 // is there isotope wise cross section? 239 // is there isotope wise cross section? 246 G4int j; 240 G4int j; 247 if (Z > MAXZCAPTURE || 0 == data->GetNumberO << 241 if (Z >= MAXZCAPTURE || 0 == data->GetNumberOfComponents(Z)) { 248 for (j = 0; j<nIso; ++j) { 242 for (j = 0; j<nIso; ++j) { 249 sum += abundVector[j]; 243 sum += abundVector[j]; 250 if(q <= sum) { 244 if(q <= sum) { 251 iso = anElement->GetIsotope(j); 245 iso = anElement->GetIsotope(j); 252 break; 246 break; 253 } 247 } 254 } 248 } 255 return iso; 249 return iso; 256 } 250 } 257 G4int nn = (G4int)temp.size(); 251 G4int nn = (G4int)temp.size(); 258 if (nn < nIso) { temp.resize(nIso, 0.); } 252 if (nn < nIso) { temp.resize(nIso, 0.); } 259 253 260 for (j=0; j<nIso; ++j) { 254 for (j=0; j<nIso; ++j) { 261 sum += abundVector[j]*IsoCrossSection(kinE 255 sum += abundVector[j]*IsoCrossSection(kinEnergy, logE, Z, 262 anElement->GetIsotope(j)->GetN()); 256 anElement->GetIsotope(j)->GetN()); 263 temp[j] = sum; 257 temp[j] = sum; 264 } 258 } 265 sum *= q; 259 sum *= q; 266 for (j = 0; j<nIso; ++j) { 260 for (j = 0; j<nIso; ++j) { 267 if (temp[j] >= sum) { 261 if (temp[j] >= sum) { 268 iso = anElement->GetIsotope(j); 262 iso = anElement->GetIsotope(j); 269 break; 263 break; 270 } 264 } 271 } 265 } 272 return iso; 266 return iso; 273 } 267 } 274 268 275 void 269 void 276 G4NeutronCaptureXS::BuildPhysicsTable(const G4 270 G4NeutronCaptureXS::BuildPhysicsTable(const G4ParticleDefinition& p) 277 { 271 { 278 if (verboseLevel > 0){ 272 if (verboseLevel > 0){ 279 G4cout << "G4NeutronCaptureXS::BuildPhysic 273 G4cout << "G4NeutronCaptureXS::BuildPhysicsTable for " 280 << p.GetParticleName() << G4endl; 274 << p.GetParticleName() << G4endl; 281 } 275 } 282 if (p.GetParticleName() != "neutron") { 276 if (p.GetParticleName() != "neutron") { 283 G4ExceptionDescription ed; 277 G4ExceptionDescription ed; 284 ed << p.GetParticleName() << " is a wrong 278 ed << p.GetParticleName() << " is a wrong particle type -" 285 << " only neutron is allowed"; 279 << " only neutron is allowed"; 286 G4Exception("G4NeutronCaptureXS::BuildPhys 280 G4Exception("G4NeutronCaptureXS::BuildPhysicsTable(..)","had012", 287 FatalException, ed, ""); 281 FatalException, ed, ""); 288 return; 282 return; 289 } 283 } 290 284 291 // it is possible re-initialisation for the 285 // it is possible re-initialisation for the second run 292 const G4ElementTable* table = G4Element::Get 286 const G4ElementTable* table = G4Element::GetElementTable(); 293 287 294 // initialise static tables only once 288 // initialise static tables only once 295 std::call_once(applyOnce, [this]() { isIniti 289 std::call_once(applyOnce, [this]() { isInitializer = true; }); 296 290 297 if (isInitializer) { 291 if (isInitializer) { 298 G4AutoLock l(&neutronCaptureXSMutex); 292 G4AutoLock l(&neutronCaptureXSMutex); 299 // Access to elements 293 // Access to elements 300 for ( auto const & elm : *table ) { 294 for ( auto const & elm : *table ) { 301 G4int Z = std::max( 1, std::min( elm->Ge << 295 G4int Z = std::max( 1, std::min( elm->GetZasInt(), MAXZCAPTURE-1) ); 302 if ( nullptr == data->GetElementData(Z) 296 if ( nullptr == data->GetElementData(Z) ) { Initialise(Z); } 303 } 297 } 304 l.unlock(); 298 l.unlock(); 305 } 299 } 306 300 307 // prepare isotope selection 301 // prepare isotope selection 308 std::size_t nIso = temp.size(); 302 std::size_t nIso = temp.size(); 309 for ( auto const & elm : *table ) { 303 for ( auto const & elm : *table ) { 310 std::size_t n = elm->GetNumberOfIsotopes() 304 std::size_t n = elm->GetNumberOfIsotopes(); 311 if (n > nIso) { nIso = n; } 305 if (n > nIso) { nIso = n; } 312 } 306 } 313 temp.resize(nIso, 0.0); 307 temp.resize(nIso, 0.0); 314 } 308 } 315 309 316 const G4String& G4NeutronCaptureXS::FindDirect 310 const G4String& G4NeutronCaptureXS::FindDirectoryPath() 317 { 311 { 318 // build the complete string identifying the 312 // build the complete string identifying the file with the data set 319 if(gDataDirectory.empty()) { 313 if(gDataDirectory.empty()) { 320 std::ostringstream ost; 314 std::ostringstream ost; 321 ost << G4HadronicParameters::Instance()->G 315 ost << G4HadronicParameters::Instance()->GetDirPARTICLEXS() << "/neutron/cap"; 322 gDataDirectory = ost.str(); 316 gDataDirectory = ost.str(); 323 } 317 } 324 return gDataDirectory; 318 return gDataDirectory; 325 } 319 } 326 320 327 void G4NeutronCaptureXS::InitialiseOnFly(G4int 321 void G4NeutronCaptureXS::InitialiseOnFly(G4int Z) 328 { 322 { 329 G4AutoLock l(&neutronCaptureXSMutex); 323 G4AutoLock l(&neutronCaptureXSMutex); 330 Initialise(Z); 324 Initialise(Z); 331 l.unlock(); 325 l.unlock(); 332 } 326 } 333 327 334 void G4NeutronCaptureXS::Initialise(G4int Z) 328 void G4NeutronCaptureXS::Initialise(G4int Z) 335 { 329 { 336 if (nullptr != data->GetElementData(Z)) { re 330 if (nullptr != data->GetElementData(Z)) { return; } 337 331 338 // upload element data 332 // upload element data 339 std::ostringstream ost; 333 std::ostringstream ost; 340 ost << FindDirectoryPath() << Z ; 334 ost << FindDirectoryPath() << Z ; 341 G4PhysicsVector* v = RetrieveVector(ost, tru 335 G4PhysicsVector* v = RetrieveVector(ost, true); 342 data->InitialiseForElement(Z, v); 336 data->InitialiseForElement(Z, v); 343 337 344 // upload isotope data 338 // upload isotope data 345 G4bool noComp = true; 339 G4bool noComp = true; 346 if (amin[Z] < amax[Z]) { 340 if (amin[Z] < amax[Z]) { 347 for(G4int A=amin[Z]; A<=amax[Z]; ++A) { 341 for(G4int A=amin[Z]; A<=amax[Z]; ++A) { 348 std::ostringstream ost1; 342 std::ostringstream ost1; 349 ost1 << gDataDirectory << Z << "_" << A; 343 ost1 << gDataDirectory << Z << "_" << A; 350 G4PhysicsVector* v1 = RetrieveVector(ost 344 G4PhysicsVector* v1 = RetrieveVector(ost1, false); 351 if (nullptr != v1) { 345 if (nullptr != v1) { 352 if (noComp) { 346 if (noComp) { 353 G4int nmax = amax[Z] - A + 1; 347 G4int nmax = amax[Z] - A + 1; 354 data->InitialiseForComponent(Z, nmax); 348 data->InitialiseForComponent(Z, nmax); 355 noComp = false; 349 noComp = false; 356 } 350 } 357 data->AddComponent(Z, A, v1); 351 data->AddComponent(Z, A, v1); 358 } 352 } 359 } 353 } 360 } 354 } 361 // no components case 355 // no components case 362 if (noComp) { data->InitialiseForComponent(Z 356 if (noComp) { data->InitialiseForComponent(Z, 0); } 363 } 357 } 364 358 365 G4PhysicsVector* 359 G4PhysicsVector* 366 G4NeutronCaptureXS::RetrieveVector(std::ostrin 360 G4NeutronCaptureXS::RetrieveVector(std::ostringstream& ost, G4bool warn) 367 { 361 { 368 G4PhysicsLogVector* v = nullptr; 362 G4PhysicsLogVector* v = nullptr; 369 std::ifstream filein(ost.str().c_str()); 363 std::ifstream filein(ost.str().c_str()); 370 if (!filein.is_open()) { 364 if (!filein.is_open()) { 371 if (warn) { 365 if (warn) { 372 G4ExceptionDescription ed; 366 G4ExceptionDescription ed; 373 ed << "Data file <" << ost.str().c_str() 367 ed << "Data file <" << ost.str().c_str() 374 << "> is not opened!"; 368 << "> is not opened!"; 375 G4Exception("G4NeutronCaptureXS::Retriev 369 G4Exception("G4NeutronCaptureXS::RetrieveVector(..)","had014", 376 FatalException, ed, "Check G4PARTICLEXSD 370 FatalException, ed, "Check G4PARTICLEXSDATA"); 377 } 371 } 378 } else { 372 } else { 379 if (verboseLevel > 1) { 373 if (verboseLevel > 1) { 380 G4cout << "File " << ost.str() 374 G4cout << "File " << ost.str() 381 << " is opened by G4NeutronCaptureXS" < 375 << " is opened by G4NeutronCaptureXS" << G4endl; 382 } 376 } 383 // retrieve data from DB 377 // retrieve data from DB 384 v = new G4PhysicsLogVector(); 378 v = new G4PhysicsLogVector(); 385 if (!v->Retrieve(filein, true)) { 379 if (!v->Retrieve(filein, true)) { 386 G4ExceptionDescription ed; 380 G4ExceptionDescription ed; 387 ed << "Data file <" << ost.str().c_str() 381 ed << "Data file <" << ost.str().c_str() 388 << "> is not retrieved!"; 382 << "> is not retrieved!"; 389 G4Exception("G4NeutronCaptureXS::Retriev 383 G4Exception("G4NeutronCaptureXS::RetrieveVector(..)","had015", 390 FatalException, ed, "Check G4PARTICLEXSD 384 FatalException, ed, "Check G4PARTICLEXSDATA"); 391 } 385 } 392 } 386 } 393 return v; 387 return v; 394 } 388 } 395 389