Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // neutron_hp -- source file 27 // J.P. Wellisch, Nov-1996 28 // A prototype of the low energy neutron trans 29 // 30 // 070523 add neglecting doppler broadening on 31 // 070613 fix memory leaking by T. Koi 32 // 071002 enable cross section dump by T. Koi 33 // 080428 change checking point of "neglecting 34 // from GetCrossSection to BuildPhysics 35 // 081024 G4NucleiPropertiesTable:: to G4Nucle 36 // 37 // P. Arce, June-2014 Conversion neutron_hp to 38 // V. Ivanchenko July-2023 converted back 39 // 40 #include "G4NeutronHPCaptureData.hh" 41 42 #include "G4ElementTable.hh" 43 #include "G4HadronicParameters.hh" 44 #include "G4Neutron.hh" 45 #include "G4NucleiProperties.hh" 46 #include "G4ParticleHPData.hh" 47 #include "G4ParticleHPManager.hh" 48 #include "G4Element.hh" 49 #include "G4Material.hh" 50 #include "G4ParticleDefinition.hh" 51 #include "G4PhysicsTable.hh" 52 #include "G4PhysicalConstants.hh" 53 #include "G4Pow.hh" 54 #include "G4SystemOfUnits.hh" 55 #include "G4AutoLock.hh" 56 57 G4bool G4NeutronHPCaptureData::fLock = true; 58 G4PhysicsTable* G4NeutronHPCaptureData::theCro 59 60 namespace 61 { 62 G4Mutex theHPCaptureData = G4MUTEX_INITIALIZ 63 } 64 65 G4NeutronHPCaptureData::G4NeutronHPCaptureData 66 : G4VCrossSectionDataSet("NeutronHPCaptureXS 67 { 68 emax = 20.*CLHEP::MeV; 69 fManager = G4ParticleHPManager::GetInstance( 70 } 71 72 G4NeutronHPCaptureData::~G4NeutronHPCaptureDat 73 { 74 if (isFirst) { 75 if (nullptr != theCrossSections) 76 theCrossSections->clearAndDestroy(); 77 delete theCrossSections; 78 theCrossSections = nullptr; 79 } 80 } 81 82 G4bool G4NeutronHPCaptureData::IsIsoApplicable 83 84 85 86 { 87 return true; 88 } 89 90 G4double G4NeutronHPCaptureData::GetIsoCrossSe 91 92 93 94 95 { 96 if (dp->GetKineticEnergy() == ke_cache && el 97 material == material_cache) 98 return xs_cache; 99 100 ke_cache = dp->GetKineticEnergy(); 101 element_cache = element; 102 material_cache = material; 103 G4double xs = GetCrossSection(dp, element, m 104 xs_cache = xs; 105 return xs; 106 } 107 108 void G4NeutronHPCaptureData::BuildPhysicsTable 109 { 110 // the choice of the first instance 111 if (fLock) { 112 G4AutoLock l(&theHPCaptureData); 113 if (fLock) { 114 isFirst = true; 115 fLock = false; 116 } 117 l.unlock(); 118 } 119 if (!isFirst) { return; } 120 if (p.GetParticleName() != "neutron") { 121 G4ExceptionDescription ed; 122 ed << p.GetParticleName() << " is a wrong 123 << " only neutron is allowed"; 124 G4Exception("G4NeutronHPCaptureData::Build 125 FatalException, ed, ""); 126 return; 127 } 128 129 // initialisation for the first instance, ot 130 G4AutoLock l(&theHPCaptureData); 131 if (theCrossSections != nullptr) { 132 theCrossSections->clearAndDestroy(); 133 delete theCrossSections; 134 } 135 std::size_t numberOfElements = G4Element::Ge 136 theCrossSections = new G4PhysicsTable(number 137 138 // make a PhysicsVector for each element 139 auto theElementTable = G4Element::GetElement 140 for (std::size_t i = 0; i < numberOfElements 141 auto elm = (*theElementTable)[i]; 142 #ifdef G4VERBOSE 143 if (fManager->GetDEBUG()) { 144 G4cout << "ElementIndex " << elm->GetInd 145 << elm->GetName() << G4endl; 146 } 147 #endif 148 G4PhysicsVector* physVec = 149 G4ParticleHPData::Instance(G4Neutron::Ne 150 theCrossSections->push_back(physVec); 151 } 152 fManager->RegisterCaptureCrossSections(theCr 153 l.unlock(); 154 } 155 156 void G4NeutronHPCaptureData::DumpPhysicsTable( 157 { 158 #ifdef G4VERBOSE 159 if (fManager->GetVerboseLevel() == 0) return 160 161 // 162 // Dump element based cross section 163 // range 10e-5 eV to 20 MeV 164 // 10 point per decade 165 // in barn 166 // 167 168 G4cout << G4endl; 169 G4cout << G4endl; 170 G4cout << "Capture Cross Section of Neutron 171 G4cout << "(Pointwise cross-section at 0 Kel 172 G4cout << G4endl; 173 G4cout << "Name of Element" << G4endl; 174 G4cout << "Energy[eV] XS[barn]" << G4endl; 175 G4cout << G4endl; 176 177 std::size_t numberOfElements = G4Element::Ge 178 auto theElementTable = G4Element::GetElement 179 180 for (std::size_t i = 0; i < numberOfElements 181 G4cout << (*theElementTable)[i]->GetName() 182 G4cout << *((*theCrossSections)(i)) << G4e 183 } 184 #endif 185 } 186 187 G4double G4NeutronHPCaptureData::GetCrossSecti 188 189 190 { 191 G4double result = 0; 192 auto idx = (G4int)anE->GetIndex(); 193 194 // prepare neutron 195 G4double eKinetic = aP->GetKineticEnergy(); 196 if (eKinetic >= emax) { return 0.0; } 197 198 // NEGLECT_DOPPLER 199 if (fManager->GetNeglectDoppler()) { 200 return (*((*theCrossSections)(idx))).Value 201 } 202 203 G4ReactionProduct theNeutron(aP->GetDefiniti 204 theNeutron.SetMomentum(aP->GetMomentum()); 205 theNeutron.SetKineticEnergy(eKinetic); 206 207 // prepare thermal nucleus 208 G4Nucleus aNuc; 209 G4int theA = anE->GetN(); 210 G4int theZ = anE->GetZasInt(); 211 G4double eleMass = G4NucleiProperties::GetNu 212 / CLHEP::neutron_mass_c2; 213 214 G4ReactionProduct boosted; 215 G4double aXsection; 216 217 // MC integration loop 218 G4int counter = 0; 219 G4double buffer = 0; 220 G4int size = G4int(std::max(10., aT / 60 * k 221 G4ThreeVector neutronVelocity = 222 1. / G4Neutron::Neutron()->GetPDGMass() * 223 G4double neutronVMag = neutronVelocity.mag() 224 225 while (counter == 0 || 226 std::abs(buffer - result / std::max(1 227 // Loop checking, 11.05.2015, T. Koi 228 { 229 if (counter != 0) buffer = result / counte 230 while (counter < size) // Loop checking, 231 { 232 ++counter; 233 G4ReactionProduct aThermalNuc = aNuc.Get 234 boosted.Lorentz(theNeutron, aThermalNuc) 235 G4double theEkin = boosted.GetKineticEne 236 aXsection = (*((*theCrossSections)(idx)) 237 // velocity correction, or luminosity fa 238 G4ThreeVector targetVelocity = 1. / aThe 239 aXsection *= (targetVelocity - neutronVe 240 result += aXsection; 241 } 242 size += size; 243 } 244 result /= counter; 245 /* 246 // Checking impact of G4NEUTRONHP_NEGLECT 247 G4cout << " result " << result << " " 248 << (*((*theCrossSections)(index))). 249 << (*((*theCrossSections)(index))). 250 */ 251 return result; 252 } 253 254 void G4NeutronHPCaptureData::CrossSectionDescr 255 { 256 outF << "High Precision cross data based on 257 << " (ENDF) for radiative capture react 258 } 259