Import Geant4 10.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 14:11:04 +02:00
parent c9b32a6c0a
commit d4af681f38
4886 changed files with 420149 additions and 1023309 deletions
@@ -14,6 +14,35 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
12 November 2015 V. Ivantchenko (hadr-stopping-V10-01-05)
--------------------------------------------------------------------
- G4HadronStoppingProcess - removed call to DeRegistration to avoid
a problem reported by Valgrind
09 September 2015 A. Ribon (hadr-stopping-V10-01-04)
--------------------------------------------------------------------
- G4AntiNeutronAnnihilationAtRest: migration to G4Exp, G4Log and G4Pow.
06 August 2015 V. Ivantchenko (hadr-stopping-V10-01-03)
--------------------------------------------------------------------
- Added checks on while/do loops
26 February 2015 V. Ivantchenko (hadr-stopping-V10-01-02)
--------------------------------------------------------------------
- G4MuonMinusBoundDecay - use G4Log
26 January 2015 V. Ivantchenko (hadr-stopping-V10-01-01)
--------------------------------------------------------------------
- G4HadronStoppingProcess, G4MuMinusCapturePrecompound,
G4MuonMinusBoundDecay - cleanup comments
08 December 2014 V. Ivantchenko (hadr-stopping-V10-01-00)
--------------------------------------------------------------------
- G4HadronStoppingProcess, G4MuonMinusBoundDecay: fixed time of muon
nuclear capture secondaries (fix #1695); define index in the model
cathalog inside PreparePhysicsTable() to avoid bad interference
with EM physics
30 August 2014 V. Ivantchenko (hadr-stopping-V10-00-08)
--------------------------------------------------------------------
- removed obsolete G4MuonMinusCaptureAtRest, G4StopElementSelector,
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronStoppingProcess.hh 85517 2014-10-30 15:53:26Z gcosmo $
// $Id: G4HadronStoppingProcess.hh 87563 2014-12-10 14:56:22Z gcosmo $
//
//---------------------------------------------------------------------
//
@@ -110,9 +110,9 @@ private:
G4HadronicInteraction* fEmCascade;
G4HadronicInteraction* fBoundDecay;
const G4int emcID;
const G4int ncID;
const G4int dioID;
G4int emcID;
G4int ncID;
G4int dioID;
// This is shadowing "result" in the cc file and
// looks to be unnecessary. Removed by DHW, 12 June 2012
@@ -23,22 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AntiNeutronAnnihilationAtRest.cc 81369 2014-05-27 13:01:34Z gcosmo $
// $Id: G4AntiNeutronAnnihilationAtRest.cc 92627 2015-09-09 12:38:54Z gcosmo $
// G4AntiNeutronAnnihilationAtRest physics process
// Larry Felawka (TRIUMF), April 1998
//---------------------------------------------------------------------
//#include <string.h>
//#include <cmath>
//#include <stdio.h>
#include "G4AntiNeutronAnnihilationAtRest.hh"
#include "G4SystemOfUnits.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleTypes.hh"
#include "G4HadronicProcessStore.hh"
#include "G4HadronicDeprecate.hh"
#include "Randomize.hh"
#include "Randomize.hh"
#include "G4Exp.hh"
#include "G4Log.hh"
#include "G4Pow.hh"
#define MAX_SECONDARIES 100
@@ -330,19 +329,19 @@ void G4AntiNeutronAnnihilationAtRest::Poisso(G4float xav, G4int *iran)
fivex = G4int(xav * G4float(5.));
*iran = 0;
if (fivex > 0) {
r = std::exp(-G4double(xav));
r = G4Exp(-G4double(xav));
ran1 = G4UniformRand();
if (ran1 > r) {
rr = r;
for (i = 1; i <= fivex; ++i) {
++(*iran);
if (i <= 5) {
rrr = std::pow(xav, G4float(i)) / NFac(i);
rrr = G4Pow::GetInstance()->powN(xav, i) / NFac(i);
}
// ** STIRLING' S FORMULA FOR LARGE NUMBERS
if (i > 5) {
rrr = std::exp(i * std::log(xav) -
(i + G4float(.5)) * std::log(i * G4float(1.)) +
rrr = G4Exp(i * G4Log(xav) -
(i + G4float(.5)) * G4Log(i * G4float(1.)) +
i - G4float(.9189385));
}
rr += r * rrr;
@@ -354,7 +353,7 @@ void G4AntiNeutronAnnihilationAtRest::Poisso(G4float xav, G4int *iran)
}
else {
// ** FOR VERY SMALL XAV TRY IRAN=1,2,3
p1 = xav * std::exp(-G4double(xav));
p1 = xav * G4Exp(-G4double(xav));
p2 = xav * p1 / G4float(2.);
p3 = xav * p2 / G4float(3.);
ran = G4UniformRand();
@@ -533,7 +532,7 @@ void G4AntiNeutronAnnihilationAtRest::AntiNeutronAnnihilation(G4int *nopt)
nt = 3;
if (targetAtomicMass >= G4float(1.5)) {
cfa = (targetAtomicMass - G4float(1.)) / G4float(120.) *
G4float(.025) * std::exp(-G4double(targetAtomicMass - G4float(1.)) /
G4float(.025) * G4Exp(-G4double(targetAtomicMass - G4float(1.)) /
G4float(120.));
targ = G4float(1.);
tex = evapEnergy1;
@@ -559,10 +558,10 @@ void G4AntiNeutronAnnihilationAtRest::AntiNeutronAnnihilation(G4int *nopt)
}
ran1 = G4UniformRand();
Normal(&ran2);
ekin1 = -G4double(ekin) * std::log(ran1) -
ekin1 = -G4double(ekin) * G4Log(ran1) -
cfa * (ran2 * G4float(.5) + G4float(1.));
if (ekin1 < G4float(0.)) {
ekin1 = std::log(ran1) * G4float(-.01);
ekin1 = G4Log(ran1) * G4float(-.01);
}
ekin1 *= G4float(1.);
ekin2 += ekin1;
@@ -634,10 +633,10 @@ void G4AntiNeutronAnnihilationAtRest::AntiNeutronAnnihilation(G4int *nopt)
}
ran1 = G4UniformRand();
Normal(&ran2);
ekin1 = -G4double(ekin) * std::log(ran1) -
ekin1 = -G4double(ekin) * G4Log(ran1) -
cfa * (ran2 * G4float(.5) + G4float(1.));
if (ekin1 < G4float(0.)) {
ekin1 = std::log(ran1) * G4float(-.01);
ekin1 = G4Log(ran1) * G4float(-.01);
}
ekin1 *= G4float(1.);
ekin2 += ekin1;
@@ -708,17 +707,17 @@ G4double G4AntiNeutronAnnihilationAtRest::ExNu(G4float ek1)
// ** 0.35 VALUE AT 1 GEV
// ** 0.05 VALUE AT 0.1 GEV
cfa = G4float(.13043478260869565);
cfa = cfa * std::log(ekin1) + G4float(.35);
cfa = cfa * G4Log(ekin1) + G4float(.35);
if (cfa < G4float(.15)) {
cfa = G4float(.15);
}
ret_val = cfa * G4float(7.716) * std::exp(-G4double(cfa));
ret_val = cfa * G4float(7.716) * G4Exp(-G4double(cfa));
atno3 = targetAtomicMass;
if (atno3 > G4float(120.)) {
atno3 = G4float(120.);
}
cfa = (atno3 - G4float(1.)) /
G4float(120.) * std::exp(-G4double(atno3 - G4float(1.)) / G4float(120.));
G4float(120.) * G4Exp(-G4double(atno3 - G4float(1.)) / G4float(120.));
ret_val *= cfa;
r__1 = ekin1;
fpdiv = G4float(1.) - r__1 * r__1 * G4float(.25);
@@ -727,7 +726,7 @@ G4double G4AntiNeutronAnnihilationAtRest::ExNu(G4float ek1)
}
gfa = (targetAtomicMass - G4float(1.)) /
G4float(70.) * G4float(2.) *
std::exp(-G4double(targetAtomicMass - G4float(1.)) / G4float(70.));
G4Exp(-G4double(targetAtomicMass - G4float(1.)) / G4float(70.));
evapEnergy1 = ret_val * fpdiv;
evapEnergy3 = ret_val - evapEnergy1;
Normal(&ran1);
@@ -744,6 +743,8 @@ G4double G4AntiNeutronAnnihilationAtRest::ExNu(G4float ek1)
if (evapEnergy3 < G4float(0.)) {
evapEnergy3 = G4float(0.);
}
// Loop checking, 06-Aug-2015, Vladimir Ivanchenko
while ((ret_val = evapEnergy1 + evapEnergy3) >= ek1) {
evapEnergy1 *= G4float(1.) - G4UniformRand() * G4float(.5);
evapEnergy3 *= G4float(1.) - G4UniformRand() * G4float(.5);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCaptureCascade.cc 69573 2013-05-08 13:35:53Z gcosmo $
// $Id: G4EmCaptureCascade.cc 91836 2015-08-07 07:25:54Z gcosmo $
//
//-----------------------------------------------------------------------------
//
@@ -161,6 +161,7 @@ G4EmCaptureCascade::ApplyYourself(const G4HadProjectile& projectile,
}
edep += deltaE;
// Loop checking, 06-Aug-2015, Vladimir Ivanchenko
} while( nLevel > 0 );
result.SetLocalEnergyDeposit(edep);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HadronStoppingProcess.cc 85517 2014-10-30 15:53:26Z gcosmo $
// $Id: G4HadronStoppingProcess.cc 94351 2015-11-12 15:35:32Z gcosmo $
//
//---------------------------------------------------------------------
//
@@ -65,10 +65,10 @@ G4HadronStoppingProcess::G4HadronStoppingProcess(const G4String& name)
: G4HadronicProcess(name, fHadronAtRest),
fElementSelector(new G4ElementSelector()),
fEmCascade(new G4EmCaptureCascade()), // Owned by InteractionRegistry
fBoundDecay(0x0),
emcID(G4PhysicsModelCatalog::Register(G4String((name + "_EMCascade")))),
ncID(G4PhysicsModelCatalog::Register(G4String((name + "_NuclearCapture")))),
dioID(G4PhysicsModelCatalog::Register(G4String((name + "_DIO"))))
fBoundDecay(0),
emcID(-1),
ncID(-1),
dioID(-1)
{
// Modify G4VProcess flags to emulate G4VRest instead of G4VDiscrete
enableAtRestDoIt = true;
@@ -81,7 +81,7 @@ G4HadronStoppingProcess::G4HadronStoppingProcess(const G4String& name)
G4HadronStoppingProcess::~G4HadronStoppingProcess()
{
G4HadronicProcessStore::Instance()->DeRegisterExtraProcess(this);
//G4HadronicProcessStore::Instance()->DeRegisterExtraProcess(this);
delete fElementSelector;
// NOTE: fEmCascade and fEmBoundDecay owned by registry, not locally
}
@@ -99,6 +99,9 @@ void
G4HadronStoppingProcess::PreparePhysicsTable(const G4ParticleDefinition& p)
{
G4HadronicProcessStore::Instance()->RegisterParticleForExtraProcess(this,&p);
emcID = G4PhysicsModelCatalog::Register(G4String((GetProcessName() + "_EMCascade")));
ncID = G4PhysicsModelCatalog::Register(G4String((GetProcessName() + "_NuclearCapture")));
dioID = G4PhysicsModelCatalog::Register(G4String((GetProcessName() + "_DIO")));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -139,7 +142,11 @@ G4VParticleChange* G4HadronStoppingProcess::AtRestDoIt(const G4Track& track,
G4HadFinalState* result = 0;
thePro.Initialise(track);
// save track time an dstart capture from zero time
thePro.SetGlobalTime(0.0);
G4double time0 = track.GetGlobalTime();
G4bool nuclearCapture = true;
// Do the electromagnetic cascade in the nuclear field.
@@ -150,12 +157,12 @@ G4VParticleChange* G4HadronStoppingProcess::AtRestDoIt(const G4Track& track,
G4double ebound = result->GetLocalEnergyDeposit();
G4double edep = 0.0;
G4int nSecondaries = result->GetNumberOfSecondaries();
G4int nEmCascaceSec = nSecondaries;
G4int nEmCascadeSec = nSecondaries;
// Try decay from bound level
// For mu- the time of projectile should be changed.
// Decay should keep G4HadFinalState object,
// because it will not be deleted at the end of this method
// because it will not be deleted at the end of this method.
//
thePro.SetBoundEnergy(ebound);
if(fBoundDecay) {
@@ -173,11 +180,16 @@ G4VParticleChange* G4HadronStoppingProcess::AtRestDoIt(const G4Track& track,
}
if(nuclearCapture) {
// delay of capture
G4double capTime = thePro.GetGlobalTime();
thePro.SetGlobalTime(0.0);
// select model
G4HadronicInteraction* model = 0;
try {
model = ChooseHadronicInteraction(thePro, *nucleus, track.GetMaterial(), elm);
model = ChooseHadronicInteraction(thePro, *nucleus,
track.GetMaterial(), elm);
}
catch(G4HadronicException & aE) {
G4ExceptionDescription ed;
@@ -226,11 +238,19 @@ G4VParticleChange* G4HadronStoppingProcess::AtRestDoIt(const G4Track& track,
G4Exception("G4HadronStoppingProcess::AtRestDoIt", "had006",
FatalException, ed);
}
}
while(!resultNuc);
// Loop checking, 06-Aug-2015, Vladimir Ivanchenko
} while(!resultNuc);
edep = resultNuc->GetLocalEnergyDeposit();
nSecondaries += resultNuc->GetNumberOfSecondaries();
size_t nnuc = resultNuc->GetNumberOfSecondaries();
// add delay time of capture
for(size_t i=0; i<nnuc; ++i) {
G4HadSecondary* sec = resultNuc->GetSecondary(i);
sec->SetTime(capTime + sec->GetTime());
}
nSecondaries += nnuc;
result->AddSecondaries(resultNuc);
resultNuc->Clear();
}
@@ -257,7 +277,7 @@ G4VParticleChange* G4HadronStoppingProcess::AtRestDoIt(const G4Track& track,
t->SetWeight(w*sec->GetWeight());
// use SetCreatorModelIndex to "label" the track
if (i<nEmCascaceSec) {
if (i<nEmCascadeSec) {
t->SetCreatorModelIndex(emcID);
} else if (nuclearCapture) {
t->SetCreatorModelIndex(ncID);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuMinusCapturePrecompound.cc 80902 2014-05-15 09:33:52Z gcosmo $
// $Id: G4MuMinusCapturePrecompound.cc 91836 2015-08-07 07:25:54Z gcosmo $
//
//-----------------------------------------------------------------------------
//
@@ -207,8 +207,11 @@ G4MuMinusCapturePrecompound::ApplyYourself(const G4HadProjectile& projectile,
eEx = momResidual.mag() - residualMass;
if(eEx < 0.0 && eEx + nenergy >= 0.0) {
momResidual.set(0.0, 0.0, 0.0, residualMass);
eEx = 0.0;
}
}
// in the case of many iterations stop the loop
// with zero excitation energy
if(reentryCount > 100 && eEx < 0.0) {
G4ExceptionDescription ed;
ed << "Call for " << GetModelName() << G4endl;
@@ -219,7 +222,9 @@ G4MuMinusCapturePrecompound::ApplyYourself(const G4HadProjectile& projectile,
G4Exception("G4MuMinusCapturePrecompound::ApplyYourself", "had006",
JustWarning, ed);
momResidual.set(0.0, 0.0, 0.0, residualMass);
eEx = 0.0;
}
// Loop checking, 06-Aug-2015, Vladimir Ivanchenko
} while(eEx <= 0.0);
G4ThreeVector dir = momNu.vect().unit();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4MuonMinusBoundDecay.cc 80902 2014-05-15 09:33:52Z gcosmo $
// $Id: G4MuonMinusBoundDecay.cc 91836 2015-08-07 07:25:54Z gcosmo $
//
//-----------------------------------------------------------------------------
//
@@ -56,6 +56,7 @@
#include "G4Electron.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoE.hh"
#include "G4Log.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -89,8 +90,8 @@ G4MuonMinusBoundDecay::ApplyYourself(const G4HadProjectile& projectile,
// === this is needed for the case when bound decay is not happen
// === but muon is capruted by the nucleus with some delay
G4double time = -std::log(G4UniformRand()) / lambda;
G4HadProjectile* p = const_cast<G4HadProjectile*>(&projectile);
G4double time = p->GetGlobalTime() - G4Log(G4UniformRand())/lambda;
p->SetGlobalTime(time);
//G4cout << "lambda= " << lambda << " lambdac= " << lambdac
@@ -121,6 +122,7 @@ G4MuonMinusBoundDecay::ApplyYourself(const G4HadProjectile& projectile,
G4double Eelect, Pelect, x, ecm;
G4LorentzVector EL, NN;
// Calculate electron energy
// these do/while loops are safe
do {
do {
x = xmin + (xmax-xmin)*G4UniformRand();
@@ -142,6 +144,7 @@ G4MuonMinusBoundDecay::ApplyYourself(const G4HadProjectile& projectile,
//
NN = MU - EL;
ecm = NN.mag2();
// Loop checking, 06-Aug-2015, Vladimir Ivanchenko
} while (Eelect < 0.0 || ecm < 0.0);
//
@@ -316,7 +319,7 @@ G4double G4MuonMinusBoundDecay::GetMuonCaptureRate(G4int Z, G4int A)
G4double r2 = 1.0 - xmu;
lambda = t1 * zeff2 * zeff2 * (r2 * r2) * (1.0 - (1.0 - xmu) * .75704) *
(a2ze * b0a + 1.0 - (a2ze - 1.0) * b0b -
G4double(2 * (A - Z) + std::fabs(a2ze - 1.) ) * b0c / G4double(A * 4) );
G4double(2 * (A - Z) + std::abs(a2ze - 1.) ) * b0c / G4double(A * 4) );
}