91 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) ) !=
dic.end()
92 ||
dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) !=
dic.end() )
return true;
126 std::map< G4int , std::map< G4double , G4NeutronHPVector* >* >::iterator it;
127 std::map< G4double , G4NeutronHPVector* >::iterator itt;
131 if ( it->second != NULL )
133 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
143 if ( it->second != NULL )
145 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
155 if ( it->second != NULL )
157 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
186 std::vector < G4int >::iterator it;
189 if ( ie == *it )
return true;
210 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
215 std::map < G4String , G4int > co_dic;
220 for (
size_t i = 0 ; i < numberOfMaterials ; i++ )
222 G4Material* material = (*theMaterialTable)[i];
224 for (
size_t j = 0 ; j < numberOfElements ; j++ )
229 G4int ts_ID_of_this_geometry;
231 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
233 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
237 ts_ID_of_this_geometry = co_dic.size();
238 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
245 dic.insert( std::pair < std::pair < G4Material* , const G4Element* > ,
G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
254 for (
size_t i = 0 ; i < numberOfElements ; i++ )
256 const G4Element* element = (*theElementTable)[i];
261 G4int ts_ID_of_this_geometry;
263 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
265 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
269 ts_ID_of_this_geometry = co_dic.size();
270 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
277 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 ) );
283 G4cout <<
"Neutron HP Thermal Scattering Data: Following material-element pairs and/or elements are registered." <<
G4endl;
284 for ( std::map < std::pair < const G4Material* , const G4Element* > ,
G4int >::iterator it =
dic.begin() ; it !=
dic.end() ; it++ )
286 if ( it->first.first != NULL )
288 G4cout <<
"Material " << it->first.first->GetName() <<
" - Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
292 G4cout <<
"Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
308 if ( !getenv(
"G4NEUTRONHPDATA" ) )
309 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
310 G4String baseName = getenv(
"G4NEUTRONHPDATA" );
312 dirName = baseName +
"/ThermalScattering";
317 for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
319 ndl_filename = it->
first;
320 G4int ts_ID = it->second;
323 full_name = dirName +
"/Coherent/CrossSection/" + ndl_filename;
324 std::map< G4double , G4NeutronHPVector* >* coh_amapTemp_EnergyCross =
readData( full_name );
325 coherent.insert ( std::pair <
G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , coh_amapTemp_EnergyCross ) );
328 full_name = dirName +
"/Incoherent/CrossSection/" + ndl_filename;
329 std::map< G4double , G4NeutronHPVector* >* incoh_amapTemp_EnergyCross =
readData( full_name );
330 incoherent.insert ( std::pair <
G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , incoh_amapTemp_EnergyCross ) );
333 full_name = dirName +
"/Inelastic/CrossSection/" + ndl_filename;
334 std::map< G4double , G4NeutronHPVector* >* inela_amapTemp_EnergyCross =
readData( full_name );
335 inelastic.insert ( std::pair <
G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , inela_amapTemp_EnergyCross ) );
346 std::map< G4double , G4NeutronHPVector* >* aData =
new std::map< G4double , G4NeutronHPVector* >;
349 std::istringstream theChannel;
355 while ( theChannel >> dummy )
363 anEnergyCross->
Init ( theChannel , nData ,
eV ,
barn );
364 aData->insert ( std::pair < G4double , G4NeutronHPVector* > ( temp , anEnergyCross ) );
377 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
429 if ( ts_id == -1 )
return result;
437 result = Xcoh + Xincoh + Xinela;
459 result =
GetX ( aP , aT ,
coherent.find( ts_id )->second );
477 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) ) !=
dic.end() )
478 return dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) )->second;
479 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) !=
dic.end() )
480 return dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) )->second;
491 if ( amapTemp_EnergyCross->size() == 0 )
return result;
496 if ( amapTemp_EnergyCross->size() == 1 ) {
497 if ( std::fabs ( aT - amapTemp_EnergyCross->begin()->first ) / amapTemp_EnergyCross->begin()->first > 0.1 ) {
498 G4cout <<
"G4NeutronHPThermalScatteringData:: The temperature of material ("
499 << aT/
kelvin <<
"K) is different more than 10% from temperature of thermal scattering file expected ("
500 << amapTemp_EnergyCross->begin()->first <<
"K). Result may not be reliable."
503 result = amapTemp_EnergyCross->begin()->second->GetXsec ( eKinetic );
507 std::map< G4double , G4NeutronHPVector* >::iterator it;
508 for ( it = amapTemp_EnergyCross->begin() ; it != amapTemp_EnergyCross->end() ; it++ ) {
509 if ( aT < it->first )
break;
511 if ( it == amapTemp_EnergyCross->begin() && it != amapTemp_EnergyCross->end() ) it++;
512 if ( it != amapTemp_EnergyCross->begin() && it == amapTemp_EnergyCross->end() ) it--;
515 G4double XH = it->second->GetXsec ( eKinetic );
519 if ( it != amapTemp_EnergyCross->begin() ) it--;
521 G4double XL = it->second->GetXsec ( eKinetic );
529 G4double X = ( XH - XL ) / ( TH - TL ) * ( T - TL ) + XL;
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > inelastic
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
std::map< std::pair< const G4Material *, const G4Element * >, G4int > dic
G4double GetKineticEnergy() const
static G4NeutronHPManager * GetInstance()
G4NeutronHPThermalScatteringData()
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
const G4String & GetName() const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
G4bool IsApplicable(const G4DynamicParticle *, const G4Element *)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
const G4Material * material_cache
G4ParticleDefinition * GetDefinition() const
std::map< G4double, G4NeutronHPVector * > * readData(G4String)
void GetDataStream(G4String, std::istringstream &iss)
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > incoherent
const G4Element * GetElement(G4int iel) const
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4NeutronHPVector * > *)
void AddThermalElement(G4String, G4String)
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
void SetMinKinEnergy(G4double value)
~G4NeutronHPThermalScatteringData()
static const double second
const G4Element * element_cache
static G4Neutron * Neutron()
static size_t GetNumberOfMaterials()
G4double GetIncoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
void AddUserThermalScatteringFile(G4String, G4String)
static const double kelvin
void BuildPhysicsTable(const G4ParticleDefinition &)
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *)
void SetMaxKinEnergy(G4double value)
void DumpPhysicsTable(const G4ParticleDefinition &)
std::vector< G4int > indexOfThermalElement
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4String GetTS_NDL_Name(G4String nameG4Element)
G4double GetTemperature() const
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > coherent
G4NeutronHPThermalScatteringNames * names
size_t GetNumberOfElements() const
std::vector< G4Element * > G4ElementTable
const G4String & GetName() const
static G4ElementTable * GetElementTable()
void clearCurrentXSData()
G4bool IsThisThermalElement(G4String)
G4int getTS_ID(const G4Material *, const G4Element *)