Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
@@ -390,6 +390,17 @@ G4HadFinalState* G4INCLXXInterface::ApplyYourself(const G4HadProjectile& aTrack,
const G4int Z = eventInfo.ZRem[i];
const G4int S = eventInfo.SRem[i];
// G4cout <<"INCL particle A = " << A << " Z = " << Z << " S= " << S << G4endl;
// Check that the remnant is a physical bound state: if not, resample the collision.
if(( Z == 0 && S == 0 && A > 1 ) || // No bound states for nn, nnn, nnnn, ...
( Z == 0 && S != 0 && A < 4 ) || // No bound states for nl, ll, nnl, nll, lll
( Z != 0 && S != 0 && A == Z + std::abs(S) )) { // No bound states for pl, ppl, pll, ...
std::stringstream ss;
ss << "unphysical residual fragment : Z=" << Z << " S=" << S << " A=" << A
<< " skipping it and resampling the collision";
theInterfaceStore->EmitWarning(ss.str());
eventIsOK = false;
continue;
}
const G4double kinE = eventInfo.EKinRem[i];
const G4double px = eventInfo.pxRem[i];
const G4double py = eventInfo.pyRem[i];
@@ -443,38 +454,45 @@ G4HadFinalState* G4INCLXXInterface::ApplyYourself(const G4HadProjectile& aTrack,
remnants.push_back(remnant);
}
// Check four-momentum conservation
const G4LorentzVector violation4Momentum = fourMomentumOut - fourMomentumIn;
const G4double energyViolation = std::abs(violation4Momentum.e());
const G4double momentumViolation = violation4Momentum.rho();
if(energyViolation > G4INCLXXInterfaceStore::GetInstance()->GetConservationTolerance()) {
std::stringstream ss;
ss << "energy conservation violated by " << energyViolation/MeV << " MeV in "
<< aTrack.GetKineticEnergy()/MeV << "-MeV " << trackDefinition->GetParticleName()
<< " + " << theIonTable->GetIonName(theNucleus.GetZ_asInt(), theNucleus.GetA_asInt(), 0)
<< " inelastic reaction, in " << (inverseKinematics ? "inverse" : "direct") << " kinematics. Will resample.";
theInterfaceStore->EmitWarning(ss.str());
eventIsOK = false;
const G4int nSecondaries = theResult.GetNumberOfSecondaries();
for(G4int j=0; j<nSecondaries; ++j)
delete theResult.GetSecondary(j)->GetParticle();
theResult.Clear();
theResult.SetStatusChange(stopAndKill);
remnants.clear();
} else if(momentumViolation > G4INCLXXInterfaceStore::GetInstance()->GetConservationTolerance()) {
std::stringstream ss;
ss << "momentum conservation violated by " << momentumViolation/MeV << " MeV in "
<< aTrack.GetKineticEnergy()/MeV << "-MeV " << trackDefinition->GetParticleName()
<< " + " << theIonTable->GetIonName(theNucleus.GetZ_asInt(), theNucleus.GetA_asInt(), 0)
<< " inelastic reaction, in " << (inverseKinematics ? "inverse" : "direct") << " kinematics. Will resample.";
theInterfaceStore->EmitWarning(ss.str());
eventIsOK = false;
const G4int nSecondaries = theResult.GetNumberOfSecondaries();
for(G4int j=0; j<nSecondaries; ++j)
delete theResult.GetSecondary(j)->GetParticle();
// Give up is the event is not ok (e.g. unphysical residual)
if(!eventIsOK) {
const G4int nSecondaries = (G4int)theResult.GetNumberOfSecondaries();
for(G4int j=0; j<nSecondaries; ++j) delete theResult.GetSecondary(j)->GetParticle();
theResult.Clear();
theResult.SetStatusChange(stopAndKill);
remnants.clear();
} else {
// Check four-momentum conservation
const G4LorentzVector violation4Momentum = fourMomentumOut - fourMomentumIn;
const G4double energyViolation = std::abs(violation4Momentum.e());
const G4double momentumViolation = violation4Momentum.rho();
if(energyViolation > G4INCLXXInterfaceStore::GetInstance()->GetConservationTolerance()) {
std::stringstream ss;
ss << "energy conservation violated by " << energyViolation/MeV << " MeV in "
<< aTrack.GetKineticEnergy()/MeV << "-MeV " << trackDefinition->GetParticleName()
<< " + " << theIonTable->GetIonName(theNucleus.GetZ_asInt(), theNucleus.GetA_asInt(), 0)
<< " inelastic reaction, in " << (inverseKinematics ? "inverse" : "direct") << " kinematics. Will resample.";
theInterfaceStore->EmitWarning(ss.str());
eventIsOK = false;
const G4int nSecondaries = (G4int)theResult.GetNumberOfSecondaries();
for(G4int j=0; j<nSecondaries; ++j) delete theResult.GetSecondary(j)->GetParticle();
theResult.Clear();
theResult.SetStatusChange(stopAndKill);
remnants.clear();
} else if(momentumViolation > G4INCLXXInterfaceStore::GetInstance()->GetConservationTolerance()) {
std::stringstream ss;
ss << "momentum conservation violated by " << momentumViolation/MeV << " MeV in "
<< aTrack.GetKineticEnergy()/MeV << "-MeV " << trackDefinition->GetParticleName()
<< " + " << theIonTable->GetIonName(theNucleus.GetZ_asInt(), theNucleus.GetA_asInt(), 0)
<< " inelastic reaction, in " << (inverseKinematics ? "inverse" : "direct") << " kinematics. Will resample.";
theInterfaceStore->EmitWarning(ss.str());
eventIsOK = false;
const G4int nSecondaries = (G4int)theResult.GetNumberOfSecondaries();
for(G4int j=0; j<nSecondaries; ++j) delete theResult.GetSecondary(j)->GetParticle();
theResult.Clear();
theResult.SetStatusChange(stopAndKill);
remnants.clear();
}
}
}
nTries++;
@@ -642,7 +660,7 @@ G4double G4INCLXXInterface::remnant4MomentumScaling(G4double mass,
void G4INCLXXInterface::ModelDescription(std::ostream& outFile) const {
outFile
<< "The Lige Intranuclear Cascade (INCL++) is a model for reactions induced\n"
<< "The Liège Intranuclear Cascade (INCL++) is a model for reactions induced\n"
<< "by nucleons, pions and light ion on any nucleus. The reaction is\n"
<< "described as an avalanche of binary nucleon-nucleon collisions, which can\n"
<< "lead to the emission of energetic particles and to the formation of an\n"