Geant4-11
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4ParticleHPThermalScatteringData Class Reference

#include <G4ParticleHPThermalScatteringData.hh>

Inheritance diagram for G4ParticleHPThermalScatteringData:
G4VCrossSectionDataSet

Public Member Functions

void AddUserThermalScatteringFile (G4String, G4String)
 
void BuildPhysicsTable (const G4ParticleDefinition &)
 
G4double ComputeCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *mat=nullptr)
 
virtual void CrossSectionDescription (std::ostream &) const
 
void DumpPhysicsTable (const G4ParticleDefinition &)
 
bool ForAllAtomsAndEnergies () const
 
 G4ParticleHPThermalScatteringData ()
 
G4double GetCoherentCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
virtual G4double GetElementCrossSection (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
G4double GetIncoherentCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
G4double GetInelasticCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
 
G4double GetIsoCrossSection (const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
 
G4double GetMaxKinEnergy () const
 
G4double GetMinKinEnergy () const
 
const G4StringGetName () const
 
virtual G4int GetVerboseLevel () const
 
G4bool IsApplicable (const G4DynamicParticle *, const G4Element *)
 
virtual G4bool IsElementApplicable (const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)
 
G4bool IsIsoApplicable (const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *)
 
virtual const G4IsotopeSelectIsotope (const G4Element *, G4double kinEnergy, G4double logE)
 
void SetForAllAtomsAndEnergies (G4bool val)
 
void SetMaxKinEnergy (G4double value)
 
void SetMinKinEnergy (G4double value)
 
void SetName (const G4String &nam)
 
virtual void SetVerboseLevel (G4int value)
 
 ~G4ParticleHPThermalScatteringData ()
 

Protected Attributes

G4String name
 
G4int verboseLevel
 

Private Member Functions

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

Private Attributes

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

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}
static constexpr double eV
Definition: G4SIunits.hh:201
static constexpr double MeV
Definition: G4SIunits.hh:200
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * inelastic
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * coherent
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * incoherent
G4ParticleHPThermalScatteringNames * names
G4VCrossSectionDataSet(const G4String &nam="")
void SetMaxKinEnergy(G4double value)
void SetMinKinEnergy(G4double value)

References element_cache, emax, eV, indexOfThermalElement, ke_cache, material_cache, MeV, names, G4VCrossSectionDataSet::SetMaxKinEnergy(), G4VCrossSectionDataSet::SetMinKinEnergy(), and xs_cache.

◆ ~G4ParticleHPThermalScatteringData()

G4ParticleHPThermalScatteringData::~G4ParticleHPThermalScatteringData ( )

Definition at line 77 of file G4ParticleHPThermalScatteringData.cc.

References clearCurrentXSData(), and names.

Member Function Documentation

◆ AddUserThermalScatteringFile()

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

◆ 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
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
static constexpr double second
Definition: G4SIunits.hh:137
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:127
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:679
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:672
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::map< G4double, G4ParticleHPVector * > * readData(G4String)
std::map< std::pair< const G4Material *, const G4Element * >, G4int > dic
G4bool IsMasterThread()
Definition: G4Threading.cc:124
string material
Definition: eplot.py:19
#define G4ThreadLocal
Definition: tls.hh:77

References clearCurrentXSData(), coherent, dic, G4cout, G4endl, G4ThreadLocal, G4Element::GetElementTable(), G4ParticleHPManager::GetInstance(), G4Material::GetMaterialTable(), G4Element::GetName(), G4Element::GetNumberOfElements(), G4Material::GetNumberOfMaterials(), G4ParticleHPManager::GetThermalScatteringCoherentCrossSections(), G4ParticleHPManager::GetThermalScatteringIncoherentCrossSections(), G4ParticleHPManager::GetThermalScatteringInelasticCrossSections(), G4ParticleHPThermalScatteringNames::GetTS_NDL_Name(), incoherent, inelastic, G4Threading::IsMasterThread(), G4ParticleHPThermalScatteringNames::IsThisThermalElement(), anonymous_namespace{G4QuasiElRatios.cc}::map, eplot::material, names, G4Neutron::Neutron(), readData(), G4ParticleHPManager::RegisterThermalScatteringCoherentCrossSections(), G4ParticleHPManager::RegisterThermalScatteringIncoherentCrossSections(), G4ParticleHPManager::RegisterThermalScatteringInelasticCrossSections(), and second.

Referenced by G4ParticleHPThermalScattering::buildPhysicsTable().

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

References coherent, incoherent, and inelastic.

Referenced by BuildPhysicsTable(), and ~G4ParticleHPThermalScatteringData().

◆ ComputeCrossSection()

G4double G4VCrossSectionDataSet::ComputeCrossSection ( const G4DynamicParticle part,
const G4Element elm,
const G4Material mat = nullptr 
)
inherited

Definition at line 81 of file G4VCrossSectionDataSet.cc.

84{
85 G4int Z = elm->GetZasInt();
86
87 if (IsElementApplicable(part, Z, mat)) {
88 return GetElementCrossSection(part, Z, mat);
89 }
90
91 // isotope-wise cross section making sum over available
92 // isotope cross sections, which may be incomplete, so
93 // the result is corrected
94 size_t nIso = elm->GetNumberOfIsotopes();
95 G4double fact = 0.0;
96 G4double xsec = 0.0;
97
98 // user-defined isotope abundances
99 const G4IsotopeVector* isoVector = elm->GetIsotopeVector();
100 const G4double* abundVector = elm->GetRelativeAbundanceVector();
101
102 for (size_t j=0; j<nIso; ++j) {
103 const G4Isotope* iso = (*isoVector)[j];
104 G4int A = iso->GetN();
105 if(abundVector[j] > 0.0 && IsIsoApplicable(part, Z, A, elm, mat)) {
106 fact += abundVector[j];
107 xsec += abundVector[j]*GetIsoCrossSection(part, Z, A, iso, elm, mat);
108 }
109 }
110 return (fact > 0.0) ? xsec/fact : 0.0;
111}
std::vector< G4Isotope * > G4IsotopeVector
double G4double
Definition: G4Types.hh:83
const G4int Z[17]
const G4double A[17]
G4double * GetRelativeAbundanceVector() const
Definition: G4Element.hh:167
size_t GetNumberOfIsotopes() const
Definition: G4Element.hh:159
G4int GetZasInt() const
Definition: G4Element.hh:132
G4IsotopeVector * GetIsotopeVector() const
Definition: G4Element.hh:163
G4int GetN() const
Definition: G4Isotope.hh:93
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 G4bool IsIsoApplicable(const G4DynamicParticle *, G4int Z, G4int A, const G4Element *elm=nullptr, const G4Material *mat=nullptr)
virtual G4bool IsElementApplicable(const G4DynamicParticle *, G4int Z, const G4Material *mat=nullptr)

References A, G4VCrossSectionDataSet::GetElementCrossSection(), G4VCrossSectionDataSet::GetIsoCrossSection(), G4Element::GetIsotopeVector(), G4Isotope::GetN(), G4Element::GetNumberOfIsotopes(), G4Element::GetRelativeAbundanceVector(), G4Element::GetZasInt(), G4VCrossSectionDataSet::IsElementApplicable(), G4VCrossSectionDataSet::IsIsoApplicable(), and Z.

Referenced by G4VCrossSectionDataSet::GetCrossSection().

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

References G4Neutron::Neutron().

◆ ForAllAtomsAndEnergies()

bool G4VCrossSectionDataSet::ForAllAtomsAndEnergies ( ) const
inlineinherited

◆ 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}
G4double GetTemperature() const
Definition: G4Material.hh:178
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
G4int getTS_ID(const G4Material *, const G4Element *)

