G4LENDModel Class Reference

#include <G4LENDModel.hh>

Inheritance diagram for G4LENDModel:

G4HadronicInteraction G4LENDCapture G4LENDElastic G4LENDFission G4LENDInelastic

Public Member Functions

 G4LENDModel (G4String name="LENDModel")
 ~G4LENDModel ()
virtual G4HadFinalStateApplyYourself (const G4HadProjectile &aTrack, G4Nucleus &aTargetNucleus)
void ChangeDefaultEvaluation (G4String name)
void AllowNaturalAbundanceTarget ()
void AllowAnyCandidateTarget ()
void BuildPhysicsTable (const G4ParticleDefinition &)

Protected Member Functions

void create_used_target_map ()
void recreate_used_target_map ()

Protected Attributes

G4ParticleDefinitionproj
G4LENDManagerlend_manager
std::map< G4int, G4LENDUsedTarget * > usedTarget_map

Detailed Description

Definition at line 49 of file G4LENDModel.hh.


Constructor & Destructor Documentation

G4LENDModel::G4LENDModel ( G4String  name = "LENDModel"  ) 

Definition at line 45 of file G4LENDModel.cc.

References G4LENDManager::GetInstance(), lend_manager, G4HadronicInteraction::SetMaxEnergy(), and G4HadronicInteraction::SetMinEnergy().

00046 :G4HadronicInteraction( name )
00047 {
00048 
00049    SetMinEnergy( 0.*eV );
00050    SetMaxEnergy( 20.*MeV );
00051 
00052    default_evaluation = "endl99"; 
00053    allow_nat = false;
00054    allow_any = false;
00055 
00056    lend_manager = G4LENDManager::GetInstance();  
00057 
00058 }

G4LENDModel::~G4LENDModel (  ) 

Definition at line 60 of file G4LENDModel.cc.

References usedTarget_map.

