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 // 27 // ------------------------------------------- 28 // 29 // Geant4 source file 30 // 31 // File name: G4ParticleHPIsoProbabilityT 32 // 33 // Authors: Marek Zmeskal (CTU, Czech Tec 34 // Loic Thulliez (CEA France) 35 // 36 // Creation date: 4 June 2024 37 // 38 // Description: Class for the probability 39 // and for the given tempera 40 // It reads the files with p 41 // finds the correct cross-s 42 // 43 // Modifications: 44 // 45 // ------------------------------------------- 46 // 47 // 48 49 #include "G4ParticleHPIsoProbabilityTable_CALE 50 #include "G4SystemOfUnits.hh" 51 #include "Randomize.hh" 52 #include "G4ParticleHPVector.hh" 53 #include "G4DynamicParticle.hh" 54 #include "G4NucleiProperties.hh" 55 #include "G4ReactionProduct.hh" 56 #include "G4ParticleHPManager.hh" 57 #include "G4ParticleHPChannel.hh" 58 #include "G4ParticleHPChannelList.hh" 59 #include "G4Nucleus.hh" 60 #include "G4Element.hh" 61 #include <string> 62 #include <sstream> 63 64 ///------------------------------------------- 65 G4ParticleHPIsoProbabilityTable_CALENDF::G4Par 66 67 ///------------------------------------------- 68 G4ParticleHPIsoProbabilityTable_CALENDF::~G4Pa 69 for ( auto it = theInelasticData->cbegin(); 70 delete* it; 71 } 72 delete theInelasticData; 73 } 74 75 ///------------------------------------------- 76 void G4ParticleHPIsoProbabilityTable_CALENDF:: 77 Z = theZ; 78 A = theA; 79 m = them; 80 T = theT; 81 G4cout << "The CALENDF probability tables ar 82 filename = std::to_string(Z) + "_" + std::to 83 if ( m != 0 ) filename += "_m" + std::to_str 84 G4String fullPathFileName = dirName + filena 85 std::istringstream theData( std::ios::in ); 86 G4ParticleHPManager::GetInstance()->GetDataS 87 if ( theData.good() ) { 88 G4double emin; 89 G4double emax; 90 theData >> emin >> emax; 91 Emin = emin * eV; 92 Emax = emax * eV; 93 theData >> nEnergies; 94 theEnergies = new G4ParticleHPVector( nEne 95 theProbabilities = new std::vector< std::v 96 theElasticData = new std::vector< std::vec 97 theCaptureData = new std::vector< std::vec 98 theFissionData = new std::vector< std::vec 99 theInelasticData = new std::vector< std::v 100 G4double tableOrder; 101 G4double probability, total, elastic, capt 102 for ( G4int i = 0; i < nEnergies; i++ ) { 103 theData >> emin >> emax >> tableOrder; 104 theEnergies->SetData( i, emax * eV, tabl 105 std::vector< G4double >* vecprob = new s 106 std::vector< G4double >* vecela = new st 107 std::vector< G4double >* veccap = new st 108 std::vector< G4double >* vecfiss = new s 109 std::vector< G4double >* vecinela = new 110 for ( G4int j = 0; j < tableOrder; j++ ) 111 theData >> probability >> total >> elastic 112 vecprob->push_back( probability ); 113 vecela->push_back( elastic * barn ); 114 veccap->push_back( capture * barn ); 115 vecfiss->push_back( fission * barn ); 116 vecinela->push_back( inelastic * barn ); 117 } 118 theProbabilities->push_back( vecprob ); 119 theElasticData->push_back( vecela ); 120 theCaptureData->push_back( veccap ); 121 theFissionData->push_back( vecfiss ); 122 theInelasticData->push_back( vecinela ); 123 } 124 G4cout << "Probability tables found and su 125 } else { 126 G4cout << "No probability tables found for 127 } 128 } 129 130 ///------------------------------------------- 131 G4double G4ParticleHPIsoProbabilityTable_CALEN 132 G4int MTnumber, const G4Element* ele, G4doub 133 // if this function is called again for diff 134 // with the same temperature and unchanged t 135 if ( kineticEnergy == energy_cache[id] ) { 136 if ( MTnumber == 2 ) { // elastic cross s 137 return xsela_cache[id]; 138 } else if ( MTnumber == 102 ) { // radiat 139 return xscap_cache[id]; 140 } else if ( MTnumber == 18 ) { // fission 141 return xsfiss_cache[id]; 142 } else if ( MTnumber == 3 ) { // inelasti 143 return xsinela_cache[id]; 144 } 145 } 146 energy_cache[id] = kineticEnergy; 147 if ( kineticEnergy < Emin || kineticEnergy 148 // if the kinetic energy is outside of the 149 G4int indexEl = (G4int)ele->GetIndex(); 150 G4int isotopeJ = -1; // index of isotope 151 G4int n_isotopes = (G4int)ele->GetNumberOf 152 for ( G4int j = 0; j < n_isotopes; j++ ) { 153 if ( A == (G4int)( ele->GetIsotope(j)->G 154 isotopeJ = j; 155 break; 156 } 157 } 158 G4double frac = ele->GetRelativeAbundanceV 159 G4double weightedelasticXS; 160 G4double weightedcaptureXS; 161 G4double weightedinelasticXS; 162 if ( G4ParticleHPManager::GetInstance()->G 163 weightedelasticXS = (*G4ParticleHPManage 164 weightedcaptureXS = (*G4ParticleHPManage 165 weightedinelasticXS = ((*G4ParticleHPMan 166 } else { 167 weightedelasticXS = this->GetDopplerBroa 168 weightedcaptureXS = this->GetDopplerBroa 169 weightedinelasticXS = this->GetDopplerBr 170 } 171 xsela_cache[id] = weightedelasticXS / frac 172 xscap_cache[id] = weightedcaptureXS / frac 173 xsinela_cache[id] = weightedinelasticXS / 174 if ( Z < 88 ) { 175 xsfiss_cache[id] = 0.0; 176 } else { 177 if ( G4ParticleHPManager::GetInstance()- 178 G4double weightedfissionXS = (*G4ParticleHPM 179 xsfiss_cache[id] = weightedfissionXS / frac; 180 } else { 181 G4double weightedfissionXS = this->GetDopple 182 xsfiss_cache[id] = weightedfissionXS / frac; 183 } 184 } 185 } else { 186 G4int indexE = theEnergies->GetEnergyIndex 187 G4int order = (G4int)( theEnergies->GetY(i 188 std::vector< G4double >* theProbability = 189 G4double rand = random_number; 190 G4int indexP; 191 for ( indexP = 0; indexP < order; indexP++ 192 if ( rand <= theProbability->at(indexP) 193 } 194 xsela_cache[id] = theElasticData->at(index 195 xscap_cache[id] = theCaptureData->at(index 196 xsinela_cache[id] = theInelasticData->at(i 197 if ( Z < 88 ) xsfiss_cache[id] = 0.0; 198 else xsfiss_cache[id] = theFissio 199 } 200 if ( MTnumber == 2 ) { // elastic 201 return xsela_cache[id]; 202 } else if ( MTnumber == 102 ) { // radiativ 203 return xscap_cache[id]; 204 } else if ( MTnumber == 18 ) { // fission 205 return xsfiss_cache[id]; 206 } else if ( MTnumber == 3 ) { // inelasti 207 return xsinela_cache[id]; 208 } else { 209 G4cout << "Reaction was not found, returns 210 return 0; 211 } 212 } 213 214 ///------------------------------------------- 215 G4double G4ParticleHPIsoProbabilityTable_CALEN 216 const G4Element* ele,G4double &kineticEnergy 217 energy_cache[id] = kineticEnergy; 218 if ( kineticEnergy < Emin || kineticEnergy 219 // if the kinetic energy is outside of the 220 G4int indexEl = (G4int)ele->GetIndex(); 221 G4int isotopeJ = -1; //index of isotope i 222 G4int n_isotopes = (G4int)ele->GetNumberOf 223 for ( G4int j = 0; j < n_isotopes; j++ ) { 224 if ( A == (G4int)ele->GetIsotope(j)->Get 225 isotopeJ = j; 226 break; 227 } 228 } 229 G4double frac = ele->GetRelativeAbundanceV 230 G4double weightedelasticXS; 231 G4double weightedcaptureXS; 232 G4double weightedinelasticXS; 233 if (G4ParticleHPManager::GetInstance()->Ge 234 weightedelasticXS = (*G4ParticleHPManage 235 weightedcaptureXS = (*G4ParticleHPManage 236 weightedinelasticXS = ((*G4ParticleHPMan 237 } else { 238 weightedelasticXS = this->GetDopplerBroa 239 weightedcaptureXS = this->GetDopplerBroa 240 weightedinelasticXS = this->GetDopplerBr 241 } 242 xsela_cache[id] = weightedelasticXS / frac 243 xscap_cache[id] = weightedcaptureXS / frac 244 xsinela_cache[id] = weightedinelasticXS / 245 if ( Z < 88 ) { 246 xsfiss_cache[id] = 0.0; 247 } else { 248 if ( G4ParticleHPManager::GetInstance()- 249 G4double weightedfissionXS = (*G4ParticleH 250 xsfiss_cache[id] = weightedfissionXS / fra 251 } else { 252 G4double weightedfissionXS = this->GetDopp 253 xsfiss_cache[id] = weightedfissionXS / fra 254 } 255 } 256 } else { 257 G4int indexE = theEnergies->GetEnergyIndex 258 G4int order = (G4int)( theEnergies->GetY(i 259 std::vector< G4double >* theProbability = 260 G4double rand = G4UniformRand(); 261 random_number_cache[id] = rand; 262 G4int indexP; 263 for ( indexP = 0; indexP < order; indexP++ 264 if ( rand <= theProbability->at(indexP) 265 } 266 xsela_cache[id] = theElasticData->at(index 267 xscap_cache[id] = theCaptureData->at(index 268 xsinela_cache[id] = theInelasticData->at(i 269 if ( Z < 88 ) xsfiss_cache[id] = 0.0; 270 else xsfiss_cache[id] = theFissio 271 } 272 if (MTnumber == 2) { // elastic cr 273 return xsela_cache[id]; 274 } else if (MTnumber == 102) { // radiative 275 return xscap_cache[id]; 276 } else if (MTnumber == 18) { // fission cr 277 return xsfiss_cache[id]; 278 } else if (MTnumber == 3) { // inelastic 279 return xsinela_cache[id]; 280 } else { 281 G4cout << "Reaction was not found, returns 282 return 0; 283 } 284 } 285