References coherent, G4Material::GetTemperature(), getTS_ID(), and GetX().

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}

References coherent, G4Material::GetTemperature(), getTS_ID(), GetX(), incoherent, and inelastic.

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

◆ GetElementCrossSection()

G4double G4VCrossSectionDataSet::GetElementCrossSection ( const G4DynamicParticle dynPart,
G4int  Z,
const G4Material mat = nullptr 
)
virtualinherited

Reimplemented in G4EMDissociationCrossSection, G4IonsShenCrossSection, G4NeutrinoElectronCcXsc, G4NeutrinoElectronNcXsc, G4NeutrinoElectronTotXsc, G4NeutronElectronElXsc, G4PhotoNuclearCrossSection, G4NeutronCaptureXS, G4NeutronElasticXS, G4NeutronInelasticXS, G4ElectroNuclearCrossSection, G4BGGNucleonElasticXS, G4BGGPionElasticXS, G4BGGPionInelasticXS, G4BGGNucleonInelasticXS, G4CrossSectionElastic, G4CrossSectionInelastic, G4GammaNuclearXS, G4ParticleInelasticXS, G4ZeroXS, G4NucleonNuclearCrossSection, G4MuNeutrinoNucleusTotXsc, and G4KokoulinMuonNuclearXS.

Definition at line 114 of file G4VCrossSectionDataSet.cc.

