Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPIsoProbabilityTable_CALENDF Class Reference

#include <G4ParticleHPIsoProbabilityTable_CALENDF.hh>

Inheritance diagram for G4ParticleHPIsoProbabilityTable_CALENDF:

Public Member Functions

 G4ParticleHPIsoProbabilityTable_CALENDF ()
 ~G4ParticleHPIsoProbabilityTable_CALENDF ()
void Init (G4int, G4int, G4int, G4double, const G4String &) override
G4double GetCorrelatedIsoCrossSectionPT (const G4DynamicParticle *, G4int, const G4Element *, G4double &, G4double &, std::thread::id &) override
G4double GetIsoCrossSectionPT (const G4DynamicParticle *, G4int, const G4Element *, G4double &, std::map< std::thread::id, G4double > &, std::thread::id &) override
Public Member Functions inherited from G4ParticleHPIsoProbabilityTable
 G4ParticleHPIsoProbabilityTable ()=default
virtual ~G4ParticleHPIsoProbabilityTable ()

Additional Inherited Members

Protected Member Functions inherited from G4ParticleHPIsoProbabilityTable
G4double GetDopplerBroadenedElasticXS (const G4DynamicParticle *, G4int, G4int)
G4double GetDopplerBroadenedCaptureXS (const G4DynamicParticle *, G4int, G4int)
G4double GetDopplerBroadenedFissionXS (const G4DynamicParticle *, G4int, G4int)
G4double GetDopplerBroadenedInelasticXS (const G4DynamicParticle *, G4int, G4int)
Protected Attributes inherited from G4ParticleHPIsoProbabilityTable
G4int Z = 0
G4int A = 0
G4int m = -1
G4double T = -1.
G4double Emin = DBL_MAX
G4double Emax = 0.
G4int nEnergies = 0
std::map< std::thread::id, G4doubleenergy_cache
std::map< std::thread::id, G4doublexsela_cache
std::map< std::thread::id, G4doublexscap_cache
std::map< std::thread::id, G4doublexsfiss_cache
G4ParticleHPVectortheEnergies = nullptr
std::vector< std::vector< G4double > * > * theProbabilities = nullptr
std::vector< std::vector< G4double > * > * theElasticData = nullptr
std::vector< std::vector< G4double > * > * theCaptureData = nullptr
std::vector< std::vector< G4double > * > * theFissionData = nullptr
std::vector< std::vector< G4double > * > * theInelasticData = nullptr
G4String filename

Detailed Description

Definition at line 61 of file G4ParticleHPIsoProbabilityTable_CALENDF.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPIsoProbabilityTable_CALENDF()

G4ParticleHPIsoProbabilityTable_CALENDF::G4ParticleHPIsoProbabilityTable_CALENDF ( )

Definition at line 65 of file G4ParticleHPIsoProbabilityTable_CALENDF.cc.

65: theInelasticData(nullptr) {}
std::vector< std::vector< G4double > * > * theInelasticData

◆ ~G4ParticleHPIsoProbabilityTable_CALENDF()

G4ParticleHPIsoProbabilityTable_CALENDF::~G4ParticleHPIsoProbabilityTable_CALENDF ( )

Definition at line 68 of file G4ParticleHPIsoProbabilityTable_CALENDF.cc.

68 {
69 for ( auto it = theInelasticData->cbegin(); it != theInelasticData->cend(); ++it ) {
70 delete* it;
71 }
72 delete theInelasticData;
73}

Member Function Documentation

◆ GetCorrelatedIsoCrossSectionPT()

G4double G4ParticleHPIsoProbabilityTable_CALENDF::GetCorrelatedIsoCrossSectionPT ( const G4DynamicParticle * dp,
G4int MTnumber,
const G4Element * ele,
G4double & kineticEnergy,
G4double & random_number,
std::thread::id & id )
overridevirtual

Reimplemented from G4ParticleHPIsoProbabilityTable.

Definition at line 131 of file G4ParticleHPIsoProbabilityTable_CALENDF.cc.

