G4NeutronHPThermalScatteringData Class Reference

#include <G4NeutronHPThermalScatteringData.hh>

Inheritance diagram for G4NeutronHPThermalScatteringData:

G4VCrossSectionDataSet

Public Member Functions

 G4NeutronHPThermalScatteringData ()
 ~G4NeutronHPThermalScatteringData ()
G4bool IsIsoApplicable (const G4DynamicParticle *, G4int, G4int, const G4Element *, const G4Material *)
G4double GetIsoCrossSection (const G4DynamicParticle *, G4int, G4int, const G4Isotope *, const G4Element *, const G4Material *)
G4bool IsApplicable (const G4DynamicParticle *, const G4Element *)
G4double GetCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetInelasticCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetCoherentCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
G4double GetIncoherentCrossSection (const G4DynamicParticle *, const G4Element *, const G4Material *)
void BuildPhysicsTable (const G4ParticleDefinition &)
void DumpPhysicsTable (const G4ParticleDefinition &)

Detailed Description

Definition at line 58 of file G4NeutronHPThermalScatteringData.hh.


Constructor & Destructor Documentation

G4NeutronHPThermalScatteringData::G4NeutronHPThermalScatteringData (  ) 

Definition at line 51 of file G4NeutronHPThermalScatteringData.cc.

References G4VCrossSectionDataSet::SetMaxKinEnergy(), and G4VCrossSectionDataSet::SetMinKinEnergy().

00052 :G4VCrossSectionDataSet("NeutronHPThermalScatteringData")
00053 {
00054 // Upper limit of neutron energy 
00055    emax = 4*eV;
00056    SetMinKinEnergy( 0*MeV );                                   
00057    SetMaxKinEnergy( emax );                                   
00058 
00059    ke_cache = 0.0;
00060    xs_cache = 0.0;
00061    element_cache = NULL;
00062    material_cache = NULL;
00063 
00064    indexOfThermalElement.clear(); 
00065 
00066    names = new G4NeutronHPThermalScatteringNames();
00067 
00068    //BuildPhysicsTable( *G4Neutron::Neutron() );
00069 }

G4NeutronHPThermalScatteringData::~G4NeutronHPThermalScatteringData (  ) 

Definition at line 71 of file G4NeutronHPThermalScatteringData.cc.

00072 {
00073 
00074    clearCurrentXSData();
00075 
00076    delete names;
00077 }


Member Function Documentation

