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;
130 std::map< G4int , std::map< G4double , G4ParticleHPVector* >* >::iterator
it;
131 std::map< G4double , G4ParticleHPVector* >::iterator itt;
136 if ( it->second != NULL )
138 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
151 if ( it->second != NULL )
153 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
166 if ( it->second != NULL )
168 for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
195 std::vector < G4int >::iterator
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++ )
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;
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 ) );
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!!!");
456 if ( ts_id == -1 )
return result;
464 result = Xcoh + Xincoh + Xinela;
477 result =
GetX ( aP , aT ,
inelastic->find( ts_id )->second );
486 result =
GetX ( aP , aT ,
coherent->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" ;