Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ParticleHPThermalScatteringData Class Reference

#include <G4ParticleHPThermalScatteringData.hh>

Inheritance diagram for G4ParticleHPThermalScatteringData:
Collaboration diagram for G4ParticleHPThermalScatteringData:

Public Member Functions

 G4ParticleHPThermalScatteringData ()
 
 ~G4ParticleHPThermalScatteringData ()
 
G4bool IsIsoApplicable (const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *)
 
G4double GetIsoCrossSection (const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
 
G4bool IsApplicable (const G4DynamicParticle *, const G4Element *)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
G4double GetInelasticCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
G4double GetCoherentCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
G4double GetIncoherentCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
void BuildPhysicsTable (const G4ParticleDefinition &)
 
void DumpPhysicsTable (const G4ParticleDefinition &)
 
void AddUserThermalScatteringFile (G4String, G4String)
 
virtual void CrossSectionDescription (std::ostream &) const
 
- Public Member Functions inherited from G4VCrossSectionDataSet
 G4VCrossSectionDataSet (const G4String &nam="")
 
virtual ~G4VCrossSectionDataSet ()
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=0)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=0)
 
virtual G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy)
 
virtual G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int value)
 
G4double GetMinKinEnergy () const
 
void SetMinKinEnergy (G4double value)
 
G4double GetMaxKinEnergy () const
 
void SetMaxKinEnergy (G4double value)
 
const G4StringGetName () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VCrossSectionDataSet
void SetName (const G4String &)
 
- Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel
 

Detailed Description

Definition at line 61 of file G4ParticleHPThermalScatteringData.hh.

Constructor & Destructor Documentation

G4ParticleHPThermalScatteringData::G4ParticleHPThermalScatteringData ( )

Definition at line 56 of file G4ParticleHPThermalScatteringData.cc.

57 :G4VCrossSectionDataSet("NeutronHPThermalScatteringData")
58 ,coherent(NULL)
59 ,incoherent(NULL)
60 ,inelastic(NULL)
61 {
62 // Upper limit of neutron energy
63  emax = 4*eV;
64  SetMinKinEnergy( 0*MeV );
65  SetMaxKinEnergy( emax );
66 
67  ke_cache = 0.0;
68  xs_cache = 0.0;
69  element_cache = NULL;
70  material_cache = NULL;
71 
72  indexOfThermalElement.clear();
73 
75 }
G4VCrossSectionDataSet(const G4String &nam="")
void SetMinKinEnergy(G4double value)
static constexpr double eV
Definition: G4SIunits.hh:215
void SetMaxKinEnergy(G4double value)
static constexpr double MeV
Definition: G4SIunits.hh:214

Here is the call graph for this function:

G4ParticleHPThermalScatteringData::~G4ParticleHPThermalScatteringData ( )

Definition at line 77 of file G4ParticleHPThermalScatteringData.cc.

78 {
79 
80  clearCurrentXSData();
81 
82  delete names;
83 }

Member Function Documentation

void G4ParticleHPThermalScatteringData::AddUserThermalScatteringFile ( G4String  nameG4Element,
G4String  filename 
)

Definition at line 568 of file G4ParticleHPThermalScatteringData.cc.

569 {
570  names->AddThermalElement( nameG4Element , filename );
571 }

Here is the call graph for this function:

Here is the caller graph for this function:

void G4ParticleHPThermalScatteringData::BuildPhysicsTable ( const G4ParticleDefinition aP)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 215 of file G4ParticleHPThermalScatteringData.cc.