void G4NeutronHPThermalScatteringData::BuildPhysicsTable ( const G4ParticleDefinition  )  [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 204 of file G4NeutronHPThermalScatteringData.cc.

References G4String::first(), G4cout, G4endl, G4Element::GetElementTable(), G4Material::GetMaterialTable(), G4Element::GetNumberOfElements(), G4Material::GetNumberOfMaterials(), G4NeutronHPThermalScatteringNames::GetTS_NDL_Name(), G4NeutronHPThermalScatteringNames::IsThisThermalElement(), and G4Neutron::Neutron().

Referenced by G4NeutronHPThermalScattering::G4NeutronHPThermalScattering().

00205 {
00206 
00207    if ( &aP != G4Neutron::Neutron() ) 
00208       throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");  
00209 
00210    //std::map < std::pair < G4Material* , const G4Element* > , G4int > dic;   
00211    dic.clear();   
00212    clearCurrentXSData();
00213    std::map < G4String , G4int > co_dic;   
00214 
00215    //Searching Nist Materials
00216    static const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
00217    size_t numberOfMaterials = G4Material::GetNumberOfMaterials();
00218    for ( size_t i = 0 ; i < numberOfMaterials ; i++ )
00219    {
00220       G4Material* material = (*theMaterialTable)[i];
00221       size_t numberOfElements = material->GetNumberOfElements();
00222       for ( size_t j = 0 ; j < numberOfElements ; j++ )
00223       {
00224          const G4Element* element = material->GetElement(j);
00225          if ( names->IsThisThermalElement ( material->GetName() , element->GetName() ) )
00226          {                                    
00227             G4int ts_ID_of_this_geometry; 
00228             G4String ts_ndl_name = names->GetTS_NDL_Name( material->GetName() , element->GetName() ); 
00229             if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
00230             {
00231                ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
00232             }
00233             else
00234             {
00235                ts_ID_of_this_geometry = co_dic.size();
00236                co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
00237             }
00238 
00239             //G4cout << "Neutron HP Thermal Scattering Data : Registering a material-element pair of " 
00240             //       << material->GetName() << " " << element->GetName() 
00241             //       << " as internal thermal scattering id of  " <<  ts_ID_of_this_geometry << "." << G4endl;
00242 
00243             dic.insert( std::pair < std::pair < G4Material* , const G4Element* > , G4int > ( std::pair < G4Material* , const G4Element* > ( material , element ) , ts_ID_of_this_geometry ) );
00244          }
00245       }
00246    }
00247 
00248    //Searching TS Elements 
00249    static const G4ElementTable* theElementTable = G4Element::GetElementTable();
00250    size_t numberOfElements = G4Element::GetNumberOfElements();
00251    //size_t numberOfThermalElements = 0; 
00252    for ( size_t i = 0 ; i < numberOfElements ; i++ )
00253    {
00254       const G4Element* element = (*theElementTable)[i];
00255       if ( names->IsThisThermalElement ( element->GetName() ) )
00256       {
00257          if ( names->IsThisThermalElement ( element->GetName() ) )
00258          {                                    
00259             G4int ts_ID_of_this_geometry; 
00260             G4String ts_ndl_name = names->GetTS_NDL_Name( element->GetName() ); 
00261             if ( co_dic.find ( ts_ndl_name ) != co_dic.end() )
00262             {
00263                ts_ID_of_this_geometry = co_dic.find ( ts_ndl_name ) -> second;
00264             }
00265             else
00266             {
00267                ts_ID_of_this_geometry = co_dic.size();
00268                co_dic.insert ( std::pair< G4String , G4int >( ts_ndl_name , ts_ID_of_this_geometry ) );
00269             }
00270 
00271             //G4cout << "Neutron HP Thermal Scattering: Registering an element of " 
00272             //       << material->GetName() << " " << element->GetName() 
00273             //       << " as internal thermal scattering id of  " <<  ts_ID_of_this_geometry << "." << G4endl;
00274 
00275             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 ) );
00276          }
00277       }
00278    }
00279 
00280    G4cout << G4endl;
00281    G4cout << "Neutron HP Thermal Scattering Data: Following material-element pairs and/or elements are registered." << G4endl;
00282    for ( std::map < std::pair < const G4Material* , const G4Element* > , G4int >::iterator it = dic.begin() ; it != dic.end() ; it++ )   
00283    {
00284       if ( it->first.first != NULL ) 
00285       {
00286          G4cout << "Material " << it->first.first->GetName() << " - Element " << it->first.second->GetName() << ",  internal thermal scattering id " << it->second << G4endl;
00287       }
00288       else
00289       {
00290          G4cout << "Element " << it->first.second->GetName() << ",  internal thermal scattering id " << it->second << G4endl;
00291       }
00292    }
00293    G4cout << G4endl;
00294 
00295 
00296    //G4cout << "Neutron HP Thermal Scattering Data: Following NDL thermal scattering files are assigned to the internal thermal scattering id." << G4endl;
00297    //for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )  
00298    //{
00299    //   G4cout << "NDL file name " << it->first << ", internal thermal scattering id " << it->second << G4endl;
00300    //}
00301 
00302 
00303    // Read Cross Section Data files
00304 
00305    G4String dirName;
00306    if ( !getenv( "G4NEUTRONHPDATA" ) ) 
00307       throw G4HadronicException(__FILE__, __LINE__, "Please setenv G4NEUTRONHPDATA to point to the neutron cross-section files.");
00308    G4String baseName = getenv( "G4NEUTRONHPDATA" );
00309 
00310    dirName = baseName + "/ThermalScattering";
00311 
00312    G4String ndl_filename;
00313    G4String full_name;
00314 
00315    for ( std::map < G4String , G4int >::iterator it = co_dic.begin() ; it != co_dic.end() ; it++ )  
00316    {
00317       ndl_filename = it->first;
00318       G4int ts_ID = it->second;
00319 
00320       // Coherent
00321       full_name = dirName + "/Coherent/CrossSection/" + ndl_filename; 
00322       std::map< G4double , G4NeutronHPVector* >*  coh_amapTemp_EnergyCross = readData( full_name );
00323       coherent.insert ( std::pair < G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , coh_amapTemp_EnergyCross ) );
00324 
00325       // Incoherent
00326       full_name = dirName + "/Incoherent/CrossSection/" + ndl_filename; 
00327       std::map< G4double , G4NeutronHPVector* >*  incoh_amapTemp_EnergyCross = readData( full_name );
00328       incoherent.insert ( std::pair < G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , incoh_amapTemp_EnergyCross ) );
00329 
00330       // Inelastic
00331       full_name = dirName + "/Inelastic/CrossSection/" + ndl_filename; 
00332       std::map< G4double , G4NeutronHPVector* >*  inela_amapTemp_EnergyCross = readData( full_name );
00333       inelastic.insert ( std::pair < G4int , std::map< G4double , G4NeutronHPVector* >* > ( ts_ID , inela_amapTemp_EnergyCross ) );
00334 
00335    }
00336 
00337 }