00061 {
00062    for ( std::map< G4int , G4LENDUsedTarget* >::iterator 
00063          it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
00064    { 
00065       delete it->second;  
00066    }
00067 }


Member Function Documentation

void G4LENDModel::AllowAnyCandidateTarget (  )  [inline]

Definition at line 62 of file G4LENDModel.hh.

References recreate_used_target_map().

Referenced by G4NeutronLENDBuilder::Build().

00062 { allow_any = true; recreate_used_target_map(); };

void G4LENDModel::AllowNaturalAbundanceTarget (  )  [inline]

Definition at line 61 of file G4LENDModel.hh.

References recreate_used_target_map().

00061 { allow_nat = true; recreate_used_target_map(); };

G4HadFinalState * G4LENDModel::ApplyYourself ( const G4HadProjectile aTrack,
G4Nucleus aTargetNucleus 
) [virtual]

Implements G4HadronicInteraction.

Reimplemented in G4LENDCapture, G4LENDElastic, G4LENDFission, and G4LENDInelastic.

Definition at line 166 of file G4LENDModel.cc.

References G4HadFinalState::AddSecondary(), G4ParticleTable::FindIon(), G4UniformRand, G4HadProjectile::Get4Momentum(), G4Nucleus::GetA_asInt(), G4HadProjectile::GetDefinition(), G4GIDI_target::getElasticFinalState(), G4ReactionProduct::GetKineticEnergy(), G4HadProjectile::GetKineticEnergy(), G4ReactionProduct::GetMass(), G4HadProjectile::GetMaterial(), G4ReactionProduct::GetMomentum(), G4LENDManager::GetNucleusEncoding(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetPDGMass(), G4Material::GetTemperature(), G4ReactionProduct::GetTotalEnergy(), G4ReactionProduct::GetTotalMomentum(), G4Nucleus::GetZ_asInt(), lend_manager, G4ReactionProduct::Lorentz(), G4DynamicParticle::SetDefinition(), G4HadFinalState::SetEnergyChange(), G4ReactionProduct::SetKineticEnergy(), G4ReactionProduct::SetMass(), G4DynamicParticle::SetMomentum(), G4ReactionProduct::SetMomentum(), G4HadFinalState::SetMomentumChange(), G4ReactionProduct::SetTotalEnergy(), and usedTarget_map.

00167 {
00168 
00169    G4double temp = aTrack.GetMaterial()->GetTemperature();
00170 
00171    //G4int iZ = int ( aTarg.GetZ() );
00172    //G4int iA = int ( aTarg.GetN() );
00173    //migrate to integer A and Z (GetN_asInt returns number of neutrons in the nucleus since this) 
00174    G4int iZ = aTarg.GetZ_asInt();
00175    G4int iA = aTarg.GetA_asInt();
00176 
00177    G4double ke = aTrack.GetKineticEnergy();
00178 
00179    G4HadFinalState* theResult = new G4HadFinalState();
00180 
00181    G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA ) )->second->GetTarget();
00182 
00183    G4double aMu = aTarget->getElasticFinalState( ke*MeV, temp, NULL, NULL );
00184 
00185    G4double phi = twopi*G4UniformRand();
00186    G4double theta = std::acos( aMu );
00187    //G4double sinth = std::sin( theta );
00188 
00189    G4ReactionProduct theNeutron( const_cast<G4ParticleDefinition *>( aTrack.GetDefinition() ) );
00190    theNeutron.SetMomentum( aTrack.Get4Momentum().vect() );
00191    theNeutron.SetKineticEnergy( ke );
00192 
00193    G4ReactionProduct theTarget( G4ParticleTable::GetParticleTable()->FindIon( iZ , iA , 0 , iZ ) );
00194 
00195    G4double mass = G4ParticleTable::GetParticleTable()->FindIon( iZ , iA , 0 , iZ )->GetPDGMass();
00196 
00197 // add Thermal motion 
00198    G4double kT = k_Boltzmann*temp;
00199    G4ThreeVector v ( G4RandGauss::shoot() * std::sqrt( kT*mass ) 
00200                    , G4RandGauss::shoot() * std::sqrt( kT*mass ) 
00201                    , G4RandGauss::shoot() * std::sqrt( kT*mass ) );
00202 
00203    theTarget.SetMomentum( v );
00204 
00205 
00206      G4ThreeVector the3Neutron = theNeutron.GetMomentum();
00207      G4double nEnergy = theNeutron.GetTotalEnergy();
00208      G4ThreeVector the3Target = theTarget.GetMomentum();
00209      G4double tEnergy = theTarget.GetTotalEnergy();
00210      G4ReactionProduct theCMS;
00211      G4double totE = nEnergy+tEnergy;
00212      G4ThreeVector the3CMS = the3Target+the3Neutron;
00213      theCMS.SetMomentum(the3CMS);
00214      G4double cmsMom = std::sqrt(the3CMS*the3CMS);
00215      G4double sqrts = std::sqrt((totE-cmsMom)*(totE+cmsMom));
00216      theCMS.SetMass(sqrts);
00217      theCMS.SetTotalEnergy(totE);
00218 
00219        theNeutron.Lorentz(theNeutron, theCMS);
00220        theTarget.Lorentz(theTarget, theCMS);
00221        G4double en = theNeutron.GetTotalMomentum(); // already in CMS.
00222        G4ThreeVector cms3Mom=theNeutron.GetMomentum(); // for neutron direction in CMS
00223        G4double cms_theta=cms3Mom.theta();
00224        G4double cms_phi=cms3Mom.phi();
00225        G4ThreeVector tempVector;
00226        tempVector.setX(std::cos(theta)*std::sin(cms_theta)*std::cos(cms_phi)
00227                        +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::cos(cms_phi)
00228                        -std::sin(theta)*std::sin(phi)*std::sin(cms_phi)  );
00229        tempVector.setY(std::cos(theta)*std::sin(cms_theta)*std::sin(cms_phi)
00230                        +std::sin(theta)*std::cos(phi)*std::cos(cms_theta)*std::sin(cms_phi)
00231                        +std::sin(theta)*std::sin(phi)*std::cos(cms_phi)  );
00232        tempVector.setZ(std::cos(theta)*std::cos(cms_theta)
00233                        -std::sin(theta)*std::cos(phi)*std::sin(cms_theta)  );
00234        tempVector *= en;
00235        theNeutron.SetMomentum(tempVector);
00236        theTarget.SetMomentum(-tempVector);
00237        G4double tP = theTarget.GetTotalMomentum();
00238        G4double tM = theTarget.GetMass();
00239        theTarget.SetTotalEnergy(std::sqrt((tP+tM)*(tP+tM)-2.*tP*tM));
00240        theNeutron.Lorentz(theNeutron, -1.*theCMS);
00241        theTarget.Lorentz(theTarget, -1.*theCMS);
00242 
00243      theResult->SetEnergyChange(theNeutron.GetKineticEnergy());
00244      theResult->SetMomentumChange(theNeutron.GetMomentum().unit());
00245      G4DynamicParticle* theRecoil = new G4DynamicParticle;
00246 
00247      theRecoil->SetDefinition( G4ParticleTable::GetParticleTable()->FindIon( iZ, iA , 0, iZ ) );
00248      theRecoil->SetMomentum( theTarget.GetMomentum() );
00249 
00250      theResult->AddSecondary( theRecoil );
00251 
00252    return theResult; 
00253 
00254 }

