Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InclAblaCascadeInterface.cc,v 1.13 2009/12/04 13:16:57 kaitanie Exp $
// $Id: G4InclAblaCascadeInterface.cc,v 1.20 2010/11/17 20:19:09 kaitanie Exp $
// Translation of INCL4.2/ABLA V3
// Pekka Kaitaniemi, HIP (translation)
// Christelle Schmidt, IPNL (fission code)
@@ -33,6 +33,7 @@
//#define DEBUGINCL 1
#include "G4InclAblaCascadeInterface.hh"
#include "G4FermiBreakUp.hh"
#include "math.h"
#include "G4GenericIon.hh"
#include "CLHEP/Random/Random.h"
@@ -45,10 +46,13 @@ G4InclAblaCascadeInterface::G4InclAblaCascadeInterface(const G4String& nam)
hazard->ial = (*table_entry);
varntp = new G4VarNtp();
calincl = new G4Calincl();
calincl = 0;
ws = new G4Ws();
mat = new G4Mat();
incl = new G4Incl(hazard, calincl, ws, mat, varntp);
if(!getenv("G4INCLABLANOFERMIBREAKUP")) { // Use Fermi Break-up by default if it is NOT explicitly disabled
incl->setUseFermiBreakUp(true);
}
verboseLevel = 0;
}
@@ -57,7 +61,6 @@ G4InclAblaCascadeInterface::~G4InclAblaCascadeInterface()
{
delete hazard;
delete varntp;
delete calincl;
delete ws;
delete mat;
delete incl;
@@ -67,8 +70,7 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
{
G4int maxTries = 200;
G4int particleI, n = 0;
G4int particleI;
G4int bulletType = 0;
// Print diagnostic messages: 0 = silent, 1 and 2 = verbose
@@ -85,20 +87,18 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
G4cout <<"G4InclAblaCascadeInterface: Now processing INCL4 event number:" << eventNumber << G4endl;
}
// INCL4 needs the energy in units MeV
G4double bulletE = aTrack.GetKineticEnergy() * MeV;
#ifdef DEBUGINCL
G4cout <<"Bullet energy = " << bulletE / MeV << G4endl;
#endif
G4double targetA = theNucleus.GetN();
G4double targetZ = theNucleus.GetZ();
G4double eKin;
G4double momx = 0.0, momy = 0.0, momz = 0.0;
G4DynamicParticle *cascadeParticle = 0;
G4ParticleDefinition *aParticleDefinition = 0;
G4FermiBreakUp *fermiBreakUp = new G4FermiBreakUp();
G4FragmentVector *theFermiBreakupResult = 0;
G4ParticleTable *theTableOfParticles = G4ParticleTable::GetParticleTable();
// INCL assumes the projectile particle is going in the direction of
// the Z-axis. Here we construct proper rotation to convert the
@@ -112,16 +112,11 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
theResult.Clear(); // Make sure the output data structure is clean.
// Map Geant4 particle types to corresponding INCL4 types.
enum bulletParticleType {nucleus = 0, proton = 1, neutron = 2, pionPlus = 3, pionZero = 4,
pionMinus = 5, deuteron = 6, triton = 7, he3 = 8, he4 = 9};
calincl = new G4InclInput(aTrack, theNucleus, false);
incl->setInput(calincl);
// Coding particles for use with INCL4 and ABLA
if (aTrack.GetDefinition() == G4Proton::Proton() ) bulletType = proton;
if (aTrack.GetDefinition() == G4Neutron::Neutron() ) bulletType = neutron;
if (aTrack.GetDefinition() == G4PionPlus::PionPlus() ) bulletType = pionPlus;
if (aTrack.GetDefinition() == G4PionMinus::PionMinus() ) bulletType = pionMinus;
if (aTrack.GetDefinition() == G4PionZero::PionZero() ) bulletType = pionZero;
// G4InclInput::printProjectileTargetInfo(aTrack, theNucleus);
// calincl->printInfo();
#ifdef DEBUGINCL
G4int baryonBullet = 0, chargeBullet = 0;
@@ -138,19 +133,8 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
G4cout <<"Energy in the beginning = " << labv.e() / MeV << G4endl;
#endif
for(int i = 0; i < 15; i++) {
calincl->f[i] = 0.0; // Initialize INCL input data
}
// Check wheter the input is acceptable.
if((bulletType != 0) && ((targetA != 1) && (targetZ != 1))) {
calincl->f[0] = targetA; // Target mass number
calincl->f[1] = targetZ; // Charge number
calincl->f[6] = bulletType; // Type
calincl->f[2] = bulletE; // Energy [MeV]
calincl->f[5] = 1.0; // Time scaling
calincl->f[4] = 45.0; // Nuclear potential
if((calincl->bulletType() != 0) && ((calincl->targetA() != 1) && (calincl->targetZ() != 1))) {
ws->nosurf = -2; // Nucleus surface, -2 = Woods-Saxon
ws->xfoisa = 8;
ws->npaulstr = 0;
@@ -159,8 +143,8 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
varntp->ntrack = 0;
mat->nbmat = 1;
mat->amat[0] = int(calincl->f[0]);
mat->zmat[0] = int(calincl->f[1]);
mat->amat[0] = int(calincl->targetA());
mat->zmat[0] = int(calincl->targetZ());
incl->initIncl(true);
@@ -169,7 +153,7 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
if(verboseLevel > 1) {
G4cout <<"G4InclAblaCascadeInterface: Try number = " << nTries << G4endl;
}
incl->processEventInclAbla(eventNumber);
incl->processEventInclAbla(calincl, eventNumber);
if(verboseLevel > 1) {
G4cout <<"G4InclAblaCascadeInterface: number of tracks = " << varntp->ntrack <<G4endl;
@@ -180,40 +164,20 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
/**
* Diagnostic output
*/
G4cout <<"G4InclAblaCascadeInterface: Bullet type: " << bulletType << G4endl;
G4cout <<"G4Incl4AblaCascadeInterface: Bullet energy: " << bulletE << " MeV" << G4endl;
G4cout <<"G4InclAblaCascadeInterface: Bullet type: " << calincl->bulletType() << G4endl;
G4cout <<"G4Incl4AblaCascadeInterface: Bullet energy: " << calincl->bulletE() << " MeV" << G4endl;
G4cout <<"G4InclAblaCascadeInterface: Target A: " << targetA << G4endl;
G4cout <<"G4InclAblaCascadeInterface: Target Z: " << targetZ << G4endl;
G4cout <<"G4InclAblaCascadeInterface: Target A: " << calincl->targetA() << G4endl;
G4cout <<"G4InclAblaCascadeInterface: Target Z: " << calincl->targetZ() << G4endl;
if(verboseLevel > 3) {
diagdata <<"G4InclAblaCascadeInterface: Bullet type: " << bulletType << G4endl;
diagdata <<"G4InclAblaCascadeInterface: Bullet energy: " << bulletE << " MeV" << G4endl;
diagdata <<"G4InclAblaCascadeInterface: Bullet type: " << calincl->bulletType() << G4endl;
diagdata <<"G4InclAblaCascadeInterface: Bullet energy: " << calincl->bulletE() << " MeV" << G4endl;
diagdata <<"G4InclAblaCascadeInterface: Target A: " << targetA << G4endl;
diagdata <<"G4InclAblaCascadeInterface: Target Z: " << targetZ << G4endl;
diagdata <<"G4InclAblaCascadeInterface: Target A: " << calincl->targetA() << G4endl;
diagdata <<"G4InclAblaCascadeInterface: Target Z: " << calincl->targetZ() << G4endl;
}
for(particleI = 0; particleI < varntp->ntrack; particleI++) {
G4cout << n << " " << calincl->f[6] << " " << calincl->f[2] << " ";
G4cout << varntp->massini << " " << varntp->mzini << " ";
G4cout << varntp->exini << " " << varntp->mulncasc << " " << varntp->mulnevap << " " << varntp->mulntot << " ";
G4cout << varntp->bimpact << " " << varntp->jremn << " " << varntp->kfis << " " << varntp->estfis << " ";
G4cout << varntp->izfis << " " << varntp->iafis << " " << varntp->ntrack << " " << varntp->itypcasc[particleI] << " ";
G4cout << varntp->avv[particleI] << " " << varntp->zvv[particleI] << " " << varntp->enerj[particleI] << " ";
G4cout << varntp->plab[particleI] << " " << varntp->tetlab[particleI] << " " << varntp->philab[particleI] << G4endl;
// For diagnostic output
if(verboseLevel > 3) {
diagdata << n << " " << calincl->f[6] << " " << calincl->f[2] << " ";
diagdata << varntp->massini << " " << varntp->mzini << " ";
diagdata << varntp->exini << " " << varntp->mulncasc << " " << varntp->mulnevap << " " << varntp->mulntot << " ";
diagdata << varntp->bimpact << " " << varntp->jremn << " " << varntp->kfis << " " << varntp->estfis << " ";
diagdata << varntp->izfis << " " << varntp->iafis << " " << varntp->ntrack << " ";
diagdata << varntp->itypcasc[particleI] << " ";
diagdata << varntp->avv[particleI] << " " << varntp->zvv[particleI] << " " << varntp->enerj[particleI] << " ";
diagdata << varntp->plab[particleI] << " " << varntp->tetlab[particleI] << " " << varntp->philab[particleI] << G4endl;
}
}
}
// Check whether a valid cascade was produced.
@@ -226,19 +190,8 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
theResult.SetStatusChange(stopAndKill);
if(bulletType == proton) {
aParticleDefinition = G4Proton::ProtonDefinition();
} else if(bulletType == neutron) {
aParticleDefinition = G4Neutron::NeutronDefinition();
} else if(bulletType == pionPlus) {
aParticleDefinition = G4PionPlus::PionPlusDefinition();
} else if(bulletType == pionZero) {
aParticleDefinition = G4PionZero::PionZeroDefinition();
} else if(bulletType == pionMinus) {
aParticleDefinition = G4PionMinus::PionMinusDefinition();
} else { // Projectile was not regognized
aParticleDefinition = 0;
}
G4int bulletType = calincl->bulletType();
aParticleDefinition = G4InclInput::getParticleDefinition(bulletType);
if(aParticleDefinition != 0) {
cascadeParticle = new G4DynamicParticle();
@@ -327,7 +280,6 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
if((varntp->avv[particleI] > 1) && (varntp->zvv[particleI] >= 1)) { // Nucleus fragment
G4ParticleDefinition * aIonDef = 0;
G4ParticleTable *theTableOfParticles = G4ParticleTable::GetParticleTable();
G4int A = G4int(varntp->avv[particleI]);
G4int Z = G4int(varntp->zvv[particleI]);
@@ -405,6 +357,108 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
}
}
// Finally do Fermi break-up if needed
if(varntp->needsFermiBreakup) {
// baryonNumberBalanceInINCL -= varntp->massini;
// chargeNumberBalanceInINCL -= varntp->mzini;
// Call Fermi Break-up
G4double nuclearMass = G4NucleiProperties::GetNuclearMass(G4int(varntp->massini), G4int(varntp->mzini)) + varntp->exini * MeV;
G4LorentzVector fragmentMomentum(varntp->pxrem * MeV, varntp->pyrem * MeV, varntp->pzrem * MeV,
varntp->erecrem * MeV + nuclearMass);
G4double momentumScaling = G4InclUtils::calculate4MomentumScaling(G4int(varntp->massini), G4int(varntp->mzini),
varntp->exini,
varntp->erecrem,
varntp->pxrem,
varntp->pyrem,
varntp->pzrem);
G4LorentzVector p4(momentumScaling * varntp->pxrem * MeV, momentumScaling * varntp->pyrem * MeV,
momentumScaling * varntp->pzrem * MeV,
varntp->erecrem + nuclearMass);
// For four-momentum, baryon number and charge conservation check:
G4LorentzVector fourMomentumBalance = p4;
G4int baryonNumberBalance = G4int(varntp->massini);
G4int chargeBalance = G4int(varntp->mzini);
G4LorentzRotation toFragmentZ;
toFragmentZ.rotateZ(-p4.theta());
toFragmentZ.rotateY(-p4.phi());
G4LorentzRotation toFragmentLab = toFragmentZ.inverse();
// p4 *= toFragmentZ;
G4LorentzVector p4rest = p4;
// p4rest.boost(-p4.boostVector());
if(verboseLevel > 0) {
G4cout <<"Cascade remnant nucleus:" << G4endl;
G4cout <<"p4: " << G4endl;
G4cout <<" px: " << p4.px() <<" py: " << p4.py() <<" pz: " << p4.pz() << G4endl;
G4cout <<" E = " << p4.e() << G4endl;
G4cout <<"p4rest: " << G4endl;
G4cout <<" px: " << p4rest.px() <<" py: " << p4rest.py() <<" pz: " << p4rest.pz() << G4endl;
G4cout <<" E = " << p4rest.e() << G4endl;
}
G4Fragment theCascadeRemnant(G4int(varntp->massini), G4int(varntp->mzini), p4rest);
theFermiBreakupResult = fermiBreakUp->BreakItUp(theCascadeRemnant);
if(theFermiBreakupResult != 0) {
G4FragmentVector::iterator fragment;
for(fragment = theFermiBreakupResult->begin(); fragment != theFermiBreakupResult->end(); fragment++) {
G4ParticleDefinition *theFragmentDefinition = 0;
if((*fragment)->GetA_asInt() == 1 && (*fragment)->GetZ_asInt() == 0) { // Neutron
theFragmentDefinition = G4Neutron::NeutronDefinition();
} else if ((*fragment)->GetA_asInt() == 1 && (*fragment)->GetZ_asInt() == 1) {
theFragmentDefinition = G4Proton::ProtonDefinition();
} else {
theFragmentDefinition = theTableOfParticles->GetIon((*fragment)->GetZ_asInt(), (*fragment)->GetA_asInt(), (*fragment)->GetExcitationEnergy());
}
if(theFragmentDefinition != 0) {
G4DynamicParticle *theFragment = new G4DynamicParticle(theFragmentDefinition, (*fragment)->GetMomentum());
G4LorentzVector labMomentum = theFragment->Get4Momentum();
// labMomentum.boost(p4.boostVector());
// labMomentum *= toFragmentLab;
// labMomentum *= toLabFrame;
theFragment->Set4Momentum(labMomentum);
fourMomentumBalance -= theFragment->Get4Momentum();
baryonNumberBalance -= theFragmentDefinition->GetAtomicMass();
chargeBalance -= theFragmentDefinition->GetAtomicNumber();
if(verboseLevel > 0) {
G4cout <<"Resulting fragment: " << G4endl;
G4cout <<" kinetic energy = " << theFragment->GetKineticEnergy() / MeV << " MeV" << G4endl;
G4cout <<" momentum = " << theFragment->GetMomentum().mag() / MeV << " MeV" << G4endl;
}
theResult.AddSecondary(theFragment);
} else {
G4cout <<"G4InclAblaCascadeInterface: Error. Fragment produced by Fermi break-up does not exist." << G4endl;
G4cout <<"Resulting fragment: " << G4endl;
G4cout <<" Z = " << (*fragment)->GetZ_asInt() << G4endl;
G4cout <<" A = " << (*fragment)->GetA_asInt() << G4endl;
G4cout <<" Excitation : " << (*fragment)->GetExcitationEnergy() / MeV << " MeV" << G4endl;
G4cout <<" momentum = " << (*fragment)->GetMomentum().mag() / MeV << " MeV" << G4endl;
}
}
delete theFermiBreakupResult;
theFermiBreakupResult = 0;
if(std::abs(fourMomentumBalance.mag() / MeV) > 0.1 * MeV) {
G4cout <<"Four-momentum balance after remnant nucleus Fermi break-up:" << G4endl;
G4cout <<"Magnitude: " << fourMomentumBalance.mag() / MeV << " MeV" << G4endl;
G4cout <<"Vector components (px, py, pz, E) = ("
<< fourMomentumBalance.px() << ", "
<< fourMomentumBalance.py() << ", "
<< fourMomentumBalance.pz() << ", "
<< fourMomentumBalance.e() << ")" << G4endl;
}
if(baryonNumberBalance != 0) {
G4cout <<"Baryon number balance after remnant nucleus Fermi break-up: " << baryonNumberBalance << G4endl;
}
if(chargeBalance != 0) {
G4cout <<"Charge balance after remnant nucleus Fermi break-up: " << chargeBalance << G4endl;
}
}
}
#ifdef DEBUGINCL
G4cout <<"--------------------------------------------------------------------------------" << G4endl;
G4double pt = std::sqrt(std::pow(labv.x(), 2) + std::pow(labv.y(), 2));
@@ -448,7 +502,6 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
else { // If the bullet type was not recognized by the interface, it will be returned back without any interaction.
theResult.SetStatusChange(stopAndKill);
G4ParticleTable *theTableOfParticles = G4ParticleTable::GetParticleTable();
cascadeParticle = new G4DynamicParticle(theTableOfParticles->FindParticle(aTrack.GetDefinition()), aTrack.Get4Momentum());
theResult.AddSecondary(cascadeParticle);
@@ -471,26 +524,26 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
}
}
if((targetA == 1) && (targetZ == 1)) { // Unsupported target
if((calincl->targetA() == 1) && (calincl->targetZ() == 1)) { // Unsupported target
if(verboseLevel > 1) {
G4cout <<"Unsupported target: " << G4endl;
G4cout <<"Target A: " << targetA << G4endl;
G4cout <<"TargetZ: " << targetZ << G4endl;
G4cout <<"Target A: " << calincl->targetA() << G4endl;
G4cout <<"TargetZ: " << calincl->targetZ() << G4endl;
}
if(verboseLevel > 3) {
diagdata <<"Unsupported target: " << G4endl;
diagdata <<"Target A: " << targetA << G4endl;
diagdata <<"TargetZ: " << targetZ << G4endl;
diagdata <<"Target A: " << calincl->targetA() << G4endl;
diagdata <<"TargetZ: " << calincl->targetZ() << G4endl;
}
}
if(bulletE < 100) { // INCL does not support E < 100 MeV.
if(calincl->bulletE() < 100) { // INCL does not support E < 100 MeV.
if(verboseLevel > 1) {
G4cout <<"Unsupported bullet energy: " << bulletE << " MeV. (Lower limit is 100 MeV)." << G4endl;
G4cout <<"Unsupported bullet energy: " << calincl->bulletE() << " MeV. (Lower limit is 100 MeV)." << G4endl;
G4cout <<"WARNING: Returning the original bullet with original energy back to Geant4." << G4endl;
}
if(verboseLevel > 3) {
diagdata <<"Unsupported bullet energy: " << bulletE << " MeV. (Lower limit is 100 MeV)." << G4endl;
diagdata <<"Unsupported bullet energy: " << calincl->bulletE() << " MeV. (Lower limit is 100 MeV)." << G4endl;
}
}
@@ -499,6 +552,9 @@ G4HadFinalState* G4InclAblaCascadeInterface::ApplyYourself(const G4HadProjectile
}
}
delete fermiBreakUp;
delete calincl;
calincl = 0;
return &theResult;
}