117{
119 ed << "GetElementCrossSection is not implemented in <" << name << ">\n"
120 << "Particle: " << dynPart->GetDefinition()->GetParticleName()
121 << " Ekin(MeV)= " << dynPart->GetKineticEnergy()/MeV;
122 if(mat) { ed << " material: " << mat->GetName(); }
123 ed << " target Z= " << Z << G4endl;
124 G4Exception("G4VCrossSectionDataSet::GetElementCrossSection", "had001",
125 FatalException, ed);
126 return 0.0;
127}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
const G4String & GetName() const
Definition: G4Material.hh:173
const G4String & GetParticleName() const

References FatalException, G4endl, G4Exception(), G4DynamicParticle::GetDefinition(), G4DynamicParticle::GetKineticEnergy(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), MeV, G4VCrossSectionDataSet::name, and Z.

Referenced by G4QMDReaction::ApplyYourself(), G4VCrossSectionDataSet::ComputeCrossSection(), G4GammaNuclearXS::GetElementCrossSection(), G4GammaNuclearXS::GetIsoCrossSection(), and G4GammaNuclearXS::Initialise().

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

References G4Material::GetTemperature(), getTS_ID(), GetX(), and incoherent.

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

References G4Material::GetTemperature(), getTS_ID(), GetX(), and inelastic.

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
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}
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)

References element_cache, GetCrossSection(), G4DynamicParticle::GetKineticEnergy(), ke_cache, eplot::material, material_cache, and xs_cache.

◆ GetMaxKinEnergy()

G4double G4VCrossSectionDataSet::GetMaxKinEnergy ( ) const
inlineinherited

◆ GetMinKinEnergy()

G4double G4VCrossSectionDataSet::GetMinKinEnergy ( ) const
inlineinherited

◆ GetName()

const G4String & G4VCrossSectionDataSet::GetName ( ) const
inlineinherited

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

References dic, and eplot::material.

Referenced by GetCoherentCrossSection(), GetCrossSection(), GetIncoherentCrossSection(), and GetInelasticCrossSection().

◆ GetVerboseLevel()

G4int G4VCrossSectionDataSet::GetVerboseLevel ( ) const
inlinevirtualinherited

◆ 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 if ( it == amapTemp_EnergyCross->begin() ) {
541 it++; // lower than the first
542 } else if ( it == amapTemp_EnergyCross->end() ) {
543 it--; // upper than the last
544 }
545
546 G4double TH = it->first;
547 G4double XH = it->second->GetXsec ( eKinetic );
548
549 //G4cout << "G4ParticleHPThermalScatteringData::GetX TH " << TH << " E " << eKinetic << " XH " << XH << G4endl;
550
551 if ( it != amapTemp_EnergyCross->begin() ) it--;
552 G4double TL = it->first;
553 G4double XL = it->second->GetXsec ( eKinetic );
554
555 //G4cout << "G4ParticleHPThermalScatteringData::GetX TL " << TL << " E " << eKinetic << " XL " << XL << G4endl;
556
557 if ( TH == TL )
558 throw G4HadronicException(__FILE__, __LINE__, "Thermal Scattering Data Error!");
559
560 G4double T = aT;
561 G4double X = ( XH - XL ) / ( TH - TL ) * ( T - TL ) + XL;
562 result = X;
563
564 return result;
565}
static constexpr double kelvin
Definition: G4SIunits.hh:274

