Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPThermalScatteringData Class Reference

#include <G4ParticleHPThermalScatteringData.hh>

+ Inheritance 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=nullptr)
 
virtual G4bool IsIsoApplicable (const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
virtual G4double GetIsoCrossSection (const G4DynamicParticle *, G4int Z, G4int A, const G4Isotope *iso=nullptr, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
 
virtual const G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy, G4double logE)
 
virtual void BuildPhysicsTable (const G4ParticleDefinition &)
 
virtual void DumpPhysicsTable (const G4ParticleDefinition &)
 
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)
 
bool ForAllAtomsAndEnergies () const
 
void SetForAllAtomsAndEnergies (G4bool val)
 
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::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}
void SetMaxKinEnergy(G4double value)
void SetMinKinEnergy(G4double value)

◆ ~G4ParticleHPThermalScatteringData()

G4ParticleHPThermalScatteringData::~G4ParticleHPThermalScatteringData ( )

Definition at line 77 of file G4ParticleHPThermalScatteringData.cc.

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

Member Function Documentation

◆ AddUserThermalScatteringFile()

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

Definition at line 568 of file G4ParticleHPThermalScatteringData.cc.

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

Referenced by G4ParticleHPThermalScattering::AddUserThermalScatteringFile().

◆ 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();
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
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 ( !std::getenv( "G4NEUTRONHPDATA" ) )
332 throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
333 G4String baseName = std::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}
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:397
static size_t GetNumberOfElements()
Definition: G4Element.cc:404
const G4String & GetName() const
Definition: G4Element.hh:126
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:644
const G4Element * GetElement(G4int iel) const
Definition: G4Material.hh:200
size_t GetNumberOfElements() const
Definition: G4Material.hh:184
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:637
const G4String & GetName() const
Definition: G4Material.hh:175
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
void RegisterThermalScatteringIncoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringCoherentCrossSections()
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringInelasticCrossSections()
void RegisterThermalScatteringCoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringIncoherentCrossSections()
static G4ParticleHPManager * GetInstance()
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
std::size_t first(char) const
G4bool IsMasterThread()
Definition: G4Threading.cc:124
#define G4ThreadLocal
Definition: tls.hh:77

◆ CrossSectionDescription()

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}

◆ 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}

◆ 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}
double G4double
Definition: G4Types.hh:83
G4double GetTemperature() const
Definition: G4Material.hh:180

Referenced by G4ParticleHPThermalScattering::ApplyYourself().

◆ 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}

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

◆ 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}

◆ 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}

Referenced by G4ParticleHPThermalScattering::ApplyYourself().

◆ 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;
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 *)

◆ 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}
bool G4bool
Definition: G4Types.hh:86
G4ParticleDefinition * GetDefinition() const
size_t GetIndex() const
Definition: G4Element.hh:181

◆ 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}

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