132 {
133 // if this function is called again for different reaction or the particle came to different region
134 // with the same temperature and unchanged temperature
135 if ( kineticEnergy == energy_cache[id] ) {
136 if ( MTnumber == 2 ) { // elastic cross section
137 return xsela_cache[id];
138 } else if ( MTnumber == 102 ) { // radiative capture cross section
139 return xscap_cache[id];
140 } else if ( MTnumber == 18 ) { // fission cross section
141 return xsfiss_cache[id];
142 } else if ( MTnumber == 3 ) { // inelastic cross section
143 return xsinela_cache[id];
144 }
145 }
146 energy_cache[id] = kineticEnergy;
147 if ( kineticEnergy < Emin || kineticEnergy > Emax ) {
148 // if the kinetic energy is outside of the URR limits for the given isotope, it finds the smooth cross section
149 G4int indexEl = (G4int)ele->GetIndex();
150 G4int isotopeJ = 0; // index of isotope in the given element
151 G4int n_isotopes = (G4int)ele->GetNumberOfIsotopes();
152 for ( G4int j = 0; j < n_isotopes; j++ ) {
153 if ( A == (G4int)( ele->GetIsotope(j)->GetN() ) ) {
154 isotopeJ = j;
155 break;
156 }
157 }
158 G4double frac = ele->GetRelativeAbundanceVector()[isotopeJ];
159 G4double weightedelasticXS;
160 G4double weightedcaptureXS;
161 G4double weightedinelasticXS;
162 if ( G4ParticleHPManager::GetInstance()->GetNeglectDoppler() ) {
163 weightedelasticXS = (*G4ParticleHPManager::GetInstance()->GetElasticFinalStates())[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ );
164 weightedcaptureXS = (*G4ParticleHPManager::GetInstance()->GetCaptureFinalStates())[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ );
165 weightedinelasticXS = ((*G4ParticleHPManager::GetInstance()->GetInelasticFinalStates(dp->GetDefinition()))[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ )) * barn;
166 } else {
167 weightedelasticXS = this->GetDopplerBroadenedElasticXS( dp, indexEl, isotopeJ );
168 weightedcaptureXS = this->GetDopplerBroadenedCaptureXS( dp, indexEl, isotopeJ );
169 weightedinelasticXS = this->GetDopplerBroadenedInelasticXS( dp, indexEl, isotopeJ );
170 }
171 xsela_cache[id] = weightedelasticXS / frac;
172 xscap_cache[id] = weightedcaptureXS / frac;
173 xsinela_cache[id] = weightedinelasticXS / frac;
174 if ( Z < 88 ) {
175 xsfiss_cache[id] = 0.0;
176 } else {
177 if ( G4ParticleHPManager::GetInstance()->GetNeglectDoppler() ) {
178 G4double weightedfissionXS = (*G4ParticleHPManager::GetInstance()->GetFissionFinalStates())[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ );
179 xsfiss_cache[id] = weightedfissionXS / frac;
180 } else {
181 G4double weightedfissionXS = this->GetDopplerBroadenedFissionXS( dp, indexEl, isotopeJ );
182 xsfiss_cache[id] = weightedfissionXS / frac;
183 }
184 }
185 } else {
186 G4int indexE = theEnergies->GetEnergyIndex( kineticEnergy );
187 G4int order = (G4int)( theEnergies->GetY(indexE) + 0.5 );
188 std::vector< G4double >* theProbability = theProbabilities->at( indexE );
189 G4double rand = random_number;
190 G4int indexP;
191 for ( indexP = 0; indexP < order; indexP++ ) {
192 if ( rand <= theProbability->at(indexP) ) break;
193 }
194 xsela_cache[id] = theElasticData->at(indexE)->at(indexP);
195 xscap_cache[id] = theCaptureData->at(indexE)->at(indexP);
196 xsinela_cache[id] = theInelasticData->at(indexE)->at(indexP);
197 if ( Z < 88 ) xsfiss_cache[id] = 0.0;
198 else xsfiss_cache[id] = theFissionData->at(indexE)->at(indexP);
199 }
200 if ( MTnumber == 2 ) { // elastic cross section
201 return xsela_cache[id];
202 } else if ( MTnumber == 102 ) { // radiative capture cross section
203 return xscap_cache[id];
204 } else if ( MTnumber == 18 ) { // fission cross section
205 return xsfiss_cache[id];
206 } else if ( MTnumber == 3 ) { // inelastic cross section
207 return xsinela_cache[id];
208 } else {
209 G4cout << "Reaction was not found, returns 0." << G4endl;
210 return 0;
211 }
212}
double G4double
Definition G4Types.hh:83
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
G4ParticleDefinition * GetDefinition() const
std::map< std::thread::id, G4double > xsela_cache
std::map< std::thread::id, G4double > xscap_cache
std::map< std::thread::id, G4double > energy_cache
G4double GetDopplerBroadenedFissionXS(const G4DynamicParticle *, G4int, G4int)
std::vector< std::vector< G4double > * > * theElasticData
std::vector< std::vector< G4double > * > * theFissionData
std::map< std::thread::id, G4double > xsfiss_cache
G4double GetDopplerBroadenedInelasticXS(const G4DynamicParticle *, G4int, G4int)
std::vector< std::vector< G4double > * > * theCaptureData
G4double GetDopplerBroadenedCaptureXS(const G4DynamicParticle *, G4int, G4int)
G4double GetDopplerBroadenedElasticXS(const G4DynamicParticle *, G4int, G4int)
std::vector< std::vector< G4double > * > * theProbabilities
std::vector< G4ParticleHPChannel * > * GetFissionFinalStates() const
std::vector< G4ParticleHPChannel * > * GetElasticFinalStates() const
std::vector< G4ParticleHPChannel * > * GetCaptureFinalStates() const
std::vector< G4ParticleHPChannelList * > * GetInelasticFinalStates(const G4ParticleDefinition *part) const
static G4ParticleHPManager * GetInstance()

