Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4NeutronHPThermalScatteringData Class Reference

#include <G4NeutronHPThermalScatteringData.hh>

Inheritance diagram for G4NeutronHPThermalScatteringData:
G4VCrossSectionDataSet

Public Member Functions

 G4NeutronHPThermalScatteringData ()
 
 ~G4NeutronHPThermalScatteringData ()
 
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)
 
- 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 G4Isotope * SelectIsotope (const G4Element *, G4double kinEnergy)
 
virtual void CrossSectionDescription (std::ostream &) const
 
virtual G4int GetVerboseLevel () const
 
virtual void SetVerboseLevel (G4int value)
 
G4double GetMinKinEnergy () const
 
void SetMinKinEnergy (G4double value)
 
G4double GetMaxKinEnergy () const
 
void SetMaxKinEnergy (G4double value)
 
const G4String & GetName () 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 58 of file G4NeutronHPThermalScatteringData.hh.

Constructor & Destructor Documentation

G4NeutronHPThermalScatteringData::G4NeutronHPThermalScatteringData ( )

Definition at line 53 of file G4NeutronHPThermalScatteringData.cc.

References python.hepunit::eV, python.hepunit::MeV, G4VCrossSectionDataSet::SetMaxKinEnergy(), and G4VCrossSectionDataSet::SetMinKinEnergy().

54 :G4VCrossSectionDataSet("NeutronHPThermalScatteringData")
55 {
56 // Upper limit of neutron energy
57  emax = 4*eV;
58  SetMinKinEnergy( 0*MeV );
59  SetMaxKinEnergy( emax );
60 
61  ke_cache = 0.0;
62  xs_cache = 0.0;
63  element_cache = NULL;
64  material_cache = NULL;
65 
66  indexOfThermalElement.clear();
67 
69 
70  //BuildPhysicsTable( *G4Neutron::Neutron() );
71 }
G4VCrossSectionDataSet(const G4String &nam="")
void SetMinKinEnergy(G4double value)
void SetMaxKinEnergy(G4double value)
G4NeutronHPThermalScatteringData::~G4NeutronHPThermalScatteringData ( )

Definition at line 73 of file G4NeutronHPThermalScatteringData.cc.

74 {
75 
76  clearCurrentXSData();
77 
78  delete names;
79 }

Member Function Documentation

void G4NeutronHPThermalScatteringData::AddUserThermalScatteringFile ( G4String  nameG4Element,
G4String  filename 
)
void G4NeutronHPThermalScatteringData::BuildPhysicsTable ( const G4ParticleDefinition &  aP)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 206 of file G4NeutronHPThermalScatteringData.cc.

References G4String::first(), G4cout, G4endl, G4ThreadLocal, G4Material::GetElement(), G4Element::GetElementTable(), G4Material::GetMaterialTable(), G4Element::GetName(), G4Material::GetName(), G4Element::GetNumberOfElements(), G4Material::GetNumberOfElements(), G4Material::GetNumberOfMaterials(), G4NeutronHPThermalScatteringNames::GetTS_NDL_Name(), G4NeutronHPThermalScatteringNames::IsThisThermalElement(), eplot::material, G4Neutron::Neutron(), and python.hepunit::second.

Referenced by G4NeutronHPThermalScattering::ApplyYourself(), and G4NeutronHPThermalScattering::G4NeutronHPThermalScattering().

