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 // 070618 fix memory leaking by T. Koi 31 // 071002 enable cross section dump by T. Koi 32 // 081024 G4NucleiPropertiesTable:: to G4Nucle 33 // 081124 Protect invalid read which caused ru 34 // 100729 Add safty for 0 lenght cross section 35 // P. Arce, June-2014 Conversion neutron_hp to 36 // 37 #include "G4ParticleHPFissionData.hh" 38 39 #include "G4ElementTable.hh" 40 #include "G4HadronicParameters.hh" 41 #include "G4Neutron.hh" 42 #include "G4NucleiProperties.hh" 43 #include "G4ParticleHPData.hh" 44 #include "G4ParticleHPManager.hh" 45 #include "G4PhysicalConstants.hh" 46 #include "G4Pow.hh" 47 #include "G4SystemOfUnits.hh" 48 49 G4ParticleHPFissionData::G4ParticleHPFissionDa 50 { 51 SetMinKinEnergy(0 * MeV); 52 SetMaxKinEnergy(20 * MeV); 53 54 theCrossSections = nullptr; 55 instanceOfWorker = false; 56 if (G4Threading::IsWorkerThread()) { 57 instanceOfWorker = true; 58 } 59 element_cache = nullptr; 60 material_cache = nullptr; 61 ke_cache = 0.0; 62 xs_cache = 0.0; 63 } 64 65 G4ParticleHPFissionData::~G4ParticleHPFissionD 66 { 67 if (theCrossSections != nullptr && !instance 68 theCrossSections->clearAndDestroy(); 69 delete theCrossSections; 70 theCrossSections = nullptr; 71 } 72 } 73 74 G4bool G4ParticleHPFissionData::IsIsoApplicabl 75 76 77 { 78 G4double eKin = dp->GetKineticEnergy(); 79 return eKin <= GetMaxKinEnergy() && eKin >= 80 && dp->GetDefinition() == G4Neutron:: 81 } 82 83 G4double G4ParticleHPFissionData::GetIsoCrossS 84 85 86 87 { 88 if (dp->GetKineticEnergy() == ke_cache && el 89 return xs_cache; 90 91 ke_cache = dp->GetKineticEnergy(); 92 element_cache = element; 93 material_cache = material; 94 G4double xs = GetCrossSection(dp, element, m 95 xs_cache = xs; 96 return xs; 97 } 98 99 void G4ParticleHPFissionData::BuildPhysicsTabl 100 { 101 if (G4Threading::IsWorkerThread()) { 102 theCrossSections = G4ParticleHPManager::Ge 103 return; 104 } 105 106 std::size_t numberOfElements = G4Element::Ge 107 if (theCrossSections == nullptr) 108 theCrossSections = new G4PhysicsTable(numb 109 else 110 theCrossSections->clearAndDestroy(); 111 112 // make a PhysicsVector for each element 113 114 auto theElementTable = G4Element::GetElement 115 for (std::size_t i = 0; i < numberOfElements 116 G4PhysicsVector* physVec = G4ParticleHPDat 117 ->MakePhysics 118 theCrossSections->push_back(physVec); 119 } 120 121 G4ParticleHPManager::GetInstance()->Register 122 } 123 124 void G4ParticleHPFissionData::DumpPhysicsTable 125 { 126 #ifdef G4VERBOSE 127 if (G4HadronicParameters::Instance()->GetVer 128 129 // 130 // Dump element based cross section 131 // range 10e-5 eV to 20 MeV 132 // 10 point per decade 133 // in barn 134 // 135 G4cout << G4endl; 136 G4cout << G4endl; 137 G4cout << "Fission Cross Section of Neutron 138 G4cout << "(Pointwise cross-section at 0 Kel 139 G4cout << G4endl; 140 G4cout << "Name of Element" << G4endl; 141 G4cout << "Energy[eV] XS[barn]" << G4endl; 142 G4cout << G4endl; 143 144 std::size_t numberOfElements = G4Element::Ge 145 auto theElementTable = G4Element::GetElement 146 147 for (std::size_t i = 0; i < numberOfElements 148 G4cout << (*theElementTable)[i]->GetName() 149 150 if ((*((*theCrossSections)(i))).GetVectorL 151 G4cout << "The cross-section data of the 152 G4cout << G4endl; 153 continue; 154 } 155 156 for (G4int ie = 0; ie < 130; ++ie) { 157 G4double eKinetic = 1.0e-5 * G4Pow::GetI 158 G4bool outOfRange = false; 159 160 if (eKinetic < 20 * MeV) { 161 G4cout << eKinetic / eV << " " 162 << (*((*theCrossSections)(i))). 163 } 164 } 165 166 G4cout << G4endl; 167 } 168 #endif 169 } 170 171 G4double G4ParticleHPFissionData::GetCrossSect 172 173 { 174 G4double result = 0; 175 if (anE->GetZ() < 88) return result; 176 G4bool outOfRange; 177 auto index = (G4int)anE->GetIndex(); 178 179 if (((*theCrossSections)(index))->GetVectorL 180 181 // prepare neutron 182 G4double eKinetic = aP->GetKineticEnergy(); 183 G4ReactionProduct theNeutronRP(aP->GetDefini 184 theNeutronRP.SetMomentum(aP->GetMomentum()); 185 theNeutronRP.SetKineticEnergy(eKinetic); 186 187 if (G4ParticleHPManager::GetInstance()->GetN 188 // NEGLECT_DOPPLER 189 G4double factor = 1.0; 190 if (eKinetic < aT * k_Boltzmann) { 191 // below 0.1 eV neutrons 192 // Have to do some, but now just igonre. 193 // Will take care after performance chec 194 // factor = factor * targetV; 195 } 196 return ((*((*theCrossSections)(index))).Ge 197 } 198 199 // prepare thermal nucleus 200 G4Nucleus aNuc; 201 G4double eps = 0.0001; 202 G4double theA = anE->GetN(); 203 G4double theZ = anE->GetZ(); 204 G4double eleMass; 205 eleMass = (G4NucleiProperties::GetNuclearMas 206 207 / G4Neutron::Neutron()->GetPDGMass 208 209 G4ReactionProduct boosted; 210 G4double aXsection; 211 212 // MC integration loop 213 G4int counter = 0; 214 G4double buffer = 0; 215 G4int size = G4int(std::max(10., aT / 60 * k 216 G4ThreeVector neutronVelocity = 217 1. / G4Neutron::Neutron()->GetPDGMass() * 218 G4double neutronVMag = neutronVelocity.mag() 219 220 while (counter == 0 221 || std::abs(buffer - result / std::ma 222 > 0.01 * buffer) // Loop checki 223 { 224 if (counter != 0) buffer = result / counte 225 while (counter < size) // Loop checking, 226 { 227 counter++; 228 G4ReactionProduct aThermalNuc = aNuc.Get 229 boosted.Lorentz(theNeutronRP, aThermalNu 230 G4double theEkin = boosted.GetKineticEne 231 aXsection = (*((*theCrossSections)(index 232 // velocity correction. 233 G4ThreeVector targetVelocity = 1. / aThe 234 aXsection *= (targetVelocity - neutronVe 235 result += aXsection; 236 } 237 size += size; 238 } 239 result /= counter; 240 return result; 241 } 242 243 G4int G4ParticleHPFissionData::GetVerboseLevel 244 { 245 return G4ParticleHPManager::GetInstance()->G 246 } 247 248 void G4ParticleHPFissionData::SetVerboseLevel( 249 { 250 G4ParticleHPManager::GetInstance()->SetVerbo 251 } 252 253 void G4ParticleHPFissionData::CrossSectionDesc 254 { 255 outFile << "High Precision cross data based 256 << "for induced fission reaction of 257 } 258