Geant4  10.02.p01
G4ParticleHPThermalScattering.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // Thermal Neutron Scattering
27 // Koi, Tatsumi (SLAC/SCCS)
28 //
29 // Class Description:
30 //
31 // Final State Generators for a high precision (based on evaluated data
32 // libraries) description of themal neutron scattering below 4 eV;
33 // Based on Thermal neutron scattering files
34 // from the evaluated nuclear data files ENDF/B-VI, Release2
35 // To be used in your physics list in case you need this physics.
36 // In this case you want to register an object of this class with
37 // the corresponding process.
38 
39 
40 // 070625 Fix memory leaking at destructor by T. Koi
41 // 081201 Fix memory leaking at destructor by T. Koi
42 // 100729 Add model name in constructor Problem #1116
43 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
44 //
48 #include "G4ParticleHPElastic.hh"
49 #include "G4ParticleHPManager.hh"
50 #include "G4SystemOfUnits.hh"
51 #include "G4Neutron.hh"
52 #include "G4ElementTable.hh"
53 #include "G4MaterialTable.hh"
54 #include "G4Threading.hh"
55 
57  :G4HadronicInteraction("NeutronHPThermalScattering")
58 {
60 
61  SetMinEnergy( 0.*eV );
62  SetMaxEnergy( 4*eV );
64 
65  //sizeOfMaterialTable = G4Material::GetMaterialTable()->size();
66  //buildPhysicsTable();
67  nMaterial = 0;
68  nElement = 0;
69 }
70 
71 
72 
74 {
75 
76 /*
77  for ( std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >::iterator it = incoherentFSs->begin() ; it != incoherentFSs->end() ; it++ )
78  {
79  std::map < G4double , std::vector < E_isoAng* >* >::iterator itt;
80  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
81  {
82  std::vector< E_isoAng* >::iterator ittt;
83  for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
84  {
85  delete *ittt;
86  }
87  delete itt->second;
88  }
89  delete it->second;
90  }
91 
92  for ( std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >::iterator it = coherentFSs->begin() ; it != coherentFSs->end() ; it++ )
93  {
94  std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >::iterator itt;
95  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
96  {
97  std::vector < std::pair< G4double , G4double >* >::iterator ittt;
98  for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
99  {
100  delete *ittt;
101  }
102  delete itt->second;
103  }
104  delete it->second;
105  }
106 
107  for ( std::map < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* >::iterator it = inelasticFSs->begin() ; it != inelasticFSs->end() ; it++ )
108  {
109  std::map < G4double , std::vector < E_P_E_isoAng* >* >::iterator itt;
110  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
111  {
112  std::vector < E_P_E_isoAng* >::iterator ittt;
113  for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
114  {
115  std::vector < E_isoAng* >::iterator it4;
116  for ( it4 = (*ittt)->vE_isoAngle.begin() ; it4 != (*ittt)->vE_isoAngle.end() ; it4++ )
117  {
118  delete *it4;
119  }
120  delete *ittt;
121  }
122  delete itt->second;
123  }
124  delete it->second;
125  }
126 */
127 
128  delete theHPElastic;
129  delete theXSection;
130 }
131 
133 
134 if ( incoherentFSs != NULL ) {
135  for ( std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >::iterator it = incoherentFSs->begin() ; it != incoherentFSs->end() ; it++ )
136  {
137  std::map < G4double , std::vector < E_isoAng* >* >::iterator itt;
138  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
139  {
140  std::vector< E_isoAng* >::iterator ittt;
141  for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
142  {
143  delete *ittt;
144  }
145  delete itt->second;
146  }
147  delete it->second;
148  }
149 }
150 
151 if ( coherentFSs != NULL ) {
152  for ( std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >::iterator it = coherentFSs->begin() ; it != coherentFSs->end() ; it++ )
153  {
154  std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >::iterator itt;
155  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
156  {
157  std::vector < std::pair< G4double , G4double >* >::iterator ittt;
158  for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
159  {
160  delete *ittt;
161  }
162  delete itt->second;
163  }
164  delete it->second;
165  }
166 }
167 
168 if ( inelasticFSs != NULL ) {
169  for ( std::map < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* >::iterator it = inelasticFSs->begin() ; it != inelasticFSs->end() ; it++ )
170  {
171  std::map < G4double , std::vector < E_P_E_isoAng* >* >::iterator itt;
172  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
173  {
174  std::vector < E_P_E_isoAng* >::iterator ittt;
175  for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
176  {
177  std::vector < E_isoAng* >::iterator it4;
178  for ( it4 = (*ittt)->vE_isoAngle.begin() ; it4 != (*ittt)->vE_isoAngle.end() ; it4++ )
179  {
180  delete *it4;
181  }
182  delete *ittt;
183  }
184  delete itt->second;
185  }
186  delete it->second;
187  }
188 }
189 
190  incoherentFSs = NULL;
191  coherentFSs = NULL;
192  inelasticFSs = NULL;
193 
194 }
195 
196 
197 
200  theHPElastic->BuildPhysicsTable( particle );
201 }
202 
203 
204 
205 std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* G4ParticleHPThermalScattering::readACoherentFSDATA( G4String name )
206 {
207 
208  std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* aCoherentFSDATA = new std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >;
209 
210  //std::ifstream theChannel( name.c_str() );
211  std::istringstream theChannel(std::ios::in);
213 
214  std::vector< G4double > vBraggE;
215 
216  G4int dummy;
217  while ( theChannel >> dummy ) // MF // Loop checking, 11.05.2015, T. Koi
218  {
219  theChannel >> dummy; // MT
220  G4double temp;
221  theChannel >> temp;
222  std::vector < std::pair< G4double , G4double >* >* anBragE_P = new std::vector < std::pair< G4double , G4double >* >;
223 
224  G4int n;
225  theChannel >> n;
226  for ( G4int i = 0 ; i < n ; i++ )
227  {
228  G4double Ei;
229  G4double Pi;
230  if ( aCoherentFSDATA->size() == 0 )
231  {
232  theChannel >> Ei;
233  vBraggE.push_back( Ei );
234  }
235  else
236  {
237  Ei = vBraggE[ i ];
238  }
239  theChannel >> Pi;
240  anBragE_P->push_back ( new std::pair < G4double , G4double > ( Ei , Pi ) );
241  //G4cout << "Coherent Elastic " << Ei << " " << Pi << G4endl;
242  }
243  aCoherentFSDATA->insert ( std::pair < G4double , std::vector < std::pair< G4double , G4double >* >* > ( temp , anBragE_P ) );
244  }
245 
246  return aCoherentFSDATA;
247 }
248 
249 
250 
251 std::map < G4double , std::vector < E_P_E_isoAng* >* >* G4ParticleHPThermalScattering::readAnInelasticFSDATA ( G4String name )
252 {
253  std::map < G4double , std::vector < E_P_E_isoAng* >* >* anT_E_P_E_isoAng = new std::map < G4double , std::vector < E_P_E_isoAng* >* >;
254 
255  //std::ifstream theChannel( name.c_str() );
256  std::istringstream theChannel(std::ios::in);
258 
259  G4int dummy;
260  while ( theChannel >> dummy ) // MF // Loop checking, 11.05.2015, T. Koi
261  {
262  theChannel >> dummy; // MT
263  G4double temp;
264  theChannel >> temp;
265  std::vector < E_P_E_isoAng* >* vE_P_E_isoAng = new std::vector < E_P_E_isoAng* >;
266  G4int n;
267  theChannel >> n;
268  for ( G4int i = 0 ; i < n ; i++ )
269  {
270  vE_P_E_isoAng->push_back ( readAnE_P_E_isoAng ( &theChannel ) );
271  }
272  anT_E_P_E_isoAng->insert ( std::pair < G4double , std::vector < E_P_E_isoAng* >* > ( temp , vE_P_E_isoAng ) );
273  }
274  //theChannel.close();
275 
276  return anT_E_P_E_isoAng;
277 }
278 
279 
280 
282 {
283  E_P_E_isoAng* aData = new E_P_E_isoAng;
284 
285  G4double dummy;
287  G4int nep , nl;
288  *file >> dummy;
289  *file >> energy;
290  aData->energy = energy*eV;
291  *file >> dummy;
292  *file >> dummy;
293  *file >> nep;
294  *file >> nl;
295  aData->n = nep/nl;
296  for ( G4int i = 0 ; i < aData->n ; i++ )
297  {
298  G4double prob;
299  E_isoAng* anE_isoAng = new E_isoAng;
300  aData->vE_isoAngle.push_back( anE_isoAng );
301  *file >> energy;
302  anE_isoAng->energy = energy*eV;
303  anE_isoAng->n = nl - 2;
304  anE_isoAng->isoAngle.resize( anE_isoAng->n );
305  *file >> prob;
306  aData->prob.push_back( prob );
307  //G4cout << "G4ParticleHPThermalScattering inelastic " << energy/eV << " " << i << " " << prob << " " << aData->prob[ i ] << G4endl;
308  for ( G4int j = 0 ; j < anE_isoAng->n ; j++ )
309  {
310  G4double x;
311  *file >> x;
312  anE_isoAng->isoAngle[j] = x ;
313  //G4cout << "G4ParticleHPThermalScattering inelastic " << x << anE_isoAng->isoAngle[j] << G4endl;
314  }
315  }
316 
317  // Calcuate sum_of_provXdEs
318  G4double total = 0;
319  for ( G4int i = 0 ; i < aData->n - 1 ; i++ )
320  {
321  G4double E_L = aData->vE_isoAngle[i]->energy/eV;
322  G4double E_H = aData->vE_isoAngle[i+1]->energy/eV;
323  G4double dE = E_H - E_L;
324  total += ( ( aData->prob[i] ) * dE );
325  }
326  aData->sum_of_probXdEs = total;
327 
328  return aData;
329 }
330 
331 
332 
333 std::map < G4double , std::vector < E_isoAng* >* >* G4ParticleHPThermalScattering::readAnIncoherentFSDATA ( G4String name )
334 {
335  std::map < G4double , std::vector < E_isoAng* >* >* T_E = new std::map < G4double , std::vector < E_isoAng* >* >;
336 
337  //std::ifstream theChannel( name.c_str() );
338  std::istringstream theChannel(std::ios::in);
340 
341  G4int dummy;
342  while ( theChannel >> dummy ) // MF // Loop checking, 11.05.2015, T. Koi
343  {
344  theChannel >> dummy; // MT
345  G4double temp;
346  theChannel >> temp;
347  std::vector < E_isoAng* >* vE_isoAng = new std::vector < E_isoAng* >;
348  G4int n;
349  theChannel >> n;
350  for ( G4int i = 0 ; i < n ; i++ )
351  vE_isoAng->push_back ( readAnE_isoAng( &theChannel ) );
352  T_E->insert ( std::pair < G4double , std::vector < E_isoAng* >* > ( temp , vE_isoAng ) );
353  }
354  //theChannel.close();
355 
356  return T_E;
357 }
358 
359 
360 
362 {
363  E_isoAng* aData = new E_isoAng;
364 
365  G4double dummy;
367  G4int n;
368  *file >> dummy;
369  *file >> energy;
370  *file >> dummy;
371  *file >> dummy;
372  *file >> n;
373  *file >> dummy;
374  aData->energy = energy*eV;
375  aData->n = n-2;
376  aData->isoAngle.resize( n );
377 
378  *file >> dummy;
379  *file >> dummy;
380  for ( G4int i = 0 ; i < aData->n ; i++ )
381  *file >> aData->isoAngle[i];
382 
383  return aData;
384 }
385 
386 
387 
389 {
390 
391 /*
392  //Trick for dynamically generated materials
393  if ( sizeOfMaterialTable != G4Material::GetMaterialTable()->size() ) {
394  sizeOfMaterialTable = G4Material::GetMaterialTable()->size();
395  buildPhysicsTable();
396  theXSection->BuildPhysicsTable( *aTrack.GetDefinition() );
397  }
398 */
399 // Select Element > Reaction >
400 
401  const G4Material * theMaterial = aTrack.GetMaterial();
402  G4double aTemp = theMaterial->GetTemperature();
403  G4int n = theMaterial->GetNumberOfElements();
404  //static const G4ElementTable* theElementTable = G4Element::GetElementTable();
405 
406  G4bool findThermalElement = false;
407  G4int ielement;
408  const G4Element* theElement = NULL;
409  for ( G4int i = 0; i < n ; i++ )
410  {
411  theElement = theMaterial->GetElement(i);
412  //Select target element
413  if ( aNucleus.GetZ_asInt() == (G4int)(theElement->GetZ() + 0.5 ) )
414  {
415  //Check Applicability of Thermal Scattering
416  if ( getTS_ID( NULL , theElement ) != -1 )
417  {
418  ielement = getTS_ID( NULL , theElement );
419  findThermalElement = true;
420  break;
421  }
422  else if ( getTS_ID( theMaterial , theElement ) != -1 )
423  {
424  ielement = getTS_ID( theMaterial , theElement );
425  findThermalElement = true;
426  break;
427  }
428  }
429  }
430 
431  if ( findThermalElement == true )
432  {
433 
434 // Select Reaction (Inelastic, coherent, incoherent)
435 
436  const G4ParticleDefinition* pd = aTrack.GetDefinition();
437  G4DynamicParticle* dp = new G4DynamicParticle ( pd , aTrack.Get4Momentum() );
438  G4double total = theXSection->GetCrossSection( dp , theElement , theMaterial );
439  G4double inelastic = theXSection->GetInelasticCrossSection( dp , theElement , theMaterial );
440 
441 
442  G4double random = G4UniformRand();
443  if ( random <= inelastic/total )
444  {
445  // Inelastic
446 
447  // T_L and T_H
448  std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator it;
449  std::vector<G4double> v_temp;
450  v_temp.clear();
451  for ( it = inelasticFSs->find( ielement )->second->begin() ; it != inelasticFSs->find( ielement )->second->end() ; it++ )
452  {
453  v_temp.push_back( it->first );
454  }
455 
456 // T_L T_H
457  std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
458 //
459 // For T_L aNEP_EPM_TL and T_H aNEP_EPM_TH
460 //
461  std::vector< E_P_E_isoAng* >* vNEP_EPM_TL = 0;
462  std::vector< E_P_E_isoAng* >* vNEP_EPM_TH = 0;
463 
464  if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
465  {
466  vNEP_EPM_TL = inelasticFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second;
467  vNEP_EPM_TH = inelasticFSs->find( ielement )->second->find ( tempLH.second/kelvin )->second;
468  }
469  else if ( tempLH.first == 0.0 )
470  {
471  std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator itm;
472  itm = inelasticFSs->find( ielement )->second->begin();
473  vNEP_EPM_TL = itm->second;
474  itm++;
475  vNEP_EPM_TH = itm->second;
476  tempLH.first = tempLH.second;
477  tempLH.second = itm->first;
478  }
479  else if ( tempLH.second == 0.0 )
480  {
481  std::map < G4double , std::vector< E_P_E_isoAng* >* >::iterator itm;
482  itm = inelasticFSs->find( ielement )->second->end();
483  itm--;
484  vNEP_EPM_TH = itm->second;
485  itm--;
486  vNEP_EPM_TL = itm->second;
487  tempLH.second = tempLH.first;
488  tempLH.first = itm->first;
489  }
490 
491  G4double rand_for_sE = G4UniformRand();
492 
493  std::pair< G4double , E_isoAng > TL = create_sE_and_EPM_from_pE_and_vE_P_E_isoAng ( rand_for_sE , aTrack.GetKineticEnergy() , vNEP_EPM_TL );
494  std::pair< G4double , E_isoAng > TH = create_sE_and_EPM_from_pE_and_vE_P_E_isoAng ( rand_for_sE , aTrack.GetKineticEnergy() , vNEP_EPM_TH );
495 
496  G4double sE;
497  sE = get_linear_interpolated ( aTemp , std::pair < G4double , G4double > ( tempLH.first , TL.first ) , std::pair < G4double , G4double > ( tempLH.second , TH.first ) );
498 
499  G4double mu=1.0;
500  E_isoAng anE_isoAng;
501  if ( TL.second.n == TH.second.n )
502  {
503  anE_isoAng.energy = sE;
504  anE_isoAng.n = TL.second.n;
505  for ( G4int i=0 ; i < anE_isoAng.n ; i++ )
506  {
507  G4double angle;
508  angle = get_linear_interpolated ( aTemp , std::pair< G4double , G4double > ( tempLH.first , TL.second.isoAngle[ i ] ) , std::pair< G4double , G4double > ( tempLH.second , TH.second.isoAngle[ i ] ) );
509  anE_isoAng.isoAngle.push_back( angle );
510  }
511  mu = getMu( &anE_isoAng );
512 
513  } else {
514  //TL.second.n != TH.second.n
515  G4HadronicException(__FILE__, __LINE__, "A problem is found in Thermal Scattering Data! Do not yet supported");
516  }
517 
518  //set
520  theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
521 
522  }
523  //else if ( random <= ( inelastic + theXSection->GetCoherentCrossSection( dp , (*theElementTable)[ ielement ] , aTemp ) ) / total )
524  else if ( random <= ( inelastic + theXSection->GetCoherentCrossSection( dp , theElement , theMaterial ) ) / total )
525  {
526  // Coherent Elastic
527 
528  G4double E = aTrack.GetKineticEnergy();
529 
530  // T_L and T_H
531  std::map < G4double , std::vector< std::pair< G4double , G4double >* >* >::iterator it;
532  std::vector<G4double> v_temp;
533  v_temp.clear();
534  for ( it = coherentFSs->find( ielement )->second->begin() ; it != coherentFSs->find( ielement )->second->end() ; it++ )
535  {
536  v_temp.push_back( it->first );
537  }
538 
539 // T_L T_H
540  std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
541 //
542 //
543 // For T_L anEPM_TL and T_H anEPM_TH
544 //
545  std::vector< std::pair< G4double , G4double >* >* pvE_p_TL = NULL;
546  std::vector< std::pair< G4double , G4double >* >* pvE_p_TH = NULL;
547 
548  if ( tempLH.first != 0.0 && tempLH.second != 0.0 )
549  {
550  pvE_p_TL = coherentFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second;
551  pvE_p_TH = coherentFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second;
552  }
553  else if ( tempLH.first == 0.0 )
554  {
555  pvE_p_TL = coherentFSs->find( ielement )->second->find ( v_temp[ 0 ] )->second;
556  pvE_p_TH = coherentFSs->find( ielement )->second->find ( v_temp[ 1 ] )->second;
557  tempLH.first = tempLH.second;
558  tempLH.second = v_temp[ 1 ];
559  }
560  else if ( tempLH.second == 0.0 )
561  {
562  pvE_p_TL = coherentFSs->find( ielement )->second->find ( v_temp.back() )->second;
563  std::vector< G4double >::iterator itv;
564  itv = v_temp.end();
565  itv--;
566  itv--;
567  pvE_p_TL = coherentFSs->find( ielement )->second->find ( *itv )->second;
568  tempLH.second = tempLH.first;
569  tempLH.first = *itv;
570  }
571  else
572  {
573  //tempLH.first == 0.0 && tempLH.second
574  G4HadronicException(__FILE__, __LINE__, "A problem is found in Thermal Scattering Data! Unexpected temperature values in data");
575  }
576 
577  std::vector< G4double > vE_T;
578  std::vector< G4double > vp_T;
579 
580  G4int n1 = pvE_p_TL->size();
581  //G4int n2 = pvE_p_TH->size();
582 
583  for ( G4int i=1 ; i < n1 ; i++ )
584  {
585  if ( (*pvE_p_TL)[i]->first != (*pvE_p_TH)[i]->first ) G4HadronicException(__FILE__, __LINE__, "A problem is found in Thermal Scattering Data!");
586  vE_T.push_back ( (*pvE_p_TL)[i]->first );
587  vp_T.push_back ( get_linear_interpolated ( aTemp , std::pair< G4double , G4double > ( tempLH.first , (*pvE_p_TL)[i]->second ) , std::pair< G4double , G4double > ( tempLH.second , (*pvE_p_TL)[i]->second ) ) );
588  }
589 
590  G4int j = 0;
591  for ( G4int i = 1 ; i < n ; i++ )
592  {
593  if ( E/eV < vE_T[ i ] )
594  {
595  j = i-1;
596  break;
597  }
598  }
599 
600  G4double rand_for_mu = G4UniformRand();
601 
602  G4int k = 0;
603  for ( G4int i = 1 ; i < j ; i++ )
604  {
605  G4double Pi = vp_T[ i ] / vp_T[ j ];
606  if ( rand_for_mu < Pi )
607  {
608  k = i-1;
609  break;
610  }
611  }
612 
613  //G4double Ei = vE_T[ j ];
614  G4double Ei = vE_T[ k ];
615 
616  G4double mu = 1 - 2 * Ei / (E/eV) ;
617  //111102
618  if ( mu < -1.0 ) mu = -1.0;
619 
621  theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
622 
623 
624  }
625  else
626  {
627  // InCoherent Elastic
628 
629  // T_L and T_H
630  std::map < G4double , std::vector < E_isoAng* >* >::iterator it;
631  std::vector<G4double> v_temp;
632  v_temp.clear();
633  for ( it = incoherentFSs->find( ielement )->second->begin() ; it != incoherentFSs->find( ielement )->second->end() ; it++ )
634  {
635  v_temp.push_back( it->first );
636  }
637 
638 // T_L T_H
639  std::pair < G4double , G4double > tempLH = find_LH ( aTemp , &v_temp );
640 
641 //
642 // For T_L anEPM_TL and T_H anEPM_TH
643 //
644 
645  E_isoAng anEPM_TL_E;
646  E_isoAng anEPM_TH_E;
647 
648  if ( tempLH.first != 0.0 && tempLH.second != 0.0 ) {
649  //Interpolate TL and TH
650  anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( tempLH.first/kelvin )->second );
651  anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( tempLH.second/kelvin )->second );
652  } else if ( tempLH.first == 0.0 ) {
653  //Extrapolate T0 and T1
654  anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp[ 0 ] )->second );
655  anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp[ 1 ] )->second );
656  tempLH.first = tempLH.second;
657  tempLH.second = v_temp[ 1 ];
658  } else if ( tempLH.second == 0.0 ) {
659  //Extrapolate Tmax-1 and Tmax
660  anEPM_TH_E = create_E_isoAng_from_energy ( aTrack.GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( v_temp.back() )->second );
661  std::vector< G4double >::iterator itv;
662  itv = v_temp.end();
663  itv--;
664  itv--;
665  anEPM_TL_E = create_E_isoAng_from_energy ( aTrack.GetKineticEnergy() , incoherentFSs->find( ielement )->second->find ( *itv )->second );
666  tempLH.second = tempLH.first;
667  tempLH.first = *itv;
668  }
669 
670  // E_isoAng for aTemp and aTrack.GetKineticEnergy()
671  G4double mu=1.0;
672  E_isoAng anEPM_T_E;
673 
674  if ( anEPM_TL_E.n == anEPM_TH_E.n )
675  {
676  anEPM_T_E.n = anEPM_TL_E.n;
677  for ( G4int i=0 ; i < anEPM_TL_E.n ; i++ )
678  {
679  G4double angle;
680  angle = get_linear_interpolated ( aTemp , std::pair< G4double , G4double > ( tempLH.first , anEPM_TL_E.isoAngle[ i ] ) , std::pair< G4double , G4double > ( tempLH.second , anEPM_TH_E.isoAngle[ i ] ) );
681  anEPM_T_E.isoAngle.push_back( angle );
682  }
683  mu = getMu ( &anEPM_T_E );
684 
685  } else {
686  // anEPM_TL_E.n != anEPM_TH_E.n
687  G4HadronicException(__FILE__, __LINE__, "A problem is found in Thermal Scattering Data! Do not yet supported");
688  }
689 
690  // Set Final State
691  theParticleChange.SetEnergyChange( aTrack.GetKineticEnergy() ); // No energy change in Elastic
692  theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
693 
694  }
695  delete dp;
696 
697  return &theParticleChange;
698 
699  }
700  else
701  {
702  // Not thermal element
703  // Neutron HP will handle
704  return theHPElastic -> ApplyYourself( aTrack, aNucleus );
705  }
706 
707 }
708 
709 
710 
712 {
713 
714  G4double random = G4UniformRand();
715  G4double result = 0.0;
716 
717  G4int in = int ( random * ( (*anEPM).n ) );
718 
719  if ( in != 0 )
720  {
721  G4double mu_l = (*anEPM).isoAngle[ in-1 ];
722  G4double mu_h = (*anEPM).isoAngle[ in ];
723  result = ( mu_h - mu_l ) * ( random * ( (*anEPM).n ) - in ) + mu_l;
724  }
725  else
726  {
727  G4double x = random * (*anEPM).n;
728  G4double D = ( (*anEPM).isoAngle[ 0 ] - ( -1 ) ) + ( 1 - (*anEPM).isoAngle[ (*anEPM).n - 1 ] );
729  G4double ratio = ( (*anEPM).isoAngle[ 0 ] - ( -1 ) ) / D;
730  if ( x <= ratio )
731  {
732  G4double mu_l = -1;
733  G4double mu_h = (*anEPM).isoAngle[ 0 ];
734  result = ( mu_h - mu_l ) * x + mu_l;
735  }
736  else
737  {
738  G4double mu_l = (*anEPM).isoAngle[ (*anEPM).n - 1 ];
739  G4double mu_h = 1;
740  result = ( mu_h - mu_l ) * x + mu_l;
741  }
742  }
743  return result;
744 }
745 
746 
747 
748 std::pair < G4double , G4double > G4ParticleHPThermalScattering::find_LH ( G4double x , std::vector< G4double >* aVector )
749 {
750  G4double LL = 0.0;
751  G4double H = 0.0;
752 
753  // v->size() == 1 --> LL=H=v(0)
754  if ( aVector->size() == 1 ) {
755  LL = aVector->front();
756  H = aVector->front();
757  } else {
758  // 1) temp < v(0) -> LL=0.0 H=v(0)
759  // 2) v(i-1) < temp <= v(i) -> LL=v(i-1) H=v(i)
760  // 3) v(imax) < temp -> LL=v(imax) H=0.0
761  for ( std::vector< G4double >::iterator
762  it = aVector->begin() ; it != aVector->end() ; it++ ) {
763  if ( x <= *it ) {
764  H = *it;
765  if ( it != aVector->begin() ) {
766  // 2)
767  it--;
768  LL = *it;
769  } else {
770  // 1)
771  LL = 0.0;
772  }
773  break;
774  }
775  }
776  // 3)
777  if ( H == 0.0 ) LL = aVector->back();
778  }
779 
780  return std::pair < G4double , G4double > ( LL , H );
781 }
782 
783 
784 
785 G4double G4ParticleHPThermalScattering::get_linear_interpolated ( G4double x , std::pair< G4double , G4double > Low , std::pair< G4double , G4double > High )
786 {
787  G4double y=0.0;
788  if ( High.first - Low.first != 0 ) {
789  y = ( High.second - Low.second ) / ( High.first - Low.first ) * ( x - Low.first ) + Low.second;
790  } else {
791  if ( High.second == Low.second ) {
792  y = High.second;
793  } else {
794  G4cout << "G4ParticleHPThermalScattering liner interpolation err!!" << G4endl;
795  }
796  }
797 
798  return y;
799 }
800 
801 
802 
804 {
805  E_isoAng anEPM_T_E;
806 
807  std::vector< E_isoAng* >::iterator iv;
808 
809  std::vector< G4double > v_e;
810  v_e.clear();
811  for ( iv = vEPM->begin() ; iv != vEPM->end() ; iv++ )
812  v_e.push_back ( (*iv)->energy );
813 
814  std::pair < G4double , G4double > energyLH = find_LH ( energy , &v_e );
815  //G4cout << " " << energy/eV << " " << energyLH.first/eV << " " << energyLH.second/eV << G4endl;
816 
817  E_isoAng* panEPM_T_EL=0;
818  E_isoAng* panEPM_T_EH=0;
819 
820  if ( energyLH.first != 0.0 && energyLH.second != 0.0 )
821  {
822  for ( iv = vEPM->begin() ; iv != vEPM->end() ; iv++ )
823  {
824  if ( energyLH.first == (*iv)->energy )
825  break;
826  }
827  panEPM_T_EL = *iv;
828  iv++;
829  panEPM_T_EH = *iv;
830  }
831  else if ( energyLH.first == 0.0 )
832  {
833  panEPM_T_EL = (*vEPM)[0];
834  panEPM_T_EH = (*vEPM)[1];
835  }
836  else if ( energyLH.second == 0.0 )
837  {
838  panEPM_T_EH = (*vEPM).back();
839  iv = vEPM->end();
840  iv--;
841  iv--;
842  panEPM_T_EL = *iv;
843  }
844 
845  //checking isoAng has proper values or not
846  // Inelastic/FS, the first and last entries of *vEPM has all zero values.
847  if ( ! ( check_E_isoAng (panEPM_T_EL) ) ) panEPM_T_EL= panEPM_T_EH;
848  if ( ! ( check_E_isoAng (panEPM_T_EH) ) ) panEPM_T_EH= panEPM_T_EL;
849 
850  if ( panEPM_T_EL->n == panEPM_T_EH->n )
851  {
852  anEPM_T_E.energy = energy;
853  anEPM_T_E.n = panEPM_T_EL->n;
854 
855  for ( G4int i=0 ; i < panEPM_T_EL->n ; i++ )
856  {
857  G4double angle;
858  angle = get_linear_interpolated ( energy , std::pair< G4double , G4double > ( energyLH.first , panEPM_T_EL->isoAngle[ i ] ) , std::pair< G4double , G4double > ( energyLH.second , panEPM_T_EH->isoAngle[ i ] ) );
859  anEPM_T_E.isoAngle.push_back( angle );
860  }
861  }
862  else
863  {
864  G4cout << "G4ParticleHPThermalScattering Do not Suuport yet." << G4endl;
865  }
866 
867 
868  return anEPM_T_E;
869 }
870 
871 
872 
874 {
875 
876  G4double secondary_energy = 0.0;
877 
878  G4int n = anE_P_E_isoAng->n;
879  G4double sum_p = 0.0; // sum_p_H
880  G4double sum_p_L = 0.0;
881 
882  G4double total=0.0;
883 
884 /*
885  delete for speed up
886  for ( G4int i = 0 ; i < n-1 ; i++ )
887  {
888  G4double E_L = anE_P_E_isoAng->vE_isoAngle[i]->energy/eV;
889  G4double E_H = anE_P_E_isoAng->vE_isoAngle[i+1]->energy/eV;
890  G4double dE = E_H - E_L;
891  total += ( ( anE_P_E_isoAng->prob[i] ) * dE );
892  }
893 
894  if ( std::abs( total - anE_P_E_isoAng->sum_of_probXdEs ) > 1.0e-14 ) G4cout << total - anE_P_E_isoAng->sum_of_probXdEs << G4endl;
895 */
896  total = anE_P_E_isoAng->sum_of_probXdEs;
897 
898  for ( G4int i = 0 ; i < n-1 ; i++ )
899  {
900  G4double E_L = anE_P_E_isoAng->vE_isoAngle[i]->energy/eV;
901  G4double E_H = anE_P_E_isoAng->vE_isoAngle[i+1]->energy/eV;
902  G4double dE = E_H - E_L;
903  sum_p += ( ( anE_P_E_isoAng->prob[i] ) * dE );
904 
905  if ( random <= sum_p/total )
906  {
907  secondary_energy = get_linear_interpolated ( random , std::pair < G4double , G4double > ( sum_p_L/total , E_L ) , std::pair < G4double , G4double > ( sum_p/total , E_H ) );
908  secondary_energy = secondary_energy*eV; //need eV
909  break;
910  }
911  sum_p_L = sum_p;
912  }
913 
914  return secondary_energy;
915 }
916 
917 
918 
919 std::pair< G4double , E_isoAng > G4ParticleHPThermalScattering::create_sE_and_EPM_from_pE_and_vE_P_E_isoAng ( G4double rand_for_sE , G4double pE , std::vector < E_P_E_isoAng* >* vNEP_EPM )
920 {
921 
922  std::map< G4double , G4int > map_energy;
923  map_energy.clear();
924  std::vector< G4double > v_energy;
925  v_energy.clear();
926  std::vector< E_P_E_isoAng* >::iterator itv;
927  G4int i = 0;
928  for ( itv = vNEP_EPM->begin(); itv != vNEP_EPM->end(); itv++ )
929  {
930  v_energy.push_back( (*itv)->energy );
931  map_energy.insert( std::pair < G4double , G4int > ( (*itv)->energy , i ) );
932  i++;
933  }
934 
935  std::pair < G4double , G4double > energyLH = find_LH ( pE , &v_energy );
936 
937  E_P_E_isoAng* pE_P_E_isoAng_EL = 0;
938  E_P_E_isoAng* pE_P_E_isoAng_EH = 0;
939 
940  if ( energyLH.first != 0.0 && energyLH.second != 0.0 )
941  {
942  pE_P_E_isoAng_EL = (*vNEP_EPM)[ map_energy.find ( energyLH.first )->second ];
943  pE_P_E_isoAng_EH = (*vNEP_EPM)[ map_energy.find ( energyLH.second )->second ];
944  }
945  else if ( energyLH.first == 0.0 )
946  {
947  pE_P_E_isoAng_EL = (*vNEP_EPM)[ 0 ];
948  pE_P_E_isoAng_EH = (*vNEP_EPM)[ 1 ];
949  }
950  if ( energyLH.second == 0.0 )
951  {
952  pE_P_E_isoAng_EH = (*vNEP_EPM).back();
953  itv = vNEP_EPM->end();
954  itv--;
955  itv--;
956  pE_P_E_isoAng_EL = *itv;
957  }
958 
959 
960  G4double sE;
961  G4double sE_L;
962  G4double sE_H;
963 
964 
965  sE_L = get_secondary_energy_from_E_P_E_isoAng ( rand_for_sE , pE_P_E_isoAng_EL );
966  sE_H = get_secondary_energy_from_E_P_E_isoAng ( rand_for_sE , pE_P_E_isoAng_EH );
967 
968  sE = get_linear_interpolated ( pE , std::pair < G4double , G4double > ( energyLH.first , sE_L ) , std::pair < G4double , G4double > ( energyLH.second , sE_H ) );
969 
970 
971  E_isoAng E_isoAng_L = create_E_isoAng_from_energy ( sE , &(pE_P_E_isoAng_EL->vE_isoAngle) );
972  E_isoAng E_isoAng_H = create_E_isoAng_from_energy ( sE , &(pE_P_E_isoAng_EH->vE_isoAngle) );
973 
974  E_isoAng anE_isoAng;
975  //For defeating warning message from compiler
976  anE_isoAng.n = 1;
977  anE_isoAng.energy = sE; //never used
978  if ( E_isoAng_L.n == E_isoAng_H.n )
979  {
980  anE_isoAng.n = E_isoAng_L.n;
981  for ( G4int j=0 ; j < anE_isoAng.n ; j++ )
982  {
983  G4double angle;
984  angle = get_linear_interpolated ( sE , std::pair< G4double , G4double > ( sE_L , E_isoAng_L.isoAngle[ j ] ) , std::pair< G4double , G4double > ( sE_H , E_isoAng_H.isoAngle[ j ] ) );
985  anE_isoAng.isoAngle.push_back( angle );
986  }
987  }
988  else
989  {
990  //G4cout << "Do not Suuport yet." << G4endl;
991  throw G4HadronicException(__FILE__, __LINE__, "Unexpected values!");
992  }
993 
994 
995 
996  return std::pair< G4double , E_isoAng >( sE , anE_isoAng);
997 }
998 
1000 {
1001 
1002  //Is rebuild of physics table a necessity
1003  if ( nMaterial == G4Material::GetMaterialTable()->size() && nElement == G4Element::GetElementTable()->size() ) {
1004  return;
1005  } else {
1007  nElement = G4Element::GetElementTable()->size();
1008  }
1009 
1010  dic.clear();
1011  std::map < G4String , G4int > co_dic;
1012 
1013  //Searching Nist Materials
1014  static G4ThreadLocal G4MaterialTable* theMaterialTable = 0 ; if (!theMaterialTable) theMaterialTable= G4Material::GetMaterialTable();
1015  size_t numberOfMaterials = G4Material::GetNumberOfMaterials();
1016  for ( size_t i = 0 ; i < numberOfMaterials ; i++ )
1017  {
1018  G4Material* material = (*theMaterialTable)[i];
1019  size_t numberOfElements = material->GetNumberOfElements();
1020  for ( size_t j = 0 ; j < numberOfElements ; j++ )
1021  {
1022  const G4Element* element = material->GetElement(j);
1023  if ( names.IsThisThermalElement ( material->GetName() , element->GetName() ) )
1024  {
1025  G4int ts_ID_of_this_geometry;
1026  G4String ts_ndl_name = names.GetTS_NDL_Name( material->GetName() , element->GetName() );
1027  if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
1028  {
1029  ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
1030  }
1031  else
1032  {
1033  ts_ID_of_this_geometry = co_dic.size();
1034  co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
1035  }
1036 
1037  //G4cout << "Neutron HP Thermal Scattering: Registering a material-element pair of "
1038  // << material->GetName() << " " << element->GetName()
1039  // << " as internal thermal scattering id of " << ts_ID_of_this_geometry << "." << G4endl;
1040 
1041  dic.insert( std::pair < std::pair < G4Material* , const G4Element* > , G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
1042  }
1043  }
1044  }
1045 
1046  //Searching TS Elements
1047  static G4ThreadLocal G4ElementTable* theElementTable = 0 ; if (!theElementTable) theElementTable= G4Element::GetElementTable();
1048  size_t numberOfElements = G4Element::GetNumberOfElements();
1049  //size_t numberOfThermalElements = 0;
1050  for ( size_t i = 0 ; i < numberOfElements ; i++ )
1051  {
1052  const G4Element* element = (*theElementTable)[i];
1053  if ( names.IsThisThermalElement ( element->GetName() ) )
1054  {
1055  if ( names.IsThisThermalElement ( element->GetName() ) )
1056  {
1057  G4int ts_ID_of_this_geometry;
1058  G4String ts_ndl_name = names.GetTS_NDL_Name( element->GetName() );
1059  if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
1060  {
1061  ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
1062  }
1063  else
1064  {
1065  ts_ID_of_this_geometry = co_dic.size();
1066  co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
1067  }
1068 
1069  //G4cout << "Neutron HP Thermal Scattering: Registering an element of "
1070  // << material->GetName() << " " << element->GetName()
1071  // << " as internal thermal scattering id of " << ts_ID_of_this_geometry << "." << G4endl;
1072 
1073  dic.insert( std::pair < std::pair < const G4Material* , const G4Element* > , G4int > ( std::pair < const G4Material* , const G4Element* > ( (G4Material*)NULL , element ) , ts_ID_of_this_geometry ) );
1074  }
1075  }
1076  }
1077 
1078  G4cout << G4endl;
1079  G4cout << "Neutron HP Thermal Scattering: Following material-element pairs or elements are registered." << G4endl;
1080  for ( std::map < std::pair < const G4Material* , const G4Element* > , G4int >::iterator it = dic.begin() ; it != dic.end() ; it++ )
1081  {
1082  if ( it->first.first != NULL )
1083  {
1084  G4cout << "Material " << it->first.first->GetName() << " - Element " << it->first.second->GetName() << ", internal thermal scattering id " << it->second << G4endl;
1085  }
1086  else
1087  {
1088  G4cout << "Element " << it->first.second->GetName() << ", internal thermal scattering id " << it->second << G4endl;
1089  }
1090  }
1091  G4cout << G4endl;
1092 
1093  // Read Cross Section Data files
1094 
1099 
1100  if ( G4Threading::IsMasterThread() ) {
1101 
1103 
1104  if ( coherentFSs == NULL ) coherentFSs = new std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >;
1105  if ( incoherentFSs == NULL ) incoherentFSs = new std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >;
1106  if ( inelasticFSs == NULL ) inelasticFSs = new std::map < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* >;
1107 
1108  G4String dirName;
1109  if ( !getenv( "G4NEUTRONHPDATA" ) )
1110  throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
1111  dirName = getenv( "G4NEUTRONHPDATA" );
1112 
1113  //G4String name;
1114 
1115  for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
1116  {
1117  G4String tsndlName = it->first;
1118  G4int ts_ID = it->second;
1119 
1120  // Coherent
1121  G4String fsName = "/ThermalScattering/Coherent/FS/";
1122  G4String fileName = dirName + fsName + tsndlName;
1123  coherentFSs->insert ( std::pair < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* > ( ts_ID , readACoherentFSDATA( fileName ) ) );
1124 
1125  // incoherent elastic
1126  fsName = "/ThermalScattering/Incoherent/FS/";
1127  fileName = dirName + fsName + tsndlName;
1128  incoherentFSs->insert ( std::pair < G4int , std::map < G4double , std::vector < E_isoAng* >* >* > ( ts_ID , readAnIncoherentFSDATA( fileName ) ) );
1129 
1130  // inelastic
1131  fsName = "/ThermalScattering/Inelastic/FS/";
1132  fileName = dirName + fsName + tsndlName;
1133  inelasticFSs->insert ( std::pair < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* > ( ts_ID , readAnInelasticFSDATA( fileName ) ) );
1134  }
1135 
1139  }
1140 
1142 }
1143 
1144 
1146 {
1147  G4int result = -1;
1148  if ( dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) != dic.end() )
1149  result = dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) )->second;
1150  return result;
1151 }
1152 
1153 const std::pair<G4double, G4double> G4ParticleHPThermalScattering::GetFatalEnergyCheckLevels() const
1154 {
1155  //return std::pair<G4double, G4double>(10*perCent,10*GeV);
1156  return std::pair<G4double, G4double>(10*perCent,DBL_MAX);
1157 }
1158 
1160 {
1161  names.AddThermalElement( nameG4Element , filename );
1162  theXSection->AddUserThermalScatteringFile( nameG4Element , filename );
1164 }
1165 
1166 
1168 {
1169  G4bool result=false;
1170 
1171  G4int n = anE_IsoAng->n;
1172  G4double sum=0.0;
1173  for ( G4int i = 0 ; i < n ; i++ ) {
1174  sum += anE_IsoAng->isoAngle[ i ];
1175  }
1176  if ( sum != 0.0 ) result = true;
1177 
1178  return result;
1179 }
1180 
1181 void G4ParticleHPThermalScattering::ModelDescription(std::ostream& outFile) const
1182 {
1183  outFile << "High Precision model based on thermal scattering data in evaluated nuclear data libraries for neutrons below 5eV on specific materials\n";
1184 }
static G4ParticleHPManager * GetInstance()
std::map< G4int, std::map< G4double, std::vector< E_isoAng * > * > * > * incoherentFSs
std::map< G4int, std::map< G4double, std::vector< std::pair< G4double, G4double > * > * > * > * coherentFSs
G4ParticleHPThermalScatteringNames names
std::vector< G4double > isoAngle
std::map< G4double, std::vector< std::pair< G4double, G4double > * > * > * readACoherentFSDATA(G4String)
G4int first(char) const
G4double get_secondary_energy_from_E_P_E_isoAng(G4double, E_P_E_isoAng *)
void BuildPhysicsTable(const G4ParticleDefinition &)
G4String name
Definition: TRTMaterials.hh:40
const G4String & GetName() const
Definition: G4Material.hh:178
G4double GetZ() const
Definition: G4Element.hh:131
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
std::vector< G4Material * > G4MaterialTable
void GetDataStream(G4String, std::istringstream &iss)
static G4double angle[DIM]
E_isoAng create_E_isoAng_from_energy(G4double, std::vector< E_isoAng * > *)
std::map< G4int, std::map< G4double, std::vector< E_P_E_isoAng * > * > * > * GetThermalScatteringInelasticFinalStates()
#define G4ThreadLocal
Definition: tls.hh:89
std::pair< G4double, E_isoAng > create_sE_and_EPM_from_pE_and_vE_P_E_isoAng(G4double, G4double, std::vector< E_P_E_isoAng * > *)
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:202
int G4int
Definition: G4Types.hh:78
std::map< G4double, std::vector< E_P_E_isoAng * > * > * readAnInelasticFSDATA(G4String)
std::vector< E_isoAng * > vE_isoAngle
std::map< G4int, std::map< G4double, std::vector< E_isoAng * > * > * > * GetThermalScatteringIncoherentFinalStates()
virtual void ModelDescription(std::ostream &outFile) const
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
std::map< G4int, std::map< G4double, std::vector< std::pair< G4double, G4double > * > * > * > * GetThermalScatteringCoherentFinalStates()
void SetMinEnergy(G4double anEnergy)
static const G4double dE
std::map< G4double, std::vector< E_isoAng * > * > * readAnIncoherentFSDATA(G4String)
#define G4UniformRand()
Definition: Randomize.hh:97
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
Definition: G4Element.cc:402
const G4ParticleDefinition * GetDefinition() const
E_P_E_isoAng * readAnE_P_E_isoAng(std::istream *)
G4ParticleHPThermalScatteringData * theXSection
bool G4bool
Definition: G4Types.hh:79
std::map< G4int, std::map< G4double, std::vector< E_P_E_isoAng * > * > * > * inelasticFSs
G4double GetKineticEnergy() const
void BuildPhysicsTable(const G4ParticleDefinition &)
G4int getTS_ID(const G4Material *, const G4Element *)
static const double second
Definition: G4SIunits.hh:156
static const double perCent
Definition: G4SIunits.hh:329
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
const G4int n
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:596
const G4LorentzVector & Get4Momentum() const
static const double kelvin
Definition: G4SIunits.hh:278
static const double eV
Definition: G4SIunits.hh:212
void SetEnergyChange(G4double anEnergy)
G4double total(Particle const *const p1, Particle const *const p2)
G4double get_linear_interpolated(G4double, std::pair< G4double, G4double >, std::pair< G4double, G4double >)
void AddUserThermalScatteringFile(G4String, G4String)
G4double energy(const ThreeVector &p, const G4double m)
void RegisterThermalScatteringInelasticFinalStates(std::map< G4int, std::map< G4double, std::vector< E_P_E_isoAng * > * > * > *val)
const G4double x[NPOINTSGL]
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
void RegisterThermalScatteringIncoherentFinalStates(std::map< G4int, std::map< G4double, std::vector< E_isoAng * > * > * > *val)
static const G4int LL[nN]
double D(double temp)
std::pair< G4double, G4double > find_LH(G4double, std::vector< G4double > *)
void SetMaxEnergy(const G4double anEnergy)
G4HadFinalState * ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
G4double GetTemperature() const
Definition: G4Material.hh:182
#define G4endl
Definition: G4ios.hh:61
const G4Material * GetMaterial() const
G4bool IsMasterThread()
Definition: G4Threading.cc:130
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
std::vector< G4Element * > G4ElementTable
double G4double
Definition: G4Types.hh:76
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
const G4String & GetName() const
Definition: G4Element.hh:127
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
#define DBL_MAX
Definition: templates.hh:83
std::map< std::pair< const G4Material *, const G4Element * >, G4int > dic
virtual const std::pair< G4double, G4double > GetFatalEnergyCheckLevels() const
void BuildPhysicsTable(const G4ParticleDefinition &)
void SetMomentumChange(const G4ThreeVector &aV)
std::vector< G4double > prob
void RegisterThermalScatteringCoherentFinalStates(std::map< G4int, std::map< G4double, std::vector< std::pair< G4double, G4double > * > * > * > *val)