Import Geant4 10.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2017-06-30 10:49:55 +02:00
parent 3a5407696b
commit 1a1316fea4
2180 changed files with 237880 additions and 59109 deletions
@@ -81,13 +81,16 @@
G4ParticleHPCapture::~G4ParticleHPCapture()
{
//delete [] theCapture;
if ( theCapture != NULL ) {
for ( std::vector<G4ParticleHPChannel*>::iterator
ite = theCapture->begin() ; ite != theCapture->end() ; ite++ ) {
delete *ite;
//vector is shared, only master deletes
if ( ! G4Threading::IsWorkerThread() ) {
if ( theCapture != NULL ) {
for ( std::vector<G4ParticleHPChannel*>::iterator
ite = theCapture->begin() ; ite != theCapture->end() ; ite++ ) {
delete *ite;
}
theCapture->clear();
}
theCapture->clear();
}
}
}
#include "G4ParticleHPThermalBoost.hh"
@@ -73,14 +73,17 @@
G4ParticleHPElastic::~G4ParticleHPElastic()
{
//delete [] theElastic;
if ( theElastic != NULL ) {
for ( std::vector<G4ParticleHPChannel*>::iterator
it = theElastic->begin() ; it != theElastic->end() ; it++ ) {
delete *it;
//the vectror is shared among threads, only master deletes
if ( ! G4Threading::IsWorkerThread() ) {
//delete [] theElastic;
if ( theElastic != NULL ) {
for ( std::vector<G4ParticleHPChannel*>::iterator
it = theElastic->begin() ; it != theElastic->end() ; it++ ) {
delete *it;
}
theElastic->clear();
}
theElastic->clear();
}
}
}
#include "G4ParticleHPThermalBoost.hh"
@@ -126,9 +126,9 @@ void G4ParticleHPElasticFS::Init (G4double A, G4double Z, G4int M, G4String & di
{
G4int nEnergy_Legendre;
theData >> nEnergy_Legendre;
if ( nEnergy_Legendre == 0 ) {
if ( nEnergy_Legendre <= 0 ) {
std::stringstream iss;
iss << "G4ParticleHPElasticFS::Init Data Error repFlag is 3 but nEnergy_Legendre is 0.";
iss << "G4ParticleHPElasticFS::Init Data Error repFlag is 3 but nEnergy_Legendre <= 0";
iss << "Z, A and M of problematic file is " << theNDLDataZ << ", " << theNDLDataA << " and " << theNDLDataM << " respectively.";
throw G4HadronicException(__FILE__, __LINE__, iss.str() );
}
@@ -142,15 +142,30 @@ G4ReactionProductVector * G4ParticleHPEnAngCorrelation::Sample(G4double anEnergy
double targetA = fCache.Get().theTarget->GetDefinition()->GetAtomicMass();
targetZ += fCache.Get().theProjectileRP->GetDefinition()->GetAtomicNumber();
targetA += fCache.Get().theProjectileRP->GetDefinition()->GetAtomicMass();
if( bAdjustFinalState ) {
if ( (sumZ != targetZ || sumA != targetA ) &&
(sumZ > targetZ || sumA > targetA
|| ! G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 ) ) ){ // e.g. Z=3, A=2
bNPOK = false;
//nParticles.clear();
if ( bAdjustFinalState ) {
/*
G4cout << "TKDB G4ParticleHPEnAngCorrelation::Sample 1" << G4endl;
G4cout << "TKDB "
<< "targetZ = " << targetZ
<< ", targetA = " << targetA
<< ", sumZ = " << sumZ
<< ", sumA = " << sumA
<< ", int( targetZ-sumZ ) = " << int( targetZ-sumZ )
<< ", int( targetA-sumA ) = " << int( targetA-sumA )
//<< ", G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 ) = " << G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 )
<< G4endl;
*/
//if ( (sumZ != targetZ || sumA != targetA ) &&
// (sumZ > targetZ || sumA > targetA
// || ! G4IonTable::GetIonTable()->GetIon ( int(targetZ - sumZ), (int)(targetA - sumA), 0.0 ) ) ){ // e.g. Z=3, A=2
if ( ( sumZ != targetZ || sumA != targetA )
&& ( sumZ > targetZ || sumA > targetA || (targetZ-sumZ) >= (targetA-sumA) ) ) {
// e.g. Z=3, A=2
bNPOK = false;
//nParticles.clear();
#ifdef G4PHPDEBUG
if( getenv("G4ParticleHPDebug") )
G4cerr << " WRONG MULTIPLICITY Z= " << sumZ
if ( getenv("G4ParticleHPDebug") )
G4cerr << " WRONG MULTIPLICITY Z= " << sumZ
<< " > " << targetZ
<< " A= " << sumA
<< " > " << targetA << G4endl;
@@ -40,6 +40,7 @@
#include "G4Proton.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
#include "G4He3.hh"
#include "G4Alpha.hh"
void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
@@ -58,6 +59,7 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
G4int imaxA = -1;
for ( int i = 0 ; i < nSecondaries ; i++ )
{
//G4cout << "G4ParticleHPFinalState::adjust_final_state theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetParticleName() = " << theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetParticleName() << G4endl;
sum_Z += theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicNumber();
max_SecZ = std::max ( max_SecZ , theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicNumber() );
sum_A += theResult.Get()->GetSecondary( i )->GetParticle()->GetDefinition()->GetAtomicMass();
@@ -84,6 +86,9 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
} else if( theProjectile == G4Triton::Triton() ) {
baseZNew ++;
baseANew += 3;
} else if( theProjectile == G4He3::He3() ) {
baseZNew += 2;
baseANew += 3;
} else if( theProjectile == G4Alpha::Alpha() ) {
baseZNew += 2;
baseANew += 4;
@@ -102,7 +107,7 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
}
else
{
if ( max_SecA > int(baseANew - sum_A) )
if ( max_SecA >= int(baseANew - sum_A) )
{
//Most heavy secondary is interpreted as residual
resi_pd = theResult.Get()->GetSecondary( imaxA )->GetParticle()->GetDefinition();
@@ -118,8 +123,9 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
{
if ( int(baseZNew - sum_Z) == 0 && (int)(baseANew - sum_A) > 0 )
{
//In this case, one neutron is added to secondaries
if ( int(baseANew - sum_A) > 1 ) G4cout << "More than one neutron is required for the balance of baryon number!" << G4endl;
oneMoreSec_pd = theProjectile;
oneMoreSec_pd = G4Neutron::Neutron();
}
else
{
@@ -154,6 +160,9 @@ void G4ParticleHPFinalState::adjust_final_state ( G4LorentzVector init_4p_lab )
} else if( theProjectile == G4Triton::Triton() ) {
ndlZNew ++;
ndlANew += 3;
} else if( theProjectile == G4He3::He3() ) {
ndlZNew += 2;
ndlANew += 3;
} else if( theProjectile == G4Alpha::Alpha() ) {
ndlZNew += 2;
ndlANew += 4;
@@ -78,14 +78,17 @@
G4ParticleHPFission::~G4ParticleHPFission()
{
//Vector is shared, only master deletes it
//delete [] theFission;
if ( theFission != NULL ) {
for ( std::vector<G4ParticleHPChannel*>::iterator
it = theFission->begin() ; it != theFission->end() ; it++ ) {
delete *it;
if ( ! G4Threading::IsMasterThread() ) {
if ( theFission != NULL ) {
for ( std::vector<G4ParticleHPChannel*>::iterator
it = theFission->begin() ; it != theFission->end() ; it++ ) {
delete *it;
}
theFission->clear();
}
theFission->clear();
}
}
}
#include "G4ParticleHPThermalBoost.hh"
@@ -234,12 +234,15 @@ throw G4HadronicException(__FILE__, __LINE__, "Channel: Do not know what to do w
G4ParticleHPInelastic::~G4ParticleHPInelastic()
{
// delete [] theInelastic;
if ( theInelastic != NULL ) {
for ( std::vector<G4ParticleHPChannelList*>::iterator
it = theInelastic->begin() ; it != theInelastic->end() ; it++ ) {
delete *it;
//Vector is shared, only master deletes
if ( !G4Threading::IsWorkerThread() ) {
if ( theInelastic != NULL ) {
for ( std::vector<G4ParticleHPChannelList*>::iterator
it = theInelastic->begin() ; it != theInelastic->end() ; it++ ) {
delete *it;
}
theInelastic->clear();
}
theInelastic->clear();
}
}
@@ -306,6 +306,7 @@ void G4ParticleHPInelasticBaseFS::BaseApply(const G4HadProjectile & theTrack,
G4int maxA = 0;
G4int jAtMaxA = 0;
for ( G4int j = 0 ; j != (G4int)tmpHadrons->size() ; j++ ) {
//G4cout << __FILE__ << " " << __LINE__ << "th line: tmpHadrons->at(j)->GetDefinition()->GetParticleName() = " << tmpHadrons->at(j)->GetDefinition()->GetParticleName() << G4endl;
if ( tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber() > maxA ) {
maxA = tmpHadrons->at(j)->GetDefinition()->GetBaryonNumber();
jAtMaxA = j;
@@ -316,7 +316,6 @@
if ( x1-x2 == 0 ) {
//Following block added for avoiding div 0 error on Release + G4FPE_DEBUG
for ( G4int j=start; j<current; j++ ) {
x = theData[j].GetX();
y = (y2+y1)/2.;
if ( std::abs( y-theData[j].GetY() ) > precision*y ) {
aBuff[++count] = theData[current-1]; // for this one, everything was fine