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 ) );
static G4ParticleHPManager * GetInstance()
void RegisterThermalScatteringIncoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
const G4String & GetName() const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
static constexpr double second
const G4Element * GetElement(G4int iel) const
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringIncoherentCrossSections()
static G4Neutron * Neutron()
static size_t GetNumberOfMaterials()
G4bool IsThisThermalElement(G4String)
size_t GetNumberOfElements() const
G4String GetTS_NDL_Name(G4String nameG4Element)
std::vector< G4Element * > G4ElementTable
void RegisterThermalScatteringCoherentCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
const G4String & GetName() const
static G4ElementTable * GetElementTable()
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringInelasticCrossSections()
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > * GetThermalScatteringCoherentCrossSections()