216 {
217 
218  if ( &aP != G4Neutron::Neutron() )
219  throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
220 
221  //std::map < std::pair < G4Material* , const G4Element* > , G4int > dic;
222  //
223  dic.clear();
224  if ( G4Threading::IsMasterThread() ) clearCurrentXSData();
225 
226  std::map < G4String , G4int > co_dic;
227 
228  //Searching Nist Materials
229  static G4ThreadLocal G4MaterialTable* theMaterialTable = 0 ; if (!theMaterialTable) theMaterialTable= G4Material::GetMaterialTable();
230  size_t numberOfMaterials = G4Material::GetNumberOfMaterials();
231  for ( size_t i = 0 ; i < numberOfMaterials ; i++ )
232  {
233  G4Material* material = (*theMaterialTable)[i];
234  size_t numberOfElements = material->GetNumberOfElements();
235  for ( size_t j = 0 ; j < numberOfElements ; j++ )
236  {
237  const G4Element* element = material->GetElement(j);
238  if ( names->IsThisThermalElement ( material->GetName() , element->GetName() ) )
239  {
240  G4int ts_ID_of_this_geometry;
241  G4String ts_ndl_name = names->GetTS_NDL_Name( material->GetName() , element->GetName() );
242  if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
243  {
244  ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
245  }
246  else
247  {
248  ts_ID_of_this_geometry = co_dic.size();
249  co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
250  }
251 
252  //G4cout << "Neutron HP Thermal Scattering Data : Registering a material-element pair of "
253  // << material->GetName() << " " << element->GetName()
254  // << " as internal thermal scattering id of " << ts_ID_of_this_geometry << "." << G4endl;
255 
256  dic.insert( std::pair < std::pair < G4Material* , const G4Element* > , G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
257  }
258  }
259  }
260 
261  //Searching TS Elements
262  static G4ThreadLocal G4ElementTable* theElementTable = 0 ; if (!theElementTable) theElementTable= G4Element::GetElementTable();
263  size_t numberOfElements = G4Element::GetNumberOfElements();
264  //size_t numberOfThermalElements = 0;
265  for ( size_t i = 0 ; i < numberOfElements ; i++ )
266  {
267  const G4Element* element = (*theElementTable)[i];
268  if ( names->IsThisThermalElement ( element->GetName() ) )
269  {
270  if ( names->IsThisThermalElement ( element->GetName() ) )
271  {
272  G4int ts_ID_of_this_geometry;
273  G4String ts_ndl_name = names->GetTS_NDL_Name( element->GetName() );
274  if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
275  {
276  ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
277  }
278  else
279  {
280  ts_ID_of_this_geometry = co_dic.size();
281  co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
282  }
283 
284  //G4cout << "Neutron HP Thermal Scattering: Registering an element of "
285  // << material->GetName() << " " << element->GetName()
286  // << " as internal thermal scattering id of " << ts_ID_of_this_geometry << "." << G4endl;
287 
288  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 ) );
289  }
290  }
291  }
292 
293  G4cout << G4endl;
294  G4cout << "Neutron HP Thermal Scattering Data: Following material-element pairs and/or elements are registered." << G4endl;
295  for ( std::map < std::pair < const G4Material* , const G4Element* > , G4int >::iterator it = dic.begin() ; it != dic.end() ; it++ )
296  {
297  if ( it->first.first != NULL )
298  {
299  G4cout << "Material " << it->first.first->GetName() << " - Element " << it->first.second->GetName() << ", internal thermal scattering id " << it->second << G4endl;
300  }
301  else
302  {
303  G4cout << "Element " << it->first.second->GetName() << ", internal thermal scattering id " << it->second << G4endl;
304  }
305  }
306  G4cout << G4endl;
307 
308 
309  //G4cout << "Neutron HP Thermal Scattering Data: Following NDL thermal scattering files are assigned to the internal thermal scattering id." << G4endl;
310  //for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
311  //{
312  // G4cout << "NDL file name " << it->first << ", internal thermal scattering id " << it->second << G4endl;
313  //}
314 
316 
317  coherent = hpmanager->GetThermalScatteringCoherentCrossSections();
318  incoherent = hpmanager->GetThermalScatteringIncoherentCrossSections();
319  inelastic = hpmanager->GetThermalScatteringInelasticCrossSections();
320 
321  if ( G4Threading::IsMasterThread() ) {
322 
323  if ( coherent == NULL ) coherent = new std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >;
324  if ( incoherent == NULL ) incoherent = new std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >;
325  if ( inelastic == NULL ) inelastic = new std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >;
326 
327 
328  // Read Cross Section Data files
329 
330  G4String dirName;
331  if ( !getenv( "G4NEUTRONHPDATA" ) )
332  throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
333  G4String baseName = getenv( "G4NEUTRONHPDATA" );
334 
335  dirName = baseName + "/ThermalScattering";
336 
337  G4String ndl_filename;
338  G4String full_name;
339 
340  for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
341  {
342 
343  ndl_filename = it->first;
344  G4int ts_ID = it->second;
345 
346  // Coherent
347  full_name = dirName + "/Coherent/CrossSection/" + ndl_filename;
348  std::map< G4double , G4ParticleHPVector* >* coh_amapTemp_EnergyCross = readData( full_name );
349  coherent->insert ( std::pair < G4int , std::map< G4double , G4ParticleHPVector* >* > ( ts_ID , coh_amapTemp_EnergyCross ) );
350 
351  // Incoherent
352  full_name = dirName + "/Incoherent/CrossSection/" + ndl_filename;
353  std::map< G4double , G4ParticleHPVector* >* incoh_amapTemp_EnergyCross = readData( full_name );
354  incoherent->insert ( std::pair < G4int , std::map< G4double , G4ParticleHPVector* >* > ( ts_ID , incoh_amapTemp_EnergyCross ) );
355 
356  // Inelastic
357  full_name = dirName + "/Inelastic/CrossSection/" + ndl_filename;
358  std::map< G4double , G4ParticleHPVector* >* inela_amapTemp_EnergyCross = readData( full_name );
359  inelastic->insert ( std::pair < G4int , std::map< G4double , G4ParticleHPVector* >* > ( ts_ID , inela_amapTemp_EnergyCross ) );
360 
361  }
362  hpmanager->RegisterThermalScatteringCoherentCrossSections( coherent );
363  hpmanager->RegisterThermalScatteringIncoherentCrossSections( incoherent );
364  hpmanager->RegisterThermalScatteringInelasticCrossSections( inelastic );
365  }
366 }
static G4ParticleHPManager * GetInstance()
void RegisterThermalScatteringIncoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
G4int first(char) const
const G4String & GetName() const
Definition: G4Material.hh:178
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:587
std::vector< G4Material * > G4MaterialTable
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
static constexpr double second
Definition: G4SIunits.hh:157
#define G4ThreadLocal
Definition: tls.hh:89
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:202
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
Definition: G4Element.cc:405
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringIncoherentCrossSections()
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:594
#define G4endl
Definition: G4ios.hh:61
G4bool IsMasterThread()
Definition: G4Threading.cc:146
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
std::vector< G4Element * > G4ElementTable
void RegisterThermalScatteringCoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
const G4String & GetName() const
Definition: G4Element.hh:127
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:398
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringInelasticCrossSections()
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringCoherentCrossSections()

