Geant4  10.02.p03
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
 

Private Member Functions

G4double GetX (const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
 
void clearCurrentXSData ()
 
std::map< G4double, G4ParticleHPVector *> * readData (G4String)
 
G4int getTS_ID (const G4Material *, const G4Element *)
 

Private Attributes

G4double emax
 
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * coherent
 
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * incoherent
 
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * inelastic
 
std::vector< G4intindexOfThermalElement
 
G4ParticleHPThermalScatteringNamesnames
 
G4double ke_cache
 
G4double xs_cache
 
const G4Elementelement_cache
 
const G4Materialmaterial_cache
 
std::map< std::pair< const G4Material *, const G4Element *>, G4intdic
 

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::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 );
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 }
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * coherent
static const double MeV
Definition: G4SIunits.hh:211
G4VCrossSectionDataSet(const G4String &nam="")
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * inelastic
void SetMinKinEnergy(G4double value)
static const double eV
Definition: G4SIunits.hh:212
void SetMaxKinEnergy(G4double value)
G4ParticleHPThermalScatteringNames * names
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * incoherent
Here is the call graph for this function:

◆ ~G4ParticleHPThermalScatteringData()

G4ParticleHPThermalScatteringData::~G4ParticleHPThermalScatteringData ( )

Definition at line 77 of file G4ParticleHPThermalScatteringData.cc.

78 {
79 
81 
82  delete names;
83 }
G4ParticleHPThermalScatteringNames * names
Here is the call graph for this function:

Member Function Documentation

◆ AddUserThermalScatteringFile()

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

Definition at line 563 of file G4ParticleHPThermalScatteringData.cc.

564 {
565  names->AddThermalElement( nameG4Element , filename );
566 }
G4ParticleHPThermalScatteringNames * names
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildPhysicsTable()

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();
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 
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  }
365  }
366 }
static G4ParticleHPManager * GetInstance()
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * coherent
G4int first(char) const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:589
std::vector< G4Material * > G4MaterialTable
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
void RegisterThermalScatteringCoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> *val)
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * inelastic
string material
Definition: eplot.py:19
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
Definition: G4Element.cc:402
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringIncoherentCrossSections()
std::map< G4double, G4ParticleHPVector *> * readData(G4String)
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:202
static const double second
Definition: G4SIunits.hh:156
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:596
const G4String & GetName() const
Definition: G4Element.hh:127
size_t GetNumberOfElements() const
Definition: G4Material.hh:186
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> *val)
std::map< std::pair< const G4Material *, const G4Element *>, G4int > dic
#define G4endl
Definition: G4ios.hh:61
G4bool IsMasterThread()
Definition: G4Threading.cc:136
std::vector< G4Element * > G4ElementTable
G4ParticleHPThermalScatteringNames * names
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
const G4String & GetName() const
Definition: G4Material.hh:178
void RegisterThermalScatteringIncoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> *val)
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * incoherent
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringInelasticCrossSections()
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringCoherentCrossSections()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCurrentXSData()

void G4ParticleHPThermalScatteringData::clearCurrentXSData ( )
private

Definition at line 128 of file G4ParticleHPThermalScatteringData.cc.

129 {
130  std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >::iterator it;
131  std::map< G4double , G4ParticleHPVector* >::iterator itt;
132 
133  if ( coherent != NULL ) {
134  for ( it = coherent->begin() ; it != coherent->end() ; it++ )
135  {
136  if ( it->second != NULL )
137  {
138  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
139  {
140  delete itt->second;
141  }
142  }
143  delete it->second;
144  }
145  coherent->clear();
146  }
147 
148  if ( incoherent != NULL ) {
149  for ( it = incoherent->begin() ; it != incoherent->end() ; it++ )
150  {
151  if ( it->second != NULL )
152  {
153  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
154  {
155  delete itt->second;
156  }
157  }
158  delete it->second;
159  }
160  incoherent->clear();
161  }
162 
163  if ( inelastic != NULL ) {
164  for ( it = inelastic->begin() ; it != inelastic->end() ; it++ )
165  {
166  if ( it->second != NULL )
167  {
168  for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
169  {
170  delete itt->second;
171  }
172  }
173  delete it->second;
174  }
175  inelastic->clear();
176  }
177 
178 }
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * coherent
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * inelastic
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * incoherent
Here is the caller graph for this function:

◆ CrossSectionDescription()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 567 of file G4ParticleHPThermalScatteringData.cc.