◆ GetIsoCrossSectionPT()

G4double G4ParticleHPIsoProbabilityTable_CALENDF::GetIsoCrossSectionPT ( const G4DynamicParticle * dp,
G4int MTnumber,
const G4Element * ele,
G4double & kineticEnergy,
std::map< std::thread::id, G4double > & random_number_cache,
std::thread::id & id )
overridevirtual

Reimplemented from G4ParticleHPIsoProbabilityTable.

Definition at line 215 of file G4ParticleHPIsoProbabilityTable_CALENDF.cc.

218 {
219 energy_cache[id] = kineticEnergy;
220 if ( kineticEnergy < Emin || kineticEnergy > Emax ) {
221 // if the kinetic energy is outside of the URR limits for the given isotope, it finds the smooth cross section
222 G4int indexEl = (G4int)ele->GetIndex();
223 G4int isotopeJ = -1; //index of isotope in the given element
224 G4int n_isotopes = (G4int)ele->GetNumberOfIsotopes();
225 for ( G4int j = 0; j < n_isotopes; j++ ) {
226 if ( A == (G4int)ele->GetIsotope(j)->GetN() ) {
227 isotopeJ = j;
228 break;
229 }
230 }
231 if (isotopeJ == -1) { return 0.0; }
232 G4double frac = ele->GetRelativeAbundanceVector()[isotopeJ];
233 G4double weightedelasticXS;
234 G4double weightedcaptureXS;
235 G4double weightedinelasticXS;
236 auto manHP = G4ParticleHPManager::GetInstance();
237 if (manHP->GetNeglectDoppler()) {
238 weightedelasticXS = (*manHP->GetElasticFinalStates())[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ );
239 weightedcaptureXS = (*manHP->GetCaptureFinalStates())[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ );
240 weightedinelasticXS = (*manHP->GetInelasticFinalStates(dp->GetDefinition()))[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ ) * barn;
241 } else {
242 weightedelasticXS = GetDopplerBroadenedElasticXS( dp, indexEl, isotopeJ );
243 weightedcaptureXS = GetDopplerBroadenedCaptureXS( dp, indexEl, isotopeJ );
244 weightedinelasticXS = GetDopplerBroadenedInelasticXS( dp, indexEl, isotopeJ );
245 }
246 xsela_cache[id] = weightedelasticXS / frac;
247 xscap_cache[id] = weightedcaptureXS / frac;
248 xsinela_cache[id] = weightedinelasticXS / frac;
249 if ( Z < 88 ) {
250 xsfiss_cache[id] = 0.0;
251 } else {
252 if ( manHP->GetNeglectDoppler() ) {
253 G4double weightedfissionXS = (*manHP->GetFissionFinalStates())[indexEl]->GetWeightedXsec( kineticEnergy, isotopeJ );
254 xsfiss_cache[id] = weightedfissionXS / frac;
255 } else {
256 G4double weightedfissionXS = GetDopplerBroadenedFissionXS( dp, indexEl, isotopeJ );
257 xsfiss_cache[id] = weightedfissionXS / frac;
258 }
259 }
260 } else {
261 G4int indexE = theEnergies->GetEnergyIndex( kineticEnergy );
262 G4int order = (G4int)( theEnergies->GetY(indexE) + 0.5 );
263 std::vector< G4double >* theProbability = theProbabilities->at(indexE);
264 G4double rand = G4UniformRand();
265 random_number_cache[id] = rand;
266 G4int indexP;
267 for ( indexP = 0; indexP < order; indexP++ ) {
268 if ( rand <= theProbability->at(indexP) ) break;
269 }
270 xsela_cache[id] = theElasticData->at(indexE)->at(indexP);
271 xscap_cache[id] = theCaptureData->at(indexE)->at(indexP);
272 xsinela_cache[id] = theInelasticData->at(indexE)->at(indexP);
273 if ( Z < 88 ) xsfiss_cache[id] = 0.0;
274 else xsfiss_cache[id] = theFissionData->at(indexE)->at(indexP);
275 }
276 if (MTnumber == 2) { // elastic cross section
277 return xsela_cache[id];
278 } else if (MTnumber == 102) { // radiative capture cross section
279 return xscap_cache[id];
280 } else if (MTnumber == 18) { // fission cross section
281 return xsfiss_cache[id];
282 } else if (MTnumber == 3) { // inelastic cross section
283 return xsinela_cache[id];
284 } else {
285 //G4cout << "Reaction was not found, returns 0." << G4endl;
286 return 0;
287 }
288}
#define G4UniformRand()
Definition Randomize.hh:52

