Geant4 11.2.2
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 () override
 
G4bool IsIsoApplicable (const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *) override
 
G4double GetIsoCrossSection (const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *) override
 
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 &) override
 
void DumpPhysicsTable (const G4ParticleDefinition &) override
 
void AddUserThermalScatteringFile (G4String, G4String)
 
void CrossSectionDescription (std::ostream &) const override
 
- Public Member Functions inherited from G4VCrossSectionDataSet
 G4VCrossSectionDataSet (const G4String &nam="")
 
virtual ~G4VCrossSectionDataSet ()
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, 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 ComputeCrossSectionPerElement (G4double kinEnergy, G4double loge, const G4ParticleDefinition *, const G4Element *, const G4Material *mat=nullptr)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
virtual G4double ComputeIsoCrossSection (G4double kinEnergy, G4double loge, const G4ParticleDefinition *, 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 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
 
void SetName (const G4String &nam)
 
G4VCrossSectionDataSetoperator= (const G4VCrossSectionDataSet &right)=delete
 
 G4VCrossSectionDataSet (const G4VCrossSectionDataSet &)=delete
 

Additional Inherited Members

- Protected Attributes inherited from G4VCrossSectionDataSet
G4int verboseLevel
 
G4String name
 

Detailed Description

Definition at line 61 of file G4ParticleHPThermalScatteringData.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPThermalScatteringData()

G4ParticleHPThermalScatteringData::G4ParticleHPThermalScatteringData ( )

Definition at line 55 of file G4ParticleHPThermalScatteringData.cc.

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

◆ ~G4ParticleHPThermalScatteringData()

G4ParticleHPThermalScatteringData::~G4ParticleHPThermalScatteringData ( )
override

Definition at line 73 of file G4ParticleHPThermalScatteringData.cc.

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

Member Function Documentation

◆ AddUserThermalScatteringFile()

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

Definition at line 457 of file G4ParticleHPThermalScatteringData.cc.

459{
460 names->AddThermalElement(nameG4Element, filename);
461}

Referenced by G4ParticleHPThermalScattering::AddUserThermalScatteringFile().

◆ BuildPhysicsTable()

void G4ParticleHPThermalScatteringData::BuildPhysicsTable ( const G4ParticleDefinition & aP)
overridevirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 172 of file G4ParticleHPThermalScatteringData.cc.

173{
174 if (&aP != G4Neutron::Neutron())
175 throw G4HadronicException(__FILE__, __LINE__,
176 "Attempt to use NeutronHP data for particles other than neutrons!!!");
177
178 // std::map < std::pair < G4Material* , const G4Element* > , G4int > dic;
179 //
180 dic.clear();
181 if (G4Threading::IsMasterThread()) clearCurrentXSData();
182
183 std::map<G4String, G4int> co_dic;
184
185 // Searching Nist Materials
186 static G4ThreadLocal G4MaterialTable* theMaterialTable = nullptr;
187 if (theMaterialTable == nullptr) theMaterialTable = G4Material::GetMaterialTable();
188 std::size_t numberOfMaterials = G4Material::GetNumberOfMaterials();
189 for (std::size_t i = 0; i < numberOfMaterials; ++i) {
190 G4Material* material = (*theMaterialTable)[i];
191 auto numberOfElements = (G4int)material->GetNumberOfElements();
192 for (G4int j = 0; j < numberOfElements; ++j) {
193 const G4Element* element = material->GetElement(j);
194 if (names->IsThisThermalElement(material->GetName(), element->GetName())) {
195 G4int ts_ID_of_this_geometry;
196 G4String ts_ndl_name = names->GetTS_NDL_Name(material->GetName(), element->GetName());
197 if (co_dic.find(ts_ndl_name) != co_dic.cend()) {
198 ts_ID_of_this_geometry = co_dic.find(ts_ndl_name)->second;
199 }
200 else {
201 ts_ID_of_this_geometry = (G4int)co_dic.size();
202 co_dic.insert(std::pair<G4String, G4int>(ts_ndl_name, ts_ID_of_this_geometry));
203 }
204
205 dic.insert(std::pair<std::pair<G4Material*, const G4Element*>, G4int>(
206 std::pair<G4Material*, const G4Element*>(material, element), ts_ID_of_this_geometry));
207 }
208 }
209 }
210
211 // Searching TS Elements
212 static G4ThreadLocal G4ElementTable* theElementTable = nullptr;
213 if (theElementTable == nullptr) theElementTable = G4Element::GetElementTable();
214 std::size_t numberOfElements = G4Element::GetNumberOfElements();
215
216 for (std::size_t i = 0; i < numberOfElements; ++i) {
217 const G4Element* element = (*theElementTable)[i];
218 if (names->IsThisThermalElement(element->GetName())) {
219 if (names->IsThisThermalElement(element->GetName())) {
220 G4int ts_ID_of_this_geometry;
221 G4String ts_ndl_name = names->GetTS_NDL_Name(element->GetName());
222 if (co_dic.find(ts_ndl_name) != co_dic.cend()) {
223 ts_ID_of_this_geometry = co_dic.find(ts_ndl_name)->second;
224 }
225 else {
226 ts_ID_of_this_geometry = (G4int)co_dic.size();
227 co_dic.insert(std::pair<G4String, G4int>(ts_ndl_name, ts_ID_of_this_geometry));
228 }
229
230 dic.insert(std::pair<std::pair<const G4Material*, const G4Element*>, G4int>(
231 std::pair<const G4Material*, const G4Element*>((G4Material*)nullptr, element),
232 ts_ID_of_this_geometry));
233 }
234 }
235 }
236
237 G4cout << G4endl;
238 G4cout << "Neutron HP Thermal Scattering Data: Following material-element pairs and/or elements "
239 "are registered."
240 << G4endl;
241 for (const auto& it : dic) {
242 if (it.first.first != nullptr) {
243 G4cout << "Material " << it.first.first->GetName() << " - Element "
244 << it.first.second->GetName() << ", internal thermal scattering id " << it.second
245 << G4endl;
246 }
247 else {
248 G4cout << "Element " << it.first.second->GetName() << ", internal thermal scattering id "
249 << it.second << G4endl;
250 }
251 }
252 G4cout << G4endl;
253
255
256 coherent = hpmanager->GetThermalScatteringCoherentCrossSections();
257 incoherent = hpmanager->GetThermalScatteringIncoherentCrossSections();
258 inelastic = hpmanager->GetThermalScatteringInelasticCrossSections();
259
261 if (coherent == nullptr)
262 coherent = new std::map<G4int, std::map<G4double, G4ParticleHPVector*>*>;
263 if (incoherent == nullptr)
264 incoherent = new std::map<G4int, std::map<G4double, G4ParticleHPVector*>*>;
265 if (inelastic == nullptr)
266 inelastic = new std::map<G4int, std::map<G4double, G4ParticleHPVector*>*>;
267
268 // Read Cross Section Data files
269
270 G4String dirName;
271 if (G4FindDataDir("G4NEUTRONHPDATA") == nullptr)
273 __FILE__, __LINE__,
274 "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
275 G4String baseName = G4FindDataDir("G4NEUTRONHPDATA");
276
277 dirName = baseName + "/ThermalScattering";
278
279 G4String ndl_filename;
280 G4String full_name;
281
282 for (const auto& it : co_dic) {
283 ndl_filename = it.first;
284 G4int ts_ID = it.second;
285
286 // Coherent
287 full_name = dirName + "/Coherent/CrossSection/" + ndl_filename;
288 auto coh_amapTemp_EnergyCross = readData(full_name);
289 coherent->insert(std::pair<G4int, std::map<G4double, G4ParticleHPVector*>*>(
290 ts_ID, coh_amapTemp_EnergyCross));
291
292 // Incoherent
293 full_name = dirName + "/Incoherent/CrossSection/" + ndl_filename;
294 auto incoh_amapTemp_EnergyCross = readData(full_name);
295 incoherent->insert(std::pair<G4int, std::map<G4double, G4ParticleHPVector*>*>(
296 ts_ID, incoh_amapTemp_EnergyCross));
297
298 // Inelastic
299 full_name = dirName + "/Inelastic/CrossSection/" + ndl_filename;
300 auto inela_amapTemp_EnergyCross = readData(full_name);
301 inelastic->insert(std::pair<G4int, std::map<G4double, G4ParticleHPVector*>*>(
302 ts_ID, inela_amapTemp_EnergyCross));
303 }
307 }
308}
std::vector< G4Element * > G4ElementTable
const char * G4FindDataDir(const char *)
std::vector< G4Material * > G4MaterialTable
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4ElementTable * GetElementTable()
Definition G4Element.cc:389
static size_t GetNumberOfElements()
Definition G4Element.cc:393
const G4String & GetName() const
Definition G4Element.hh:115
const G4Element * GetElement(G4int iel) const
static std::size_t GetNumberOfMaterials()
static G4MaterialTable * GetMaterialTable()
std::size_t GetNumberOfElements() const
const G4String & GetName() const
static G4Neutron * Neutron()
Definition G4Neutron.cc:101
void RegisterThermalScatteringIncoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringCoherentCrossSections() const
void RegisterThermalScatteringCoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringInelasticCrossSections() const
static G4ParticleHPManager * GetInstance()
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringIncoherentCrossSections() const
G4bool IsMasterThread()
#define G4ThreadLocal
Definition tls.hh:77