void G4LENDModel::BuildPhysicsTable ( const G4ParticleDefinition  )  [inline]

Definition at line 64 of file G4LENDModel.hh.

References recreate_used_target_map().

void G4LENDModel::ChangeDefaultEvaluation ( G4String  name  )  [inline]

Definition at line 60 of file G4LENDModel.hh.

References recreate_used_target_map().

Referenced by G4NeutronLENDBuilder::Build().

00060 { default_evaluation = name; recreate_used_target_map(); };

void G4LENDModel::create_used_target_map (  )  [protected]

Definition at line 86 of file G4LENDModel.cc.

References G4LENDUsedTarget::AllowAny(), G4LENDUsedTarget::AllowNat(), G4cout, G4endl, G4Element::GetElementTable(), G4NistElementBuilder::GetIsotopeAbundance(), G4HadronicInteraction::GetModelName(), G4LENDManager::GetNistElementBuilder(), G4NistElementBuilder::GetNistFirstIsotopeN(), G4LENDManager::GetNucleusEncoding(), G4Element::GetNumberOfElements(), G4NistElementBuilder::GetNumberOfNistIsotopes(), lend_manager, proj, G4LENDManager::RequestChangeOfVerboseLevel(), usedTarget_map, and G4HadronicInteraction::verboseLevel.

Referenced by G4LENDCapture::G4LENDCapture(), G4LENDElastic::G4LENDElastic(), G4LENDFission::G4LENDFission(), G4LENDInelastic::G4LENDInelastic(), and recreate_used_target_map().