References G4cout, G4endl, G4DynamicParticle::GetKineticEnergy(), and kelvin.

Referenced by GetCoherentCrossSection(), GetCrossSection(), GetIncoherentCrossSection(), and GetInelasticCrossSection().

◆ 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
size_t GetIndex() const
Definition: G4Element.hh:182

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

◆ IsElementApplicable()

G4bool G4VCrossSectionDataSet::IsElementApplicable ( const G4DynamicParticle ,
G4int  Z,
const G4Material mat = nullptr 
)
virtualinherited

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

References dic, eV, G4DynamicParticle::GetDefinition(), G4DynamicParticle::GetKineticEnergy(), eplot::material, and G4Neutron::Neutron().

◆ 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 constexpr double barn
Definition: G4SIunits.hh:85
void GetDataStream(G4String, std::istringstream &iss)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)

References barn, eV, G4ParticleHPManager::GetDataStream(), G4ParticleHPManager::GetInstance(), and G4ParticleHPVector::Init().

Referenced by BuildPhysicsTable().

◆ SelectIsotope()

const G4Isotope * G4VCrossSectionDataSet::SelectIsotope ( const G4Element anElement,
G4double  kinEnergy,
G4double  logE 
)
virtualinherited

Reimplemented in G4GammaNuclearXS, G4NeutronCaptureXS, G4NeutronElasticXS, G4NeutronInelasticXS, and G4ParticleInelasticXS.

Definition at line 149 of file G4VCrossSectionDataSet.cc.

151{
152 size_t nIso = anElement->GetNumberOfIsotopes();
153 const G4Isotope* iso = anElement->GetIsotope(0);
154
155 // more than 1 isotope
156 if(1 < nIso) {
157 const G4double* abundVector = anElement->GetRelativeAbundanceVector();
158 G4double sum = 0.0;
160 for (size_t j=0; j<nIso; ++j) {
161 sum += abundVector[j];
162 if(q <= sum) {
163 iso = anElement->GetIsotope(j);
164 break;
165 }
166 }
167 }
168 return iso;
169}
#define G4UniformRand()
Definition: Randomize.hh:52
const G4Isotope * GetIsotope(G4int iso) const
Definition: G4Element.hh:170

References G4UniformRand, G4Element::GetIsotope(), G4Element::GetNumberOfIsotopes(), and G4Element::GetRelativeAbundanceVector().

◆ SetForAllAtomsAndEnergies()

void G4VCrossSectionDataSet::SetForAllAtomsAndEnergies ( G4bool  val)
inlineinherited

◆ SetMaxKinEnergy()

void G4VCrossSectionDataSet::SetMaxKinEnergy ( G4double  value)
inlineinherited

◆ SetMinKinEnergy()

void G4VCrossSectionDataSet::SetMinKinEnergy ( G4double  value)
inlineinherited

◆ SetName()

void G4VCrossSectionDataSet::SetName ( const G4String nam)
inlineinherited

Definition at line 240 of file G4VCrossSectionDataSet.hh.

241{
242 name = nam;
243}

References G4VCrossSectionDataSet::name.

Referenced by G4ParticleHPInelasticData::G4ParticleHPInelasticData().

◆ SetVerboseLevel()

void G4VCrossSectionDataSet::SetVerboseLevel ( G4int  value)
inlinevirtualinherited

Field Documentation

◆ coherent

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

◆ dic

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

◆ element_cache

const G4Element* G4ParticleHPThermalScatteringData::element_cache
private

◆ emax