207 {
208 
209  if ( &aP != G4Neutron::Neutron() )
210  throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
211 
212  //std::map < std::pair < G4Material* , const G4Element* > , G4int > dic;
213  dic.clear();
214  clearCurrentXSData();
215  std::map < G4String , G4int > co_dic;
216 
217  //Searching Nist Materials
218  static G4ThreadLocal G4MaterialTable* theMaterialTable = 0 ; if (!theMaterialTable) theMaterialTable= G4Material::GetMaterialTable();
219  size_t numberOfMaterials = G4Material::GetNumberOfMaterials();
220  for ( size_t i = 0 ; i < numberOfMaterials ; i++ )
221  {
222  G4Material* material = (*theMaterialTable)[i];
223  size_t numberOfElements = material->GetNumberOfElements();
224  for ( size_t j = 0 ; j < numberOfElements ; j++ )
225  {
226  const G4Element* element = material->GetElement(j);
227  if ( names->IsThisThermalElement ( material->GetName() , element->GetName() ) )
228  {
229  G4int ts_ID_of_this_geometry;
230  G4String ts_ndl_name = names->GetTS_NDL_Name( material->GetName() , element->GetName() );
231  if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
232  {
233  ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
234  }
235  else
236  {
237  ts_ID_of_this_geometry = co_dic.size();
238  co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
239  }
240 
241  //G4cout << "Neutron HP Thermal Scattering Data : Registering a material-element pair of "
242  // << material->GetName() << " " << element->GetName()
243  // << " as internal thermal scattering id of " << ts_ID_of_this_geometry << "." << G4endl;
244 
245  dic.insert( std::pair < std::pair < G4Material* , const G4Element* > , G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
246  }
247  }
248  }
249 
250  //Searching TS Elements
251  static G4ThreadLocal G4ElementTable* theElementTable = 0 ; if (!theElementTable) theElementTable= G4Element::GetElementTable();
252  size_t numberOfElements = G4Element::GetNumberOfElements();
253  //size_t numberOfThermalElements = 0;
254  for ( size_t i = 0 ; i < numberOfElements ; i++ )
255  {
256  const G4Element* element = (*theElementTable)[i];
257  if ( names->IsThisThermalElement ( element->GetName() ) )
258  {
259  if ( names->IsThisThermalElement ( element->GetName() ) )
260  {
261  G4int ts_ID_of_this_geometry;
262  G4String ts_ndl_name = names->GetTS_NDL_Name( element->GetName() );
263  if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
264  {
265  ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
266  }
267  else
268  {
269  ts_ID_of_this_geometry = co_dic.size();
270  co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
271  }
272 
273  //G4cout << "Neutron HP Thermal Scattering: Registering an element of "
274  // << material->GetName() << " " << element->GetName()
275  // << " as internal thermal scattering id of " << ts_ID_of_this_geometry << "." << G4endl;
276 
277  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 ) );
278  }
279  }
280  }
281 
282  G4cout << G4endl;
283  G4cout << "Neutron HP Thermal Scattering Data: Following material-element pairs and/or elements are registered." << G4endl;
284  for ( std::map < std::pair < const G4Material* , const G4Element* > , G4int >::iterator it = dic.begin() ; it != dic.end() ; it++ )
285  {
286  if ( it->first.first != NULL )
287  {
288  G4cout << "Material " << it->first.first->GetName() << " - Element " << it->first.second->GetName() << ", internal thermal scattering id " << it->second << G4endl;
289  }
290  else
291  {
292  G4cout << "Element " << it->first.second->GetName() << ", internal thermal scattering id " << it->second << G4endl;
293  }
294  }
295  G4cout << G4endl;
296 
297 
298  //G4cout << "Neutron HP Thermal Scattering Data: Following NDL thermal scattering files are assigned to the internal thermal scattering id." << G4endl;
299  //for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
300  //{
301  // G4cout << "NDL file name " << it->first << ", internal thermal scattering id " << it->second << G4endl;
302  //}
303 
304 
305  // Read Cross Section Data files
306 
307  G4String dirName;
308  if ( !getenv( "G4NEUTRONHPDATA" ) )
309  throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
310  G4String baseName = getenv( "G4NEUTRONHPDATA" );
311 
312  dirName = baseName + "/ThermalScattering";
313 
314  G4String ndl_filename;
315  G4String full_name;
316 
317  for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
318  {
319  ndl_filename = it->first;
320  G4int ts_ID = it->second;
321 
322  // Coherent
323  full_name = dirName + "/Coherent/CrossSection/" + ndl_filename;
324  std::map< G4double , G4NeutronHPVector* >* coh_amapTemp_EnergyCross = readData( full_name );
325  coherent.insert ( std::pair < G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , coh_amapTemp_EnergyCross ) );
326 
327  // Incoherent
328  full_name = dirName + "/Incoherent/CrossSection/" + ndl_filename;
329  std::map< G4double , G4NeutronHPVector* >* incoh_amapTemp_EnergyCross = readData( full_name );
330  incoherent.insert ( std::pair < G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , incoh_amapTemp_EnergyCross ) );
331 
332  // Inelastic
333  full_name = dirName + "/Inelastic/CrossSection/" + ndl_filename;
334  std::map< G4double , G4NeutronHPVector* >* inela_amapTemp_EnergyCross = readData( full_name );
335  inelastic.insert ( std::pair < G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , inela_amapTemp_EnergyCross ) );
336 
337  }
338 
339 }
G4int first(char) const
const G4String & GetName() const
Definition: G4Material.hh:176
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
std::vector< G4Material * > G4MaterialTable
#define G4ThreadLocal
Definition: tls.hh:52
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:200
int G4int
Definition: G4Types.hh:78
string material
Definition: eplot.py:19
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
Definition: G4Element.cc:402
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:571
G4String GetTS_NDL_Name(G4String nameG4Element)
#define G4endl
Definition: G4ios.hh:61
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
std::vector< G4Element * > G4ElementTable
const G4String & GetName() const
Definition: G4Element.hh:127
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
void G4NeutronHPThermalScatteringData::DumpPhysicsTable ( const G4ParticleDefinition &  aP)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 374 of file G4NeutronHPThermalScatteringData.cc.

