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2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/hadronic/models/particle_hp/src/G4ParticleHPIsoProbabilityTable_CALENDF.cc (Version 11.3.0) and /processes/hadronic/models/particle_hp/src/G4ParticleHPIsoProbabilityTable_CALENDF.cc (Version 9.0.p2)


  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