void G4NeutronHPThermalScatteringData::DumpPhysicsTable ( const G4ParticleDefinition  )  [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 370 of file G4NeutronHPThermalScatteringData.cc.

References G4Neutron::Neutron().

00371 {
00372    if( &aP != G4Neutron::Neutron() ) 
00373      throw G4HadronicException(__FILE__, __LINE__, "Attempt to use NeutronHP data for particles other than neutrons!!!");  
00374 //  G4cout << "G4NeutronHPThermalScatteringData::DumpPhysicsTable still to be implemented"<<G4endl;
00375 }

G4double G4NeutronHPThermalScatteringData::GetCoherentCrossSection ( const G4DynamicParticle ,
const G4Element ,
const G4Material  
)

Definition at line 450 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

Referenced by G4NeutronHPThermalScattering::ApplyYourself().

00451 {
00452    G4double result = 0;
00453    G4int ts_id = getTS_ID( aM , anE );
00454    G4double aT = aM->GetTemperature();
00455    result = GetX ( aP , aT , coherent.find( ts_id )->second );
00456    return result;
00457 }

G4double G4NeutronHPThermalScatteringData::GetCrossSection ( const G4DynamicParticle ,
const G4Element ,
const G4Material  
)

Reimplemented from G4VCrossSectionDataSet.

Definition at line 419 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

Referenced by G4NeutronHPThermalScattering::ApplyYourself(), and GetIsoCrossSection().

00420 {
00421    G4double result = 0;
00422    
00423    G4int ts_id =getTS_ID( aM , anE );
00424 
00425    if ( ts_id == -1 ) return result;
00426 
00427    G4double aT = aM->GetTemperature();
00428 
00429    G4double Xcoh = GetX ( aP , aT , coherent.find(ts_id)->second );
00430    G4double Xincoh = GetX ( aP , aT , incoherent.find(ts_id)->second );
00431    G4double Xinela = GetX ( aP , aT , inelastic.find(ts_id)->second );
00432 
00433    result = Xcoh + Xincoh + Xinela;
00434 
00435    //G4cout << "G4NeutronHPThermalScatteringData::GetCrossSection  Tot= " << result/barn << " Coherent= " << Xcoh/barn << " Incoherent= " << Xincoh/barn << " Inelastic= " << Xinela/barn << G4endl;
00436 
00437    return result;
00438 }

G4double G4NeutronHPThermalScatteringData::GetIncoherentCrossSection ( const G4DynamicParticle ,
const G4Element ,
const G4Material  
)

Definition at line 459 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

00460 {
00461    G4double result = 0;
00462    G4int ts_id = getTS_ID( aM , anE );
00463    G4double aT = aM->GetTemperature();
00464    result = GetX ( aP , aT , incoherent.find( ts_id )->second );
00465    return result;
00466 }

G4double G4NeutronHPThermalScatteringData::GetInelasticCrossSection ( const G4DynamicParticle ,
const G4Element ,
const G4Material  
)

Definition at line 441 of file G4NeutronHPThermalScatteringData.cc.

References G4Material::GetTemperature().

Referenced by G4NeutronHPThermalScattering::ApplyYourself().

00442 {
00443    G4double result = 0;
00444    G4int ts_id = getTS_ID( aM , anE );
00445    G4double aT = aM->GetTemperature();
00446    result = GetX ( aP , aT , inelastic.find( ts_id )->second );
00447    return result;
00448 }

G4double G4NeutronHPThermalScatteringData::GetIsoCrossSection ( const G4DynamicParticle ,
G4int  ,
G4int  ,
const G4Isotope ,
const G4Element ,
const G4Material  
) [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 104 of file G4NeutronHPThermalScatteringData.cc.

References GetCrossSection(), and G4DynamicParticle::GetKineticEnergy().

00109 {
00110    if ( dp->GetKineticEnergy() == ke_cache && element == element_cache &&  material == material_cache ) return xs_cache;
00111 
00112    ke_cache = dp->GetKineticEnergy();
00113    element_cache = element;
00114    material_cache = material;
00115    //G4double xs = GetCrossSection( dp , element , material->GetTemperature() );
00116    G4double xs = GetCrossSection( dp , element , material );
00117    xs_cache = xs;
00118    return xs;
00119    //return GetCrossSection( dp , element , material->GetTemperature() );
00120 }

G4bool G4NeutronHPThermalScatteringData::IsApplicable ( const G4DynamicParticle ,
const G4Element  
)

Definition at line 171 of file G4NeutronHPThermalScatteringData.cc.

References G4DynamicParticle::GetDefinition(), G4Element::GetIndex(), G4DynamicParticle::GetKineticEnergy(), and G4Neutron::Neutron().

00172 {
00173    G4bool result = false;
00174 
00175    G4double eKin = aP->GetKineticEnergy();
00176    // Check energy 
00177    if ( eKin < emax )
00178    {
00179       // Check Particle Species
00180       if ( aP->GetDefinition() == G4Neutron::Neutron() ) 
00181       {
00182         // anEle is one of Thermal elements 
00183          G4int ie = (G4int) anEle->GetIndex();
00184          std::vector < G4int >::iterator it; 
00185          for ( it = indexOfThermalElement.begin() ; it != indexOfThermalElement.end() ; it++ )
00186          {
00187              if ( ie == *it ) return true;
00188          }
00189       }
00190    }
00191 
00192 /*
00193    if ( names->IsThisThermalElement ( anEle->GetName() ) )
00194    {
00195       // Check energy and projectile species 
00196       G4double eKin = aP->GetKineticEnergy();
00197       if ( eKin < emax && aP->GetDefinition() == G4Neutron::Neutron() ) result = true; 
00198    }
00199 */
00200    return result;
00201 }

G4bool G4NeutronHPThermalScatteringData::IsIsoApplicable ( const G4DynamicParticle ,
G4int  ,
G4int  ,
const G4Element ,
const G4Material  
) [virtual]

Reimplemented from G4VCrossSectionDataSet.

Definition at line 79 of file G4NeutronHPThermalScatteringData.cc.

References G4DynamicParticle::GetDefinition(), G4DynamicParticle::GetKineticEnergy(), and G4Neutron::Neutron().

00083 {
00084    G4double eKin = dp->GetKineticEnergy();
00085    if ( eKin > 4.0*eV //GetMaxKinEnergy() 
00086      || eKin < 0 //GetMinKinEnergy() 
00087      || dp->GetDefinition() != G4Neutron::Neutron() ) return false;                                   
00088 
00089    if ( dic.find( std::pair < const G4Material* , const G4Element* > ( (G4Material*)NULL , element ) ) != dic.end() 
00090      || dic.find( std::pair < const G4Material* , const G4Element* > ( material , element ) ) != dic.end() ) return true;
00091 
00092    return false;
00093 
00094 //   return IsApplicable( dp , element );
00095 /*
00096    G4double eKin = dp->GetKineticEnergy();
00097    if ( eKin > 4.0*eV //GetMaxKinEnergy() 
00098      || eKin < 0 //GetMinKinEnergy() 
00099      || dp->GetDefinition() != G4Neutron::Neutron() ) return false;                                   
00100    return true;
00101 */
00102 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:43 2013 for Geant4 by  doxygen 1.4.7