Here is the call graph for this function:

void G4ParticleHPThermalScatteringData::CrossSectionDescription ( std::ostream &  outFile) const
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 572 of file G4ParticleHPThermalScatteringData.cc.

573 {
574  outFile << "High Precision cross data based on thermal scattering data in evaluated nuclear data libraries for neutrons below 5eV on specific materials\n" ;
575 }
void G4ParticleHPThermalScatteringData::DumpPhysicsTable ( const G4ParticleDefinition aP)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 401 of file G4ParticleHPThermalScatteringData.cc.

402 {
403  if( &aP != G4Neutron::Neutron() )
404  throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
405 // G4cout << "G4ParticleHPThermalScatteringData::DumpPhysicsTable still to be implemented"<<G4endl;
406 }
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104

Here is the call graph for this function:

G4double G4ParticleHPThermalScatteringData::GetCoherentCrossSection ( const G4DynamicParticle aP,
const G4Element anE,
const G4Material aM 
)

Definition at line 481 of file G4ParticleHPThermalScatteringData.cc.

482 {
483  G4double result = 0;
484  G4int ts_id = getTS_ID( aM , anE );
485  G4double aT = aM->GetTemperature();
486  result = GetX ( aP , aT , coherent->find( ts_id )->second );
487  return result;
488 }
G4double G4ParticleHPJENDLHEData::G4double result
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4ParticleHPThermalScatteringData::GetCrossSection ( const G4DynamicParticle aP,
const G4Element anE,
const G4Material aM 
)

Definition at line 450 of file G4ParticleHPThermalScatteringData.cc.

451 {
452  G4double result = 0;
453 
454  G4int ts_id =getTS_ID( aM , anE );
455 
456  if ( ts_id == -1 ) return result;
457 
458  G4double aT = aM->GetTemperature();
459 
460  G4double Xcoh = GetX ( aP , aT , coherent->find(ts_id)->second );
461  G4double Xincoh = GetX ( aP , aT , incoherent->find(ts_id)->second );
462  G4double Xinela = GetX ( aP , aT , inelastic->find(ts_id)->second );
463 
464  result = Xcoh + Xincoh + Xinela;
465 
466  //G4cout << "G4ParticleHPThermalScatteringData::GetCrossSection Tot= " << result/barn << " Coherent= " << Xcoh/barn << " Incoherent= " << Xincoh/barn << " Inelastic= " << Xinela/barn << G4endl;
467 
468  return result;
469 }
G4double G4ParticleHPJENDLHEData::G4double result
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4ParticleHPThermalScatteringData::GetIncoherentCrossSection ( const G4DynamicParticle aP,
const G4Element anE,
const G4Material aM 
)

Definition at line 490 of file G4ParticleHPThermalScatteringData.cc.