568 {
569  outFile << "High Precision cross data based on thermal scattering data in evaluated nuclear data libraries for neutrons below 5eV on specific materials\n" ;
570 }

◆ DumpPhysicsTable()

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:

◆ GetCoherentCrossSection()

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 }
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * coherent
int G4int
Definition: G4Types.hh:78
G4int getTS_ID(const G4Material *, const G4Element *)
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetCrossSection()

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 }
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * coherent
int G4int
Definition: G4Types.hh:78
G4int getTS_ID(const G4Material *, const G4Element *)
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * inelastic
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * incoherent
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIncoherentCrossSection()

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 }
int G4int
Definition: G4Types.hh:78
G4int getTS_ID(const G4Material *, const G4Element *)
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * incoherent
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
Here is the call graph for this function:

◆ GetInelasticCrossSection()

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 }
int G4int
Definition: G4Types.hh:78
G4int getTS_ID(const G4Material *, const G4Element *)
std::map< G4int, std::map< G4double, G4ParticleHPVector *> *> * inelastic
G4double GetTemperature() const
Definition: G4Material.hh:182
double G4double
Definition: G4Types.hh:76
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetIsoCrossSection()

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;
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 }
string material
Definition: eplot.py:19
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:

◆ getTS_ID()

G4int G4ParticleHPThermalScatteringData::getTS_ID ( const G4Material material,
const G4Element element 
)
private

Definition at line 501 of file G4ParticleHPThermalScatteringData.cc.

502 {
503  G4int result = -1;
504  if ( dic.find( std::pair < const G4Material* , const G4Element* > ( (G4Material*)NULL , element ) ) != dic.end() )
505  return dic.find( std::pair < const G4Material* , const G4Element* > ( (G4Material*)NULL , element ) )->second;
506  if ( dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) != dic.end() )
507  return dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) )->second;
508  return result;
509 }
int G4int
Definition: G4Types.hh:78
std::map< std::pair< const G4Material *, const G4Element *>, G4int > dic
Here is the caller graph for this function:

◆ GetX()

G4double G4ParticleHPThermalScatteringData::GetX ( const G4DynamicParticle aP,
G4double  aT,
std::map< G4double, G4ParticleHPVector * > *  amapTemp_EnergyCross 
)
private

Definition at line 514 of file G4ParticleHPThermalScatteringData.cc.

515 {
516 
517  G4double result = 0;
518  if ( amapTemp_EnergyCross->size() == 0 ) return result;
519 
520 
521  G4double eKinetic = aP->GetKineticEnergy();
522 
523  if ( amapTemp_EnergyCross->size() == 1 ) {
524  if ( std::fabs ( aT - amapTemp_EnergyCross->begin()->first ) / amapTemp_EnergyCross->begin()->first > 0.1 ) {
525  G4cout << "G4ParticleHPThermalScatteringData:: The temperature of material ("
526  << aT/kelvin << "K) is different more than 10% from temperature of thermal scattering file expected ("
527  << amapTemp_EnergyCross->begin()->first << "K). Result may not be reliable."
528  << G4endl;
529  }
530  result = amapTemp_EnergyCross->begin()->second->GetXsec ( eKinetic );
531  return result;
532  }
533 
534  std::map< G4double , G4ParticleHPVector* >::iterator it;
535  for ( it = amapTemp_EnergyCross->begin() ; it != amapTemp_EnergyCross->end() ; it++ ) {
536  if ( aT < it->first ) break;
537  }
538  if ( it == amapTemp_EnergyCross->begin() && it != amapTemp_EnergyCross->end() ) it++; // lower than the first
539  if ( it != amapTemp_EnergyCross->begin() && it == amapTemp_EnergyCross->end() ) it--; // upper than the last
540 
541  G4double TH = it->first;
542  G4double XH = it->second->GetXsec ( eKinetic );
543 
544  //G4cout << "G4ParticleHPThermalScatteringData::GetX TH " << TH << " E " << eKinetic << " XH " << XH << G4endl;
545 
546  if ( it != amapTemp_EnergyCross->begin() ) it--;
547  G4double TL = it->first;
548  G4double XL = it->second->GetXsec ( eKinetic );
549 
550  //G4cout << "G4ParticleHPThermalScatteringData::GetX TL " << TL << " E " << eKinetic << " XL " << XL << G4endl;
551 
552  if ( TH == TL )
553  throw G4HadronicException(__FILE__, __LINE__, "Thermal Scattering Data Error!");
554 
555  G4double T = aT;
556  G4double X = ( XH - XL ) / ( TH - TL ) * ( T - TL ) + XL;
557  result = X;
558 
559  return result;
560 }
Float_t X
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
static const double kelvin
Definition: G4SIunits.hh:278
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsApplicable()

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 }
size_t GetIndex() const
Definition: G4Element.hh:181
int G4int
Definition: G4Types.hh:78
G4double GetKineticEnergy() const
bool G4bool
Definition: G4Types.hh:79
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
G4ParticleDefinition * GetDefinition() const
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ IsIsoApplicable()

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
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
static const double eV
Definition: G4SIunits.hh:212
std::map< std::pair< const G4Material *, const G4Element *>, G4int > dic
G4ParticleDefinition * GetDefinition() const
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:

◆ readData()

std::map< G4double, G4ParticleHPVector *> * G4ParticleHPThermalScatteringData::readData ( G4String  full_name)
private

Definition at line 370 of file G4ParticleHPThermalScatteringData.cc.

371 {
372 
373  std::map< G4double , G4ParticleHPVector* >* aData = new std::map< G4double , G4ParticleHPVector* >;
374 
375  //std::ifstream theChannel( full_name.c_str() );
376  std::istringstream theChannel;
377  G4ParticleHPManager::GetInstance()->GetDataStream(full_name,theChannel);
378 
379  //G4cout << "G4ParticleHPThermalScatteringData " << name << G4endl;
380 
381  G4int dummy;
382  while ( theChannel >> dummy ) // MF // Loop checking, 11.05.2015, T. Koi
383  {
384  theChannel >> dummy; // MT
385  G4double temp;
386  theChannel >> temp;
387  G4ParticleHPVector* anEnergyCross = new G4ParticleHPVector;
388  G4int nData;
389  theChannel >> nData;
390  anEnergyCross->Init ( theChannel , nData , eV , barn );
391  aData->insert ( std::pair < G4double , G4ParticleHPVector* > ( temp , anEnergyCross ) );
392  }
393  //theChannel.close();
394 
395  return aData;
396 
397 }
static G4ParticleHPManager * GetInstance()
void GetDataStream(G4String, std::istringstream &iss)
int G4int
Definition: G4Types.hh:78
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
static const double eV
Definition: G4SIunits.hh:212
static const double barn
Definition: G4SIunits.hh:104
double G4double
Definition: G4Types.hh:76
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ coherent

std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >* G4ParticleHPThermalScatteringData::coherent
private

Definition at line 110 of file G4ParticleHPThermalScatteringData.hh.

◆ dic

std::map< std::pair < const G4Material* , const G4Element* > , G4int > G4ParticleHPThermalScatteringData::dic
private

Definition at line 126 of file G4ParticleHPThermalScatteringData.hh.

◆ element_cache

const G4Element* G4ParticleHPThermalScatteringData::element_cache
private

Definition at line 123 of file G4ParticleHPThermalScatteringData.hh.

◆ emax

G4double G4ParticleHPThermalScatteringData::emax
private

Definition at line 105 of file G4ParticleHPThermalScatteringData.hh.

◆ incoherent

std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >* G4ParticleHPThermalScatteringData::incoherent
private

Definition at line 111 of file G4ParticleHPThermalScatteringData.hh.

◆ indexOfThermalElement

std::vector< G4int > G4ParticleHPThermalScatteringData::indexOfThermalElement
private

Definition at line 116 of file G4ParticleHPThermalScatteringData.hh.

◆ inelastic

std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >* G4ParticleHPThermalScatteringData::inelastic
private

Definition at line 112 of file G4ParticleHPThermalScatteringData.hh.

◆ ke_cache

G4double G4ParticleHPThermalScatteringData::ke_cache
private

Definition at line 121 of file G4ParticleHPThermalScatteringData.hh.

◆ material_cache

const G4Material* G4ParticleHPThermalScatteringData::material_cache
private

Definition at line 124 of file G4ParticleHPThermalScatteringData.hh.

◆ names

G4ParticleHPThermalScatteringNames* G4ParticleHPThermalScatteringData::names
private

Definition at line 117 of file G4ParticleHPThermalScatteringData.hh.

◆ xs_cache

G4double G4ParticleHPThermalScatteringData::xs_cache
private

Definition at line 122 of file G4ParticleHPThermalScatteringData.hh.


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