◆ CrossSectionDescription()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 463 of file G4ParticleHPThermalScatteringData.cc.

464{
465 outFile << "High Precision cross data based on thermal scattering data in evaluated nuclear data "
466 "libraries for neutrons below 5eV on specific materials\n";
467}

◆ DumpPhysicsTable()

void G4ParticleHPThermalScatteringData::DumpPhysicsTable ( const G4ParticleDefinition & aP)
overridevirtual

Reimplemented from G4VCrossSectionDataSet.

Definition at line 334 of file G4ParticleHPThermalScatteringData.cc.

335{
336 if (&aP != G4Neutron::Neutron())
337 throw G4HadronicException(__FILE__, __LINE__,
338 "Attempt to use NeutronHP data for particles other than neutrons!!!");
339}

◆ GetCoherentCrossSection()

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

Definition at line 373 of file G4ParticleHPThermalScatteringData.cc.

376{
377 G4double result = 0;
378 G4int ts_id = getTS_ID(aM, anE);
379 G4double aT = aM->GetTemperature();
380 result = GetX(aP, aT, coherent->find(ts_id)->second);
381 return result;
382}
double G4double
Definition G4Types.hh:83
G4double GetTemperature() const

Referenced by G4ParticleHPThermalScattering::ApplyYourself().