G4double G4ParticleHPThermalScatteringData::emax
private

◆ incoherent

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

◆ indexOfThermalElement

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

◆ inelastic

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

◆ isForAllAtomsAndEnergies

G4bool G4VCrossSectionDataSet::isForAllAtomsAndEnergies
privateinherited

◆ ke_cache

G4double G4ParticleHPThermalScatteringData::ke_cache
private

◆ material_cache

const G4Material* G4ParticleHPThermalScatteringData::material_cache
private

◆ maxKinEnergy

G4double G4VCrossSectionDataSet::maxKinEnergy
privateinherited

◆ minKinEnergy

G4double G4VCrossSectionDataSet::minKinEnergy
privateinherited

◆ name

G4String G4VCrossSectionDataSet::name
protectedinherited

◆ names

G4ParticleHPThermalScatteringNames* G4ParticleHPThermalScatteringData::names
private

◆ registry

G4CrossSectionDataSetRegistry* G4VCrossSectionDataSet::registry
privateinherited

◆ verboseLevel

G4int G4VCrossSectionDataSet::verboseLevel
protectedinherited

Definition at line 168 of file G4VCrossSectionDataSet.hh.

Referenced by G4BGGNucleonElasticXS::BuildPhysicsTable(), G4BGGPionElasticXS::BuildPhysicsTable(), G4BGGPionInelasticXS::BuildPhysicsTable(), G4GammaNuclearXS::BuildPhysicsTable(), G4NeutronCaptureXS::BuildPhysicsTable(), G4NeutronElasticXS::BuildPhysicsTable(), G4NeutronInelasticXS::BuildPhysicsTable(), G4ParticleInelasticXS::BuildPhysicsTable(), G4BGGNucleonInelasticXS::BuildPhysicsTable(), G4LENDCrossSection::create_used_target_map(), G4BGGNucleonElasticXS::G4BGGNucleonElasticXS(), G4BGGNucleonInelasticXS::G4BGGNucleonInelasticXS(), G4BGGPionElasticXS::G4BGGPionElasticXS(), G4BGGPionInelasticXS::G4BGGPionInelasticXS(), G4GammaNuclearXS::G4GammaNuclearXS(), G4NeutronCaptureXS::G4NeutronCaptureXS(), G4NeutronElasticXS::G4NeutronElasticXS(), G4NeutronInelasticXS::G4NeutronInelasticXS(), G4ParticleInelasticXS::G4ParticleInelasticXS(), G4NeutronCaptureXS::GetElementCrossSection(), G4NeutronElasticXS::GetElementCrossSection(), G4NeutronInelasticXS::GetElementCrossSection(), G4BGGNucleonElasticXS::GetElementCrossSection(), G4BGGPionElasticXS::GetElementCrossSection(), G4BGGPionInelasticXS::GetElementCrossSection(), G4BGGNucleonInelasticXS::GetElementCrossSection(), G4GammaNuclearXS::GetElementCrossSection(), G4ParticleInelasticXS::GetElementCrossSection(), G4BGGNucleonElasticXS::GetIsoCrossSection(), G4BGGPionElasticXS::GetIsoCrossSection(), G4BGGPionInelasticXS::GetIsoCrossSection(), G4GammaNuclearXS::GetIsoCrossSection(), G4BGGNucleonInelasticXS::GetIsoCrossSection(), G4VCrossSectionDataSet::GetVerboseLevel(), G4NeutronElasticXS::Initialise(), G4ParticleInelasticXS::IsoCrossSection(), G4NeutronCaptureXS::IsoCrossSection(), G4NeutronInelasticXS::IsoCrossSection(), G4GammaNuclearXS::RetrieveVector(), G4NeutronCaptureXS::RetrieveVector(), G4NeutronInelasticXS::RetrieveVector(), G4ParticleInelasticXS::RetrieveVector(), and G4VCrossSectionDataSet::SetVerboseLevel().

◆ xs_cache

G4double G4ParticleHPThermalScatteringData::xs_cache
private

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