70 material_cache = NULL;
72 indexOfThermalElement.clear();
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;
119 element_cache = element;
120 material_cache = material;
128void G4ParticleHPThermalScatteringData::clearCurrentXSData()
130 std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >::iterator it;
131 std::map< G4double , G4ParticleHPVector* >::iterator itt;
133 if ( coherent != NULL ) {
134 for ( it = coherent->begin() ; it != coherent->end() ; it++ )
136 if ( it->second != NULL )
138 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
148 if ( incoherent != NULL ) {
149 for ( it = incoherent->begin() ; it != incoherent->end() ; it++ )
151 if ( it->second != NULL )
153 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
163 if ( inelastic != NULL ) {
164 for ( it = inelastic->begin() ; it != inelastic->end() ; it++ )
166 if ( it->second != NULL )
168 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
195 std::vector < G4int >::iterator it;
196 for ( it = indexOfThermalElement.begin() ; it != indexOfThermalElement.end() ; 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 ( !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" );
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 ) );
370std::map< G4double , G4ParticleHPVector* >* G4ParticleHPThermalScatteringData::readData (
G4String full_name )
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!!!");
454 G4int ts_id =getTS_ID( aM , anE );
456 if ( ts_id == -1 )
return result;
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 );
464 result = Xcoh + Xincoh + Xinela;
475 G4int ts_id = getTS_ID( aM , anE );
477 result = GetX ( aP , aT , inelastic->find( ts_id )->second );
484 G4int ts_id = getTS_ID( aM , anE );
486 result = GetX ( aP , aT , coherent->find( ts_id )->second );
493 G4int ts_id = getTS_ID( aM , anE );
495 result = GetX ( aP , aT , incoherent->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" ;
std::vector< G4Element * > G4ElementTable
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cout
G4ParticleDefinition * GetDefinition() const
G4double GetKineticEnergy() const
static G4ElementTable * GetElementTable()
static size_t GetNumberOfElements()
const G4String & GetName() const
static size_t GetNumberOfMaterials()
G4double GetTemperature() const
const G4Element * GetElement(G4int iel) const
size_t GetNumberOfElements() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
static G4Neutron * Neutron()
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 GetDataStream(G4String, std::istringstream &iss)
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > *val)
G4ParticleHPThermalScatteringData()
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
~G4ParticleHPThermalScatteringData()
G4double GetIncoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void BuildPhysicsTable(const G4ParticleDefinition &)
void AddUserThermalScatteringFile(G4String, G4String)
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void DumpPhysicsTable(const G4ParticleDefinition &)
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
virtual void CrossSectionDescription(std::ostream &) const
G4bool IsApplicable(const G4DynamicParticle *, const G4Element *)
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *)
void AddThermalElement(G4String, G4String)
G4bool IsThisThermalElement(G4String)
G4String GetTS_NDL_Name(G4String nameG4Element)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
std::size_t first(char) const
void SetMaxKinEnergy(G4double value)
void SetMinKinEnergy(G4double value)