Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -52,8 +52,8 @@ G4HadFinalState * G4LENDCapture::ApplyYourself(const G4HadProjectile& aTrack, G4
G4HadFinalState* theResult = &theParticleChange;
theResult->Clear();
G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA , iM ) )->second->GetTarget();
//std::vector<G4GIDI_Product>* products = aTarget->getCaptureFinalState( ke*MeV, temp, NULL, NULL );
G4GIDI_target* aTarget = get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , iM ) );
if ( aTarget == NULL ) return returnUnchanged( aTrack , theResult );
std::vector<G4GIDI_Product>* products = aTarget->getCaptureFinalState( ke*MeV, temp, MyRNG, NULL );
G4int ipZ = aTrack.GetDefinition()->GetAtomicNumber();
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4LENDCombinedCrossSection.hh"
#include "G4LENDElasticCrossSection.hh"
#include "G4LENDInelasticCrossSection.hh"
#include "G4LENDCaptureCrossSection.hh"
#include "G4LENDFissionCrossSection.hh"
#include "Randomize.hh"
G4LENDCombinedCrossSection::G4LENDCombinedCrossSection( G4ParticleDefinition* pd )
:G4LENDCrossSection("LENDCombinedCrossSection")
{
proj = pd;
elasticXS = new G4LENDElasticCrossSection( pd );
inelasticXS = new G4LENDInelasticCrossSection( pd );
captureXS = new G4LENDCaptureCrossSection( pd );
fissionXS = new G4LENDFissionCrossSection( pd );
}
void G4LENDCombinedCrossSection::BuildPhysicsTable( const G4ParticleDefinition& pd )
{
elasticXS->BuildPhysicsTable( pd );
inelasticXS->BuildPhysicsTable( pd );
captureXS->BuildPhysicsTable( pd );
fissionXS->BuildPhysicsTable( pd );
create_used_target_map();
}
G4double G4LENDCombinedCrossSection::GetIsoCrossSection( const G4DynamicParticle* dp , G4int iZ , G4int iA ,
const G4Isotope* isotope , const G4Element* /*elment*/ , const G4Material* material )
{
G4double XS = 0.0;
XS += elasticXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
XS += inelasticXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
XS += captureXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
XS += fissionXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
//G4cout << "G4LENDCombinedCrossSection::GetIsoCrossSection " << XS/CLHEP::barn << " [barn]" << G4endl;
return XS;
}
G4int G4LENDCombinedCrossSection::SelectChannel( const G4DynamicParticle* dp , G4int iZ , G4int iA ,
const G4Isotope* isotope , const G4Element* /*elment*/ , const G4Material* material )
{
G4int ichannel=-1;
G4double XSs[4];
XSs[0] = elasticXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
XSs[1] = XSs[0] + inelasticXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
XSs[2] = XSs[1] + captureXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
XSs[3] = XSs[2] + fissionXS->GetIsoCrossSection( dp, iZ, iA, isotope, NULL , material );
G4double total = XSs[3];
G4double random = G4UniformRand();
for ( G4int i = 0 ; i != 4 ; i++ ) {
if ( random*total <= XSs[i] ) {
ichannel = i;
break;
}
}
return ichannel;
}
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4LENDCombinedModel.hh"
#include "G4LENDCombinedCrossSection.hh"
#include "G4LENDElastic.hh"
#include "G4LENDInelastic.hh"
#include "G4LENDCapture.hh"
#include "G4LENDFission.hh"
#include "G4DynamicParticle.hh"
G4LENDCombinedModel::G4LENDCombinedModel( G4ParticleDefinition* pd )
:G4LENDModel( "LENDCombinedModel" ) {
proj = pd;
crossSection = new G4LENDCombinedCrossSection( pd );
elastic = new G4LENDElastic( pd );
inelastic = new G4LENDInelastic( pd );
capture = new G4LENDCapture( pd );
fission = new G4LENDFission( pd );
channels[0] = elastic;
channels[1] = inelastic;
channels[2] = capture;
channels[3] = fission;
}
void G4LENDCombinedModel::BuildPhysicsTable(const G4ParticleDefinition& projectile) {
crossSection->BuildPhysicsTable( projectile );
create_used_target_map();
}
G4bool G4LENDCombinedModel::HasData( const G4DynamicParticle* , G4int iZ, G4int iA , G4int iM,
const G4Isotope* , const G4Element* , const G4Material* ) {
G4bool result = false;
if ( get_target_from_map ( lend_manager->GetNucleusEncoding ( iZ, iA , iM ) ) != NULL ) result=true;
return result;
}
G4HadFinalState * G4LENDCombinedModel::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aTarg ){
G4LENDModel* channel = NULL;
G4int iZ = aTarg.GetZ_asInt();
G4int iA = aTarg.GetA_asInt();
//To pass kinetic energy, need to generate dynamic particle
G4DynamicParticle* dp = new G4DynamicParticle( proj , G4ThreeVector(0.,0.,1.) , aTrack.GetKineticEnergy() );
G4int ichannel = crossSection->SelectChannel( dp , iZ , iA , aTarg.GetIsotope(), NULL , aTrack.GetMaterial() );
delete dp;
//ichannel=1;
channel = channels[ichannel];
return channel->ApplyYourself(aTrack,aTarg);
}
@@ -43,15 +43,41 @@
#include "G4ElementTable.hh"
#include "G4HadronicException.hh"
//TK110811
G4bool G4LENDCrossSection::IsIsoApplicable( const G4DynamicParticle* dp, G4int /*iZ*/ , G4int /*aA*/ ,
const G4Element* /*element*/ , const G4Material* /*material*/ )
G4bool G4LENDCrossSection::IsIsoApplicable( const G4DynamicParticle* dp, G4int iZ , G4int iA ,
const G4Element* element , const G4Material* /*material*/ )
{
G4double eKin = dp->GetKineticEnergy();
if ( dp->GetDefinition() != proj ) return false;
if ( eKin > GetMaxKinEnergy() || eKin < GetMinKinEnergy() ) return false;
return true;
//G4cout << "G4LENDCrossSection::GetIsoIsIsoApplicable this->GetName() = " << this->GetName() << ", iZ = " << iZ << ", iA = " << iA << ", allow_nat = " << allow_nat << G4endl;
//Check existence of target data
if ( element != NULL ) {
if ( element->GetNumberOfIsotopes() != 0 ) {
std::vector< const G4Isotope*> vIsotope;
for ( size_t i = 0 ; i != element->GetNumberOfIsotopes() ; i++ ) {
if ( element->GetIsotope( i )->GetN() == iA ) vIsotope.push_back( element->GetIsotope( i ) );
}
for ( size_t i = 0 ; i != vIsotope.size() ; i++ ) {
G4int iM = vIsotope[i]->Getm();
if ( get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , iM ) ) != NULL ) return true;
}
//No isomer has data
//Check natural aboundance data for the element
if ( get_target_from_map( lend_manager->GetNucleusEncoding( iZ , 0 , 0 ) ) != NULL ) return true;
} else {
//Check for iZ and iA under assuming iM = 0
if ( get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , 0 ) ) != NULL ) return true;
//Check natural aboundance data for the element
if ( get_target_from_map( lend_manager->GetNucleusEncoding( iZ , 0 , 0 ) ) != NULL ) return true;
}
} else {
//Check for iZ and iA under assuming iM = 0
if ( get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , 0 ) ) != NULL ) return true;
//Check natural aboundance data for iZ
if ( get_target_from_map( lend_manager->GetNucleusEncoding( iZ , 0 , 0 ) ) != NULL ) return true;
}
return false;
}
G4double G4LENDCrossSection::GetIsoCrossSection( const G4DynamicParticle* dp , G4int iZ , G4int iA ,
@@ -61,10 +87,18 @@ G4double G4LENDCrossSection::GetIsoCrossSection( const G4DynamicParticle* dp , G
G4double xs = 0.0;
G4double ke = dp->GetKineticEnergy();
G4double temp = material->GetTemperature();
G4int iM = isotope->Getm();
G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA , iM ) )->second->GetTarget();
G4int iM = 0;
if ( isotope != NULL ) iM = isotope->Getm();
G4GIDI_target* aTarget = get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , iM ) );
if ( aTarget == NULL ) {
G4String message;
message = this->GetName();
message += " is unexpectedly called.";
//G4Exception( "G4LEND::GetIsoCrossSection(,)" , "LENDCrossSection-01" , JustWarning ,
G4Exception( "G4LEND::GetIsoCrossSection(,)" , "LENDCrossSection-01" , FatalException ,
message );
}
xs = getLENDCrossSection ( aTarget , ke , temp );
return xs;
@@ -330,24 +364,7 @@ void G4LENDCrossSection::create_used_target_map()
}
}
}
G4cout << "Dump UsedTarget for " << GetName() << G4endl;
//G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) , Pointer of Target" << G4endl;
G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) " << G4endl;
for ( std::map< G4int , G4LENDUsedTarget* >::iterator
it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
{
G4cout
<< " " << it->second->GetWantedEvaluation()
<< ", " << it->second->GetWantedZ()
<< ", " << it->second->GetWantedA()
<< " -> " << it->second->GetActualEvaluation()
<< ", " << it->second->GetActualZ()
<< ", " << it->second->GetActualA()
//<< ", " << it->second->GetTarget()
<< G4endl;
}
DumpLENDTargetInfo();
}
// elow ehigh xs_elow xs_ehigh ke (ke < elow)
@@ -360,3 +377,32 @@ G4double G4LENDCrossSection::GetUltraLowEnergyExtrapolatedXS( G4double x1, G4dou
G4double result = a * 1/std::sqrt(ke) + b;
return result;
}
G4GIDI_target* G4LENDCrossSection::get_target_from_map( G4int nuclear_code ) {
G4GIDI_target* target = NULL;
if ( usedTarget_map.find( nuclear_code ) != usedTarget_map.end() ) {
target = usedTarget_map.find( nuclear_code )->second->GetTarget();
}
return target;
}
void G4LENDCrossSection::DumpLENDTargetInfo( G4bool force ) {
if ( lend_manager->GetVerboseLevel() >= 1 || force ) {
if ( usedTarget_map.size() == 0 ) create_used_target_map();
G4cout << "Dumping UsedTarget of " << GetName() << " for " << proj->GetParticleName() << G4endl;
G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) " << G4endl;
for ( std::map< G4int , G4LENDUsedTarget* >::iterator
it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ ) {
G4cout
<< " " << it->second->GetWantedEvaluation()
<< ", " << it->second->GetWantedZ()
<< ", " << it->second->GetWantedA()
<< " -> " << it->second->GetActualEvaluation()
<< ", " << it->second->GetActualZ()
<< ", " << it->second->GetActualA()
<< G4endl;
}
}
}
@@ -51,12 +51,12 @@ G4HadFinalState * G4LENDElastic::ApplyYourself(const G4HadProjectile& aTrack, G4
G4double ke = aTrack.GetKineticEnergy();
//G4HadFinalState* theResult = new G4HadFinalState();
G4HadFinalState* theResult = &theParticleChange;
theResult->Clear();
G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA , iM ) )->second->GetTarget();
//G4double aMu = aTarget->getElasticFinalState( ke*MeV, temp, NULL, NULL );
G4GIDI_target* aTarget = get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , iM ) );
if ( aTarget == NULL ) return returnUnchanged( aTrack , theResult );
G4double aMu = aTarget->getElasticFinalState( ke*MeV, temp, MyRNG , NULL );
G4double phi = twopi*G4UniformRand();
@@ -121,7 +121,8 @@ G4HadFinalState * G4LENDElastic::ApplyYourself(const G4HadProjectile& aTrack, G4
theTarget.SetTotalEnergy(std::sqrt((tP+tM)*(tP+tM)-2.*tP*tM));
theNeutron.Lorentz(theNeutron, -1.*theCMS);
theNeutron.Lorentz(theNeutron, -1.*theCMS);
theTarget.Lorentz(theTarget, -1.*theCMS);
//110913 Add Protection for very low energy (1e-6eV) scattering
if ( theNeutron.GetKineticEnergy() <= 0 )
@@ -129,22 +130,18 @@ G4HadFinalState * G4LENDElastic::ApplyYourself(const G4HadProjectile& aTrack, G4
theNeutron.SetTotalEnergy ( theNeutron.GetMass() * ( 1 + G4Pow::GetInstance()->powA( 10 , -15.65 ) ) );
}
theTarget.Lorentz(theTarget, -1.*theCMS);
if ( theTarget.GetKineticEnergy() < 0 )
{
theTarget.SetTotalEnergy ( theTarget.GetMass() * ( 1 + G4Pow::GetInstance()->powA( 10 , -15.65 ) ) );
}
//110913 END
theTarget.Lorentz(theTarget, -1.*theCMS);
theResult->SetEnergyChange(theNeutron.GetKineticEnergy());
theResult->SetMomentumChange(theNeutron.GetMomentum().unit());
G4DynamicParticle* theRecoil = new G4DynamicParticle;
theRecoil->SetDefinition( target_pd );
theRecoil->SetMomentum( theTarget.GetMomentum() );
theResult->AddSecondary( theRecoil );
return theResult;
@@ -47,7 +47,8 @@ G4HadFinalState * G4LENDFission::ApplyYourself(const G4HadProjectile& aTrack, G4
G4HadFinalState* theResult = &theParticleChange;
theResult->Clear();
G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA , iM ) )->second->GetTarget();
G4GIDI_target* aTarget = get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , iM ) );
if ( aTarget == NULL ) return returnUnchanged( aTrack , theResult );
std::vector<G4GIDI_Product>* products = aTarget->getFissionFinalState( ke*MeV, temp, MyRNG, NULL );
if ( products != NULL )
{
@@ -55,8 +55,8 @@ G4HadFinalState * G4LENDInelastic::ApplyYourself(const G4HadProjectile& aTrack,
G4HadFinalState* theResult = &theParticleChange;
theResult->Clear();
G4GIDI_target* aTarget = usedTarget_map.find( lend_manager->GetNucleusEncoding( iZ , iA , iM ) )->second->GetTarget();
//std::vector<G4GIDI_Product>* products = aTarget->getOthersFinalState( ke*MeV, temp, MyRNG, NULL );
G4GIDI_target* aTarget = get_target_from_map( lend_manager->GetNucleusEncoding( iZ , iA , iM ) );
if ( aTarget == NULL ) return returnUnchanged( aTrack , theResult );
std::vector<G4GIDI_Product>* products;
for ( G4int i = 0 ; i != 1024 ; i++ ) {
@@ -148,25 +148,7 @@ void G4LENDModel::create_used_target_map()
}
}
G4cout << "Dump UsedTarget for " << GetModelName() << G4endl;
//G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) , Pointer of Target" << G4endl;
G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) " << G4endl;
for ( std::map< G4int , G4LENDUsedTarget* >::iterator
it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ )
{
G4cout
<< " " << it->second->GetWantedEvaluation()
<< ", " << it->second->GetWantedZ()
<< ", " << it->second->GetWantedA()
<< " -> " << it->second->GetActualEvaluation()
<< ", " << it->second->GetActualZ()
<< ", " << it->second->GetActualA()
//<< ", " << it->second->GetTarget()
<< G4endl;
}
DumpLENDTargetInfo();
}
@@ -267,3 +249,45 @@ G4HadFinalState * G4LENDModel::ApplyYourself(const G4HadProjectile& aTrack, G4Nu
return theResult;
}
G4HadFinalState* G4LENDModel::returnUnchanged(const G4HadProjectile& aTrack, G4HadFinalState* theResult ) {
if ( lend_manager->GetVerboseLevel() >= 1 ) {
G4String message;
message = "Produce unchanged final state is requested in ";
message += this->GetModelName();
message += ". Cross section and model likely have an inconsistency.";
G4Exception( "G4LENDModel::returnUnchanged(,)" , "LENDModel-01" , JustWarning ,
message );
}
theResult->SetEnergyChange( aTrack.GetKineticEnergy() );
theResult->SetMomentumChange( aTrack.Get4Momentum().getV().unit() );
return theResult;
}
G4GIDI_target* G4LENDModel::get_target_from_map( G4int nuclear_code ) {
G4GIDI_target* target = NULL;
if ( usedTarget_map.find( nuclear_code ) != usedTarget_map.end() ) {
target = usedTarget_map.find( nuclear_code )->second->GetTarget();
}
return target;
}
void G4LENDModel::DumpLENDTargetInfo( G4bool force ) {
if ( lend_manager->GetVerboseLevel() >= 1 || force ) {
if ( usedTarget_map.size() == 0 ) create_used_target_map();
G4cout << "Dumping UsedTarget of " << GetModelName() << " for " << proj->GetParticleName() << G4endl;
G4cout << "Requested Evaluation, Z , A -> Actual Evaluation, Z , A(0=Nat) " << G4endl;
for ( std::map< G4int , G4LENDUsedTarget* >::iterator
it = usedTarget_map.begin() ; it != usedTarget_map.end() ; it ++ ) {
G4cout
<< " " << it->second->GetWantedEvaluation()
<< ", " << it->second->GetWantedZ()
<< ", " << it->second->GetWantedA()
<< " -> " << it->second->GetActualEvaluation()
<< ", " << it->second->GetActualZ()
<< ", " << it->second->GetActualA()
<< G4endl;
}
}
}
@@ -173,7 +173,7 @@ int MCGIDI_angular_parseFromTOM( statusMessageReporting *smr, xDataTOM_element *
err:
if( pdfXY != NULL ) ptwXY_free( pdfXY );
if( cdfX != NULL ) cdfX = ptwX_free( cdfX );
MCGIDI_angular_free( smr, angular );
if ( angular != NULL ) MCGIDI_angular_free( smr, angular );
return( 1 );
}
/*
@@ -111,6 +111,15 @@ int MCGIDI_outputChannel_parseFromTOM( statusMessageReporting *smr, xDataTOM_ele
targetMass_MeV = MCGIDI_reaction_getTargetMass_MeV( smr, reaction );
productMass_MeV = MCGIDI_product_getMass_MeV( smr, &(outputChannel->products[0]) );
residualMass_MeV = MCGIDI_product_getMass_MeV( smr, &(outputChannel->products[1]) );
//TK 17-11-10 for v1.3
//A temporary fix for emission of gamma(2.2MeV) from n captured by H
// capture gamma D
if ( reaction->ENDF_MT == 102 && productMass_MeV == 0 && ( outputChannel->products[1].pop->A == 2 && outputChannel->products[1].pop->Z == 1 ) ) {
//include/PoPs_data.h:#define e_Mass 5.4857990943e-4 /* electron mass in AMU */
residualMass_MeV += 5.4857990943e-4*MCGIDI_AMU2MeV;
}
MCGIDI_product_setTwoBodyMasses( smr, &(outputChannel->products[0]), projectileMass_MeV, targetMass_MeV, productMass_MeV, residualMass_MeV );
}
@@ -516,7 +516,8 @@ ptwXPoints *ptwXY_groupTwoFunctions( ptwXYPoints *ptwXY1, ptwXYPoints *ptwXY2, p
err:
ptwXY_free( ff );
if( gg != NULL ) ptwXY_free( gg );
if( f != NULL ) ptwXY_free( ff );
// Coverity #63063
if( f != NULL ) ptwXY_free( f );
if( g != NULL ) ptwXY_free( g );
if( groupedData != NULL ) ptwX_free( groupedData );
return( NULL );