491 {
492  G4double result = 0;
493  G4int ts_id = getTS_ID( aM , anE );
494  G4double aT = aM->GetTemperature();
495  result = GetX ( aP , aT , incoherent->find( ts_id )->second );
496  return result;
497 }
G4double G4ParticleHPJENDLHEData::G4double result
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4double G4ParticleHPThermalScatteringData::GetInelasticCrossSection ( const G4DynamicParticle aP,
const G4Element anE,
const G4Material aM 
)

Definition at line 472 of file G4ParticleHPThermalScatteringData.cc.

473 {
474  G4double result = 0;
475  G4int ts_id = getTS_ID( aM , anE );
476  G4double aT = aM->GetTemperature();
477  result = GetX ( aP , aT , inelastic->find( ts_id )->second );
478  return result;
479 }
G4double G4ParticleHPJENDLHEData::G4double result
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

Here is the caller graph for this function:

G4double G4ParticleHPThermalScatteringData::GetIsoCrossSection ( const G4DynamicParticle dp,
G4int  ,
G4int  ,
const G4Isotope ,
const G4Element element,
const G4Material material 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 110 of file G4ParticleHPThermalScatteringData.cc.

115 {
116  //if ( dp->GetKineticEnergy() == ke_cache && element == element_cache && material == material_cache ) return xs_cache;
117 
118  ke_cache = dp->GetKineticEnergy();
119  element_cache = element;
120  material_cache = material;
121  //G4double xs = GetCrossSection( dp , element , material->GetTemperature() );
122  G4double xs = GetCrossSection( dp , element , material );
123  xs_cache = xs;
124  return xs;
125  //return GetCrossSection( dp , element , material->GetTemperature() );
126 }
G4double GetKineticEnergy() const
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4bool G4ParticleHPThermalScatteringData::IsApplicable ( const G4DynamicParticle aP,
const G4Element anEle 
)

Definition at line 182 of file G4ParticleHPThermalScatteringData.cc.

183 {
184  G4bool result = false;
185 
186  G4double eKin = aP->GetKineticEnergy();
187  // Check energy
188  if ( eKin < emax )
189  {
190  // Check Particle Species
191  if ( aP->GetDefinition() == G4Neutron::Neutron() )
192  {
193  // anEle is one of Thermal elements
194  G4int ie = (G4int) anEle->GetIndex();
195  std::vector < G4int >::iterator it;
196  for ( it = indexOfThermalElement.begin() ; it != indexOfThermalElement.end() ; it++ )
197  {
198  if ( ie == *it ) return true;
199  }
200  }
201  }
202 
203 /*
204  if ( names->IsThisThermalElement ( anEle->GetName() ) )
205  {
206  // Check energy and projectile species
207  G4double eKin = aP->GetKineticEnergy();
208  if ( eKin < emax && aP->GetDefinition() == G4Neutron::Neutron() ) result = true;
209  }
210 */
211  return result;
212 }
G4double G4ParticleHPJENDLHEData::G4double result
G4double GetKineticEnergy() const
G4ParticleDefinition * GetDefinition() const
int G4int
Definition: G4Types.hh:78
bool G4bool
Definition: G4Types.hh:79
size_t GetIndex() const
Definition: G4Element.hh:182
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:

G4bool G4ParticleHPThermalScatteringData::IsIsoApplicable ( const G4DynamicParticle dp,
G4int  ,
G4int  ,
const G4Element element,
const G4Material material 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 85 of file G4ParticleHPThermalScatteringData.cc.

89 {
90  G4double eKin = dp->GetKineticEnergy();
91  if ( eKin > 4.0*eV //GetMaxKinEnergy()
92  || eKin < 0 //GetMinKinEnergy()
93  || dp->GetDefinition() != G4Neutron::Neutron() ) return false;
94 
95  if ( dic.find( std::pair < const G4Material* , const G4Element* > ( (G4Material*)NULL , element ) ) != dic.end()
96  || dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) != dic.end() ) return true;
97 
98  return false;
99 
100 // return IsApplicable( dp , element );
101 /*
102  G4double eKin = dp->GetKineticEnergy();
103  if ( eKin > 4.0*eV //GetMaxKinEnergy()
104  || eKin < 0 //GetMinKinEnergy()
105  || dp->GetDefinition() != G4Neutron::Neutron() ) return false;
106  return true;
107 */
108 }
G4double GetKineticEnergy() const
G4ParticleDefinition * GetDefinition() const
static constexpr double eV
Definition: G4SIunits.hh:215
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
double G4double
Definition: G4Types.hh:76

Here is the call graph for this function:


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