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;
130 std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >::iterator it;
131 std::map< G4double , G4ParticleHPVector* >::iterator itt;
136 if ( it->second != NULL )
138 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
151 if ( it->second != NULL )
153 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
166 if ( it->second != NULL )
168 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
195 std::vector < G4int >::iterator it;
198 if ( ie == *it )
return true;
219 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
226 std::map < G4String , G4int > co_dic;
231 for (
size_t i = 0 ; i < numberOfMaterials ; i++ )
233 G4Material* material = (*theMaterialTable)[i];
235 for (
size_t j = 0 ; j < numberOfElements ; j++ )
240 G4int ts_ID_of_this_geometry;
242 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
244 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
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 ) );
256 dic.insert( std::pair < std::pair < G4Material* , const G4Element* > ,
G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
265 for (
size_t i = 0 ; i < numberOfElements ; i++ )
267 const G4Element* element = (*theElementTable)[i];
272 G4int ts_ID_of_this_geometry;
274 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
276 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
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 ) );
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 ) );
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++ )
297 if ( it->first.first != NULL )
299 G4cout <<
"Material " << it->first.first->GetName() <<
" - Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
303 G4cout <<
"Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
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* >* >;
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" );
335 dirName = baseName +
"/ThermalScattering";
340 for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
343 ndl_filename = it->
first;
344 G4int ts_ID = it->second;
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 ) );
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 ) );
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 ) );
373 std::map< G4double , G4ParticleHPVector* >* aData =
new std::map< G4double , G4ParticleHPVector* >;
376 std::istringstream theChannel;
382 while ( theChannel >> dummy )
390 anEnergyCross->
Init ( theChannel , nData ,
eV ,
barn );
391 aData->insert ( std::pair < G4double , G4ParticleHPVector* > ( temp , anEnergyCross ) );
404 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
456 if ( ts_id == -1 )
return result;
464 result = Xcoh + Xincoh + Xinela;
477 result =
GetX ( aP , aT ,
inelastic->find( ts_id )->second );
486 result =
GetX ( aP , aT ,
coherent->find( ts_id )->second );
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;
518 if ( amapTemp_EnergyCross->size() == 0 )
return result;
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."
530 result = amapTemp_EnergyCross->begin()->second->GetXsec ( eKinetic );
534 std::map< G4double , G4ParticleHPVector* >::iterator it;
535 for ( it = amapTemp_EnergyCross->begin() ; it != amapTemp_EnergyCross->end() ; it++ ) {
536 if ( aT < it->
first )
break;
540 if ( it == amapTemp_EnergyCross->begin() ) {
542 }
else if ( it == amapTemp_EnergyCross->end() ) {
547 G4double XH = it->second->GetXsec ( eKinetic );
551 if ( it != amapTemp_EnergyCross->begin() ) it--;
553 G4double XL = it->second->GetXsec ( eKinetic );
561 G4double X = ( XH - XL ) / ( TH - TL ) * ( T - TL ) + XL;
574 outFile <<
"High Precision cross data based on thermal scattering data in evaluated nuclear data libraries for neutrons below 5eV on specific materials\n" ;
static constexpr double kelvin
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
static G4ParticleHPManager * GetInstance()
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *)
void RegisterThermalScatteringCoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
void SetMinKinEnergy(G4double value)
static size_t GetNumberOfMaterials()
static constexpr double MeV
void SetMaxKinEnergy(G4double value)
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
std::map< std::pair< const G4Material *, const G4Element * >, G4int > dic
std::vector< G4int > indexOfThermalElement
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void AddThermalElement(G4String, G4String)
G4double GetIncoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
const G4Element * element_cache
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * inelastic
static constexpr double second
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * incoherent
G4int getTS_ID(const G4Material *, const G4Element *)
void AddUserThermalScatteringFile(G4String, G4String)
G4ParticleHPThermalScatteringNames * names
void clearCurrentXSData()
const G4String & GetName() const
void GetDataStream(G4String, std::istringstream &iss)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringInelasticCrossSections()
void DumpPhysicsTable(const G4ParticleDefinition &)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4ParticleDefinition * GetDefinition() const
std::vector< G4Element * > G4ElementTable
G4bool IsThisThermalElement(G4String)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * coherent
~G4ParticleHPThermalScatteringData()
static constexpr double eV
void BuildPhysicsTable(const G4ParticleDefinition &)
G4ParticleHPThermalScatteringData()
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
const G4Material * material_cache
void RegisterThermalScatteringIncoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
G4double G4ParticleHPJENDLHEData::G4double result
std::vector< G4Material * > G4MaterialTable
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringIncoherentCrossSections()
static G4Neutron * Neutron()
static constexpr double barn
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringCoherentCrossSections()
G4String GetTS_NDL_Name(G4String nameG4Element)
static size_t GetNumberOfElements()
virtual void CrossSectionDescription(std::ostream &) const
std::map< G4double, G4ParticleHPVector * > * readData(G4String)
G4bool IsApplicable(const G4DynamicParticle *, const G4Element *)
const G4Element * GetElement(G4int iel) const
size_t GetNumberOfElements() const
G4double GetTemperature() const
static G4ElementTable * GetElementTable()