93 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) ) !=
dic.end()
94 ||
dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) !=
dic.end() )
return true;
128 std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >::iterator it;
129 std::map< G4double , G4ParticleHPVector* >::iterator itt;
133 if ( it->second != NULL )
135 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
145 if ( it->second != NULL )
147 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
157 if ( it->second != NULL )
159 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
188 std::vector < G4int >::iterator it;
191 if ( ie == *it )
return true;
212 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
217 std::map < G4String , G4int > co_dic;
222 for (
size_t i = 0 ; i < numberOfMaterials ; i++ )
224 G4Material* material = (*theMaterialTable)[i];
226 for (
size_t j = 0 ; j < numberOfElements ; j++ )
231 G4int ts_ID_of_this_geometry;
233 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
235 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
239 ts_ID_of_this_geometry = co_dic.size();
240 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
247 dic.insert( std::pair < std::pair < G4Material* , const G4Element* > ,
G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
256 for (
size_t i = 0 ; i < numberOfElements ; i++ )
258 const G4Element* element = (*theElementTable)[i];
263 G4int ts_ID_of_this_geometry;
265 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
267 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
271 ts_ID_of_this_geometry = co_dic.size();
272 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
279 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 ) );
285 G4cout <<
"Neutron HP Thermal Scattering Data: Following material-element pairs and/or elements are registered." <<
G4endl;
286 for ( std::map < std::pair < const G4Material* , const G4Element* > ,
G4int >::iterator it =
dic.begin() ; it !=
dic.end() ; it++ )
288 if ( it->first.first != NULL )
290 G4cout <<
"Material " << it->first.first->GetName() <<
" - Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
294 G4cout <<
"Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
310 if ( !getenv(
"G4NEUTRONHPDATA" ) )
311 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
312 G4String baseName = getenv(
"G4NEUTRONHPDATA" );
314 dirName = baseName +
"/ThermalScattering";
319 for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
321 ndl_filename = it->
first;
322 G4int ts_ID = it->second;
325 full_name = dirName +
"/Coherent/CrossSection/" + ndl_filename;
326 std::map< G4double , G4ParticleHPVector* >* coh_amapTemp_EnergyCross =
readData( full_name );
327 coherent.insert ( std::pair <
G4int , std::map< G4double , G4ParticleHPVector* >* > ( ts_ID , coh_amapTemp_EnergyCross ) );
330 full_name = dirName +
"/Incoherent/CrossSection/" + ndl_filename;
331 std::map< G4double , G4ParticleHPVector* >* incoh_amapTemp_EnergyCross =
readData( full_name );
332 incoherent.insert ( std::pair <
G4int , std::map< G4double , G4ParticleHPVector* >* > ( ts_ID , incoh_amapTemp_EnergyCross ) );
335 full_name = dirName +
"/Inelastic/CrossSection/" + ndl_filename;
336 std::map< G4double , G4ParticleHPVector* >* inela_amapTemp_EnergyCross =
readData( full_name );
337 inelastic.insert ( std::pair <
G4int , std::map< G4double , G4ParticleHPVector* >* > ( ts_ID , inela_amapTemp_EnergyCross ) );
348 std::map< G4double , G4ParticleHPVector* >* aData =
new std::map< G4double , G4ParticleHPVector* >;
351 std::istringstream theChannel;
357 while ( theChannel >> dummy )
365 anEnergyCross->
Init ( theChannel , nData ,
eV ,
barn );
366 aData->insert ( std::pair < G4double , G4ParticleHPVector* > ( temp , anEnergyCross ) );
379 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
431 if ( ts_id == -1 )
return result;
439 result = Xcoh + Xincoh + Xinela;
461 result =
GetX ( aP , aT ,
coherent.find( ts_id )->second );
479 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) ) !=
dic.end() )
480 return dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) )->second;
481 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) !=
dic.end() )
482 return dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) )->second;
493 if ( amapTemp_EnergyCross->size() == 0 )
return result;
498 if ( amapTemp_EnergyCross->size() == 1 ) {
499 if ( std::fabs ( aT - amapTemp_EnergyCross->begin()->first ) / amapTemp_EnergyCross->begin()->first > 0.1 ) {
500 G4cout <<
"G4ParticleHPThermalScatteringData:: The temperature of material ("
501 << aT/
kelvin <<
"K) is different more than 10% from temperature of thermal scattering file expected ("
502 << amapTemp_EnergyCross->begin()->first <<
"K). Result may not be reliable."
505 result = amapTemp_EnergyCross->begin()->second->GetXsec ( eKinetic );
509 std::map< G4double , G4ParticleHPVector* >::iterator it;
510 for ( it = amapTemp_EnergyCross->begin() ; it != amapTemp_EnergyCross->end() ; it++ ) {
511 if ( aT < it->first )
break;
513 if ( it == amapTemp_EnergyCross->begin() && it != amapTemp_EnergyCross->end() ) it++;
514 if ( it != amapTemp_EnergyCross->begin() && it == amapTemp_EnergyCross->end() ) it--;
517 G4double XH = it->second->GetXsec ( eKinetic );
521 if ( it != amapTemp_EnergyCross->begin() ) it--;
523 G4double XL = it->second->GetXsec ( eKinetic );
531 G4double X = ( XH - XL ) / ( TH - TL ) * ( T - TL ) + XL;
static G4ParticleHPManager * GetInstance()
const G4Material * material_cache
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > incoherent
G4double GetKineticEnergy() const
void DumpPhysicsTable(const G4ParticleDefinition &)
const G4String & GetName() const
void AddThermalElement(G4String, G4String)
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
void GetDataStream(G4String, std::istringstream &iss)
G4ParticleDefinition * GetDefinition() const
G4bool IsApplicable(const G4DynamicParticle *, const G4Element *)
const G4Element * GetElement(G4int iel) const
G4int getTS_ID(const G4Material *, const G4Element *)
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4ParticleHPThermalScatteringData()
void AddUserThermalScatteringFile(G4String, G4String)
G4double GetIncoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
std::map< G4double, G4ParticleHPVector * > * readData(G4String)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4GLOB_DLL std::ostream G4cout
static size_t GetNumberOfElements()
void SetMinKinEnergy(G4double value)
const G4Element * element_cache
static const double second
static G4Neutron * Neutron()
static size_t GetNumberOfMaterials()
static const double kelvin
G4bool IsIsoApplicable(const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *)
void SetMaxKinEnergy(G4double value)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > inelastic
G4bool IsThisThermalElement(G4String)
std::map< G4int, std::map< G4double, G4ParticleHPVector * > * > coherent
std::map< std::pair< const G4Material *, const G4Element * >, G4int > dic
G4double GetTemperature() const
size_t GetNumberOfElements() const
G4double GetCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
G4String GetTS_NDL_Name(G4String nameG4Element)
std::vector< G4Element * > G4ElementTable
G4double GetInelasticCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
const G4String & GetName() const
~G4ParticleHPThermalScatteringData()
G4ParticleHPThermalScatteringNames * names
static G4ElementTable * GetElementTable()
void BuildPhysicsTable(const G4ParticleDefinition &)
G4double GetX(const G4DynamicParticle *, G4double aT, std::map< G4double, G4ParticleHPVector * > *)
std::vector< G4int > indexOfThermalElement
void clearCurrentXSData()