◆ Init()

void G4ParticleHPIsoProbabilityTable_CALENDF::Init ( G4int theZ,
G4int theA,
G4int them,
G4double theT,
const G4String & dirName )
overridevirtual

Reimplemented from G4ParticleHPIsoProbabilityTable.

Definition at line 76 of file G4ParticleHPIsoProbabilityTable_CALENDF.cc.

76 {
77 Z = theZ;
78 A = theA;
79 m = them;
80 T = theT;
81 G4cout << "The CALENDF probability tables are being initialized for Z=" << Z << " A=" << A << " and T=" << T << " K." << G4endl;
83 if ( m != 0 ) filename += "_m" + std::to_string(m);
84 G4String fullPathFileName = dirName + filename + "." + std::to_string( (G4int)(T) ) + ".pt";
85 std::istringstream theData( std::ios::in );
86 G4ParticleHPManager::GetInstance()->GetDataStream( fullPathFileName, theData );
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( nEnergies );
95 theProbabilities = new std::vector< std::vector< G4double >* >;
96 theElasticData = new std::vector< std::vector< G4double >* >;
97 theCaptureData = new std::vector< std::vector< G4double >* >;
98 theFissionData = new std::vector< std::vector< G4double >* >;
99 theInelasticData = new std::vector< std::vector< G4double >* >;
100 G4double tableOrder;
101 G4double probability, total, elastic, capture, fission, inelastic;
102 for ( G4int i = 0; i < nEnergies; i++ ) {
103 theData >> emin >> emax >> tableOrder;
104 theEnergies->SetData( i, emax * eV, tableOrder );
105 std::vector< G4double >* vecprob = new std::vector< G4double >;
106 std::vector< G4double >* vecela = new std::vector< G4double >;
107 std::vector< G4double >* veccap = new std::vector< G4double >;
108 std::vector< G4double >* vecfiss = new std::vector< G4double >;
109 std::vector< G4double >* vecinela = new std::vector< G4double >;
110 for ( G4int j = 0; j < tableOrder; j++ ) {
111 theData >> probability >> total >> elastic >> capture >> fission >> inelastic;
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 succesfully read from " << Emin / keV << " keV to " << Emax / keV << " keV." << G4endl;
125 } else {
126 G4cout << "No probability tables found for this isotope and temperature, smooth cross section will be used instead." << G4endl;
127 }
128}
void GetDataStream(const G4String &, std::istringstream &iss)
G4double elastic(Particle const *const p1, Particle const *const p2)
G4double total(Particle const *const p1, Particle const *const p2)
std::string to_string(G4FermiAtomicMass mass)

The documentation for this class was generated from the following files: