Import Geant4 9.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:46:55 +02:00
parent 89a9605df1
commit b1eb5424d2
10957 changed files with 888481 additions and 160139 deletions
@@ -78,12 +78,18 @@ G4bool G4Absorber::Absorb(G4KineticTrack & kt, G4KineticTrackVector & tgt)
G4bool G4Absorber::FindAbsorbers(G4KineticTrack & kt,
G4KineticTrackVector & tgt)
{
// Find a closest ( in space) pair of Nucleons capable to absorb pi+/pi-
// pi+ can be absorbed on np or nn resulting in pp or np
// pi- can be absorbed on np or pp resulting in nn or np
// @GF: FindAbsorbers is unused, logic is seriously wrong
G4KineticTrack * kt1 = NULL;
G4KineticTrack * kt2 = NULL;
G4double dist1 = DBL_MAX;
G4double dist2 = DBL_MAX;
G4double dist1 = DBL_MAX; // dist to closest nucleon
G4double dist2 = DBL_MAX; // dist to next close
G4double charge1 = 0;
G4double charge2 = 0;
// G4double charge2 = 0; // charge2 is only assigned to, never used
G4double charge0 = kt.GetDefinition()->GetPDGCharge();
G4ThreeVector pos = kt.GetPosition();
@@ -96,28 +102,28 @@ G4bool G4Absorber::FindAbsorbers(G4KineticTrack & kt,
continue;
if(dist < dist1)
{
if(dist1 == DBL_MAX) // accept the candidate
if(dist1 == DBL_MAX) // accept 1st as a candidate,
{
kt1 = curr;
charge1 = kt1->GetDefinition()->GetPDGCharge();
dist1 = dist;
continue;
}
if(dist2 == DBL_MAX) // accept the candidate put kt1 in kt2
{
if(dist2 == DBL_MAX) // accept the candidate and shift kt1 to kt2
{ // @GF: should'nt we check if compatible?
kt2 = kt1;
charge2 = charge1;
// charge2 = charge1;
dist2 = dist1;
kt1 = curr;
charge1 = kt1->GetDefinition()->GetPDGCharge();
dist1 = dist;
continue;
}
// test the compatibility with charge conservation
// test the compatibility with charge conservation for new config
G4double charge = curr->GetDefinition()->GetPDGCharge();
if((charge0+charge1+charge < 0.) ||
if((charge0+charge1+charge < 0.) || //test config (curr,kt1)
(charge0+charge1+charge) > 2*eplus)
{ // incomatible: change kt1 with curr.
{ // incompatible: change kt1 with curr.
kt1 = curr;
charge1 = charge;
dist1 = dist;
@@ -125,7 +131,7 @@ G4bool G4Absorber::FindAbsorbers(G4KineticTrack & kt,
else
{ // compatible: change kt1 with curr and kt2 with kt1
kt2 = kt1;
charge2 = charge1;
// charge2 = charge1;
dist2 = dist1;
kt1 = curr;
charge1 = charge;
@@ -137,7 +143,7 @@ G4bool G4Absorber::FindAbsorbers(G4KineticTrack & kt,
if(dist2 == DBL_MAX) // accept the candidate
{
kt2 = curr;
charge2 = kt2->GetDefinition()->GetPDGCharge();
// charge2 = kt2->GetDefinition()->GetPDGCharge();
dist2 = dist;
continue;
}
@@ -148,7 +154,7 @@ G4bool G4Absorber::FindAbsorbers(G4KineticTrack & kt,
continue; // incomatible: do nothing
// compatible: change kt2 with curr
kt2 = curr;
charge2 = charge;
// charge2 = charge;
dist2 = dist;
}
File diff suppressed because it is too large Load Diff
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4GeneratorPrecompoundInterface.cc,v 1.11 2010/11/10 17:04:35 gunter Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4GeneratorPrecompoundInterface.cc,v 1.11 2010-11-10 17:04:35 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// -----------------------------------------------------------------------------
// GEANT 4 class file
@@ -33,7 +33,8 @@
// HPW, 10DEC 98, the decay part originally written by Gunter Folger
// in his FTF-test-program.
//
//
// M.Kelsey, 28 Jul 2011 -- Replace loop to decay input secondaries
// with new utility class, simplify cleanup loops
// -----------------------------------------------------------------------------
#include "G4GeneratorPrecompoundInterface.hh"
@@ -45,8 +46,13 @@
#include "G4Nucleon.hh"
#include "G4FragmentVector.hh"
#include "G4ReactionProduct.hh"
#include "G4ReactionProductVector.hh"
#include "G4PreCompoundModel.hh"
#include "G4ExcitationHandler.hh"
#include "G4DecayKineticTracks.hh"
#include <algorithm>
#include <vector>
G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(G4VPreCompoundModel* p)
: CaptureThreshold(10*MeV)
@@ -59,133 +65,153 @@ G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(G4VPreCompoundM
G4GeneratorPrecompoundInterface::~G4GeneratorPrecompoundInterface()
{}
// choose to calculate excitation energy from energy balance
#define exactExcitationEnergy
G4ReactionProductVector* G4GeneratorPrecompoundInterface::
Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus)
{
G4ReactionProductVector * theTotalResult = new G4ReactionProductVector;
G4ReactionProductVector * theTotalResult = new G4ReactionProductVector;
// decay the strong resonances
G4KineticTrackVector *result1, *secondaries, *result;
result1=theSecondaries;
result=new G4KineticTrackVector();
//G4cout << "### G4GeneratorPrecompoundInterface::Propagate "
// << result1->size() << " tracks " << theDeExcitation << G4endl;
for (unsigned int aResult=0; aResult < result1->size(); ++aResult)
{
G4ParticleDefinition * pdef;
pdef=result1->operator[](aResult)->GetDefinition();
secondaries=0;
if ( pdef->IsShortLived() )
{
secondaries = result1->operator[](aResult)->Decay();
}
if ( 0 == secondaries )
{
result->push_back(result1->operator[](aResult));
result1->operator[](aResult)=NULL; //protect for clearAndDestroy
}
else
{
unsigned int amax = secondaries->size();
for (unsigned int aSecondary=0; aSecondary<amax; ++aSecondary)
{
result1->push_back(secondaries->operator[](aSecondary));
}
delete secondaries;
}
}
//G4cout << "Delete tracks" << G4endl;
std::for_each(result1->begin(), result1->end(), DeleteKineticTrack());
delete result1;
// prepare the fragment
G4int anA=theNucleus->GetMassNumber();
G4int aZ=theNucleus->GetCharge();
G4int numberOfEx = 0;
G4int numberOfCh = 0;
G4int numberOfHoles = 0;
G4double exEnergy = 0.0;
G4double R = theNucleus->GetNuclearRadius();
G4ThreeVector exciton3Momentum(0.,0.,0.);
// decay the strong resonances
G4DecayKineticTracks decay(theSecondaries);
// loop over secondaries
unsigned int amax = result->size();
for(unsigned int list=0; list<amax; ++list)
{
G4KineticTrack *aTrack = result->operator[](list);
G4ParticleDefinition* part = aTrack->GetDefinition();
G4double e = aTrack->Get4Momentum().e();
G4double mass = aTrack->Get4Momentum().mag();
G4ThreeVector mom = aTrack->Get4Momentum().vect();
if((part != proton && part != neutron) ||
(e > mass + CaptureThreshold) ||
(aTrack->GetPosition().mag() > R))
{
G4ReactionProduct * theNew = new G4ReactionProduct(part);
theNew->SetMomentum(mom);
theNew->SetTotalEnergy(e);
theTotalResult->push_back(theNew);
}
else
{
// within the nucleus, neutron or proton
// now calculate A, Z of the fragment, momentum, number of exciton states
++anA;
++numberOfEx;
G4int Z = G4int(part->GetPDGCharge()/eplus + 0.1);
aZ += Z;
numberOfCh += Z;
exciton3Momentum += mom;
exEnergy += (e - mass);
}
}
// loop over wounded nucleus
G4Nucleon * theCurrentNucleon =
theNucleus->StartLoop() ? theNucleus->GetNextNucleon() : 0;
while(0 != theCurrentNucleon)
{
if(theCurrentNucleon->AreYouHit())
{
++numberOfHoles;
++numberOfEx;
--anA;
aZ -= G4int(theCurrentNucleon->GetDefinition()->GetPDGCharge()/eplus + 0.1);
exciton3Momentum -= theCurrentNucleon->Get4Momentum().vect();
exEnergy += theCurrentNucleon->GetBindingEnergy();
}
theCurrentNucleon = theNucleus->GetNextNucleon();
}
if(0!=anA && 0!=aZ)
{
G4double fMass = G4NucleiProperties::GetNuclearMass(anA, aZ);
fMass += exEnergy;
// prepare the fragment
G4int anA=theNucleus->GetMassNumber();
G4int aZ=theNucleus->GetCharge();
G4int numberOfEx = 0;
G4int numberOfCh = 0;
G4int numberOfHoles = 0;
G4double exEnergy = 0.0;
G4double R = theNucleus->GetNuclearRadius();
G4ThreeVector exciton3Momentum(0.,0.,0.);
G4LorentzVector exciton4Momentum(exciton3Momentum,
std::sqrt(exciton3Momentum.mag2() + fMass*fMass));
G4Fragment anInitialState(anA, aZ, exciton4Momentum);
anInitialState.SetNumberOfParticles(numberOfEx-numberOfHoles);
anInitialState.SetNumberOfCharged(numberOfCh);
anInitialState.SetNumberOfHoles(numberOfHoles);
G4ReactionProductVector * aPreResult = theDeExcitation->DeExcite(anInitialState);
// loop over secondaries
unsigned int amax = theSecondaries->size();
#ifdef exactExcitationEnergy
G4LorentzVector secondary4Momemtum(0,0,0,0);
#endif
for(unsigned int list=0; list<amax; ++list)
{
G4KineticTrack *aTrack = (*theSecondaries)[list];
G4ParticleDefinition* part = aTrack->GetDefinition();
G4double e = aTrack->Get4Momentum().e();
G4double mass = aTrack->Get4Momentum().mag();
G4ThreeVector mom = aTrack->Get4Momentum().vect();
if((part != proton && part != neutron) ||
(e > mass + CaptureThreshold) ||
(aTrack->GetPosition().mag() > R)) {
G4ReactionProduct * theNew = new G4ReactionProduct(part);
theNew->SetMomentum(mom);
theNew->SetTotalEnergy(e);
theTotalResult->push_back(theNew);
#ifdef exactExcitationEnergy
secondary4Momemtum += aTrack->Get4Momentum();
#endif
} else {
// within the nucleus, neutron or proton
// now calculate A, Z of the fragment, momentum, number of exciton states
++anA;
++numberOfEx;
G4int Z = G4int(part->GetPDGCharge()/eplus + 0.1);
aZ += Z;
numberOfCh += Z;
exciton3Momentum += mom;
exEnergy += (e - mass);
}
delete aTrack;
}
delete theSecondaries;
// fill pre-compound part into the result, and return
unsigned int amax = aPreResult->size();
for(unsigned int ll=0; ll<amax; ++ll)
{
theTotalResult->push_back(aPreResult->operator[](ll));
}
delete aPreResult;
}
std::for_each(result->begin(), result->end(), DeleteKineticTrack());
delete result;
return theTotalResult;
// loop over wounded nucleus
G4Nucleon * theCurrentNucleon =
theNucleus->StartLoop() ? theNucleus->GetNextNucleon() : 0;
while(0 != theCurrentNucleon) {
if(theCurrentNucleon->AreYouHit()) {
++numberOfHoles;
++numberOfEx;
--anA;
aZ -= G4int(theCurrentNucleon->GetDefinition()->GetPDGCharge()/eplus + 0.1);
exciton3Momentum -= theCurrentNucleon->Get4Momentum().vect();
exEnergy += theCurrentNucleon->GetBindingEnergy();
}
theCurrentNucleon = theNucleus->GetNextNucleon();
}
if(0!=anA && 0!=aZ) {
G4double fMass = G4NucleiProperties::GetNuclearMass(anA, aZ);
#ifdef exactExcitationEnergy
// recalculate exEnergy from Energy balance....
const G4HadProjectile * primary = GetPrimaryProjectile();
G4double Einitial= primary->Get4Momentum().e()
+ G4NucleiProperties::GetNuclearMass(theNucleus->GetMassNumber(),theNucleus->GetCharge());
G4double Efinal = fMass + secondary4Momemtum.e();
if ( (Einitial - Efinal) > 0 ) {
// G4cout << "G4GPI::Propagate() : positive exact excitation Energy "
// << (Einitial - Efinal)/MeV << " MeV, exciton estimate " << exEnergy/MeV << " MeV" << G4endl;
exEnergy=Einitial - Efinal;
}
else {
// G4cout << "G4GeneratorPrecompoundInterface::Propagate() : negative exact excitation Energy "
// << (Einitial - Efinal)/MeV << " MeV, using exciton estimate " << exEnergy/MeV << " MeV" << G4endl;
exEnergy=0.;
}
#endif
fMass += exEnergy;
#ifdef exactExcitationEnergy
G4LorentzVector exciton4Momentum(exciton3Momentum, fMass);
#else
G4LorentzVector exciton4Momentum(exciton3Momentum,
std::sqrt(exciton3Momentum.mag2() + fMass*fMass));
#endif
if ( exEnergy > 0.0 ) { // Need to de-excite the remnant nucleus only if excitation energy > 0.
G4Fragment anInitialState(anA, aZ, exciton4Momentum);
anInitialState.SetNumberOfParticles(numberOfEx-numberOfHoles);
anInitialState.SetNumberOfCharged(numberOfCh);
anInitialState.SetNumberOfHoles(numberOfHoles);
G4ReactionProductVector * aPreResult = theDeExcitation->DeExcite(anInitialState);
// fill pre-compound part into the result, and return
unsigned int amax = aPreResult->size();
for(unsigned int ll=0; ll<amax; ++ll) {
theTotalResult->push_back(aPreResult->operator[](ll));
}
delete aPreResult;
} else { // No excitation energy, we only need to create the remnant nucleus
G4ParticleDefinition* theKindOfFragment = 0;
if (anA == 1 && aZ == 0) {
theKindOfFragment = G4Neutron::NeutronDefinition();
} else if (anA == 1 && aZ == 1) {
theKindOfFragment = G4Proton::ProtonDefinition();
} else if (anA == 2 && aZ == 1) {
theKindOfFragment = G4Deuteron::DeuteronDefinition();
} else if (anA == 3 && aZ == 1) {
theKindOfFragment = G4Triton::TritonDefinition();
} else if (anA == 3 && aZ == 2) {
theKindOfFragment = G4He3::He3Definition();
} else if (anA == 4 && aZ == 2) {
theKindOfFragment = G4Alpha::AlphaDefinition();;
} else {
theKindOfFragment =
G4ParticleTable::GetParticleTable()->GetIonTable()->GetIon(aZ,anA,0.0);
}
if (theKindOfFragment != 0) {
G4ReactionProduct * theNew = new G4ReactionProduct(theKindOfFragment);
theNew->SetMomentum(exciton3Momentum);
theNew->SetTotalEnergy(fMass);
//theNew->SetFormationTime(??0.??);
theTotalResult->push_back(theNew);
}
}
}
return theTotalResult;
}
G4HadFinalState* G4GeneratorPrecompoundInterface::
ApplyYourself(const G4HadProjectile &, G4Nucleus & )
{
@@ -143,7 +143,7 @@ G4double G4RKFieldIntegrator::Erf(G4double X)
H = 1 - std::exp(-V*V)*(C1+Y*(P30 + P31*Y)/(Q30 + Y))/V;
}
if (X < 0)
H =- H;
H = -H;
}
return H;
}