◆ GetCrossSection()

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

Definition at line 341 of file G4ParticleHPThermalScatteringData.cc.

344{
345 G4double result = 0;
346
347 G4int ts_id = getTS_ID(aM, anE);
348
349 if (ts_id == -1) return result;
350
351 G4double aT = aM->GetTemperature();
352
353 G4double Xcoh = GetX(aP, aT, coherent->find(ts_id)->second);
354 G4double Xincoh = GetX(aP, aT, incoherent->find(ts_id)->second);
355 G4double Xinela = GetX(aP, aT, inelastic->find(ts_id)->second);
356
357 result = Xcoh + Xincoh + Xinela;
358
359 return result;
360}

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

◆ GetIncoherentCrossSection()

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

Definition at line 384 of file G4ParticleHPThermalScatteringData.cc.

387{
388 G4double result = 0;
389 G4int ts_id = getTS_ID(aM, anE);
390 G4double aT = aM->GetTemperature();
391 result = GetX(aP, aT, incoherent->find(ts_id)->second);
392 return result;
393}

◆ GetInelasticCrossSection()

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

Definition at line 362 of file G4ParticleHPThermalScatteringData.cc.

365{
366 G4double result = 0;
367 G4int ts_id = getTS_ID(aM, anE);
368 G4double aT = aM->GetTemperature();
369 result = GetX(aP, aT, inelastic->find(ts_id)->second);
370 return result;
371}

Referenced by G4ParticleHPThermalScattering::ApplyYourself().

◆ GetIsoCrossSection()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 98 of file G4ParticleHPThermalScatteringData.cc.

103{
104 ke_cache = dp->GetKineticEnergy();
105 element_cache = element;
106 material_cache = material;
107 G4double xs = GetCrossSection(dp, element, material);
108 xs_cache = xs;
109 return xs;
110}
G4double GetKineticEnergy() const
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)

◆ IsApplicable()

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

Definition at line 151 of file G4ParticleHPThermalScatteringData.cc.

153{
154 G4bool result = false;
155
156 G4double eKin = aP->GetKineticEnergy();
157 // Check energy
158 if (eKin < emax) {
159 // Check Particle Species
160 if (aP->GetDefinition() == G4Neutron::Neutron()) {
161 // anEle is one of Thermal elements
162 auto ie = (G4int)anEle->GetIndex();
163 for (int it : indexOfThermalElement) {
164 if (ie == it) return true;
165 }
166 }
167 }
168
169 return result;
170}
bool G4bool
Definition G4Types.hh:86
G4ParticleDefinition * GetDefinition() const
size_t GetIndex() const
Definition G4Element.hh:159

◆ IsIsoApplicable()

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

Reimplemented from G4VCrossSectionDataSet.

Definition at line 80 of file G4ParticleHPThermalScatteringData.cc.

83{
84 G4double eKin = dp->GetKineticEnergy();
85 if (eKin > 4.0 * eV // GetMaxKinEnergy()
86 || eKin < 0 // GetMinKinEnergy()
88 return false;
89
90 if (dic.find(std::pair<const G4Material*, const G4Element*>((G4Material*)nullptr, element))
91 != dic.end()
92 || dic.find(std::pair<const G4Material*, const G4Element*>(material, element)) != dic.end())
93 return true;
94
95 return false;
96}

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