References G4Neutron::Neutron().

375 {
376  if( &aP != G4Neutron::Neutron() )
377  throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");
378 // G4cout << "G4NeutronHPThermalScatteringData::DumpPhysicsTable still to be implemented"<<G4endl;
379 }
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4double G4NeutronHPThermalScatteringData::GetCoherentCrossSection ( const G4DynamicParticle *  aP,
const G4Element *  anE,
const G4Material *  aM 
)

Definition at line 454 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

Referenced by G4NeutronHPThermalScattering::ApplyYourself().

455 {
456  G4double result = 0;
457  G4int ts_id = getTS_ID( aM , anE );
458  G4double aT = aM->GetTemperature();
459  result = GetX ( aP , aT , coherent.find( ts_id )->second );
460  return result;
461 }
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:180
double G4double
Definition: G4Types.hh:76
G4double G4NeutronHPThermalScatteringData::GetCrossSection ( const G4DynamicParticle *  aP,
const G4Element *  anE,
const G4Material *  aM 
)

Definition at line 423 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

Referenced by G4NeutronHPThermalScattering::ApplyYourself(), and GetIsoCrossSection().

424 {
425  G4double result = 0;
426 
427  G4int ts_id =getTS_ID( aM , anE );
428 
429  if ( ts_id == -1 ) return result;
430 
431  G4double aT = aM->GetTemperature();
432 
433  G4double Xcoh = GetX ( aP , aT , coherent.find(ts_id)->second );
434  G4double Xincoh = GetX ( aP , aT , incoherent.find(ts_id)->second );
435  G4double Xinela = GetX ( aP , aT , inelastic.find(ts_id)->second );
436 
437  result = Xcoh + Xincoh + Xinela;
438 
439  //G4cout << "G4NeutronHPThermalScatteringData::GetCrossSection Tot= " << result/barn << " Coherent= " << Xcoh/barn << " Incoherent= " << Xincoh/barn << " Inelastic= " << Xinela/barn << G4endl;
440 
441  return result;
442 }
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:180
double G4double
Definition: G4Types.hh:76
G4double G4NeutronHPThermalScatteringData::GetIncoherentCrossSection ( const G4DynamicParticle *  aP,
const G4Element *  anE,
const G4Material *  aM 
)

