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 , G4NeutronHPVector* >* >::iterator it;
129 std::map< G4double , G4NeutronHPVector* >::iterator itt;
132 for ( it = (*coherent).begin() ; it != (*coherent).end() ; it++ )
134 if ( it->second != NULL )
136 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
147 for ( it = (*incoherent).begin() ; it != (*incoherent).end() ; it++ )
149 if ( it->second != NULL )
151 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
158 (*incoherent).clear();
162 for ( it = (*inelastic).begin() ; it != (*inelastic).end() ; it++ )
164 if ( it->second != NULL )
166 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
173 (*inelastic).clear();
193 std::vector < G4int >::iterator it;
196 if ( ie == *it )
return true;
217 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
224 std::map < G4String , G4int > co_dic;
229 for (
size_t i = 0 ; i < numberOfMaterials ; i++ )
231 G4Material* material = (*theMaterialTable)[i];
233 for (
size_t j = 0 ; j < numberOfElements ; j++ )
238 G4int ts_ID_of_this_geometry;
240 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
242 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
246 ts_ID_of_this_geometry = co_dic.size();
247 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
254 dic.insert( std::pair < std::pair < G4Material* , const G4Element* > ,
G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
263 for (
size_t i = 0 ; i < numberOfElements ; i++ )
265 const G4Element* element = (*theElementTable)[i];
270 G4int ts_ID_of_this_geometry;
272 if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
274 ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) ->
second;
278 ts_ID_of_this_geometry = co_dic.size();
279 co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
286 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 ) );
292 G4cout <<
"Neutron HP Thermal Scattering Data: Following material-element pairs and/or elements are registered." <<
G4endl;
293 for ( std::map < std::pair < const G4Material* , const G4Element* > ,
G4int >::iterator it =
dic.begin() ; it !=
dic.end() ; it++ )
295 if ( it->first.first != NULL )
297 G4cout <<
"Material " << it->first.first->GetName() <<
" - Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
301 G4cout <<
"Element " << it->first.second->GetName() <<
", internal thermal scattering id " << it->second <<
G4endl;
321 if (
coherent == NULL )
coherent =
new std::map< G4int , std::map< G4double , G4NeutronHPVector* >* >;
322 if (
incoherent == NULL )
incoherent =
new std::map< G4int , std::map< G4double , G4NeutronHPVector* >* >;
323 if (
inelastic == NULL )
inelastic =
new std::map< G4int , std::map< G4double , G4NeutronHPVector* >* >;
328 if ( !getenv(
"G4NEUTRONHPDATA" ) )
329 throw G4HadronicException(__FILE__, __LINE__,
"Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
330 G4String baseName = getenv(
"G4NEUTRONHPDATA" );
332 dirName = baseName +
"/ThermalScattering";
337 for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )
339 ndl_filename = it->
first;
340 G4int ts_ID = it->second;
343 full_name = dirName +
"/Coherent/CrossSection/" + ndl_filename;
344 std::map< G4double , G4NeutronHPVector* >* coh_amapTemp_EnergyCross =
readData( full_name );
345 (*coherent).insert ( std::pair <
G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , coh_amapTemp_EnergyCross ) );
348 full_name = dirName +
"/Incoherent/CrossSection/" + ndl_filename;
349 std::map< G4double , G4NeutronHPVector* >* incoh_amapTemp_EnergyCross =
readData( full_name );
350 (*incoherent).insert ( std::pair <
G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , incoh_amapTemp_EnergyCross ) );
353 full_name = dirName +
"/Inelastic/CrossSection/" + ndl_filename;
354 std::map< G4double , G4NeutronHPVector* >* inela_amapTemp_EnergyCross =
readData( full_name );
355 (*inelastic).insert ( std::pair <
G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , inela_amapTemp_EnergyCross ) );
372 std::map< G4double , G4NeutronHPVector* >* aData =
new std::map< G4double , G4NeutronHPVector* >;
375 std::istringstream theChannel;
381 while ( theChannel >> dummy )
389 anEnergyCross->
Init ( theChannel , nData ,
eV ,
barn );
390 aData->insert ( std::pair < G4double , G4NeutronHPVector* > ( temp , anEnergyCross ) );
403 throw G4HadronicException(__FILE__, __LINE__,
"Attempt to use NeutronHP data for particles other than neutrons!!!");
455 if ( ts_id == -1 )
return result;
459 G4double Xcoh =
GetX ( aP , aT , (*coherent).find(ts_id)->second );
460 G4double Xincoh =
GetX ( aP , aT , (*incoherent).find(ts_id)->second );
461 G4double Xinela =
GetX ( aP , aT , (*inelastic).find(ts_id)->second );
463 result = Xcoh + Xincoh + Xinela;
476 result =
GetX ( aP , aT , (*inelastic).find( ts_id )->second );
485 result =
GetX ( aP , aT , (*coherent).find( ts_id )->second );
494 result =
GetX ( aP , aT , (*incoherent).find( ts_id )->second );
503 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) ) !=
dic.end() )
504 return dic.find( std::pair < const G4Material* , const G4Element* > ( (
G4Material*)NULL , element ) )->second;
505 if (
dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) !=
dic.end() )
506 return dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) )->second;
517 if ( amapTemp_EnergyCross->size() == 0 )
return result;
522 if ( amapTemp_EnergyCross->size() == 1 ) {
523 if ( std::fabs ( aT - amapTemp_EnergyCross->begin()->first ) / amapTemp_EnergyCross->begin()->first > 0.1 ) {
524 G4cout <<
"G4NeutronHPThermalScatteringData:: The temperature of material ("
525 << aT/
kelvin <<
"K) is different more than 10% from temperature of thermal scattering file expected ("
526 << amapTemp_EnergyCross->begin()->first <<
"K). Result may not be reliable."
529 result = amapTemp_EnergyCross->begin()->second->GetXsec ( eKinetic );
533 std::map< G4double , G4NeutronHPVector* >::iterator it;
534 for ( it = amapTemp_EnergyCross->begin() ; it != amapTemp_EnergyCross->end() ; it++ ) {
535 if ( aT < it->first )
break;
537 if ( it == amapTemp_EnergyCross->begin() && it != amapTemp_EnergyCross->end() ) it++;
538 if ( it != amapTemp_EnergyCross->begin() && it == amapTemp_EnergyCross->end() ) it--;
541 G4double XH = it->second->GetXsec ( eKinetic );
545 if ( it != amapTemp_EnergyCross->begin() ) it--;
547 G4double XL = it->second->GetXsec ( eKinetic );
555 G4double X = ( XH - XL ) / ( TH - TL ) * ( T - TL ) + XL;
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > * coherent
G4double GetIsoCrossSection(const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
std::map< std::pair< const G4Material *, const G4Element * >, G4int > dic
void RegisterThermalScatteringCoherentCrossSections(std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > *val)
G4double GetKineticEnergy() const
void RegisterThermalScatteringIncoherentCrossSections(std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > *val)
static G4NeutronHPManager * GetInstance()
G4NeutronHPThermalScatteringData()
G4double GetCoherentCrossSection(const G4DynamicParticle *, const G4Element *, const G4Material *)
const G4String & GetName() const
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > * inelastic
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > * GetThermalScatteringIncoherentCrossSections()
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 * > * > * GetThermalScatteringInelasticCrossSections()
const G4Element * GetElement(G4int iel) const
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > * incoherent
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()
std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > * GetThermalScatteringCoherentCrossSections()
static size_t GetNumberOfMaterials()
void RegisterThermalScatteringInelasticCrossSections(std::map< G4int, std::map< G4double, G4NeutronHPVector * > * > *val)
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
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 *)