00087 {
00088 
00089    lend_manager->RequestChangeOfVerboseLevel( verboseLevel );
00090 
00091    size_t numberOfElements = G4Element::GetNumberOfElements();
00092    static const G4ElementTable* theElementTable = G4Element::GetElementTable();
00093 
00094    for ( size_t i = 0 ; i < numberOfElements ; ++i )
00095    {
00096 
00097       const G4Element* anElement = (*theElementTable)[i];
00098       G4int numberOfIsotope = anElement->GetNumberOfIsotopes(); 
00099 
00100       if ( numberOfIsotope > 0 )
00101       {
00102       // User Defined Abundances   
00103          for ( G4int i_iso = 0 ; i_iso < numberOfIsotope ; i_iso++ )
00104          {
00105             G4int iZ = anElement->GetIsotope( i_iso )->GetZ();
00106             G4int iA = anElement->GetIsotope( i_iso )->GetN();
00107 
00108             G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iA );  
00109             if ( allow_nat == true ) aTarget->AllowNat();
00110             if ( allow_any == true ) aTarget->AllowAny();
00111             usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iA ) , aTarget ) );
00112          }
00113       }
00114       else
00115       {
00116       // Natural Abundances   
00117          G4NistElementBuilder* nistElementBuild = lend_manager->GetNistElementBuilder();
00118          G4int iZ = int ( anElement->GetZ() );
00119          //G4cout << nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) ) << G4endl;
00120          G4int numberOfNistIso = nistElementBuild->GetNumberOfNistIsotopes( int ( anElement->GetZ() ) ); 
00121 
00122          for ( G4int ii = 0 ; ii < numberOfNistIso ; ii++ )
00123          {
00124             //G4cout << nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + i ) << G4endl;
00125             if ( nistElementBuild->GetIsotopeAbundance( iZ , nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii ) > 0 )
00126             {
00127                G4int iMass = nistElementBuild->GetNistFirstIsotopeN( iZ ) + ii;  
00128                //G4cout << iZ << " " << nistElementBuild->GetNistFirstIsotopeN( iZ ) + i << " " << nistElementBuild->GetIsotopeAbundance ( iZ , iMass ) << G4endl;  
00129 
00130                G4LENDUsedTarget* aTarget = new G4LENDUsedTarget ( proj , default_evaluation , iZ , iMass );  
00131                if ( allow_nat == true ) aTarget->AllowNat();
00132                if ( allow_any == true ) aTarget->AllowAny();
00133                usedTarget_map.insert( std::pair< G4int , G4LENDUsedTarget* > ( lend_manager->GetNucleusEncoding( iZ , iMass ) , aTarget ) );
00134 
00135             }
00136 
00137          }
00138 
00139       }
00140    }
00141 
00142 
00143 
00144    G4cout << "Dump UsedTarget for " << GetModelName() << G4endl;
00145    G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) , Pointer of Target" << G4endl;
00146    for ( std::map< G4int , G4LENDUsedTarget* >::iterator 
00147          it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
00148    {
00149       G4cout 
00150          << " " << it->second->GetWantedEvaluation() 
00151          << ", " << it->second->GetWantedZ() 
00152          << ", " << it->second->GetWantedA() 
00153          << " -> " << it->second->GetActualEvaluation() 
00154          << ", " << it->second->GetActualZ() 
00155          << ", " << it->second->GetActualA() 
00156          << ", " << it->second->GetTarget() 
00157          << G4endl; 
00158    } 
00159 
00160 }

void G4LENDModel::recreate_used_target_map (  )  [protected]

Definition at line 70 of file G4LENDModel.cc.

References create_used_target_map(), and usedTarget_map.

Referenced by AllowAnyCandidateTarget(), AllowNaturalAbundanceTarget(), BuildPhysicsTable(), and ChangeDefaultEvaluation().

00071 {
00072 
00073    for ( std::map< G4int , G4LENDUsedTarget* >::iterator 
00074          it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
00075    { 
00076       delete it->second;  
00077    }
00078    usedTarget_map.clear();
00079 
00080    create_used_target_map();
00081 
00082 }


Field Documentation

G4LENDManager* G4LENDModel::lend_manager [protected]

Definition at line 78 of file G4LENDModel.hh.

Referenced by ApplyYourself(), G4LENDInelastic::ApplyYourself(), G4LENDFission::ApplyYourself(), G4LENDElastic::ApplyYourself(), G4LENDCapture::ApplyYourself(), create_used_target_map(), and G4LENDModel().

G4ParticleDefinition* G4LENDModel::proj [protected]

Definition at line 77 of file G4LENDModel.hh.

Referenced by create_used_target_map(), G4LENDCapture::G4LENDCapture(), G4LENDElastic::G4LENDElastic(), G4LENDFission::G4LENDFission(), and G4LENDInelastic::G4LENDInelastic().

std::map< G4int , G4LENDUsedTarget* > G4LENDModel::usedTarget_map [protected]

Definition at line 79 of file G4LENDModel.hh.

Referenced by ApplyYourself(), G4LENDInelastic::ApplyYourself(), G4LENDFission::ApplyYourself(), G4LENDElastic::ApplyYourself(), G4LENDCapture::ApplyYourself(), create_used_target_map(), recreate_used_target_map(), and ~G4LENDModel().


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