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3 ] [ 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/G4ParticleHPElasticData.cc (Version 11.3.0) and /processes/hadronic/models/particle_hp/src/G4ParticleHPElasticData.cc (Version 10.0.p4)


  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 //                                                
 39 #include "G4ParticleHPElasticData.hh"             
 40                                                   
 41 #include "G4Electron.hh"                          
 42 #include "G4ElementTable.hh"                      
 43 #include "G4HadronicParameters.hh"                
 44 #include "G4Neutron.hh"                           
 45 #include "G4NucleiProperties.hh"                  
 46 #include "G4Nucleus.hh"                           
 47 #include "G4ParticleHPData.hh"                    
 48 #include "G4ParticleHPManager.hh"                 
 49 #include "G4PhysicalConstants.hh"                 
 50 #include "G4Pow.hh"                               
 51 #include "G4SystemOfUnits.hh"                     
 52                                                   
 53 G4ParticleHPElasticData::G4ParticleHPElasticDa    
 54 {                                                 
 55   SetMinKinEnergy(0 * MeV);                       
 56   SetMaxKinEnergy(20 * MeV);                      
 57                                                   
 58   theCrossSections = nullptr;                     
 59   instanceOfWorker = false;                       
 60   if (G4Threading::IsWorkerThread()) {            
 61     instanceOfWorker = true;                      
 62   }                                               
 63   element_cache = nullptr;                        
 64   material_cache = nullptr;                       
 65   ke_cache = 0.0;                                 
 66   xs_cache = 0.0;                                 
 67   // BuildPhysicsTable( *G4Neutron::Neutron()     
 68 }                                                 
 69                                                   
 70 G4ParticleHPElasticData::~G4ParticleHPElasticD    
 71 {                                                 
 72   if (theCrossSections != nullptr && !instance    
 73     theCrossSections->clearAndDestroy();          
 74     delete theCrossSections;                      
 75     theCrossSections = nullptr;                   
 76   }                                               
 77 }                                                 
 78                                                   
 79 G4bool G4ParticleHPElasticData::IsIsoApplicabl    
 80                                                   
 81                                                   
 82 {                                                 
 83   G4double eKin = dp->GetKineticEnergy();         
 84   return eKin <= GetMaxKinEnergy() && eKin >=     
 85          && dp->GetDefinition() == G4Neutron::    
 86 }                                                 
 87                                                   
 88 G4double G4ParticleHPElasticData::GetIsoCrossS    
 89                                                   
 90                                                   
 91                                                   
 92 {                                                 
 93   if (dp->GetKineticEnergy() == ke_cache && el    
 94     return xs_cache;                              
 95                                                   
 96   ke_cache = dp->GetKineticEnergy();              
 97   element_cache = element;                        
 98   material_cache = material;                      
 99   G4double xs = GetCrossSection(dp, element, m    
100   xs_cache = xs;                                  
101   return xs;                                      
102 }                                                 
103                                                   
104 void G4ParticleHPElasticData::BuildPhysicsTabl    
105 {                                                 
106   if (&aP != G4Neutron::Neutron())                
107     throw G4HadronicException(__FILE__, __LINE    
108                               "Attempt to use     
109                                                   
110   if (G4Threading::IsWorkerThread()) {            
111     theCrossSections = G4ParticleHPManager::Ge    
112     return;                                       
113   }                                               
114                                                   
115   std::size_t numberOfElements = G4Element::Ge    
116   // TKDB                                         
117   // if ( theCrossSections == 0 ) theCrossSect    
118   if (theCrossSections == nullptr)                
119     theCrossSections = new G4PhysicsTable(numb    
120   else                                            
121     theCrossSections->clearAndDestroy();          
122                                                   
123   // make a PhysicsVector for each element        
124                                                   
125   auto theElementTable = G4Element::GetElement    
126   for (std::size_t i = 0; i < numberOfElements    
127     G4PhysicsVector* physVec = G4ParticleHPDat    
128                                  ->MakePhysics    
129     theCrossSections->push_back(physVec);         
130   }                                               
131                                                   
132   G4ParticleHPManager::GetInstance()->Register    
133 }                                                 
134                                                   
135 void G4ParticleHPElasticData::DumpPhysicsTable    
136 {                                                 
137 #ifdef G4VERBOSE                                  
138   if (G4HadronicParameters::Instance()->GetVer    
139                                                   
140   //                                              
141   // Dump element based cross section             
142   // range 10e-5 eV to 20 MeV                     
143   // 10 point per decade                          
144   // in barn                                      
145   //                                              
146                                                   
147   G4cout << G4endl;                               
148   G4cout << G4endl;                               
149   G4cout << "Elastic Cross Section of Neutron     
150   G4cout << "(Pointwise cross-section at 0 Kel    
151   G4cout << G4endl;                               
152   G4cout << "Name of Element" << G4endl;          
153   G4cout << "Energy[eV]  XS[barn]" << G4endl;     
154   G4cout << G4endl;                               
155                                                   
156   std::size_t numberOfElements = G4Element::Ge    
157   auto theElementTable = G4Element::GetElement    
158                                                   
159   for (std::size_t i = 0; i < numberOfElements    
160     G4cout << (*theElementTable)[i]->GetName()    
161     G4int ie = 0;                                 
162                                                   
163     for (ie = 0; ie < 130; ++ie) {                
164       G4double eKinetic = 1.0e-5 * G4Pow::GetI    
165       G4bool outOfRange = false;                  
166                                                   
167       if (eKinetic < 20 * MeV) {                  
168         G4cout << eKinetic / eV << " "            
169                << (*((*theCrossSections)(i))).    
170       }                                           
171     }                                             
172     G4cout << G4endl;                             
173   }                                               
174 #endif                                            
175 }                                                 
176                                                   
177 G4double G4ParticleHPElasticData::GetCrossSect    
178                                                   
179 {                                                 
180   G4double result = 0;                            
181   G4bool outOfRange;                              
182   auto index = (G4int)anE->GetIndex();            
183                                                   
184   // prepare neutron                              
185   G4double eKinetic = aP->GetKineticEnergy();     
186                                                   
187   if (G4ParticleHPManager::GetInstance()->GetN    
188     // NEGLECT_DOPPLER_B.                         
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   G4ReactionProduct theNeutron(aP->GetDefiniti    
200   theNeutron.SetMomentum(aP->GetMomentum());      
201   theNeutron.SetKineticEnergy(eKinetic);          
202                                                   
203   // prepare thermal nucleus                      
204   G4Nucleus aNuc;                                 
205   G4double eps = 0.0001;                          
206   G4double theA = anE->GetN();                    
207   G4double theZ = anE->GetZ();                    
208   G4double eleMass;                               
209                                                   
210   eleMass = (G4NucleiProperties::GetNuclearMas    
211             / G4Neutron::Neutron()->GetPDGMass    
212                                                   
213   G4ReactionProduct boosted;                      
214   G4double aXsection;                             
215                                                   
216   // MC integration loop                          
217   G4int counter = 0;                              
218   G4double buffer = 0;                            
219   G4int size = G4int(std::max(10., aT / 60 * k    
220   G4ThreeVector neutronVelocity =                 
221     1. / G4Neutron::Neutron()->GetPDGMass() *     
222   G4double neutronVMag = neutronVelocity.mag()    
223                                                   
224   while (counter == 0                             
225          || std::abs(buffer - result / std::ma    
226               > 0.03 * buffer)  // Loop checki    
227   {                                               
228     if (counter != 0) buffer = result / counte    
229     while (counter < size)  // Loop checking,     
230     {                                             
231       counter++;                                  
232       G4ReactionProduct aThermalNuc = aNuc.Get    
233       boosted.Lorentz(theNeutron, aThermalNuc)    
234       G4double theEkin = boosted.GetKineticEne    
235       aXsection = (*((*theCrossSections)(index    
236       // velocity correction.                     
237       G4ThreeVector targetVelocity = 1. / aThe    
238       aXsection *= (targetVelocity - neutronVe    
239       result += aXsection;                        
240     }                                             
241     size += size;                                 
242   }                                               
243   result /= counter;                              
244   /*                                              
245     // Checking impact of  G4NEUTRONHP_NEGLECT    
246     G4cout << " result " << result << " "         
247            << (*((*theCrossSections)(index))).    
248            << (*((*theCrossSections)(index))).    
249   */                                              
250   return result;                                  
251 }                                                 
252                                                   
253 G4int G4ParticleHPElasticData::GetVerboseLevel    
254 {                                                 
255   return G4ParticleHPManager::GetInstance()->G    
256 }                                                 
257                                                   
258 void G4ParticleHPElasticData::SetVerboseLevel(    
259 {                                                 
260   G4ParticleHPManager::GetInstance()->SetVerbo    
261 }                                                 
262                                                   
263 void G4ParticleHPElasticData::CrossSectionDesc    
264 {                                                 
265   outFile << "High Precision cross data based     
266              "reaction of neutrons below 20MeV    
267 }                                                 
268