Definition at line 463 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

464 {
465  G4double result = 0;
466  G4int ts_id = getTS_ID( aM , anE );
467  G4double aT = aM->GetTemperature();
468  result = GetX ( aP , aT , incoherent.find( ts_id )->second );
469  return result;
470 }
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:180
double G4double
Definition: G4Types.hh:76
G4double G4NeutronHPThermalScatteringData::GetInelasticCrossSection ( const G4DynamicParticle *  aP,
const G4Element *  anE,
const G4Material *  aM 
)

Definition at line 445 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

Referenced by G4NeutronHPThermalScattering::ApplyYourself().

446 {
447  G4double result = 0;
448  G4int ts_id = getTS_ID( aM , anE );
449  G4double aT = aM->GetTemperature();
450  result = GetX ( aP , aT , inelastic.find( ts_id )->second );
451  return result;
452 }
int G4int
Definition: G4Types.hh:78
G4double GetTemperature() const
Definition: G4Material.hh:180
double G4double
Definition: G4Types.hh:76
G4double G4NeutronHPThermalScatteringData::GetIsoCrossSection ( const G4DynamicParticle *  dp,
G4int  ,
G4int  ,
const G4Isotope *  ,
const G4Element *  element,
const G4Material *  material 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 106 of file G4NeutronHPThermalScatteringData.cc.

References GetCrossSection(), G4DynamicParticle::GetKineticEnergy(), and eplot::material.

111 {
112  if ( dp->GetKineticEnergy() == ke_cache && element == element_cache && material == material_cache ) return xs_cache;
113 
114  ke_cache = dp->GetKineticEnergy();
115  element_cache = element;
116  material_cache = material;
117  //G4double xs = GetCrossSection( dp , element , material->GetTemperature() );
118  G4double xs = GetCrossSection( dp , element , material );
119  xs_cache = xs;
120  return xs;
121  //return GetCrossSection( dp , element , material->GetTemperature() );
122 }
G4double GetKineticEnergy() const
string material
Definition: eplot.py:19
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
double G4double
Definition: G4Types.hh:76
G4bool G4NeutronHPThermalScatteringData::IsApplicable ( const G4DynamicParticle *  aP,
const G4Element *  anEle 
)

Definition at line 173 of file G4NeutronHPThermalScatteringData.cc.

References G4DynamicParticle::GetDefinition(), G4Element::GetIndex(), G4DynamicParticle::GetKineticEnergy(), and G4Neutron::Neutron().

174 {
175  G4bool result = false;
176 
177  G4double eKin = aP->GetKineticEnergy();
178  // Check energy
179  if ( eKin < emax )
180  {
181  // Check Particle Species
182  if ( aP->GetDefinition() == G4Neutron::Neutron() )
183  {
184  // anEle is one of Thermal elements
185  G4int ie = (G4int) anEle->GetIndex();
186  std::vector < G4int >::iterator it;
187  for ( it = indexOfThermalElement.begin() ; it != indexOfThermalElement.end() ; it++ )
188  {
189  if ( ie == *it ) return true;
190  }
191  }
192  }
193 
194 /*
195  if ( names->IsThisThermalElement ( anEle->GetName() ) )
196  {
197  // Check energy and projectile species
198  G4double eKin = aP->GetKineticEnergy();
199  if ( eKin < emax && aP->GetDefinition() == G4Neutron::Neutron() ) result = true;
200  }
201 */
202  return result;
203 }
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:181
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
double G4double
Definition: G4Types.hh:76
G4bool G4NeutronHPThermalScatteringData::IsIsoApplicable ( const G4DynamicParticle *  dp,
G4int  ,
G4int  ,
const G4Element *  element,
const G4Material *  material 
)
virtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 81 of file G4NeutronHPThermalScatteringData.cc.

References python.hepunit::eV, G4DynamicParticle::GetDefinition(), G4DynamicParticle::GetKineticEnergy(), and G4Neutron::Neutron().

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

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