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
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-abla-V11-00-05)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-10-07 Gabriele Cosmo (hadr-abla-V11-00-04)
- Fixed compilation warnings on Intel/icx compiler for variables set
but not used in G4AblaDataDefs header.
## 2022-04-25 Ben Morgan (hadr-abla-V11-00-03)
- Add needed dependencies
@@ -452,7 +452,9 @@ public:
/**
* Dump debugging output.
*/
void dump() {
void dump()
{
/*
G4int nProton = 0, nNeutron = 0;
G4int nPiPlus = 0, nPiZero = 0, nPiMinus = 0;
G4int nH2 = 0, nHe3 = 0, nAlpha = 0;
@@ -472,6 +474,7 @@ public:
if(avv[i] == 4 && zvv[i] == 2) nAlpha++;
if( zvv[i] > 2) nFragments++;
}
*/
}
/**
@@ -6193,7 +6193,7 @@ G4int G4Abla::secnds(G4int x)
return(mylocaltime->tm_hour*60*60 + mylocaltime->tm_min*60 + mylocaltime->tm_sec);
}
else {
return(mytime - x);
return G4int(mytime - x);
}
}
@@ -10219,7 +10219,7 @@ G4double G4Abla::haz(G4int k)
{
// const G4int pSize = 110;
// static G4ThreadLocal G4double p[pSize];
static G4ThreadLocal G4long ix = 0;
static G4ThreadLocal G4int ix = 0;
static G4ThreadLocal G4double x = 0.0, y = 0.0;
// k =< -1 on initialise
// k = -1 c'est reproductible
@@ -10239,7 +10239,7 @@ G4double G4Abla::haz(G4int k)
y = secnds(G4int(x));
ix = G4int(y * 100 + 43543000);
if(mod(ix,2) == 0) {
ix = ix + 1;
ix = ix + 1;
}
}}
@@ -106,14 +106,14 @@ G4ReactionProductVector *G4AblaInterface::DeExcite(G4Fragment& aFragment) {
const G4double pyRem = pRem.y() / MeV;
const G4double pzRem = pRem.z() / MeV;
eventNumber++;
++eventNumber;
theABLAModel->DeexcitationAblaxx(ARem, ZRem, eStarRem, jRem, pxRem, pyRem,
pzRem, eventNumber, SRem);
pzRem, (G4int)eventNumber, SRem);
G4ReactionProductVector* result = new G4ReactionProductVector;
for(int j = 0; j < ablaResult->ntrack; ++j)
for(G4int j = 0; j < ablaResult->ntrack; ++j)
{ // Copy ABLA result to the EventInfo
G4ReactionProduct* product =
toG4Particle(ablaResult->avv[j], ablaResult->zvv[j], ablaResult->svv[j],
@@ -1,11 +1,15 @@
# Category had-abrasion History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2021-12-10 Ben Morgan (had-abrasion-V11-00-00)
## 2022-11-26 Gabriele Cosmo (hadr-abrasion-V11-00-01)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2021-12-10 Ben Morgan (hadr-abrasion-V11-00-00)
- Change to new Markdown History format
---
@@ -423,7 +423,7 @@ G4HadFinalState *G4WilsonAbrasionModel::ApplyYourself (
//
G4ThreeVector boost = pP.findBoostToCM();
G4Fragment *fragmentP = GetAbradedNucleons (Dabr, AP, ZP, rP);
G4int nSecP = theParticleChange.GetNumberOfSecondaries();
G4int nSecP = (G4int)theParticleChange.GetNumberOfSecondaries();
G4int i = 0;
for (i=0; i<nSecP; ++i)
{
@@ -472,7 +472,7 @@ G4HadFinalState *G4WilsonAbrasionModel::ApplyYourself (
// from these is determined.
//
G4Fragment *fragmentT = GetAbradedNucleons (Dabr, AT, ZT, rT);
G4int nSec = theParticleChange.GetNumberOfSecondaries();
G4int nSec = (G4int)theParticleChange.GetNumberOfSecondaries();
for (i=nSecP; i<nSec; ++i)
{
TotalEPost += theParticleChange.GetSecondary(i)->
@@ -1,14 +1,28 @@
# Category had-binary History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (had-binary-V11-00-04)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-11-25 Alberto Ribon (had-binary-V11-00-03)
- G4GeneratorPrecompoundInterface: in the PropagateNuclNucl method, in the
case of anti-nucleus projectile, convert also lambdas into anti-lambdas
after the de-excitation (which assumes a projectile nucleus).
## 2022-10-07 Gabriele Cosmo (had-binary-V11-00-02)
- Fixed compilation warnings on Intel/icx compiler for variables set
but not used in G4BinaryCascade.
## 2022-05-25 Alberto Ribon (had-binary-V11-00-01)
- `G4GeneratorPrecompoundInterface`, `G4BinaryCascade`: propagate the information
on parent resonance (in the `G4BinaryCascade::ApplyYourself` method,
from `G4ReactionProduct` to `G4HadSecondary`, in other methods
from `G4KineticTrack` to `G4ReactionProduct`)
- G4GeneratorPrecompoundInterface, G4BinaryCascade: propagate the information
on parent resonance (in the G4BinaryCascade::ApplyYourself method,
from G4ReactionProduct to G4HadSecondary, in other methods
from G4KineticTrack to G4ReactionProduct)
## 2021-12-10 Ben Morgan (had-binary-V11-00-00)
- Change to new Markdown History format
@@ -95,6 +95,7 @@ private:
const G4ParticleDefinition* proton;
const G4ParticleDefinition* neutron;
const G4ParticleDefinition* lambda;
const G4ParticleDefinition* deuteron;
const G4ParticleDefinition* triton;
@@ -457,8 +457,10 @@ G4ReactionProductVector * G4BinaryCascade::Propagate(
G4bool haveProducts = false;
#ifdef debug_BIC_Propagate_Collisions
G4int collisionCount=0;
G4int collisionLoopMaxCount=1000000;
#endif
G4int collisionLoopMaxCount=1000000;
while(theCollisionMgr->Entries() > 0 && currentZ && --collisionLoopMaxCount>0) /* Loop checking, 31.08.2015, G.Folger */
{
if(Absorb()) { // absorb secondaries, pions only
@@ -495,9 +497,9 @@ G4ReactionProductVector * G4BinaryCascade::Propagate(
{
//G4cerr << "ApplyCollision success " << G4endl;
haveProducts = true;
#ifdef debug_BIC_Propagate_Collisions
collisionCount++;
//_CheckChargeAndBaryonNumber_("ApplyCollision");
//_DebugEpConservation("ApplyCollision");
#endif
} else {
//G4cerr << "ApplyCollision failure " << G4endl;
@@ -1691,7 +1693,6 @@ void G4BinaryCascade::StepParticlesOut()
while( theSecondaryList.size() > 0 ) /* Loop checking, 31.08.2015, G.Folger */
// if countreset reaches limit, there is a break from while, see below.
{
G4int nsec=0;
G4double minTimeStep = 1.e-12*ns; // about 30*fermi/(0.1*c_light);1.e-12*ns
// i.e. a big step
std::vector<G4KineticTrack *>::iterator i;
@@ -1700,7 +1701,6 @@ void G4BinaryCascade::StepParticlesOut()
G4KineticTrack * kt = *i;
if( kt->GetState() == G4KineticTrack::inside )
{
nsec++;
G4double tStep(0), tdummy(0);
G4bool intersect =
((G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(kt,tdummy,tStep);
@@ -1724,7 +1724,6 @@ void G4BinaryCascade::StepParticlesOut()
}
}
minTimeStep *= 1.2;
// G4cerr << "CaptureCount = "<<counter<<" "<<nsec<<" "<<minTimeStep<<" "<<1*ns<<G4endl;
G4double timeToCollision=DBL_MAX;
G4CollisionInitialState * nextCollision=0;
if(theCollisionMgr->Entries() > 0)
@@ -1920,11 +1919,9 @@ void G4BinaryCascade::CorrectFinalPandE()
G4cerr << " -CorrectFinalPandE 3" << G4endl;
#endif
G4LorentzVector pFinals(0);
G4int nFinals(0);
for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
{
pFinals += (*i)->Get4Momentum();
++nFinals;
#ifdef debug_BIC_CorrectFinalPandE
G4cout <<"CorrectFinalPandE a final " << (*i)->GetDefinition()->GetParticleName()
<< " 4mom " << (*i)->Get4Momentum()<< G4endl;
@@ -1978,7 +1975,6 @@ void G4BinaryCascade::CorrectFinalPandE()
{
G4ThreeVector p3finals=pInCM*pFinals.vect().unit();
// G4ThreeVector deltap=(p3finals - pFinals.vect() ) / nFinals;
G4double factor=std::max(0.98,pInCM/pFinals.vect().mag()); // small correction
G4LorentzVector qFinals(0);
for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
@@ -2496,7 +2492,7 @@ G4Fragment * G4BinaryCascade::FindFragments()
<< G4endl;
#endif
G4int a = theTargetList.size()+theCapturedList.size();
G4int a = G4int(theTargetList.size()+theCapturedList.size());
G4int zTarget = 0;
G4KineticTrackVector::iterator i;
for(i = theTargetList.begin(); i != theTargetList.end(); ++i)
@@ -2543,8 +2539,8 @@ G4Fragment * G4BinaryCascade::FindFragments()
// if(getenv("BCDEBUG") ) G4cerr << "Fragment A, Z "<< a <<" "<< z<<G4endl;
if ( z < 1 ) return 0;
G4int holes = the3DNucleus->GetMassNumber() - theTargetList.size();
G4int excitons = theCapturedList.size();
G4int holes = G4int(the3DNucleus->GetMassNumber() - theTargetList.size());
G4int excitons = (G4int)theCapturedList.size();
#ifdef debug_BIC_FindFragments
G4cout << "Fragment: a= " << a << " z= " << z << " particles= " << excitons
<< " Charged= " << zCaptured << " holes= " << holes
@@ -2891,11 +2887,11 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
// return product when nucleus is destroyed, i.e. charge=0, or theTargetList.size()=0
G4double Esecondaries(0.);
G4LorentzVector psecondaries;
std::vector<G4KineticTrack *>::iterator iter;
std::vector<G4ReactionProduct *>::iterator rpiter;
std::vector<G4KineticTrack *>::const_iterator iter;
std::vector<G4ReactionProduct *>::const_iterator rpiter;
decayKTV.Decay(&theFinalState);
for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
for(iter = theFinalState.cbegin(); iter != theFinalState.cend(); ++iter)
{
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
aNew->SetMomentum((*iter)->Get4Momentum().vect());
@@ -2951,7 +2947,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
transferCorrection= theMomentumTransfer /(theSecondaryList.size() + theCapturedList.size());
}
for(iter = theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
for(iter = theSecondaryList.cbegin(); iter != theSecondaryList.cend(); ++iter)
{
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
(*iter)->Update4Momentum((*iter)->Get4Momentum().vect()+transferCorrection);
@@ -2966,7 +2962,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
products->push_back(aNew);
}
for(iter = theCapturedList.begin(); iter != theCapturedList.end(); ++iter)
for(iter = theCapturedList.cbegin(); iter != theCapturedList.cend(); ++iter)
{
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
(*iter)->Update4Momentum((*iter)->Get4Momentum().vect()+transferCorrection);
@@ -2983,7 +2979,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
G4double SumMassNucleons(0.);
G4LorentzVector pNucleons(0.);
for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
for(iter = theTargetList.cbegin(); iter != theTargetList.cend(); ++iter)
{
SumMassNucleons += (*iter)->GetDefinition()->GetPDGMass();
pNucleons += (*iter)->Get4Momentum();
@@ -3002,7 +2998,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
G4double Ekineticrdm(0);
if (theTargetList.size()) Ekineticrdm = ( 0.1 + G4UniformRand()*5.) * MeV; // leave some Energy for Nucleons
G4double TotalEkin(Ekineticrdm);
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
TotalEkin+=(*rpiter)->GetKineticEnergy();
}
G4double correction(1.);
@@ -3015,7 +3011,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
}
#endif
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
(*rpiter)->SetKineticEnergy((*rpiter)->GetKineticEnergy()*correction); // this sets kinetic & total energy
(*rpiter)->SetMomentum((*rpiter)->GetTotalMomentum() * (*rpiter)->GetMomentum().unit());
@@ -3026,7 +3022,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
}
for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter) {
for(iter = theTargetList.cbegin(); iter != theTargetList.cend(); ++iter) {
// set Nucleon it to be hit - as it is in fact
(*iter)->Hit();
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
@@ -3041,7 +3037,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
psecondaries += G4LorentzVector(aNew->GetMomentum(),aNew->GetTotalEnergy() );
}
psecondaries=G4LorentzVector(0);
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
psecondaries += G4LorentzVector((*rpiter)->GetMomentum(),(*rpiter)->GetTotalEnergy() );
}
@@ -3055,24 +3051,22 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
SumMom=initial4Mom.vect()-SumMom;
G4int loopcount(0);
std::vector<G4ReactionProduct *>::reverse_iterator reverse; // start to correct last added first
// reverse_iterator reverse - start to correct last added first
while ( SumMom.mag() > 0.1*MeV && loopcount++ < 10) /* Loop checking, 31.08.2015, G.Folger */
{
G4int index=products->size();
for (reverse=products->rbegin(); reverse!=products->rend(); ++reverse, --index){
SumMom=initial4Mom.vect();
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
SumMom-=(*rpiter)->GetMomentum();
}
G4double p=((*reverse)->GetMomentum()).mag();
(*reverse)->SetMomentum( p*(((*reverse)->GetMomentum()+SumMom).unit()));
}
G4int index=(G4int)products->size();
for (auto reverse=products->crbegin(); reverse!=products->crend(); ++reverse, --index){
SumMom=initial4Mom.vect();
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
SumMom-=(*rpiter)->GetMomentum();
}
G4double p=((*reverse)->GetMomentum()).mag();
(*reverse)->SetMomentum( p*(((*reverse)->GetMomentum()+SumMom).unit()));
}
}
return products;
}
G4ReactionProductVector * G4BinaryCascade::HighEnergyModelFSProducts(G4ReactionProductVector * products,
G4KineticTrackVector * secondaries)
{
@@ -49,6 +49,7 @@
#include "G4KineticTrackVector.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4Lambda.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
@@ -60,6 +61,7 @@
#include "G4AntiProton.hh"
#include "G4AntiNeutron.hh"
#include "G4AntiLambda.hh"
#include "G4AntiDeuteron.hh"
#include "G4AntiTriton.hh"
#include "G4AntiHe3.hh"
@@ -100,6 +102,7 @@ G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(G4VPreCompoundM
{
proton = G4Proton::Proton();
neutron = G4Neutron::Neutron();
lambda = G4Lambda::Lambda();
deuteron=G4Deuteron::Deuteron();
triton =G4Triton::Triton();
@@ -747,6 +750,7 @@ PropagateNuclNucl(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus
const G4ParticleDefinition * LastFragment=aFragment;
if (aFragment == proton) {LastFragment=G4AntiProton::AntiProtonDefinition();}
else if(aFragment == neutron) {LastFragment=G4AntiNeutron::AntiNeutronDefinition();}
else if(aFragment == lambda) {LastFragment=G4AntiLambda::AntiLambdaDefinition();}
else if(aFragment == deuteron){LastFragment=G4AntiDeuteron::AntiDeuteronDefinition();}
else if(aFragment == triton) {LastFragment=G4AntiTriton::AntiTritonDefinition();}
else if(aFragment == He3) {LastFragment=G4AntiHe3::AntiHe3Definition();}
@@ -802,7 +806,7 @@ void G4GeneratorPrecompoundInterface::MakeCoalescence(G4KineticTrackVector *trac
G4double MassCut = deuteron->GetPDGMass() + DeltaM; // In MeV
for ( size_t i = 0; i < tracks->size(); ++i ) { // search for protons
for ( std::size_t i = 0; i < tracks->size(); ++i ) { // search for protons
G4KineticTrack* trackP = (*tracks)[i];
if ( ! trackP ) continue;
@@ -811,7 +815,7 @@ void G4GeneratorPrecompoundInterface::MakeCoalescence(G4KineticTrackVector *trac
G4LorentzVector Prot4Mom = trackP->Get4Momentum();
G4LorentzVector ProtSPposition = G4LorentzVector(trackP->GetPosition(), trackP->GetFormationTime());
for ( size_t j = 0; j < tracks->size(); ++j ) { // search for neutron
for ( std::size_t j = 0; j < tracks->size(); ++j ) { // search for neutron
G4KineticTrack* trackN = (*tracks)[j];
if (! trackN ) continue;
@@ -837,9 +841,7 @@ void G4GeneratorPrecompoundInterface::MakeCoalescence(G4KineticTrackVector *trac
}
// Find and remove null pointers created by decays above
for ( int jj = tracks->size()-1; jj >= 0; --jj ) {
for ( G4int jj = (G4int)tracks->size()-1; jj >= 0; --jj ) {
if ( ! (*tracks)[jj] ) tracks->erase(tracks->begin()+jj);
}
}
@@ -60,13 +60,13 @@ G4double G4RKFieldIntegrator::CalculateTotalEnergy(const G4KineticTrackVector& B
const G4double GammaY = 1.4*fermi;
G4double Etot = 0;
G4int nBarion = Barions.size();
for(G4int c1 = 0; c1 < nBarion; c1++)
G4int nBarion = (G4int)Barions.size();
for(G4int c1 = 0; c1 < nBarion; ++c1)
{
G4KineticTrack* p1 = Barions.operator[](c1);
// Ekin
Etot += p1->Get4Momentum().e();
for(G4int c2 = c1 + 1; c2 < nBarion; c2++)
for(G4int c2 = c1 + 1; c2 < nBarion; ++c2)
{
G4KineticTrack* p2 = Barions.operator[](c2);
G4double r12 = (p1->GetPosition() - p2->GetPosition()).mag()*fermi;
@@ -186,7 +186,7 @@ G4double G4RKFieldIntegrator::GetExcitationEnergy(G4int nHitNucleons, const G4Ki
{
const G4double MeanE = 50;
G4double Sum = 0;
for(G4int c1 = 0; c1 < nHitNucleons; c1++)
for(G4int c1 = 0; c1 < nHitNucleons; ++c1)
{
Sum += -MeanE*G4Log(G4UniformRand());
}
@@ -198,7 +198,7 @@ G4double G4RKFieldIntegrator::GetExcitationEnergy(G4int nHitNucleons, const G4Ki
//This is free propagation of particles for CASCADE mode. Target nucleons should be frozen
void G4RKFieldIntegrator::Integrate(G4KineticTrackVector& theParticles)
{
for(G4int cParticle = 0; cParticle < theParticles.length(); cParticle++)
for(G4int cParticle = 0; cParticle < theParticles.length(); ++cParticle)
{
G4KineticTrack* pKineticTrack = theParticles.at(cParticle);
pKineticTrack->SetPosition(pKineticTrack->GetPosition() + theTimeStep*pKineticTrack->Get4Momentum().boostVector());
@@ -209,7 +209,7 @@ void G4RKFieldIntegrator::Integrate(G4KineticTrackVector& theParticles)
void G4RKFieldIntegrator::Integrate(const G4KineticTrackVector& theBarions, G4double theTimeStep)
{
for(size_t cParticle = 0; cParticle < theBarions.size(); cParticle++)
for(std::size_t cParticle = 0; cParticle < theBarions.size(); ++cParticle)
{
G4KineticTrack* pKineticTrack = theBarions[cParticle];
pKineticTrack->SetPosition(pKineticTrack->GetPosition() + theTimeStep*pKineticTrack->Get4Momentum().boostVector());
@@ -6,6 +6,20 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-casc-V11-00-05)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-11-13 Alberto Ribon (hadr-casc-V11-00-04)
(Two bug-fixes found and suggested by Sven Menke)
- G4NumIntTwoBodyAngDst.hh : corrected the incomplete initialization of the
vector angDist (fixing bug #2515).
- G4TwoBodyAngularDist.cc : corrected the charge exchange reaction of pion+ on
neutron producing in the final state pion0 and proton (fixing bug #2516)
## 2022-08-26 Gabriele Cosmo (hadr-casc-V11-00-03)
- Attempt to fix compilation warning on gcc-12.1 for
G4CascadeParamMessenger::CreateDirectory().
## 2022-05-23 Gabriele Cosmo (hadr-casc-V11-00-02)
- Fixed wrong comparison between two arrays in findCrossSection(..)
for G4CascadePPChannel, G4CascadeNPChanneland G4CascadeNNChannel.
@@ -39,7 +39,7 @@
#include <iosfwd>
#include <vector>
template <int NBINS, int NMULT>
template <G4int NBINS, G4int NMULT>
class G4CascadeSampler {
public:
enum { energyBins=NBINS, multBins=NMULT }; // For use in function arguments
@@ -50,7 +50,7 @@ public:
virtual ~G4CascadeSampler() {}
virtual G4double
findCrossSection(double ke, const G4double (&xsec)[energyBins]) const;
findCrossSection(G4double ke, const G4double (&xsec)[energyBins]) const;
virtual G4int
findMultiplicity(G4double ke, const G4double xmult[][energyBins]) const;
@@ -41,14 +41,14 @@
#include <vector>
template <int NBINS, int NMULT> inline
template <G4int NBINS, G4int NMULT> inline
G4double G4CascadeSampler<NBINS,NMULT>::
findCrossSection(double ke,
findCrossSection(G4double ke,
const G4double (&xsec)[energyBins]) const {
return interpolator.interpolate(ke, xsec);
}
template <int NBINS, int NMULT> inline
template <G4int NBINS, G4int NMULT> inline
G4int G4CascadeSampler<NBINS,NMULT>::
findMultiplicity(G4double ke,
const G4double xmult[][energyBins]) const {
@@ -56,7 +56,7 @@ findMultiplicity(G4double ke,
return sampleFlat() + 2; // Convert array index to actual mult (2 to 7)
}
template <int NBINS, int NMULT> inline
template <G4int NBINS, G4int NMULT> inline
G4int G4CascadeSampler<NBINS,NMULT>::
findFinalStateIndex(G4int mult, G4double ke, const G4int index[],
const G4double xsec[][energyBins]) const {
@@ -69,7 +69,7 @@ findFinalStateIndex(G4int mult, G4double ke, const G4int index[],
}
// Optional start/stop arguments default to multiplicity arrays
template <int NBINS, int NMULT> inline
template <G4int NBINS, G4int NMULT> inline
void G4CascadeSampler<NBINS,NMULT>::
fillSigmaBuffer(G4double ke, const G4double x[][energyBins],
G4int startBin, G4int stopBin) const {
@@ -78,14 +78,14 @@ fillSigmaBuffer(G4double ke, const G4double x[][energyBins],
// NOTE: push_back() must be used to ensure that size() gets set!
sigmaBuf.reserve(stopBin-startBin);
for(G4int i = startBin; i < stopBin; i++)
for(G4int i = startBin; i < stopBin; ++i)
sigmaBuf.push_back(interpolator.interpolate(ke, x[i]));
}
template <int NBINS, int NMULT> inline
template <G4int NBINS, G4int NMULT> inline
G4int G4CascadeSampler<NBINS,NMULT>::sampleFlat() const {
G4int nbins = sigmaBuf.size();
G4int nbins = (G4int)sigmaBuf.size();
if (nbins <= 1) return 0; // Avoid unnecessary work
#ifdef G4CASCADE_DEBUG_SAMPLER
@@ -96,7 +96,7 @@ G4int G4CascadeSampler<NBINS,NMULT>::sampleFlat() const {
G4int i;
G4double fsum = 0.;
for (i = 0; i < nbins; i++) fsum += sigmaBuf[i];
for (i = 0; i < nbins; ++i) fsum += sigmaBuf[i];
#ifdef G4CASCADE_DEBUG_SAMPLER
G4cout << " buffer total (fsum) " << fsum;
#endif
@@ -106,7 +106,7 @@ G4int G4CascadeSampler<NBINS,NMULT>::sampleFlat() const {
#endif
G4double partialSum = 0.0;
for (i = 0; i < nbins; i++) {
for (i = 0; i < nbins; ++i) {
partialSum += sigmaBuf[i];
if (fsum < partialSum) return i; // Breaks out of loop automatically
}
@@ -115,7 +115,7 @@ G4int G4CascadeSampler<NBINS,NMULT>::sampleFlat() const {
}
template <int NBINS, int NMULT> inline
template <G4int NBINS, G4int NMULT> inline
void G4CascadeSampler<NBINS,NMULT>::print(std::ostream& os) const {
interpolator.printBins(os);
}
@@ -62,9 +62,10 @@
class G4CascadParticle;
class G4LorentzConvertor;
class G4CollisionOutput
{
public:
class G4CollisionOutput {
public:
G4CollisionOutput();
G4CollisionOutput& operator=(const G4CollisionOutput& right);
@@ -121,7 +122,7 @@ public:
// ===== Access contents of lists =====
G4int numberOfOutgoingParticles() const { return outgoingParticles.size(); }
G4int numberOfOutgoingParticles() const { return (G4int)outgoingParticles.size(); }
const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
return outgoingParticles;
@@ -131,7 +132,7 @@ public:
return outgoingParticles;
};
G4int numberOfOutgoingNuclei() const { return outgoingNuclei.size(); };
G4int numberOfOutgoingNuclei() const { return (G4int)outgoingNuclei.size(); };
const std::vector<G4InuclNuclei>& getOutgoingNuclei() const {
return outgoingNuclei;
@@ -139,7 +140,7 @@ public:
std::vector<G4InuclNuclei>& getOutgoingNuclei() { return outgoingNuclei; };
G4int numberOfFragments() const { return recoilFragments.size(); }
G4int numberOfFragments() const { return (G4int)recoilFragments.size(); }
const G4Fragment& getRecoilFragment(G4int index=0) const;
@@ -169,10 +170,11 @@ public:
void setOnShell(G4InuclParticle* bullet, G4InuclParticle* target);
void setRemainingExitationEnergy();
double getRemainingExitationEnergy() const { return eex_rest; };
G4double getRemainingExitationEnergy() const { return eex_rest; };
G4bool acceptable() const { return on_shell; };
private:
private:
G4int verboseLevel;
std::vector<G4InuclElementaryParticle> outgoingParticles;
@@ -51,7 +51,7 @@ public:
const G4double highKEscale, G4int verbose = 0)
: G4VTwoBodyAngDst(name, verbose), tcoeff(highKEscale),
labKE(kebins), cosBins(angles), angDists(dists) {
std::fill(angDist, angDist+nDists, 0.); // Initialize working buffer
std::fill(angDist, angDist+nAngles, 0.); // Initialize working buffer
}
virtual ~G4NumIntTwoBodyAngDst() {;}
@@ -201,9 +201,8 @@ void G4CascadeCoalescence::removeNucleons() {
G4cout << " >>> G4CascadeCoalescence::removeNucleons()" << G4endl;
// Remove nucleons from output from last to first (to preserve indexing)
std::set<size_t>::reverse_iterator usedIter;
for (usedIter = usedNucleons.rbegin(); usedIter != usedNucleons.rend(); ++usedIter)
thisFinalState->removeOutgoingParticle(*usedIter);
for (auto usedIter = usedNucleons.crbegin(); usedIter != usedNucleons.crend(); ++usedIter)
thisFinalState->removeOutgoingParticle((G4int)*usedIter);
usedNucleons.clear();
}
@@ -323,7 +322,7 @@ bool G4CascadeCoalescence::makeLightIon(const ClusterCandidate& aCluster) {
if (aCluster.size()<2) return false; // Sanity check
G4int A = aCluster.size();
G4int A = (G4int)aCluster.size();
G4int Z = -1;
G4int type = clusterType(aCluster);
@@ -96,7 +96,7 @@ Configure(G4InuclElementaryParticle* bullet,
G4cout << " >>> " << GetName() << "::Configure" << G4endl;
// Identify initial and final state (if two-body) for algorithm selection
multiplicity = particle_kinds.size();
multiplicity = (G4int)particle_kinds.size();
G4int is = bullet->type() * target->type();
G4int fs = (multiplicity==2) ? particle_kinds[0]*particle_kinds[1] : 0;
@@ -469,7 +469,7 @@ FillUsingKopylov(G4double initialMass,
finalState.clear();
size_t N = masses.size();
std::size_t N = masses.size();
finalState.resize(N);
G4double mtot = std::accumulate(masses.begin(), masses.end(), 0.0);
@@ -480,9 +480,9 @@ FillUsingKopylov(G4double initialMass,
G4ThreeVector momV, boostV; // Buffers to reduce memory churn
G4LorentzVector recoil(0.0,0.0,0.0,Mass);
for (size_t k=N-1; k>0; --k) {
for (std::size_t k=N-1; k>0; --k) {
mu -= masses[k];
T *= (k>1) ? BetaKopylov(k) : 0.;
T *= (k>1) ? BetaKopylov((G4int)k) : 0.;
recoilMass = mu + T;
@@ -136,8 +136,8 @@ void G4CascadeParamMessenger::CreateDirectory(const char* path,
// Directory path must be absolute, prepend "/" if ncessary
G4String fullPath = path;
if (fullPath[0] != '/') fullPath.insert(0, "/");
if (fullPath.back() != '/') fullPath.append("/");
if (fullPath[0] != '/') fullPath.insert(0, '/', 1);
if (fullPath.back() != '/') fullPath.append('/', 1);
// See if input path has already been registered
G4UIcommand* foundPath = UIman->GetTree()->FindPath(fullPath);
@@ -423,12 +423,12 @@ G4ElementaryParticleCollider::generateSCMfinalState(G4double ekin,
// Use generated list of final states to fill mass buffers
void G4ElementaryParticleCollider::fillOutgoingMasses() {
G4int mult = particle_kinds.size();
std::size_t mult = particle_kinds.size();
masses.resize(mult,0.);
masses2.resize(mult,0.); // Allows direct [i] setting
for (G4int i = 0; i < mult; i++) {
for (std::size_t i = 0; i < mult; ++i) {
masses[i] = G4InuclElementaryParticle::getParticleMass(particle_kinds[i]);
masses2[i] = masses[i] * masses[i];
}
@@ -544,7 +544,7 @@ G4ElementaryParticleCollider::generateSCMmuonAbsorption(G4double etot_scm,
return;
}
for (size_t i=0; i<3; i++) {
for (std::size_t i=0; i<3; ++i) {
scm_momentums[i].setVectM(theMomenta[i], masses[i]);
particles[i].fill(scm_momentums[i], particle_kinds[i], G4InuclParticle::EPCollider);
}
@@ -144,7 +144,7 @@ void G4Fissioner::deExcite(const G4Fragment& target,
};
};
G4int store_size = fissionStore.size();
std::size_t store_size = fissionStore.size();
if (store_size == 0) return; // No fission products
G4FissionConfiguration config =
@@ -52,8 +52,8 @@ void G4NuclWatcher::watch(G4int a, G4int z) {
if (std::abs(z-nuclz) >= small) return;
G4bool here = false; // Increment specified nucleus count
G4int simulatedAsSize = simulated_as.size();
for (G4int i = 0; i<simulatedAsSize && !here; i++) {
std::size_t simulatedAsSize = simulated_as.size();
for (std::size_t i = 0; i<simulatedAsSize && !here; ++i) {
if (std::abs(simulated_as[i] - a) < small) {
simulated_cs[i] += 1.0;
here = true; // Terminates loop
@@ -67,8 +67,8 @@ void G4NuclWatcher::watch(G4int a, G4int z) {
}
void G4NuclWatcher::setInuclCs(G4double csec, G4int nev) {
G4int simulatedAsSize = simulated_as.size();
for(G4int i = 0; i < simulatedAsSize ; i++) {
std::size_t simulatedAsSize = simulated_as.size();
for(std::size_t i = 0; i < simulatedAsSize ; ++i) {
double err = std::sqrt(simulated_cs[i]) / simulated_cs[i];
simulated_prob.push_back(simulated_cs[i] / nev);
@@ -81,8 +81,8 @@ std::pair<G4double, G4double> G4NuclWatcher::getExpCs() const {
G4double cs = 0.0;
G4double err = 0.0;
G4int experAsSize = exper_as.size();
for(G4int iz = 0; iz < experAsSize; iz++) {
std::size_t experAsSize = exper_as.size();
for(std::size_t iz = 0; iz < experAsSize; ++iz) {
cs += exper_cs[iz];
err += exper_err[iz];
}
@@ -93,8 +93,8 @@ std::pair<G4double, G4double> G4NuclWatcher::getExpCs() const {
std::pair<G4double, G4double> G4NuclWatcher::getInuclCs() const {
G4double cs = 0.0;
G4double err = 0.0;
G4int simulatedAsSize = simulated_as.size();
for(G4int iz = 0; iz < simulatedAsSize; iz++) {
std::size_t simulatedAsSize = simulated_as.size();
for(std::size_t iz = 0; iz < simulatedAsSize; ++iz) {
cs += simulated_cs[iz];
err += simulated_errors[iz];
}
@@ -116,20 +116,20 @@ void G4NuclWatcher::print() {
G4double inucl_cs = 0.0;
G4double inucl_cs_err = 0.0;
std::vector<G4bool> not_used(simulated_cs.size(), true);
G4int nmatched = exper_as.size();
G4int nused = simulated_cs.size();
std::size_t nmatched = exper_as.size();
std::size_t nused = simulated_cs.size();
G4double lhood = 0.0;
G4int experAsSize = exper_as.size();
std::size_t experAsSize = exper_as.size();
for (G4int iz = 0; iz < experAsSize; iz++) {
for (std::size_t iz = 0; iz < experAsSize; ++iz) {
G4double a = exper_as[iz];
exp_cs += exper_cs[iz];
exp_cs_err += exper_err[iz];
G4bool found = false;
G4int simulatedAsSize = simulated_as.size();
for (G4int i = 0; i<simulatedAsSize && !found; i++) {
std::size_t simulatedAsSize = simulated_as.size();
for (std::size_t i = 0; i<simulatedAsSize && !found; ++i) {
if (std::fabs(simulated_as[i] - a) < small) {
G4double rat = simulated_cs[i] / exper_cs[iz];
@@ -150,11 +150,11 @@ void G4NuclWatcher::print() {
not_used[i] = false;
izotop_chsq += (rat - 1.0) * (rat - 1.0) / rat_err / rat_err;
found = true;
nused--;
--nused;
}
}
if (found) nmatched--;
if (found) --nmatched;
else
G4cout << " not found exper.: A " << a << " exp.cs " << exper_cs[iz]
<< " err " << exper_err[iz] << G4endl;
@@ -163,8 +163,8 @@ void G4NuclWatcher::print() {
G4cout << " not found in simulations " << nmatched << G4endl
<< " not found in exper: " << nused << G4endl;
G4int simulatedAsSize = simulated_as.size();
for(G4int i = 0; i < simulatedAsSize; i++) {
std::size_t simulatedAsSize = simulated_as.size();
for(std::size_t i = 0; i < simulatedAsSize; ++i) {
inucl_cs += simulated_cs[i];
inucl_cs_err += simulated_errors[i];
@@ -175,7 +175,7 @@ void G4NuclWatcher::print() {
G4cout << " simulated production rate " << simulated_prob[i] << G4endl;
}
G4int matched = exper_as.size() - nmatched;
G4int matched = G4int(exper_as.size() - nmatched);
if (matched > 0) {
aver_lhood = lhood;
@@ -819,7 +819,7 @@ G4NucleiModel::generateInteractionPartners(G4CascadParticle& cparticle) {
// Select quasideuteron interaction from non-zero cross-section choices
if (verboseLevel > 2) {
for (size_t i=0; i<qdeutrons.size(); i++) {
for (std::size_t i=0; i<qdeutrons.size(); i++) {
G4cout << " acsecs[" << qdeutrons[i].getDefinition()->GetParticleName()
<< "] " << acsecs[i];
}
@@ -833,7 +833,7 @@ G4NucleiModel::generateInteractionPartners(G4CascadParticle& cparticle) {
G4double sl = inuclRndm() * tot_invmfp;
G4double as = 0.0;
for (size_t i = 0; i < qdeutrons.size(); i++) {
for (std::size_t i = 0; i < qdeutrons.size(); i++) {
as += acsecs[i];
if (sl < as) {
if (verboseLevel > 2)
@@ -886,7 +886,7 @@ generateParticleFate(G4CascadParticle& cparticle,
return;
}
G4int npart = thePartners.size(); // Last item is a total-path placeholder
std::size_t npart = thePartners.size(); // Last item is a total-path placeholder
if (npart == 1) { // cparticle is on the next zone entry
if (verboseLevel > 1)
@@ -914,7 +914,7 @@ generateParticleFate(G4CascadParticle& cparticle,
G4bool no_interaction = true;
G4int zone = cparticle.getCurrentZone();
for (G4int i=0; i<npart-1; i++) { // Last item is a total-path placeholder
for (std::size_t i=0; i<npart-1; ++i) { // Last item is a total-path placeholder
if (i > 0) cparticle.updatePosition(old_position);
G4InuclElementaryParticle& target = thePartners[i].first;
@@ -965,7 +965,7 @@ generateParticleFate(G4CascadParticle& cparticle,
// NOTE: Embedded temporary is optimized away (no copying gets done)
G4int nextGen = cparticle.getGeneration()+1;
for (G4int ip = 0; ip < G4int(outgoing_particles.size()); ip++) {
for (std::size_t ip = 0; ip < outgoing_particles.size(); ++ip) {
outgoing_cparticles.push_back(G4CascadParticle(outgoing_particles[ip],
new_position, zone,
0.0, nextGen));
@@ -1311,7 +1311,7 @@ void G4NucleiModel::choosePointAlongTraj(G4CascadParticle& cparticle) {
// Choose random point along trajectory, weighted by density
G4double rand = G4UniformRand();
G4int ir = std::upper_bound(wtlen.begin(),wtlen.end(),rand) - wtlen.begin();
G4long ir = std::upper_bound(wtlen.begin(),wtlen.end(),rand) - wtlen.begin();
G4double frac = (rand-wtlen[ir-1]) / (wtlen[ir]-wtlen[ir-1]);
G4double drand = (1.-frac)*len[ir-1] + frac*len[ir];
@@ -163,7 +163,7 @@ G4TwoBodyAngularDist::ChooseDist(G4int is, G4int fs, G4int kw) const {
if ((fs == is) && (is == pi0*pro || is == pi0*neu) ) return pi0pAngDst;
// pi- p -> pi0 n, pi+ n -> pi0 p, pi0 p -> pi+ n, pi0 n -> pi- p
if ((is == pim*pro && fs == pi0*neu) || (is == pip*neu && fs == pi0*pip) ||
if ((is == pim*pro && fs == pi0*neu) || (is == pip*neu && fs == pi0*pro) ||
(is == pi0*pro && fs == pip*neu) || (is == pi0*neu && fs == pim*pro) )
return pipCXAngDst;
@@ -1,9 +1,26 @@
# Category hadr-cohe History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-cohe-V11-00-05)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-10-25 Alberto Ribon (hadr-cohe-V11-00-04)
- G4AntiNuclElastic : Vladimir Uzhinsky's extension of the SampleInvariantT method
for the simulation of a light anti-hypernucleus projectile elastic scattering
on a target nucleus.
Note: most of the considered light anti-hypernuclei projectiles have
baryon number equal to -4 : it is assumed that their properties are similar
to anti-He4, therefore their elastic scattering is set-up as for anti-He4
elastic nuclear scattering. These properties can be improved in the future
if theoretical estimations will be available.
## 2022-09-05 Ben Morgan (hadr-cohe-V11-00-03)
- Update dependencies to address warnings from consistency check
## 2022-02-04 Vladimir Ivanchenko (hadr-cohe-V11-00-02)
- G4ElasticHadrNucleusHE, G4NeutronElectronElModel, G4NeutrinoElectronNcModel
@@ -43,18 +43,18 @@ geant4_add_module(G4hadronic_coherent_elastic
geant4_module_link_libraries(G4hadronic_coherent_elastic
PUBLIC
G4bosons
G4globman
G4hadronic_mgt
G4hadronic_util
G4hadronic_xsect
G4hepnumerics
G4heprandom
G4materials
G4partman
G4track
PRIVATE
G4baryons
G4cuts
G4heprandom
G4ions
G4leptons)
G4leptons
G4materials
G4mesons)
@@ -210,8 +210,8 @@ G4double G4AntiNuclElastic::SampleInvariantT(const G4ParticleDefinition* particl
if((A>=48.) && (A<65) ) fRa=fRa*0.95;
G4double Ref2 = XsTotalHadronic/10./2./pi; // in fm^2
G4double ceff2 =0;
G4double rho = 0;
G4double ceff2 = 0.0;
G4double rho = 0.0;
if ((theParticle == theAProton) || (theParticle == theANeutron))
{
@@ -308,7 +308,7 @@ G4double G4AntiNuclElastic::SampleInvariantT(const G4ParticleDefinition* particl
}
}
if (theParticle == theAAlpha)
if ( (theParticle == theAAlpha) || (ceff2 == 0.0) )
{
if(theTargetDef == theProton)
{
@@ -143,7 +143,7 @@ void G4DiffuseElastic::Initialise()
const G4ElementTable* theElementTable = G4Element::GetElementTable();
size_t jEl, numOfEl = G4Element::GetNumberOfElements();
std::size_t jEl, numOfEl = G4Element::GetNumberOfElements();
for( jEl = 0; jEl < numOfEl; ++jEl) // application element loop
{
@@ -854,7 +854,7 @@ G4double
G4DiffuseElastic::SampleTableThetaCMS(const G4ParticleDefinition* particle,
G4double momentum, G4double Z, G4double A)
{
size_t iElement;
std::size_t iElement;
G4int iMomentum, iAngle;
G4double randAngle, position, theta1, theta2, E1, E2, W1, W2, W;
G4double m1 = particle->GetPDGMass();
@@ -1103,7 +1103,7 @@ G4DiffuseElastic:: GetScatteringAngle( G4int iMomentum, G4int iAngle, G4double p
{
if ( iAngle >= G4int((*fAngleTable)(iMomentum)->GetVectorLength()) )
{
iAngle = (*fAngleTable)(iMomentum)->GetVectorLength() - 1;
iAngle = G4int((*fAngleTable)(iMomentum)->GetVectorLength() - 1);
}
y1 = (*(*fAngleTable)(iMomentum))(iAngle-1);
y2 = (*(*fAngleTable)(iMomentum))(iAngle);
@@ -130,7 +130,7 @@ void G4DiffuseElasticV2::Initialise()
const G4ElementTable* theElementTable = G4Element::GetElementTable();
size_t jEl, numOfEl = G4Element::GetNumberOfElements();
std::size_t jEl, numOfEl = G4Element::GetNumberOfElements();
for( jEl = 0; jEl < numOfEl; ++jEl) // application element loop
{
@@ -339,7 +339,7 @@ G4double
G4DiffuseElasticV2::SampleTableThetaCMS(const G4ParticleDefinition* particle,
G4double momentum, G4double Z, G4double A)
{
size_t iElement;
std::size_t iElement;
G4int iMomentum;
unsigned long iAngle = 0;
G4double randAngle, position, theta1, theta2, E1, E2, W1, W2, W;
@@ -361,11 +361,11 @@ G4DiffuseElasticV2::SampleTableThetaCMS(const G4ParticleDefinition* particle,
G4double kinE = std::sqrt(momentum*momentum + m1*m1) - m1;
iMomentum = fEnergyVector->FindBin(kinE,1000) + 1;
iMomentum = G4int(fEnergyVector->FindBin(kinE,1000) + 1);
position = (*(*fEnergySumVector)[iMomentum])[0]*G4UniformRand();
for(iAngle = 0; iAngle < fAngleBin; iAngle++)
for(iAngle = 0; iAngle < fAngleBin; ++iAngle)
{
if (position > (*(*fEnergySumVector)[iMomentum])[iAngle]) break;
}
@@ -434,16 +434,15 @@ void G4DiffuseElasticV2::InitialiseOnFly(G4double Z, G4double A)
void G4DiffuseElasticV2::BuildAngleTable()
{
G4int i, j;
G4double partMom, kinE, a = 0., z = fParticle->GetPDGCharge(), m1 = fParticle->GetPDGMass();
G4double alpha1, alpha2, alphaMax, alphaCoulomb, delta = 0., sum = 0.;
G4Integrator<G4DiffuseElasticV2,G4double(G4DiffuseElasticV2::*)(G4double)> integral;
fEnergyAngleVector = new std::vector<std::vector<double>*>;
fEnergySumVector = new std::vector<std::vector<double>*>;
fEnergyAngleVector = new std::vector<std::vector<G4double>*>;
fEnergySumVector = new std::vector<std::vector<G4double>*>;
for( i = 0; i < fEnergyBin; i++)
for( G4int i = 0; i < fEnergyBin; ++i)
{
kinE = fEnergyVector->Energy(i);
partMom = std::sqrt( kinE*(kinE + 2*m1) );
@@ -469,15 +468,15 @@ void G4DiffuseElasticV2::BuildAngleTable()
fAddCoulomb = true;
}
std::vector<double>* angleVector = new std::vector<double>(fAngleBin);
std::vector<double>* sumVector = new std::vector<double>(fAngleBin);
std::vector<G4double>* angleVector = new std::vector<G4double>(fAngleBin);
std::vector<G4double>* sumVector = new std::vector<G4double>(fAngleBin);
G4double delth = alphaMax/fAngleBin;
sum = 0.;
for(j = fAngleBin-1; j >= 0; j--)
for(G4int j = (G4int)fAngleBin-1; j >= 0; --j)
{
alpha1 = delth*j;
alpha2 = alpha1 + delth;
@@ -339,7 +339,7 @@ void G4ElasticHadrNucleusHE::InitialiseModel()
if(!isMaster) { return; }
G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4int numOfCouples = (G4int)theCoupleTable->GetTableSize();
for(G4int i=0; i<2; ++i) {
const G4ParticleDefinition* p = G4PionPlus::PionPlus();
@@ -349,19 +349,19 @@ void G4ElasticHadrNucleusHE::InitialiseModel()
iHadron1 = fHadronType1[i];
hMass = p->GetPDGMass()*invGeV;
hMass2 = hMass*hMass;
for(size_t j=0; j<numOfCouples; ++j) {
for(G4int j=0; j<numOfCouples; ++j) {
auto mat = theCoupleTable->GetMaterialCutsCouple(j)->GetMaterial();
auto elmVec = mat->GetElementVector();
size_t numOfElem = mat->GetNumberOfElements();
for(size_t k=0; k<numOfElem; ++k) {
G4int Z = std::min((*elmVec)[k]->GetZasInt(), ZMAX-1);
if(!fElasticData[i][Z]) {
std::size_t numOfElem = mat->GetNumberOfElements();
for(std::size_t k=0; k<numOfElem; ++k) {
G4int Z = std::min((*elmVec)[k]->GetZasInt(), ZMAX-1);
if(!fElasticData[i][Z]) {
if(1 == i && Z > 1) {
fElasticData[1][Z] = fElasticData[0][Z];
} else {
FillData(p, i, Z);
}
}
fElasticData[1][Z] = fElasticData[0][Z];
} else {
FillData(p, i, Z);
}
}
}
}
}
@@ -570,7 +570,7 @@ G4ElasticHadrNucleusHE::HadronNucleusQ2_2(const G4ElasticData* pElD,
R1 = pElD->R1;
dQ2 = pElD->dQ2;
Q2max = pElD->maxQ2[idx];
G4int length = (pElD->fCumProb[idx]).size();
G4int length = (G4int)(pElD->fCumProb[idx]).size();
G4double Rand = G4UniformRand();
@@ -1423,10 +1423,10 @@ G4bool G4ElasticHadrNucleusHE::ReadLine(std::ifstream& infile,
void G4ElasticHadrNucleusHE::WriteLine(std::ofstream& outfile,
std::vector<G4double>& v)
{
G4int n = v.size();
std::size_t n = v.size();
outfile << n << G4endl;
if(n > 0) {
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
outfile << v[i] << " ";
}
outfile << G4endl;
@@ -1434,5 +1434,3 @@ void G4ElasticHadrNucleusHE::WriteLine(std::ofstream& outfile,
}
///////////////////////////////////////////////////////////
@@ -203,7 +203,7 @@ G4NeutronElectronElModel:: GetTransfer( G4int iTkin, G4int iTransfer, G4double p
{
if ( iTransfer >= G4int((*fAngleTable)(iTkin)->GetVectorLength()) )
{
iTransfer = (*fAngleTable)(iTkin)->GetVectorLength() - 1;
iTransfer = G4int((*fAngleTable)(iTkin)->GetVectorLength() - 1);
}
y1 = (*(*fAngleTable)(iTkin))(iTransfer-1);
y2 = (*(*fAngleTable)(iTkin))(iTransfer);
@@ -153,7 +153,7 @@ void G4NuclNuclDiffuseElastic::Initialise()
// fEnergyVector = new G4PhysicsLogVector( theMinEnergy, theMaxEnergy, fEnergyBin );
const G4ElementTable* theElementTable = G4Element::GetElementTable();
size_t jEl, numOfEl = G4Element::GetNumberOfElements();
std::size_t jEl, numOfEl = G4Element::GetNumberOfElements();
// projectile radius
@@ -855,7 +855,7 @@ G4double
G4NuclNuclDiffuseElastic::SampleTableThetaCMS(const G4ParticleDefinition* particle,
G4double momentum, G4double Z, G4double A)
{
size_t iElement;
std::size_t iElement;
G4int iMomentum, iAngle;
G4double randAngle, position, theta1, theta2, E1, E2, W1, W2, W;
G4double m1 = particle->GetPDGMass();
@@ -1096,7 +1096,7 @@ G4NuclNuclDiffuseElastic:: GetScatteringAngle( G4int iMomentum, G4int iAngle, G4
{
if ( iAngle >= G4int((*fAngleTable)(iMomentum)->GetVectorLength()) )
{
iAngle = (*fAngleTable)(iMomentum)->GetVectorLength() - 1;
iAngle = G4int((*fAngleTable)(iMomentum)->GetVectorLength() - 1);
}
y1 = (*(*fAngleTable)(iMomentum))(iAngle-1);
y2 = (*(*fAngleTable)(iMomentum))(iAngle);
@@ -639,7 +639,7 @@ G4hhElastic:: GetTransfer( G4int iTkin, G4int iTransfer, G4double position )
{
if ( iTransfer >= G4int((*fTableT)(iTkin)->GetVectorLength()) )
{
iTransfer = (*fTableT)(iTkin)->GetVectorLength() - 1;
iTransfer = G4int((*fTableT)(iTkin)->GetVectorLength() - 1);
}
y1 = (*(*fTableT)(iTkin))(iTransfer-1);
y2 = (*(*fTableT)(iTkin))(iTransfer);
@@ -1,9 +1,49 @@
# Category hadr-deex History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-deex-V11-00-21)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-11-24 Alberto Ribon (hadr-deex-V11-00-20)
- G4ExcitationHandler : added protections that prevents crashes and
large energy non-conservations in the case of hypernuclei and, even more,
for anti-hypernuclei projectiles.
Note: there are still cases of off-shell masses and few GeV energy
non-conservations that need further investigations.
## 2022-11-21 Vladimir Ivanchenko (hadr-deex-V11-00-19)
- G4ExcitationHandler - added extra sanity check for negative value
of lambda inside a fragment
## 2022-11-11 Vladimir Ivanchenko (hadr-deex-V11-00-18)
- G4FermiCoulombBarrier - added Coulomb barrier accourdint to
prescription
- G4FermiDecayProbability, G4FermiFragment - use this new class
- G4VCoulombBarrier, G4CoulombBarrier, G4GEMCoulombBarrier - cleanup
## 2022-11-07 Vladimir Ivanchenko (hadr-deex-V11-00-17)
- G4ExcitationHandler - introduced de-excitation of fragments with
lambda inside
## 2022-11-03 Vladimir Ivanchenko (hadr-deex-V11-00-16)
- G4AtomicTransition - extended upper limit of atomic de-excitation
from Z=100 to Z=104 by R. Chakma
## 2022-09-05 Ben Morgan (hadr-deex-V11-00-15)
- Update dependencies to address warnings from consistency check
## 2022-07-24 Vladimir Ivanchenko (hadr-deex-V11-00-14)
- G4PhotonEvaporation - improved use of mutex
- G4StatMFChannel - implement fixes reported by Roman Nepeyvoda
- G4StatMF - clean-up
## 2022-06-16 Vladimir Ivanchenko (hadr-deex-V11-00-13)
- G4PhotonEvaporation - fixed Coverity warning
## 2022-06-16 Vladimir Ivanchenko (hadr-deex-V11-00-12)
- G4PhotonEvaporation - simplified handling of floating levels
@@ -357,7 +357,7 @@ G4FragmentVector *G4WilsonAblationModel::BreakItUp
for (G4int ift=0; ift<nFragTypes; ift++)
{
G4ParticleDefinition *type = fragType[ift];
G4int n = std::count(evapType.begin(),evapType.end(),type);
G4long n = std::count(evapType.cbegin(),evapType.cend(),type);
if (n > 0)
G4cout <<"Particle type: " <<std::setw(10) <<type->GetParticleName()
<<", number of particles emitted = " <<n <<G4endl;
@@ -374,7 +374,7 @@ G4FragmentVector *G4WilsonAblationModel::BreakItUp
// G4Fragment *resultNucleus(theNucleus);
G4Fragment *resultNucleus = new G4Fragment(A, Z, theNucleus.GetMomentum());
G4ThreeVector boost(0.0,0.0,0.0);
G4int nEvap = 0;
std::size_t nEvap = 0;
if (produceSecondaries && evapType.size()>0)
{
if (excess > 0.0)
@@ -415,9 +415,9 @@ G4FragmentVector *G4WilsonAblationModel::BreakItUp
G4cout <<"Evaporated particles :" <<G4endl;
G4cout <<"----------------------" <<G4endl;
}
G4int ie = 0;
G4FragmentVector::iterator iter;
for (iter = fragmentVector->begin(); iter != fragmentVector->end(); iter++)
std::size_t ie = 0;
for (auto iter = fragmentVector->cbegin();
iter != fragmentVector->cend(); ++iter)
{
if (ie == nEvap)
{
@@ -517,13 +517,13 @@ void G4WilsonAblationModel::SelectSecondariesByEvaporation
// (*i)->Initialize(theResidualNucleus);
iters.push_back(iter);
}
G4int nChannels = theChannels1.size();
std::size_t nChannels = theChannels1.size();
G4double totalProb = 0.0;
G4int ich = 0;
G4double probEvapType[6] = {0.0};
std::vector<G4VEvaporationChannel*>::iterator iterEv;
for (iterEv=theChannels1.begin(); iterEv!=theChannels1.end(); iterEv++) {
for (auto iterEv=theChannels1.cbegin();
iterEv!=theChannels1.cend(); ++iterEv) {
totalProb += (*iterEv)->GetEmissionProbability(intermediateNucleus);
probEvapType[ich] = totalProb;
++ich;
@@ -536,14 +536,18 @@ void G4WilsonAblationModel::SelectSecondariesByEvaporation
// the nucleus.
//
G4double xi = totalProb*G4UniformRand();
G4int ii = 0;
for (ii=0; ii<nChannels; ii++) {
std::size_t ii = 0;
for (ii=0; ii<nChannels; ++ii)
{
if (xi < probEvapType[ii]) { break; }
}
if (ii >= nChannels) { ii = nChannels - 1; }
G4FragmentVector *evaporationResult = theChannels1[ii]->
BreakUpFragment(intermediateNucleus);
if ((*evaporationResult)[0] != nullptr) { (*evaporationResult)[0]->SetCreatorModelID(secID); }
if ((*evaporationResult)[0] != nullptr)
{
(*evaporationResult)[0]->SetCreatorModelID(secID);
}
fragmentVector->push_back((*evaporationResult)[0]);
intermediateNucleus = (*evaporationResult)[1];
delete evaporationResult;
@@ -565,7 +569,7 @@ void G4WilsonAblationModel::SelectSecondariesByEvaporation
//
void G4WilsonAblationModel::SelectSecondariesByDefault (G4ThreeVector boost)
{
for (unsigned i=0; i<evapType.size(); i++)
for (std::size_t i=0; i<evapType.size(); ++i)
{
G4ParticleDefinition *type = evapType[i];
G4double mass = type->GetPDGMass();
@@ -56,6 +56,5 @@ geant4_module_link_libraries(G4hadronic_deex_evaporation
G4hadronic_deex_photon_evaporation
G4hepgeometry
G4heprandom
G4ions
G4materials
G4partman)
@@ -107,7 +107,7 @@ G4double G4EvaporationChannel::GetEmissionProbability(G4Fragment* fragment)
bCoulomb = theCoulombBarrier->GetCoulombBarrier(resA, resZ, 0.0);
// for OPTxs >0 penetration under the barrier is taken into account
elim = (0 != OPTxs) ? bCoulomb*0.5 : bCoulomb;
elim = (0 != OPTxs) ? bCoulomb*0.6 : bCoulomb;
}
/*
G4cout << "exEnergy= " << exEnergy << " Ec= " << bCoulomb
@@ -172,7 +172,8 @@ G4EvaporationProbability::CrossSection(G4double K, G4double CB)
res = G4ChatterjeeCrossSection::ComputeCrossSection(K, CB, resA13, muu,
index, theZ, resA);
} else {
G4double elim = 0.5*CB;
// added barrier penetration factor
G4double elim = 0.6*CB;
if(K > elim) {
res = G4KalbachCrossSection::ComputeCrossSection(K, elim, resA13, muu,
index, theZ, theA, resA);
@@ -0,0 +1,48 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// 11-11-2022 V.Ivanchenko restored
#ifndef G4FermiCoulombBarrier_h
#define G4FermiCoulombBarrier_h 1
#include "globals.hh"
#include "G4VCoulombBarrier.hh"
class G4FermiCoulombBarrier : public G4VCoulombBarrier
{
public:
explicit G4FermiCoulombBarrier(G4int anA, G4int aZ);
~G4FermiCoulombBarrier() override = default;
G4double GetCoulombBarrier(G4int ARes, G4int ZRes, G4double U) const override;
G4FermiCoulombBarrier(const G4FermiCoulombBarrier & right) = delete;
const G4FermiCoulombBarrier & operator=
(const G4FermiCoulombBarrier & right) = delete;
};
#endif
@@ -40,19 +40,15 @@ class G4FermiDecayProbability
public:
explicit G4FermiDecayProbability();
~G4FermiDecayProbability();
~G4FermiDecayProbability() = default;
G4double ComputeProbability(G4int Z, G4int A, G4int spin, G4double TotalE,
const G4FermiFragment* f1,
const G4FermiFragment* f2) const;
private:
G4FermiDecayProbability(const G4FermiDecayProbability &right) = delete;
const G4FermiDecayProbability & operator =
(const G4FermiDecayProbability &right) = delete;
G4bool operator==(const G4FermiDecayProbability &right) const = delete;
G4bool operator!=(const G4FermiDecayProbability &right) const = delete;
};
@@ -33,7 +33,7 @@
#include "globals.hh"
#include "G4FragmentVector.hh"
#include "G4CoulombBarrier.hh"
#include "G4VCoulombBarrier.hh"
class G4FermiFragment
{
@@ -43,32 +43,17 @@ public:
~G4FermiFragment();
inline G4int GetA(void) const
{
return A;
}
inline G4int GetA() const { return A; }
inline G4int GetZ(void) const
{
return Z;
}
inline G4int GetZ() const { return Z; }
inline G4int GetSpin(void) const
{
return spin;
}
inline G4int GetSpin() const { return spin; }
inline G4double GetExcitationEnergy(void) const
{
return excitEnergy;
}
inline G4double GetExcitationEnergy() const { return excitEnergy; }
inline G4double GetFragmentMass(void) const
{
return fragmentMass;
}
inline G4double GetFragmentMass() const { return fragmentMass; }
inline G4double GetTotalEnergy(void) const
inline G4double GetTotalEnergy(void) const
{
return (fragmentMass + excitEnergy);
}
@@ -83,21 +68,20 @@ public:
return (A == right.A && Z == right.Z &&
std::abs(excitEnergy - right.excitEnergy) < 0.0001);
}
G4FermiFragment(const G4FermiFragment &right) = delete;
const G4FermiFragment & operator=(const G4FermiFragment &right) = delete;
private:
G4double excitEnergy;
G4double fragmentMass;
G4CoulombBarrier* cBarrier;
G4VCoulombBarrier* cBarrier;
G4int A;
G4int Z;
G4int spin;
G4FermiFragment(const G4FermiFragment &right);
const G4FermiFragment & operator=(const G4FermiFragment &right);
G4bool operator!=(const G4FermiFragment &right) const;
};
@@ -5,6 +5,7 @@ geant4_add_module(G4hadronic_deex_fermi_breakup
PUBLIC_HEADERS
G4FermiBreakUpVI.hh
G4FermiChannels.hh
G4FermiCoulombBarrier.hh
G4FermiDecayProbability.hh
G4FermiFragment.hh
G4FermiFragmentsPoolVI.hh
@@ -13,6 +14,7 @@ geant4_add_module(G4hadronic_deex_fermi_breakup
G4VFermiBreakUp.hh
SOURCES
G4FermiBreakUpVI.cc
G4FermiCoulombBarrier.cc
G4FermiDecayProbability.cc
G4FermiFragment.cc
G4FermiFragmentsPoolVI.cc
@@ -159,7 +159,7 @@ void G4FermiBreakUpVI::BreakFragment(G4FragmentVector* theResult,
G4bool G4FermiBreakUpVI::SampleDecay()
{
const G4FermiChannels* chan = thePool->ClosestChannels(Z, A, mass);
if(!chan) { return false; }
if(nullptr == chan) { return false; }
size_t nn = chan->GetNumberOfChannels();
if(verbose > 1) {
G4cout << "== SampleDecay " << nn << " channels Eex= "
@@ -0,0 +1,56 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Dec 1999)
//
// 14-11-2007 modified barrier by JMQ (test30)
// 15-11-2010 V.Ivanchenko use G4Pow and cleanup
#include "G4FermiCoulombBarrier.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Pow.hh"
#include "G4NuclearRadii.hh"
G4FermiCoulombBarrier::G4FermiCoulombBarrier(G4int A, G4int Z)
: G4VCoulombBarrier(A, Z)
{
SetParameters(G4NuclearRadii::RadiusCB(Z, A), 1.3*CLHEP::fermi);
factor = CLHEP::elm_coupling*0.6*g4calc->Z13(7)/theRho;
}
G4double G4FermiCoulombBarrier::GetCoulombBarrier(
G4int ARes, G4int ZRes, G4double) const
{
if(0 == theZ) { return 0.0; }
G4int A = theA + ARes;
G4int Z = theZ + ZRes;
G4double cb = factor*((Z*Z)/g4calc->Z13(A) - (theZ*theZ)/g4calc->Z13(theA)
- (ZRes*ZRes)/g4calc->Z13(ARes));
return cb;
}
@@ -35,9 +35,6 @@
G4FermiDecayProbability::G4FermiDecayProbability()
{}
G4FermiDecayProbability::~G4FermiDecayProbability()
{}
G4double
G4FermiDecayProbability::ComputeProbability(G4int, G4int A, G4int spin,
G4double etot,
@@ -54,8 +51,8 @@ G4FermiDecayProbability::ComputeProbability(G4int, G4int A, G4int spin,
G4double ekin = etot - mass1 - mass2;
// mass factors
G4double massFactor = mass1*mass2/(mass1 + mass2);
massFactor *= std::sqrt(massFactor);
G4double x = mass1*mass2/(mass1 + mass2);
G4double massFactor = x*std::sqrt(x);
// Spin factor S_n
G4double S_n = 1.0;
@@ -31,6 +31,7 @@
#include "G4FermiFragment.hh"
#include "G4NucleiProperties.hh"
#include "G4PhysicalConstants.hh"
#include "G4CoulombBarrier.hh"
G4FermiFragment::G4FermiFragment(G4int anA, G4int aZ, G4int sp, G4double exc)
: excitEnergy(exc), A(anA), Z(aZ), spin(sp)
@@ -70,7 +70,7 @@ G4FermiFragmentsPoolVI::ClosestChannels(G4int Z, G4int A, G4double e) const
G4double demax = 1.e+9;
// stable channels
for(size_t j=0; j<(list_c[A]).size(); ++j) {
for(std::size_t j=0; j<(list_c[A]).size(); ++j) {
const G4FermiFragment* frag = (list_f[A])[j];
if(frag->GetZ() != Z) { continue; }
G4double de = e - frag->GetTotalEnergy();
@@ -117,7 +117,7 @@ G4bool
G4FermiFragmentsPoolVI::HasChannels(G4int Z, G4int A, G4double exc) const
{
// stable fragment
for(size_t j=0; j<(list_f[A]).size(); ++j) {
for(std::size_t j=0; j<(list_f[A]).size(); ++j) {
const G4FermiFragment* frag = (list_f[A])[j];
if(frag->GetZ() == Z) {
if(exc > frag->GetExcitationEnergy() &&
@@ -161,12 +161,12 @@ void G4FermiFragmentsPoolVI::Initialise()
for(G4int A=Amin; A<Amax; ++A) {
const G4LevelManager* man = ndata->GetLevelManager(Z, A);
if(man) {
size_t nn = man->NumberOfTransitions();
std::size_t nn = man->NumberOfTransitions();
// very unstable state
if(ndata->MaxLevelEnergy(Z, A) == 0.0f && man->LifeTime(0) == 0.0f) {
continue;
}
for(size_t i=0; i<=nn; ++i) {
for(std::size_t i=0; i<=nn; ++i) {
G4float exc = man->LevelEnergy(i);
/*
G4cout << "Z= " << Z << " A= " << A << " Eex= " << exc
@@ -183,15 +183,15 @@ void G4FermiFragmentsPoolVI::Initialise()
}
}
}
G4int nfrag = fragment_pool.size();
G4int nfrag = (G4int)fragment_pool.size();
// prepare structures per A for normal fragments
const size_t lfmax[maxA] = {
const std::size_t lfmax[maxA] = {
0, 2, 1, 2, 1, 2, 8, 19, 28, 56, 70, 104, 74, 109, 143, 212, 160};
for(G4int A=1; A<maxA; ++A) {
list_f[A].reserve(lfmax[A]);
list_c[A].reserve(lfmax[A]);
}
const size_t lfch[maxA] = {
const std::size_t lfch[maxA] = {
0, 0, 0, 0, 0, 1, 4, 8, 6, 13, 27, 40, 29, 21, 31, 32, 30};
for(auto const& f : fragment_pool) {
@@ -241,8 +241,8 @@ void G4FermiFragmentsPoolVI::Initialise()
// ignore very excited case
if(exc >= elim) { continue; }
G4FermiPair* fpair = nullptr;
G4int kmax = list_f[A].size();
for(G4int k=0; k<kmax; ++k) {
std::size_t kmax = list_f[A].size();
for(std::size_t k=0; k<kmax; ++k) {
const G4FermiFragment* f3 = (list_f[A])[k];
if(Z == f3->GetZ() &&
f3->GetTotalEnergy() - minE + tolerance >= 0.0) {
@@ -257,15 +257,15 @@ void G4FermiFragmentsPoolVI::Initialise()
}
// compute static probabilities
for(G4int A=1; A<maxA; ++A) {
for(size_t j=0; j<list_c[A].size(); ++j) {
for(std::size_t j=0; j<list_c[A].size(); ++j) {
G4FermiChannels* ch = (list_c[A])[j];
const G4FermiFragment* frag = (list_f[A])[j];
size_t nch = ch->GetNumberOfChannels();
std::size_t nch = ch->GetNumberOfChannels();
if(1 < nch) {
std::vector<G4double>& prob = ch->GetProbabilities();
const std::vector<const G4FermiPair*>& pairs = ch->GetChannels();
G4double ptot = 0.0;
for(size_t i=0; i<nch; ++i) {
for(std::size_t i=0; i<nch; ++i) {
ptot += theDecay.ComputeProbability(frag->GetZ(), frag->GetA(),
frag->GetSpin(),
frag->GetTotalEnergy(),
@@ -277,7 +277,7 @@ void G4FermiFragmentsPoolVI::Initialise()
prob[0] = 1.0;
} else {
ptot = 1./ptot;
for(size_t i=0; i<nch-1; ++i) { prob[i] *= ptot; }
for(std::size_t i=0; i<nch-1; ++i) { prob[i] *= ptot; }
prob[nch-1] = 1.0;
}
}
@@ -288,7 +288,7 @@ void G4FermiFragmentsPoolVI::Initialise()
void G4FermiFragmentsPoolVI::DumpFragment(const G4FermiFragment* f) const
{
if(f) {
G4int prec = G4cout.precision(6);
G4long prec = G4cout.precision(6);
G4cout << " Z= " << f->GetZ() << " A= " << std::setw(2) << f->GetA()
<< " Mass(GeV)= " << std::setw(8) << f->GetFragmentMass()/GeV
<< " Eexc(MeV)= " << std::setw(7) << f->GetExcitationEnergy()
@@ -305,10 +305,10 @@ void G4FermiFragmentsPoolVI::Dump() const
<<G4endl;
G4cout << "##### List of Fragments in the Fermi Fragment Pool #####"
<< G4endl;
G4int nfrag = fragment_pool.size();
std::size_t nfrag = fragment_pool.size();
G4cout << " For stable " << nfrag << " Elim(MeV) = "
<< elim/CLHEP::MeV << G4endl;
for(G4int i=0; i<nfrag; ++i) {
for(std::size_t i=0; i<nfrag; ++i) {
DumpFragment(fragment_pool[i]);
}
G4cout << G4endl;
@@ -318,17 +318,17 @@ void G4FermiFragmentsPoolVI::Dump() const
<< G4endl;
G4cout << "### G4FermiFragmentPoolVI: fragments sorted by A" << G4endl;
G4int prec = G4cout.precision(6);
G4int ama[maxA];
G4long prec = G4cout.precision(6);
std::size_t ama[maxA];
ama[0] = 0;
for(G4int A=1; A<maxA; ++A) {
G4cout << " # A= " << A << G4endl;
size_t am(0);
for(size_t j=0; j<list_f[A].size(); ++j) {
std::size_t am(0);
for(std::size_t j=0; j<list_f[A].size(); ++j) {
const G4FermiFragment* f = (list_f[A])[j];
G4int a1 = f->GetA();
G4int z1 = f->GetZ();
size_t nch = (list_c[A])[j]->GetNumberOfChannels();
std::size_t nch = (list_c[A])[j]->GetNumberOfChannels();
am = std::max(am, nch);
G4cout << " ("<<a1<<","<<z1<<"); Eex(MeV)= "
<< f->GetExcitationEnergy()
@@ -337,7 +337,7 @@ void G4FermiFragmentsPoolVI::Dump() const
<< " MassExcess= " << f->GetTotalEnergy() -
(z1*proton_mass_c2 + (a1 - z1)*neutron_mass_c2)
<< G4endl;
for(size_t k=0; k<nch; ++k) {
for(std::size_t k=0; k<nch; ++k) {
const G4FermiPair* fpair = ((list_c[A])[j]->GetChannels())[k];
G4cout << " (" << fpair->GetFragment1()->GetZ()
<< ", " << fpair->GetFragment1()->GetA()
@@ -359,7 +359,7 @@ void G4FermiFragmentsPoolVI::Dump() const
G4cout << G4endl;
G4cout << " Max number of channels per A:" << G4endl;
for (size_t j=0; j<maxA; ++j) { G4cout << ama[j] << ", "; }
for (std::size_t j=0; j<maxA; ++j) { G4cout << ama[j] << ", "; }
G4cout << G4endl;
G4cout << " Number of fragment pairs per A:" << G4endl;
@@ -373,7 +373,7 @@ void G4FermiFragmentsPoolVI::Dump() const
prec = G4cout.precision(6);
for(G4int A=2; A<maxA; ++A) {
G4cout << " A= " << A<<G4endl;
for(size_t j=0; j<list_p[A].size(); ++j) {
for(std::size_t j=0; j<list_p[A].size(); ++j) {
const G4FermiFragment* f1 = (list_p[A])[j]->GetFragment1();
const G4FermiFragment* f2 = (list_p[A])[j]->GetFragment2();
G4int a1 = f1->GetA();
@@ -55,13 +55,13 @@ std::vector<G4LorentzVector*>* G4FermiPhaseSpaceDecay::Decay(G4double M,
const std::vector<G4double>& mr) const
// Calculates momentum for N fragments (Kopylov's method of sampling is used)
{
size_t N = mr.size();
std::size_t N = mr.size();
std::vector<G4LorentzVector*>* P =
new std::vector<G4LorentzVector*>(N, nullptr);
G4double mtot = 0.0;
for(size_t k=0; k<N; ++k) { mtot += mr[k]; }
for(std::size_t k=0; k<N; ++k) { mtot += mr[k]; }
G4double mu = mtot;
G4double PFragMagCM = 0.0;
@@ -76,7 +76,7 @@ std::vector<G4LorentzVector*>* G4FermiPhaseSpaceDecay::Decay(G4double M,
CLHEP::HepRandomEngine* rndmEngine = G4Random::getTheEngine();
for (size_t k = N-1; k>0; --k)
for (G4int k = (G4int)N-1; k>0; --k)
{
mu -= mr[k];
if (k>1) { T *= BetaKopylov(k, rndmEngine); }
@@ -27,6 +27,6 @@ geant4_module_link_libraries(G4hadronic_deex_fission
G4hadronic_deex_management
G4hadronic_deex_util
G4hadronic_util
G4partman
PRIVATE
G4heprandom)
G4heprandom
G4partman)
@@ -33,22 +33,20 @@
#include "G4CoulombBarrier.hh"
#include "globals.hh"
class G4GEMCoulombBarrier : public G4CoulombBarrier
{
public:
explicit G4GEMCoulombBarrier(G4int anA, G4int aZ);
virtual ~G4GEMCoulombBarrier();
~G4GEMCoulombBarrier() override = default;
virtual G4double GetCoulombBarrier(G4int ARes, G4int ZRes, G4double U) const;
private:
G4double GetCoulombBarrier(G4int ARes, G4int ZRes, G4double U) const override;
G4GEMCoulombBarrier(const G4GEMCoulombBarrier & right) = delete;
const G4GEMCoulombBarrier & operator=(const G4GEMCoulombBarrier & right) = delete;
G4bool operator==(const G4GEMCoulombBarrier & right) const = delete;
G4bool operator!=(const G4GEMCoulombBarrier & right) const = delete;
const G4GEMCoulombBarrier & operator=
(const G4GEMCoulombBarrier & right) = delete;
private:
G4double CalcCompoundRadius(G4int ARes) const;
@@ -34,30 +34,27 @@
#include "G4SystemOfUnits.hh"
G4GEMCoulombBarrier::G4GEMCoulombBarrier(G4int anA, G4int aZ) :
G4CoulombBarrier(anA,aZ)
G4CoulombBarrier(anA, aZ)
{
AejectOneThird = g4calc->Z13(anA);
}
G4GEMCoulombBarrier::~G4GEMCoulombBarrier()
{}
G4double G4GEMCoulombBarrier::GetCoulombBarrier(G4int ARes, G4int ZRes,
G4double U) const
// Calculation of Coulomb potential energy (barrier) for outgoing fragment
{
// Calculation of Coulomb potential energy (barrier) for outgoing fragment
G4double Barrier = 0.0;
if (GetZ() > 0 && ZRes > 0) {
if (theZ > 0 && ZRes > 0) {
G4double CompoundRadius = CalcCompoundRadius(ARes);
Barrier = CLHEP::elm_coupling * (GetZ() * ZRes)/CompoundRadius;
Barrier = CLHEP::elm_coupling * (theZ * ZRes)/CompoundRadius;
// Barrier penetration coeficient
if(GetA() <= 4) { Barrier *= BarrierPenetrationFactor(ZRes); }
if(theA <= 4) { Barrier *= BarrierPenetrationFactor(ZRes); }
//JMQ 200709 effective decrease of barrier with E* (Barashenkov)
// (not inclued in original Furihata's formulation)
Barrier /= (1.0 + std::sqrt(U/(static_cast<G4double>(2*ARes))));
Barrier /= (1.0 + std::sqrt(U/((2*ARes)*CLHEP::MeV)));
}
return Barrier;
}
@@ -65,20 +62,19 @@ G4double G4GEMCoulombBarrier::GetCoulombBarrier(G4int ARes, G4int ZRes,
G4double G4GEMCoulombBarrier::CalcCompoundRadius(G4int ARes) const
{
G4double AresOneThird = g4calc->Z13(ARes);
G4int A = GetA();
G4double Result = 0.0;
if(A == 1){
if(theA == 1){
Result = 1.7* AresOneThird;
} else if (A <= 4){
} else if (theA <= 4){
Result = 1.7* AresOneThird + 1.2;
} else {
Result = 1.12*(AresOneThird + AejectOneThird) -
0.86*(AresOneThird+AejectOneThird)/(AresOneThird*AejectOneThird)+3.75;
}
return Result*fermi;
return Result*CLHEP::fermi;
}
@@ -83,10 +83,10 @@ G4double G4GEMProbability::EmissionProbability(const G4Fragment & fragment,
// Next there is a loop over excited states for this channel
// summing probabilities
size_t nn = ExcitEnergies.size();
std::size_t nn = ExcitEnergies.size();
if (0 < nn) {
G4double SavedSpin = Spin;
for (size_t i = 0; i <nn; ++i) {
for (std::size_t i = 0; i <nn; ++i) {
Spin = ExcitSpins[i];
// substract excitation energies
G4double Tmax = MaximalKineticEnergy - ExcitEnergies[i];
@@ -266,12 +266,12 @@ void G4GEMProbability::Dump() const
efermi = G4NucleiProperties::GetNuclearMass(theA-1, theZ)
+ neutron_mass_c2 - mass;
}
G4int nlev = ExcitEnergies.size();
std::size_t nlev = ExcitEnergies.size();
G4cout << "GEM: List of Excited States for Isotope Z= "
<< theZ << " A= " << theA << " Nlevels= " << nlev
<< " Efermi(MeV)= " << efermi
<< G4endl;
for(G4int i=0; i< nlev; ++i) {
for(std::size_t i=0; i< nlev; ++i) {
G4cout << "Z= " << theZ << " A= " << theA
<< " Mass(GeV)= " << mass/GeV
<< " Eexc(MeV)= " << ExcitEnergies[i]
@@ -58,6 +58,7 @@ class G4VMultiFragmentation;
class G4VFermiBreakUp;
class G4VEvaporation;
class G4VEvaporationChannel;
class G4ParticleTable;
class G4ExcitationHandler
{
@@ -118,6 +119,7 @@ private:
G4VMultiFragmentation* theMultiFragmentation;
G4VFermiBreakUp* theFermiModel;
G4VEvaporationChannel* thePhotonEvaporation;
G4ParticleTable* thePartTable;
G4IonTable* theTableOfIons;
G4NistManager* nist;
@@ -128,6 +130,7 @@ private:
const G4ParticleDefinition* theTriton;
const G4ParticleDefinition* theHe3;
const G4ParticleDefinition* theAlpha;
const G4ParticleDefinition* theLambda;
G4int icID;
@@ -140,6 +143,7 @@ private:
G4double minEForMultiFrag;
G4double minExcitation;
G4double maxExcitation;
G4double fLambdaMass;
G4bool isInitialised;
G4bool isEvapLocal;
@@ -19,4 +19,5 @@ geant4_module_link_libraries(G4hadronic_deex_handler
G4hadronic_deex_photon_evaporation
G4hepgeometry
G4leptons
G4baryons
G4procman)
@@ -63,10 +63,12 @@
#include "G4ExcitationHandler.hh"
#include "G4SystemOfUnits.hh"
#include "G4LorentzVector.hh"
#include "G4ThreeVector.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4Ions.hh"
#include "G4Electron.hh"
#include "G4Lambda.hh"
#include "G4VMultiFragmentation.hh"
#include "G4VFermiBreakUp.hh"
@@ -89,7 +91,8 @@ G4ExcitationHandler::G4ExcitationHandler()
minExcitation(1.*CLHEP::eV),maxExcitation(100.*CLHEP::MeV),
isInitialised(false),isEvapLocal(true),isActive(true)
{
theTableOfIons = G4ParticleTable::GetParticleTable()->GetIonTable();
thePartTable = G4ParticleTable::GetParticleTable();
theTableOfIons = thePartTable->GetIonTable();
nist = G4NistManager::Instance();
theMultiFragmentation = nullptr;
@@ -107,7 +110,10 @@ G4ExcitationHandler::G4ExcitationHandler()
theDeuteron = G4Deuteron::DeuteronDefinition();
theTriton = G4Triton::TritonDefinition();
theHe3 = G4He3::He3Definition();
theAlpha = G4Alpha::AlphaDefinition();;
theAlpha = G4Alpha::AlphaDefinition();
theLambda = G4Lambda::Lambda();
fLambdaMass = theLambda->GetPDGMass();
if(fVerbose > 1) { G4cout << "### New handler " << this << G4endl; }
}
@@ -296,6 +302,7 @@ G4ExcitationHandler::BreakItUp(const G4Fragment & theInitialState)
G4double exEnergy = theInitialState.GetExcitationEnergy();
G4int A = theInitialState.GetA_asInt();
G4int Z = theInitialState.GetZ_asInt();
G4int nL = theInitialState.GetNumberOfLambdas();
// too much excitation
if(exEnergy > A*maxExcitation && A > 0) {
@@ -307,18 +314,82 @@ G4ExcitationHandler::BreakItUp(const G4Fragment & theInitialState)
G4Exception("G4ExcitationHandler::BreakItUp()","had0034",JustWarning,ed,"");
}
}
// for hyper-nuclei subtract lambdas from the projectile fragment
G4double lambdaF = 0.0;
G4LorentzVector lambdaLV = theInitialStatePtr->GetMomentum();
if(0 < nL) {
// is it a stable hyper-nuclei?
if(A >= 3 && A <= 5 && nL <= 2) {
G4int pdg = 0;
if(3 == A && 1 == nL) {
pdg = 1010010030;
} else if(5 == A && 2 == Z && 1 == nL) {
pdg = 1010020050;
} else if(4 == A) {
if(1 == Z && 1 == nL) {
pdg = 1010010040;
} else if(2 == Z && 1 == nL) {
pdg = 1010020040;
} else if(0 == Z && 2 == nL) {
pdg = 1020000040;
} else if(1 == Z && 2 == nL) {
pdg = 1020010040;
}
}
// initial state is one of hyper-nuclei
if(0 < pdg) {
const G4ParticleDefinition* part = thePartTable->FindParticle(pdg);
if(nullptr != part) {
G4ReactionProduct* theNew = new G4ReactionProduct(part);
G4ThreeVector dir = G4ThreeVector( 0.0, 0.0, 0.0 );
if ( lambdaLV.vect().mag() > CLHEP::eV ) {
dir = lambdaLV.vect().unit();
}
G4double mass = part->GetPDGMass();
G4double etot = std::max(lambdaLV.e(), mass);
dir *= std::sqrt((etot - mass)*(etot + mass));
theNew->SetMomentum(dir);
theNew->SetTotalEnergy(etot);
theNew->SetFormationTime(theInitialState.GetCreationTime());
theNew->SetCreatorModelID(theInitialState.GetCreatorModelID());
G4ReactionProductVector* v = new G4ReactionProductVector();
v->push_back(theNew);
return v;
}
}
}
G4double mass = theInitialStatePtr->GetGroundStateMass();
lambdaF = nL*(fLambdaMass - CLHEP::neutron_mass_c2)/mass;
// de-excitation with neutrons instead of lambda inside the fragment
theInitialStatePtr->SetZAandMomentum(lambdaLV*(1. - lambdaF), Z, A, 0);
// 4-momentum not used in de-excitation
lambdaLV *= lambdaF;
} else if(0 > nL) {
++fWarnings;
if(fWarnings < 0) {
G4ExceptionDescription ed;
ed << "Fragment with negative L: Z=" << Z << " A=" << A << " L=" << nL
<< " Eex/A(MeV)= " << exEnergy/A;
G4Exception("G4ExcitationHandler::BreakItUp()","had0034",JustWarning,ed,"");
}
}
// In case A <= 1 the fragment will not perform any nucleon emission
if (A <= 1 || !isActive) {
theResults.push_back( theInitialStatePtr );
// check if a fragment is stable
} else if(exEnergy < minExcitation && nist->GetIsotopeAbundance(Z, A) > 0.0) {
} else if(exEnergy < minExcitation &&
nist->GetIsotopeAbundance(Z, A) > 0.0) {
theResults.push_back( theInitialStatePtr );
// JMQ 150909: first step in de-excitation is treated separately
// Fragments after the first step are stored in theEvapList
} else {
} else {
if((A<maxAForFermiBreakUp && Z<maxZForFermiBreakUp)
|| exEnergy <= minEForMultiFrag*A) {
theEvapList.push_back(theInitialStatePtr);
@@ -435,14 +506,17 @@ G4ExcitationHandler::BreakItUp(const G4Fragment & theInitialState)
G4cout << "### ExcitationHandler provides " << theResults.size()
<< " evaporated products:" << G4endl;
}
G4LorentzVector partOfLambdaLV;
if ( nL > 0 ) partOfLambdaLV = lambdaLV/(G4double)nL;
for (auto & frag : theResults) {
G4LorentzVector lv0 = frag->GetMomentum();
G4double etot = lv0.e();
// in the case of dummy de-excitation, excitation energy is transfered
// into kinetic energy of output ion
if(!isActive) {
G4double mass = frag->GetGroundStateMass();
G4double ptot = (frag->GetMomentum()).vect().mag();
G4double etot = (frag->GetMomentum()).e();
G4double ptot = lv0.vect().mag();
G4double fac = (etot <= mass || 0.0 == ptot) ? 0.0
: std::sqrt((etot - mass)*(etot + mass))/ptot;
G4LorentzVector lv((frag->GetMomentum()).px()*fac,
@@ -460,9 +534,9 @@ G4ExcitationHandler::BreakItUp(const G4Fragment & theInitialState)
G4int fragmentA = frag->GetA_asInt();
G4int fragmentZ = frag->GetZ_asInt();
G4double etot= frag->GetMomentum().e();
G4double eexc = 0.0;
const G4ParticleDefinition* theKindOfFragment = nullptr;
G4bool isHyperN = false;
if (fragmentA == 0) { // photon or e-
theKindOfFragment = frag->GetParticleDefinition();
} else if (fragmentA == 1 && fragmentZ == 0) { // neutron
@@ -473,21 +547,37 @@ G4ExcitationHandler::BreakItUp(const G4Fragment & theInitialState)
theKindOfFragment = theDeuteron;
} else if (fragmentA == 3 && fragmentZ == 1) { // triton
theKindOfFragment = theTriton;
if(0 < nL) {
const G4ParticleDefinition* p = thePartTable->FindParticle(1010010030);
if(nullptr != p) {
theKindOfFragment = p;
isHyperN = true;
--nL;
}
}
} else if (fragmentA == 3 && fragmentZ == 2) { // helium3
theKindOfFragment = theHe3;
} else if (fragmentA == 4 && fragmentZ == 2) { // alpha
theKindOfFragment = theAlpha;
if(0 < nL) {
const G4ParticleDefinition* p = thePartTable->FindParticle(1010020040);
if(nullptr != p) {
theKindOfFragment = p;
isHyperN = true;
--nL;
}
}
} else {
// fragment
eexc = frag->GetExcitationEnergy();
G4int idxf = frag->GetFloatingLevelNumber();
if(eexc < minExcitation) {
if(eexc < minExcitation) {
eexc = 0.0;
idxf = 0;
}
theKindOfFragment = theTableOfIons->GetIon(fragmentZ,fragmentA,eexc,
theKindOfFragment = theTableOfIons->GetIon(fragmentZ, fragmentA, eexc,
G4Ions::FloatLevelBase(idxf));
if(fVerbose > 3) {
G4cout << "### EXCH: Find ion Z= " << fragmentZ
@@ -497,9 +587,21 @@ G4ExcitationHandler::BreakItUp(const G4Fragment & theInitialState)
}
}
// fragment identified
if(theKindOfFragment) {
if(nullptr != theKindOfFragment) {
G4ReactionProduct * theNew = new G4ReactionProduct(theKindOfFragment);
theNew->SetMomentum(frag->GetMomentum().vect());
if(isHyperN) {
G4LorentzVector lv = lv0 + partOfLambdaLV;
G4ThreeVector dir = lv.vect().unit();
G4double mass = theKindOfFragment->GetPDGMass();
etot = std::max(lv.e(), mass);
G4double ptot = std::sqrt((etot - mass)*(etot + mass));
dir *= ptot;
theNew->SetMomentum(dir);
// remaining not compensated 4-momentum
lambdaLV += (lv0 - G4LorentzVector(dir, etot));
} else {
theNew->SetMomentum(lv0.vect());
}
theNew->SetTotalEnergy(etot);
theNew->SetFormationTime(frag->GetCreationTime());
if(theKindOfFragment == theElectron) {
@@ -536,7 +638,25 @@ G4ExcitationHandler::BreakItUp(const G4Fragment & theInitialState)
}
delete frag;
}
if(fVerbose > 3) {
// remaining lambdas are free; conserve quantum numbers but
// not 4-momentum
if(0 < nL) {
G4ThreeVector dir = G4ThreeVector( 0.0, 0.0, 0.0 );
if ( lambdaLV.vect().mag() > CLHEP::eV ) {
dir = lambdaLV.vect().unit();
}
G4double etot = std::max(lambdaLV.e()/(G4double)nL, fLambdaMass);
dir *= std::sqrt((etot - fLambdaMass)*(etot + fLambdaMass));
for(G4int i=0; i<nL; ++i) {
G4ReactionProduct* theNew = new G4ReactionProduct(theLambda);
theNew->SetMomentum(dir);
theNew->SetTotalEnergy(etot);
theNew->SetFormationTime(theInitialState.GetCreationTime());
theNew->SetCreatorModelID(theInitialState.GetCreatorModelID());
theReactionProductVector->push_back(theNew);
}
}
if(fVerbose > 3) {
G4cout << "@@@@@@@@@@ End G4Excitation Handler "<< G4endl;
}
return theReactionProductVector;
@@ -59,7 +59,7 @@ public:
// energies - list of excitation energies of nuclear levels starting
// from the ground state with energy zero
// spin - 2J, where J is the full angular momentum of the state
explicit G4LevelManager(G4int Z, G4int A, size_t nlev,
explicit G4LevelManager(G4int Z, G4int A, std::size_t nlev,
const std::vector<G4double>& energies,
const std::vector<G4int>& spin,
const std::vector<const G4NucLevel*>& levels);
@@ -71,40 +71,40 @@ public:
//===================================================================
// only in this method there is a check on the vector boundary
size_t NearestLevelIndex(const G4double energy, const size_t index=0) const;
std::size_t NearestLevelIndex(const G4double energy, const std::size_t index=0) const;
inline size_t NumberOfTransitions() const;
inline std::size_t NumberOfTransitions() const;
inline const G4NucLevel* GetLevel(const size_t i) const;
inline const G4NucLevel* GetLevel(const std::size_t i) const;
inline G4double LevelEnergy(const size_t i) const;
inline G4double LevelEnergy(const std::size_t i) const;
inline G4double MaxLevelEnergy() const;
inline size_t NearestLowEdgeLevelIndex(const G4double energy) const;
inline std::size_t NearestLowEdgeLevelIndex(const G4double energy) const;
inline const G4NucLevel* NearestLevel(const G4double energy,
const size_t index=0) const;
const std::size_t index=0) const;
inline G4double NearestLevelEnergy(const G4double energy,
const size_t index=0) const;
const std::size_t index=0) const;
inline G4double NearestLowEdgeLevelEnergy(const G4double energy) const;
// for stable isotopes life time is -1
inline G4double LifeTime(const size_t i) const;
inline G4double LifeTime(const std::size_t i) const;
inline G4int SpinTwo(const size_t i) const;
inline G4int SpinTwo(const std::size_t i) const;
inline G4int Parity(const size_t i) const;
inline G4int Parity(const std::size_t i) const;
inline G4int FloatingLevel(const size_t i) const;
inline G4int FloatingLevel(const std::size_t i) const;
inline G4double ShellCorrection() const;
inline G4double LevelDensity(const G4double U) const;
const G4String& FloatingType(const size_t i) const;
const G4String& FloatingType(const std::size_t i) const;
void StreamInfo(std::ostream& os) const;
@@ -122,24 +122,24 @@ private:
G4double fShellCorrection;
G4double fLevelDensity;
size_t nTransitions;
std::size_t nTransitions;
static const G4int nfloting = 13;
static G4String fFloatingLevels[nfloting];
};
inline size_t G4LevelManager::NumberOfTransitions() const
inline std::size_t G4LevelManager::NumberOfTransitions() const
{
return nTransitions;
}
inline const G4NucLevel* G4LevelManager::GetLevel(const size_t i) const
inline const G4NucLevel* G4LevelManager::GetLevel(const std::size_t i) const
{
return fLevels[i];
}
inline G4double G4LevelManager::LevelEnergy(const size_t i) const
inline G4double G4LevelManager::LevelEnergy(const std::size_t i) const
{
return fLevelEnergy[i];
}
@@ -149,10 +149,10 @@ inline G4double G4LevelManager::MaxLevelEnergy() const
return fLevelEnergy[nTransitions];
}
inline size_t
inline std::size_t
G4LevelManager::NearestLowEdgeLevelIndex(const G4double energy) const
{
size_t idx = nTransitions;
std::size_t idx = nTransitions;
if(energy < fLevelEnergy[nTransitions]) {
idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy)
- fLevelEnergy.begin() - 1;
@@ -161,14 +161,14 @@ G4LevelManager::NearestLowEdgeLevelIndex(const G4double energy) const
}
inline const G4NucLevel*
G4LevelManager::NearestLevel(const G4double energy, const size_t index) const
G4LevelManager::NearestLevel(const G4double energy, const std::size_t index) const
{
return GetLevel(NearestLevelIndex(energy, index));
}
inline G4double
G4LevelManager::NearestLevelEnergy(const G4double energy,
const size_t index) const
const std::size_t index) const
{
return LevelEnergy(NearestLevelIndex(energy, index));
}
@@ -179,22 +179,22 @@ G4LevelManager::NearestLowEdgeLevelEnergy(const G4double energy) const
return LevelEnergy(NearestLowEdgeLevelIndex(energy));
}
inline G4double G4LevelManager::LifeTime(const size_t i) const
inline G4double G4LevelManager::LifeTime(const std::size_t i) const
{
return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0;
}
inline G4int G4LevelManager::SpinTwo(const size_t i) const
inline G4int G4LevelManager::SpinTwo(const std::size_t i) const
{
return std::abs(fSpin[i]%100000 - 100);
}
inline G4int G4LevelManager::Parity(const size_t i) const
inline G4int G4LevelManager::Parity(const std::size_t i) const
{
return (fSpin[i]%100000 - 100 > 0) ? 1 : -1;
}
inline G4int G4LevelManager::FloatingLevel(const size_t i) const
inline G4int G4LevelManager::FloatingLevel(const std::size_t i) const
{
return fSpin[i]/100000;
}
@@ -53,7 +53,7 @@ class G4NucLevel
{
public:
explicit G4NucLevel(size_t ntrans, G4double tgamma,
explicit G4NucLevel(std::size_t ntrans, G4double tgamma,
const std::vector<G4int>& vTrans,
const std::vector<G4float>& wLevelGamma,
const std::vector<G4float>& wGamma,
@@ -62,25 +62,25 @@ public:
~G4NucLevel();
inline size_t NumberOfTransitions() const;
inline std::size_t NumberOfTransitions() const;
inline size_t FinalExcitationIndex(size_t idx) const;
inline std::size_t FinalExcitationIndex(std::size_t idx) const;
inline G4int TransitionType(size_t idx) const;
inline G4int TransitionType(std::size_t idx) const;
inline G4double GetTimeGamma() const;
inline G4float GammaProbability(size_t idx) const;
inline G4float GammaProbability(std::size_t idx) const;
inline G4float GammaCumProbability(size_t idx) const;
inline G4float GammaCumProbability(std::size_t idx) const;
inline G4float MultipolarityRatio(size_t idx) const;
inline G4float MultipolarityRatio(std::size_t idx) const;
inline size_t SampleGammaTransition(G4double rndm) const;
inline std::size_t SampleGammaTransition(G4double rndm) const;
inline G4int SampleShell(size_t idx, G4double rndm) const;
inline G4int SampleShell(std::size_t idx, G4double rndm) const;
inline const std::vector<G4float>* ShellProbabilty(size_t idx) const;
inline const std::vector<G4float>* ShellProbabilty(std::size_t idx) const;
void StreamInfo(std::ostream& os) const;
@@ -92,7 +92,7 @@ public:
private:
size_t length;
std::size_t length;
G4double fTimeGamma;
std::vector<G4int> fTrans;
@@ -102,17 +102,17 @@ private:
std::vector<const std::vector<G4float>*> fShellProbability;
};
inline size_t G4NucLevel::NumberOfTransitions() const
inline std::size_t G4NucLevel::NumberOfTransitions() const
{
return length;
}
inline size_t G4NucLevel::FinalExcitationIndex(const size_t idx) const
inline std::size_t G4NucLevel::FinalExcitationIndex(const std::size_t idx) const
{
return (size_t)(fTrans[idx]/10000);
return (std::size_t)(fTrans[idx]/10000);
}
inline G4int G4NucLevel::TransitionType(const size_t idx) const
inline G4int G4NucLevel::TransitionType(const std::size_t idx) const
{
return fTrans[idx]%10000;
}
@@ -122,25 +122,25 @@ inline G4double G4NucLevel::GetTimeGamma() const
return fTimeGamma;
}
inline G4float G4NucLevel::GammaProbability(const size_t idx) const
inline G4float G4NucLevel::GammaProbability(const std::size_t idx) const
{
return fGammaProbability[idx];
}
inline G4float G4NucLevel::GammaCumProbability(const size_t idx) const
inline G4float G4NucLevel::GammaCumProbability(const std::size_t idx) const
{
return fGammaCumProbability[idx];
}
inline G4float G4NucLevel::MultipolarityRatio(const size_t idx) const
inline G4float G4NucLevel::MultipolarityRatio(const std::size_t idx) const
{
return fMpRatio[idx];
}
inline size_t G4NucLevel::SampleGammaTransition(const G4double rndm) const
inline std::size_t G4NucLevel::SampleGammaTransition(const G4double rndm) const
{
G4float x = rndm;
size_t idx = 0;
std::size_t idx = 0;
for(; idx<length; ++idx) {
if(x <= fGammaCumProbability[idx]) { break; }
}
@@ -148,12 +148,12 @@ inline size_t G4NucLevel::SampleGammaTransition(const G4double rndm) const
}
inline G4int
G4NucLevel::SampleShell(const size_t idx, const G4double rndm) const
G4NucLevel::SampleShell(const std::size_t idx, const G4double rndm) const
{
const std::vector<G4float>* prob = fShellProbability[idx];
G4int i(-1);
if(nullptr != prob) {
G4int nn = prob->size();
G4int nn = (G4int)prob->size();
G4float x = rndm;
for(i=0; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
}
@@ -161,14 +161,9 @@ G4NucLevel::SampleShell(const size_t idx, const G4double rndm) const
}
inline const std::vector<G4float>*
G4NucLevel::ShellProbabilty(size_t idx) const
G4NucLevel::ShellProbabilty(std::size_t idx) const
{
return fShellProbability[idx];
}
#endif
@@ -292,9 +292,9 @@ std::ostream& G4DeexPrecoParameters::StreamInfo(std::ostream& os) const
{
static const G4String namm[5] = {"Evaporation","GEM","Evaporation+GEM","GEMVI","Dummy"};
static const G4int nmm[5] = {8, 68, 68, 31, 0};
size_t idx = (size_t)fDeexChannelType;
G4int idx = fDeexChannelType;
G4int prec = os.precision(5);
G4long prec = os.precision(5);
os << "=======================================================================" << "\n";
os << "====== Pre-compound/De-excitation Physics Parameters ========" << "\n";
os << "=======================================================================" << "\n";
@@ -50,7 +50,7 @@
G4String G4LevelManager::fFloatingLevels[] = {
"-", "+X", "+Y", "+Z", "+U", "+V", "+W", "+R", "+S", "+T", "+A", "+B", "+C"};
G4LevelManager::G4LevelManager(G4int Z, G4int A, size_t ntrans,
G4LevelManager::G4LevelManager(G4int Z, G4int A, std::size_t ntrans,
const std::vector<G4double>& energies,
const std::vector<G4int>& spin,
const std::vector<const G4NucLevel*>& levels)
@@ -61,7 +61,7 @@ G4LevelManager::G4LevelManager(G4int Z, G4int A, size_t ntrans,
fLevelEnergy.reserve(ntrans);
fSpin.reserve(ntrans);
fLevels.reserve(ntrans);
for(size_t i=0; i<ntrans; ++i) {
for(std::size_t i=0; i<ntrans; ++i) {
fLevelEnergy.push_back(energies[i]);
fSpin.push_back(spin[i]);
fLevels.push_back(levels[i]);
@@ -93,13 +93,13 @@ G4LevelManager::G4LevelManager(G4int Z, G4int A, size_t ntrans,
G4LevelManager::~G4LevelManager()
{
for(size_t i=0; i<=nTransitions; ++i) { delete fLevels[i]; }
for(std::size_t i=0; i<=nTransitions; ++i) { delete fLevels[i]; }
}
size_t G4LevelManager::NearestLevelIndex(const G4double energy,
const size_t index) const
std::size_t G4LevelManager::NearestLevelIndex(const G4double energy,
const std::size_t index) const
{
size_t idx = std::min(index, nTransitions);
std::size_t idx = std::min(index, nTransitions);
static const G4double tolerance = 10*CLHEP::eV;
if(0 == nTransitions || std::abs(energy - fLevelEnergy[idx]) <= tolerance) {
return idx;
@@ -111,15 +111,15 @@ size_t G4LevelManager::NearestLevelIndex(const G4double energy,
return idx;
}
const G4String& G4LevelManager::FloatingType(const size_t i) const
const G4String& G4LevelManager::FloatingType(const std::size_t i) const
{
return fFloatingLevels[fSpin[i]/100000];
}
void G4LevelManager::StreamInfo(std::ostream& out) const
{
for(size_t i=0; i<=nTransitions; ++i) {
G4int prec = out.precision(6);
for(std::size_t i=0; i<=nTransitions; ++i) {
G4long prec = out.precision(6);
out << std::setw(6) << i << ". "
<< std::setw(8) << fLevelEnergy[i];
if(fLevels[i]) {
@@ -194,10 +194,10 @@ const std::vector<G4float>* G4LevelReader::NormalizedICCProbability(G4int Z)
vec->push_back(x);
}
if (fVerbose > 3) {
G4int prec = G4cout.precision(3);
G4long prec = G4cout.precision(3);
G4cout << "# InternalConv: ";
G4int nn = vec->size();
for(G4int i=0; i<nn; ++i) { G4cout << " " << (*vec)[i]; }
std::size_t nn = vec->size();
for(std::size_t i=0; i<nn; ++i) { G4cout << " " << (*vec)[i]; }
G4cout << G4endl;
G4cout.precision(prec);
}
@@ -378,7 +378,7 @@ G4LevelReader::LevelManager(G4int Z, G4int A, G4int nlev,
vGammaProbability[j] = 1.0f/x;
vShellProbability[j] = nullptr;
if(fVerbose > 2) {
G4int prec = G4cout.precision(4);
G4long prec = G4cout.precision(4);
G4cout << "### Transition #" << j << " to level " << i2
<< " i2= " << i2 << " Etrans(MeV)= " << tener*CLHEP::keV
<< " fProb= " << fProb << " MultiP= " << tnum
@@ -430,7 +430,7 @@ G4LevelReader::LevelManager(G4int Z, G4int A, G4int nlev,
G4cout << " New G4NucLevel: Ntrans= " << ntrans
<< " Time(ns)= " << fTime << G4endl;
}
vLevel[i] = new G4NucLevel((size_t)ntrans, fTime,
vLevel[i] = new G4NucLevel((std::size_t)ntrans, fTime,
vTrans,
vGammaCumProbability,
vGammaProbability,
@@ -440,7 +440,7 @@ G4LevelReader::LevelManager(G4int Z, G4int A, G4int nlev,
}
G4LevelManager* lman = nullptr;
if(1 <= i) {
lman = new G4LevelManager(Z, A, (size_t)i,vEnergy,vSpin,vLevel);
lman = new G4LevelManager(Z, A, (std::size_t)i,vEnergy,vSpin,vLevel);
if(fVerbose > 1) {
G4cout << "=== Reader: new manager for Z= " << Z << " A= " << A
<< " Nlevels= " << i << " E[0]= "
@@ -43,7 +43,7 @@
#include "G4HadronicException.hh"
#include <iomanip>
G4NucLevel::G4NucLevel(size_t ntrans, G4double tgamma,
G4NucLevel::G4NucLevel(std::size_t ntrans, G4double tgamma,
const std::vector<G4int>& vTrans,
const std::vector<G4float>& wLevelGamma,
const std::vector<G4float>& wGamma,
@@ -57,7 +57,7 @@ G4NucLevel::G4NucLevel(size_t ntrans, G4double tgamma,
fGammaProbability.reserve(length);
fMpRatio.reserve(length);
fShellProbability.reserve(length);
for(size_t i=0; i<length; ++i) {
for(std::size_t i=0; i<length; ++i) {
fTrans.push_back(vTrans[i]);
fGammaCumProbability.push_back(wLevelGamma[i]);
fGammaProbability.push_back(wGamma[i]);
@@ -69,15 +69,15 @@ G4NucLevel::G4NucLevel(size_t ntrans, G4double tgamma,
G4NucLevel::~G4NucLevel()
{
for(size_t i=0; i<length; ++i) {
for(std::size_t i=0; i<length; ++i) {
delete fShellProbability[i];
}
}
void G4NucLevel::StreamInfo(std::ostream& out) const
{
G4int prec = out.precision(4);
for(size_t i=0; i<length; ++i) {
G4long prec = out.precision(4);
for(std::size_t i=0; i<length; ++i) {
out << std::setw(12) << FinalExcitationIndex(i)
<< std::setw(4) << TransitionType(i)
<< std::setw(7) << fMpRatio[i]
@@ -86,9 +86,9 @@ void G4NucLevel::StreamInfo(std::ostream& out) const
<< "\n";
const std::vector<G4float>* vec = fShellProbability[i];
if(vec) {
size_t len = vec->size();
std::size_t len = vec->size();
out << " ";
for(size_t j=0; j<len; ++j) { out << std::setw(7) << (*vec)[j]; }
for(std::size_t j=0; j<len; ++j) { out << std::setw(7) << (*vec)[j]; }
out << "\n";
}
}
@@ -28,7 +28,6 @@
// Hadronic Process: Nuclear De-excitations
// by V. Lara
#ifndef G4StatMF_h
#define G4StatMF_h 1
@@ -46,23 +45,19 @@
class G4StatMF : public G4VMultiFragmentation
{
public:
// Default constructor
G4StatMF();
// Destructor
~G4StatMF();
private:
// Copy constructor
G4StatMF(const G4StatMF & right);
G4StatMF(const G4StatMF & right) = delete;
// Operators
G4StatMF & operator=(const G4StatMF & right);
G4bool operator==(const G4StatMF & right);
G4bool operator!=(const G4StatMF & right);
G4StatMF & operator=(const G4StatMF & right) = delete;
G4bool operator==(const G4StatMF & right) = delete;
G4bool operator!=(const G4StatMF & right) = delete;
public:
G4FragmentVector * BreakItUp(const G4Fragment &theNucleus);
G4FragmentVector* BreakItUp(const G4Fragment &theNucleus) override;
private:
@@ -71,18 +66,12 @@ private:
const G4StatMFChannel * aChannel,
G4double & Temperature);
//
G4double CalcEnergy(G4int A, G4int Z,
const G4StatMFChannel * aChannel,
G4double T);
private:
G4VStatMFEnsemble * _theEnsemble;
G4int _secID; // Creator model ID for the secondaries created by this model
G4VStatMFEnsemble* _theEnsemble = nullptr;
G4int _secID = -1; // Creator model ID for the secondaries created by this model
};
#endif
@@ -34,27 +34,19 @@
#include "G4Pow.hh"
#include "G4PhysicsModelCatalog.hh"
// Default constructor
G4StatMF::G4StatMF() : _theEnsemble(0), _secID(-1) {
G4StatMF::G4StatMF()
{
_secID = G4PhysicsModelCatalog::GetModelID("model_G4StatMF");
}
G4StatMF::~G4StatMF() {}
// Destructor
G4StatMF::~G4StatMF() {} //{if (_theEnsemble != 0) delete _theEnsemble;}
G4FragmentVector * G4StatMF::BreakItUp(const G4Fragment &theFragment)
G4FragmentVector* G4StatMF::BreakItUp(const G4Fragment &theFragment)
{
// G4FragmentVector * theResult = new G4FragmentVector;
if (theFragment.GetExcitationEnergy() <= 0.0) {
//G4FragmentVector * theResult = new G4FragmentVector;
//theResult->push_back(new G4Fragment(theFragment));
return 0;
return nullptr;
}
// Maximun average multiplicity: M_0 = 2.6 for A ~ 200
// and M_0 = 3.3 for A <= 110
G4double MaxAverageMultiplicity =
@@ -140,19 +132,14 @@ G4FragmentVector * G4StatMF::BreakItUp(const G4Fragment &theFragment)
// Loop checking, 05-Aug-2015, Vladimir Ivanchenko
} while (Iterations++ < IterationsLimit );
// If Iterations >= IterationsLimit means that we couldn't solve for temperature
if (Iterations >= IterationsLimit)
throw G4HadronicException(__FILE__, __LINE__, "G4StatMF::BreakItUp: Was not possible to solve for temperature of breaking channel");
G4FragmentVector * theResult = theChannel->
GetFragments(theFragment.GetA_asInt(),theFragment.GetZ_asInt(),Temperature);
// ~~~~~~ Energy conservation Patch !!!!!!!!!!!!!!!!!!!!!!
// Original nucleus 4-momentum in CM system
G4LorentzVector InitialMomentum(theFragment.GetMomentum());
@@ -250,17 +237,14 @@ G4bool G4StatMF::FindTemperatureOfBreakingChannel(const G4Fragment & theFragment
return true;
}
T = Tc;
T = Tc;
TotalEnergy = CalcEnergy(A,Z,aChannel,T);
G4double Dc = (U - TotalEnergy)/U;
if (Dc == 0.0) {
Temperature = Tc;
return true;
}
if (Da*Dc < 0.0) {
T = Tc;
Db = Dc;
@@ -342,7 +342,7 @@ void G4StatMFChannel::SolveEqOfMotion(G4int anA, G4int anZ, G4double T)
// for fragments in the self-consistent time-dependent Coulomb field
{
G4Pow* g4calc = G4Pow::GetInstance();
G4double CoulombEnergy = 0.6*elm_coupling*anZ*anZ*
G4double CoulombEnergy = 0.6*CLHEP::elm_coupling*anZ*anZ*
g4calc->A13(1.0+G4StatMFParameters::GetKappaCoulomb())/
(G4StatMFParameters::Getr0()*g4calc->Z13(anA)) - GetFragmentsCoulombEnergy();
if (CoulombEnergy <= 0.0) return;
@@ -357,7 +357,7 @@ void G4StatMFChannel::SolveEqOfMotion(G4int anA, G4int anZ, G4double T)
G4ThreeVector * Accel = new G4ThreeVector[_NumOfChargedFragments];
G4int i;
for (i = 0; i < _NumOfChargedFragments; i++)
for (i = 0; i < _NumOfChargedFragments; ++i)
{
Vel[i] = (1.0/(_theFragments[i]->GetNuclearMass()))*
_theFragments[i]->GetMomentum();
@@ -368,25 +368,24 @@ void G4StatMFChannel::SolveEqOfMotion(G4int anA, G4int anZ, G4double T)
G4ThreeVector force(0.,0.,0.);
G4ThreeVector SavedVel(0.,0.,0.);
do {
for (i = 0; i < _NumOfChargedFragments; i++)
for (i = 0; i < _NumOfChargedFragments; ++i)
{
force.set(0.,0.,0.);
for (G4int j = 0; j < _NumOfChargedFragments; j++)
for (G4int j = 0; j < _NumOfChargedFragments; ++j)
{
if (i != j)
{
distance = Pos[i] - Pos[j];
force += (elm_coupling*_theFragments[i]->GetZ()
*_theFragments[j]->GetZ()/
force += (_theFragments[i]->GetZ()*_theFragments[j]->GetZ()/
(distance.mag2()*distance.mag()))*distance;
}
}
Accel[i] = (1./(_theFragments[i]->GetNuclearMass()))*force;
Accel[i] = CLHEP::elm_coupling*CLHEP::fermi*force/_theFragments[i]->GetNuclearMass();
}
TimeN = TimeS + DeltaTime;
for ( i = 0; i < _NumOfChargedFragments; i++)
for ( i = 0; i < _NumOfChargedFragments; ++i)
{
SavedVel = Vel[i];
Vel[i] += Accel[i]*(TimeN-TimeS);
@@ -399,23 +398,19 @@ void G4StatMFChannel::SolveEqOfMotion(G4int anA, G4int anZ, G4double T)
// Summed fragment kinetic energy
G4double TotalKineticEnergy = 0.0;
for (i = 0; i < _NumOfChargedFragments; i++)
for (i = 0; i < _NumOfChargedFragments; ++i)
{
TotalKineticEnergy += _theFragments[i]->GetNuclearMass()*
0.5*Vel[i].mag2();
}
// Scaling of fragment velocities
G4double KineticEnergy = 1.5*_theFragments.size()*T;
G4double Eta = ( CoulombEnergy + KineticEnergy ) / TotalKineticEnergy;
for (i = 0; i < _NumOfChargedFragments; i++)
{
Vel[i] *= Eta;
}
G4double KineticEnergy = 1.5*_NumOfChargedFragments*T;
G4double Eta = std::pow(( CoulombEnergy + KineticEnergy ) / TotalKineticEnergy, 2);
// Finally calculate fragments momenta
for (i = 0; i < _NumOfChargedFragments; i++)
for (i = 0; i < _NumOfChargedFragments; ++i)
{
_theFragments[i]->SetMomentum(_theFragments[i]->GetNuclearMass()*Vel[i]);
_theFragments[i]->SetMomentum((_theFragments[i]->GetNuclearMass()*Eta)*Vel[i]);
}
// garbage collection
@@ -215,12 +215,12 @@ G4StatMFChannel * G4StatMFMacroCanonical::ChooseZ(G4int & Z,
G4int DeltaZ = 0;
G4double CP = G4StatMFParameters::GetCoulomb();
G4int multiplicity = FragmentsA.size();
G4int multiplicity = (G4int)FragmentsA.size();
do {
FragmentsZ.clear();
G4int SumZ = 0;
for (G4int i = 0; i < multiplicity; i++)
for (G4int i = 0; i < multiplicity; ++i)
{
G4int A = FragmentsA[i];
if (A <= 1)
@@ -269,7 +269,7 @@ G4StatMFChannel * G4StatMFMacroCanonical::ChooseZ(G4int & Z,
FragmentsZ[idx] += DeltaZ;
G4StatMFChannel * theChannel = new G4StatMFChannel;
for (G4int i = multiplicity-1; i >= 0; i--)
for (G4int i = multiplicity-1; i >= 0; --i)
{
theChannel->CreateFragment(FragmentsA[i],FragmentsZ[i]);
}
@@ -281,7 +281,7 @@ G4double G4StatMFMicroPartition::CalcPartitionProbability(G4double U,
ThermalWaveLenght3 = ThermalWaveLenght3*ThermalWaveLenght3*ThermalWaveLenght3;
// Translational Entropy
G4double kappa = 1. + elm_coupling*(g4calc->Z13(_thePartition.size())-1.0)
G4double kappa = 1. + elm_coupling*(g4calc->Z13((G4int)_thePartition.size())-1.0)
/(G4StatMFParameters::Getr0()*g4calc->Z13(theA));
kappa = kappa*kappa*kappa;
kappa -= 1.;
@@ -36,13 +36,9 @@
//
// Creation date: 22 October 2015
//
//Modifications:
//
//
// -------------------------------------------------------------------
//
// This is a new class which has different design and uses different data
// structure than the old one
// This is gamma deexcitation model based on the nuclear levels data
//
#ifndef G4PHOTONEVAPORATION_HH
@@ -53,10 +49,9 @@
#include "G4NuclearLevelData.hh"
#include "G4LevelManager.hh"
#include "G4Fragment.hh"
#include "G4Threading.hh"
const G4int MAXDEPOINT = 10;
const G4int MAXGRDATA = 300;
const G4int MAXGRDATA = 300;
class G4GammaTransition;
@@ -152,10 +147,6 @@ private:
G4bool fSampleTime;
G4bool fCorrelatedGamma;
G4bool isInitialised;
#ifdef G4MULTITHREADED
static G4Mutex PhotonEvaporationMutex;
#endif
};
inline void G4PhotonEvaporation::SetVerboseLevel(G4int verbose)
@@ -69,9 +69,8 @@ G4GammaTransition::SampleTransition(G4Fragment* nucleus,
if (!isGamma) {
if(0 <= shell) {
G4int Z = nucleus->GetZ_asInt();
if(Z <= 100) {
G4int idx = (G4int)shell;
idx = std::min(idx, G4AtomicShells::GetNumberOfShells(Z)-1);
if(Z <= 104) {
G4int idx = std::min(shell, G4AtomicShells::GetNumberOfShells(Z)-1);
bond_energy = G4AtomicShells::GetBindingEnergy(Z, idx);
}
}
@@ -95,7 +94,7 @@ G4GammaTransition::SampleTransition(G4Fragment* nucleus,
// select secondary
G4ParticleDefinition* part;
if(isGamma) { part = G4Gamma::Gamma(); }
if(isGamma) { part = G4Gamma::Gamma(); }
else {
part = G4Electron::Electron();
G4int ne = std::max(nucleus->GetNumberOfElectrons() - 1, 0);
@@ -35,9 +35,6 @@
//
// Creation date: 20 December 2011
//
//Modifications:
//
//
// -------------------------------------------------------------------
//
@@ -53,14 +50,16 @@
#include <CLHEP/Units/SystemOfUnits.h>
#include <CLHEP/Units/PhysicalConstants.h>
#include "G4PhysicsModelCatalog.hh"
#include "G4AutoLock.hh"
namespace
{
G4Mutex photEvaporationMutex = G4MUTEX_INITIALIZER;
}
G4float G4PhotonEvaporation::GREnergy[] = {0.0f};
G4float G4PhotonEvaporation::GRWidth[] = {0.0f};
#ifdef G4MULTITHREADED
G4Mutex G4PhotonEvaporation::PhotonEvaporationMutex = G4MUTEX_INITIALIZER;
#endif
G4PhotonEvaporation::G4PhotonEvaporation(G4GammaTransition* p)
: fLevelManager(nullptr), fTransition(p), fPolarization(nullptr),
fVerbose(1), fPoints(0), vShellNumber(-1), fIndex(0), fSecID(-1),
@@ -109,20 +108,18 @@ void G4PhotonEvaporation::Initialise()
void G4PhotonEvaporation::InitialiseGRData()
{
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&G4PhotonEvaporation::PhotonEvaporationMutex);
#endif
if(0.0f == GREnergy[1]) {
G4Pow* g4calc = G4Pow::GetInstance();
const G4float GRWfactor = 0.3f;
for (G4int A=1; A<MAXGRDATA; ++A) {
GREnergy[A] = (G4float)(40.3*CLHEP::MeV/g4calc->powZ(A,0.2));
GRWidth[A] = GRWfactor*GREnergy[A];
if(0.0f == GREnergy[1]) {
G4AutoLock l(&photEvaporationMutex);
if(0.0f == GREnergy[1]) {
G4Pow* g4calc = G4Pow::GetInstance();
const G4float GRWfactor = 0.3f;
for (G4int A=1; A<MAXGRDATA; ++A) {
GREnergy[A] = (G4float)(40.3*CLHEP::MeV/g4calc->powZ(A,0.2));
GRWidth[A] = GRWfactor*GREnergy[A];
}
}
}
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&G4PhotonEvaporation::PhotonEvaporationMutex);
#endif
l.unlock();
}
}
G4Fragment*
@@ -136,9 +133,9 @@ G4PhotonEvaporation::EmittedFragment(G4Fragment* nucleus)
G4NuclearPolarizationStore* fNucPStore = nullptr;
if(fCorrelatedGamma && fRDM) {
fNucPStore = G4NuclearPolarizationStore::GetInstance();
if(nucleus->GetNuclearPolarization()) {
fNucPStore->RemoveMe(nucleus->GetNuclearPolarization());
delete nucleus->GetNuclearPolarization();
auto nucp = nucleus->GetNuclearPolarization();
if(nullptr != nucp) {
fNucPStore->RemoveMe(nucp);
}
fPolarization = fNucPStore->FindOrBuild(nucleus->GetZ_asInt(),
nucleus->GetA_asInt(),
@@ -226,7 +223,7 @@ G4bool G4PhotonEvaporation::BreakUpChain(G4FragmentVector* products,
} while(gamma);
// clear nuclear polarization end of chain
if(fPolarization) {
if(nullptr != fPolarization) {
delete fPolarization;
fPolarization = nullptr;
nucleus->SetNuclearPolarization(fPolarization);
@@ -372,7 +369,7 @@ G4PhotonEvaporation::GenerateGamma(G4Fragment* nucleus)
G4bool isDiscrete = false;
const G4NucLevel* level = nullptr;
size_t ntrans = 0;
std::size_t ntrans = 0;
if(fVerbose > 2) {
G4cout << "GenerateGamma: " << " Eex= " << eexc
@@ -413,7 +410,7 @@ G4PhotonEvaporation::GenerateGamma(G4Fragment* nucleus)
if(0 == ntrans) { isDiscrete = false; }
}
if(fVerbose > 2) {
G4int prec = G4cout.precision(4);
G4long prec = G4cout.precision(4);
G4cout << "GenerateGamma: Z= " << nucleus->GetZ_asInt()
<< " A= " << nucleus->GetA_asInt()
<< " Exc= " << eexc << " Emax= "
@@ -502,7 +499,7 @@ G4PhotonEvaporation::GenerateGamma(G4Fragment* nucleus)
return result;
}
size_t idx = 0;
std::size_t idx = 0;
if(1 < ntrans) {
idx = level->SampleGammaTransition(G4UniformRand());
}
@@ -103,14 +103,14 @@ G4double G4PolarizationTransition::GammaTransF3Coefficient(G4int K, G4int K2,
G4double G4PolarizationTransition::GenerateGammaCosTheta(const POLAR& pol)
{
size_t length = pol.size();
std::size_t length = pol.size();
// Isotropic case
if(length <= 1) return G4UniformRand()*2.-1.;
// kappa > 0 terms integrate out to zero over phi: 0->2pi, so just need (k,0)
// terms to generate cos theta distribution
vector<G4double> polyPDFCoeffs(length, 0.0);
for(size_t k = 0; k < length; k += 2) {
for(G4int k = 0; k < (G4int)length; k += 2) {
if ((pol[k]).size() > 0 ) {
if(fVerbose > 1 && std::abs(((pol)[k])[0].imag()) > kEps) {
G4cout << "G4PolarizationTransition::GenerateGammaCosTheta WARNING: \n"
@@ -120,8 +120,8 @@ G4double G4PolarizationTransition::GenerateGammaCosTheta(const POLAR& pol)
<< ((pol)[k])[0].imag() << "*i" << G4endl;
}
G4double a_k = std::sqrt((G4double)(2*k+1))*GammaTransFCoefficient(k)*((pol)[k])[0].real();
size_t nCoeff = fgLegendrePolys.GetNCoefficients(k);
for(size_t iCoeff=0; iCoeff < nCoeff; ++iCoeff) {
std::size_t nCoeff = fgLegendrePolys.GetNCoefficients(k);
for(std::size_t iCoeff=0; iCoeff < nCoeff; ++iCoeff) {
polyPDFCoeffs[iCoeff] += a_k*fgLegendrePolys.GetCoefficient(iCoeff, k);
}
} else {
@@ -143,10 +143,10 @@ G4double G4PolarizationTransition::GenerateGammaCosTheta(const POLAR& pol)
G4double G4PolarizationTransition::GenerateGammaPhi(G4double& cosTheta,
const POLAR& pol)
{
size_t length = pol.size();
G4int length = (G4int)pol.size();
// Isotropic case
G4bool phiIsIsotropic = true;
for(size_t i=0; i<length; ++i) {
for(G4int i=0; i<length; ++i) {
if(((pol)[i]).size() > 1) {
phiIsIsotropic = false;
break;
@@ -154,18 +154,16 @@ G4double G4PolarizationTransition::GenerateGammaPhi(G4double& cosTheta,
}
if(phiIsIsotropic) { return G4UniformRand()*CLHEP::twopi; }
// map<G4int, map<G4int, G4double> > cache;
map<G4int, map<G4int, G4double> >* cachePtr = nullptr;
// if(length > 10) cachePtr = &cache;
// Otherwise, P(phi) can be written as a sum of cos(kappa phi + phi_kappa).
// Calculate the amplitude and phase for each term
std::vector<G4double> amp(length, 0.0);
std::vector<G4double> phase(length, 0.0);
for(size_t kappa = 0; kappa < length; ++kappa) {
for(G4int kappa = 0; kappa < length; ++kappa) {
G4complex cAmpSum(0.,0.);
for(size_t k = kappa + (kappa % 2); k < length; k += 2) {
size_t kmax = (pol[k]).size();
for(G4int k = kappa + (kappa % 2); k < length; k += 2) {
G4int kmax = (G4int)pol[k].size();
if(kmax > 0) {
if(kappa >= kmax || std::abs(((pol)[k])[kappa]) < kEps) { continue; }
G4double tmpAmp = GammaTransFCoefficient(k);
@@ -195,7 +193,7 @@ G4double G4PolarizationTransition::GenerateGammaPhi(G4double& cosTheta,
// Normalize PDF and calc max (note: it's not the true max, but the max
// assuming that all of the phases line up at a max)
G4double pdfMax = 0.;
for(size_t kappa = 0; kappa < length; ++kappa) { pdfMax += amp[kappa]; }
for(G4int kappa = 0; kappa < length; ++kappa) { pdfMax += amp[kappa]; }
if(fVerbose > 1 && pdfMax < kEps) {
G4cout << "G4PolarizationTransition::GenerateGammaPhi: WARNING "
<< "got pdfMax = 0 for \n";
@@ -206,11 +204,11 @@ G4double G4PolarizationTransition::GenerateGammaPhi(G4double& cosTheta,
}
// Finally, throw phi until it falls in the pdf
for(size_t i=0; i<100; ++i) {
for(std::size_t i=0; i<100; ++i) {
G4double phi = G4UniformRand()*CLHEP::twopi;
G4double prob = G4UniformRand()*pdfMax;
G4double pdfSum = amp[0];
for(size_t kappa = 1; kappa < length; ++kappa) {
for(G4int kappa = 1; kappa < length; ++kappa) {
pdfSum += amp[kappa]*std::cos(phi*kappa + phase[kappa]);
}
if(fVerbose > 1 && pdfSum > pdfMax) {
@@ -278,7 +276,7 @@ void G4PolarizationTransition::SampleGammaTransition(
return;
}
size_t newlength = fTwoJ2+1;
std::size_t newlength = fTwoJ2+1;
//POLAR newPol(newlength);
POLAR newPol;
@@ -286,19 +284,19 @@ void G4PolarizationTransition::SampleGammaTransition(
map<G4int, map<G4int, G4double> >* cachePtr = nullptr;
//if(newlength > 10 || pol.size() > 10) cachePtr = &cache;
for(size_t k2=0; k2<newlength; ++k2) {
for(G4int k2=0; k2<(G4int)newlength; ++k2) {
std::vector<G4complex> npolar;
npolar.resize(k2+1, 0);
//(newPol[k2]).assign(k2+1, 0);
for(size_t k1=0; k1<pol.size(); ++k1) {
for(size_t k=0; k<=k1+k2; k+=2) {
for(G4int k1=0; k1<(G4int)pol.size(); ++k1) {
for(G4int k=0; k<=k1+k2; k+=2) {
// TransF3Coefficient takes the most time. Only calculate it once per
// (k, k1, k2) triplet, and wait until the last possible moment to do
// so. Break out of the inner loops as soon as it is found to be zero.
G4double tF3 = 0.;
G4bool recalcTF3 = true;
for(size_t kappa2=0; kappa2<=k2; ++kappa2) {
G4int ll = (pol[k1]).size();
for(G4int kappa2=0; kappa2<=k2; ++kappa2) {
G4int ll = (G4int)pol[k1].size();
for(G4int kappa1 = 1 - ll; kappa1<ll; ++kappa1) {
if(k+k2<k1 || k+k1<k2) continue;
G4complex tmpAmp = (kappa1 < 0) ?
@@ -357,20 +355,20 @@ void G4PolarizationTransition::SampleGammaTransition(
DumpTransitionData(newPol);
}
// Normalize and trim
size_t lastNonEmptyK2 = 0;
for(size_t k2=0; k2<newlength; ++k2) {
std::size_t lastNonEmptyK2 = 0;
for(std::size_t k2=0; k2<newlength; ++k2) {
G4int lastNonZero = -1;
for(size_t kappa2=0; kappa2<(newPol[k2]).size(); ++kappa2) {
for(std::size_t kappa2=0; kappa2<(newPol[k2]).size(); ++kappa2) {
if(k2 == 0 && kappa2 == 0) {
lastNonZero = 0;
continue;
}
if(std::abs((newPol[k2])[kappa2]) > 0.0) {
lastNonZero = kappa2;
lastNonZero = (G4int)kappa2;
(newPol[k2])[kappa2] /= (newPol[0])[0];
}
}
while((newPol[k2]).size() != size_t (lastNonZero+1)) (newPol[k2]).pop_back();
while((newPol[k2]).size() != std::size_t (lastNonZero+1)) (newPol[k2]).pop_back();
if((newPol[k2]).size() > 0) lastNonEmptyK2 = k2;
}
@@ -393,9 +391,9 @@ void G4PolarizationTransition::DumpTransitionData(const POLAR& pol) const
G4cout << ")--> ";
(fTwoJ2 % 2) ? G4cout << fTwoJ2 << "/2" : G4cout << fTwoJ2/2;
G4cout << ", P = [ { ";
for(size_t k=0; k<pol.size(); ++k) {
for(std::size_t k=0; k<pol.size(); ++k) {
if(k>0) G4cout << " }, { ";
for(size_t kappa=0; kappa<(pol[k]).size(); ++kappa) {
for(std::size_t kappa=0; kappa<(pol[k]).size(); ++kappa) {
if(kappa > 0) G4cout << ", ";
G4cout << (pol[k])[kappa].real() << " + " << (pol[k])[kappa].imag() << "*i";
}
@@ -35,11 +35,8 @@
#include "globals.hh"
#include "G4VCoulombBarrier.hh"
class G4Pow;
class G4CoulombBarrier : public G4VCoulombBarrier
{
public:
explicit G4CoulombBarrier(G4int anA, G4int aZ);
@@ -51,15 +48,6 @@ public:
G4CoulombBarrier(const G4CoulombBarrier & right) = delete;
const G4CoulombBarrier & operator=(const G4CoulombBarrier & right) = delete;
G4bool operator==(const G4CoulombBarrier & right) const = delete;
G4bool operator!=(const G4CoulombBarrier & right) const = delete;
protected:
G4Pow* g4calc;
private:
G4double factor;
};
#endif
@@ -33,6 +33,8 @@
#include "globals.hh"
class G4Pow;
class G4VCoulombBarrier
{
public:
@@ -43,26 +45,23 @@ public:
virtual G4double GetCoulombBarrier(G4int ARes, G4int ZRes,
G4double U = 0.0) const = 0;
virtual G4double BarrierPenetrationFactor(G4int aZ) const = 0;
virtual G4double BarrierPenetrationFactor(G4int aZ) const;
void SetParameters(G4double rho, G4double r0);
inline G4int GetA(void) const { return theA; }
inline G4int GetZ(void) const { return theZ; }
inline G4double GetRho(void) const { return theRho; }
inline G4double GetR0(void) const { return theR0; }
G4VCoulombBarrier(const G4VCoulombBarrier & right) = delete;
const G4VCoulombBarrier & operator=(const G4VCoulombBarrier & right) = delete;
G4bool operator==(const G4VCoulombBarrier & right) const = delete;
G4bool operator!=(const G4VCoulombBarrier & right) const = delete;
private:
protected:
G4Pow* g4calc;
G4int theA;
G4int theZ;
G4double theRho;
G4double theR0;
G4double theRho = 0.0;
G4double factor = 0.0;
};
#endif
@@ -33,11 +33,10 @@
#include "G4CoulombBarrier.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4Pow.hh"
#include "G4NuclearRadii.hh"
G4CoulombBarrier::G4CoulombBarrier(G4int A, G4int Z)
: G4VCoulombBarrier(A, Z), g4calc(G4Pow::GetInstance())
: G4VCoulombBarrier(A, Z)
{
factor = CLHEP::elm_coupling*Z;
SetParameters(0.4*G4NuclearRadii::RadiusCB(Z, A), 1.5*CLHEP::fermi);
@@ -46,7 +45,8 @@ G4CoulombBarrier::G4CoulombBarrier(G4int A, G4int Z)
G4double G4CoulombBarrier::GetCoulombBarrier(
G4int ARes, G4int ZRes, G4double U) const
{
G4double cb = factor*ZRes/(G4NuclearRadii::RadiusCB(ZRes,ARes) + GetRho());
if(0 == theZ) { return 0.0; }
G4double cb = factor*ZRes/(G4NuclearRadii::RadiusCB(ZRes,ARes) + theRho);
if(U > 0.0) { cb /= (1.0 + std::sqrt( U/((2*ARes)*CLHEP::MeV) )); }
return cb;
}
@@ -62,15 +62,15 @@ G4double G4CoulombBarrier::BarrierPenetrationFactor(G4int aZ) const
// const G4double Kprot[size] = {0.42, 0.58, 0.68, 0.77, 0.80};
//
G4double res = 1.0;
if(GetZ() == 1) {
if(theZ == 1) {
res = (aZ >= 70) ? 0.80 :
(((0.2357e-5*aZ) - 0.42679e-3)*aZ + 0.27035e-1)*aZ + 0.19025;
res += 0.06*(GetA() - 1);
res += 0.06*(theA - 1);
} else if(GetZ() == 2 && GetA() <= 4) {
} else if(theZ == 2 && theA <= 4) {
res = (aZ >= 70) ? 0.98 :
(((0.23684e-5*aZ) - 0.42143e-3)*aZ + 0.25222e-1)*aZ + 0.46699;
res += 0.12*(4 - GetA());
res += 0.12*(4 - theA);
}
return res;
}
@@ -29,12 +29,13 @@
#include "G4VCoulombBarrier.hh"
#include "G4PhysicalConstants.hh"
#include "G4Pow.hh"
G4VCoulombBarrier::G4VCoulombBarrier(G4int anA, G4int aZ)
: g4calc(G4Pow::GetInstance())
{
theA = anA;
theZ = aZ;
theRho = 0.0;
theR0 = 1.5*CLHEP::fermi;
}
@@ -43,3 +44,9 @@ void G4VCoulombBarrier::SetParameters(G4double rho, G4double r0)
theRho = rho;
theR0 = r0;
}
G4double G4VCoulombBarrier::BarrierPenetrationFactor(G4int) const
{
return 1.0;
}
@@ -1,9 +1,21 @@
# Category hadr-fission History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-fission-V11-00-03)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-09-05 Ben Morgan (hadr-fission-V11-00-02)
- Update dependencies to address warnings from consistency check
## 2022-07-01 Alberto Ribon (hadr-fission-V11-00-01)
- G4FissLib.cc, G4LFission.cc : use consistent thresholds for relative
(10% instead of 5%) and absolute (350 GeV instead of 250 GeV) energy
non-conservation check.
## 2021-12-10 Ben Morgan (hadr-fission-V11-00-00)
- Change to new Markdown History format
@@ -47,5 +47,4 @@ geant4_module_link_libraries(G4had_fission
G4hadronic_util
G4heprandom
G4leptons
G4materials
G4track)
@@ -73,10 +73,10 @@ G4FissLib::G4FissLib()
dirName = G4FindDataDir("G4NEUTRONHPDATA");
G4String tString = "/Fission/";
dirName = dirName + tString;
numEle = G4Element::GetNumberOfElements();
numEle = (G4int)G4Element::GetNumberOfElements();
theFission = new G4ParticleHPChannel[numEle];
for (G4int i=0; i<numEle; i++)
for (G4int i=0; i<numEle; ++i)
{
// G4cout << "G4FissLib::G4FissLib(): element "<< i << " : " << (*(G4Element::GetElementTable()))[i]->GetZ()<< G4endl;
if((*(G4Element::GetElementTable()))[i]->GetZ()>89)
@@ -98,18 +98,18 @@ G4FissLib::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aNucleus)
G4ParticleHPManager::GetInstance()->OpenReactionWhiteBoard();
const G4Material* theMaterial = aTrack.GetMaterial();
G4int n = theMaterial->GetNumberOfElements();
G4int index = theMaterial->GetElement(0)->GetIndex();
std::size_t n = theMaterial->GetNumberOfElements();
std::size_t index = theMaterial->GetElement(0)->GetIndex();
if (n != 1) {
xSec = new G4double[n];
G4double sum = 0;
G4int i;
G4int imat;
std::size_t imat;
const G4double * NumAtomsPerVolume = theMaterial->GetVecNbOfAtomsPerVolume();
G4double rWeight;
G4ParticleHPThermalBoost aThermalE;
for (i = 0; i < n; i++) {
for (i = 0; i < (G4int)n; ++i) {
imat = theMaterial->GetElement(i)->GetIndex();
rWeight = NumAtomsPerVolume[i];
xSec[i] = theFission[imat].GetXsec(aThermalE.GetThermalEnergy(aTrack,
@@ -121,7 +121,7 @@ G4FissLib::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aNucleus)
G4double random = G4UniformRand();
G4double running = 0;
for (i = 0; i < n; i++) {
for (i = 0; i < (G4int)n; ++i) {
running += xSec[i];
index = theMaterial->GetElement(i)->GetIndex();
if(random<=running/sum) break;
@@ -135,8 +135,8 @@ G4FissLib::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aNucleus)
aNucleus.SetParameters(G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA(),G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargZ());
const G4Element* target_element = (*G4Element::GetElementTable())[index];
const G4Isotope* target_isotope=NULL;
G4int iele = target_element->GetNumberOfIsotopes();
for ( G4int j = 0 ; j != iele ; j++ ) {
G4int iele = (G4int)target_element->GetNumberOfIsotopes();
for ( G4int j = 0 ; j != iele ; ++j ) {
target_isotope=target_element->GetIsotope( j );
if ( target_isotope->GetN() == G4ParticleHPManager::GetInstance()->GetReactionWhiteBoard()->GetTargA() ) break;
}
@@ -147,6 +147,6 @@ G4FissLib::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aNucleus)
const std::pair<G4double, G4double> G4FissLib::GetFatalEnergyCheckLevels() const
{
// max energy non-conservation is mass of heavy nucleus (taken from G4LFission)
return std::pair<G4double, G4double>(5*perCent,250*GeV);
// max energy non-conservation is mass of heavy nucleus
return std::pair<G4double, G4double>(10.0*perCent, 350.0*CLHEP::GeV);
}
@@ -284,5 +284,5 @@ G4double G4LFission::Atomas(const G4double A, const G4double Z)
const std::pair<G4double, G4double> G4LFission::GetFatalEnergyCheckLevels() const
{
// max energy non-conservation is mass of heavy nucleus
return std::pair<G4double, G4double>(5*perCent,250*GeV);
return std::pair<G4double, G4double>(10.0*perCent, 350.0*CLHEP::GeV);
}
@@ -5,6 +5,9 @@ which **must** added in reverse chronological order (newest at the top). It must
be used as a substitute for writing good git commit messages!
## 2022-09-05 Ben Morgan (hadr-gammanuc-V11-00-01)
- Update dependencies to address warnings from consistency check
## 2021-12-10 Ben Morgan (hadr-gammanuc-V11-00-00)
- Change to new Markdown History format
@@ -9,5 +9,6 @@ geant4_module_link_libraries(G4had_gamma_nuclear
PUBLIC
G4had_lend
PRIVATE
G4globman
G4hadronic_bert_cascade
G4partman)
@@ -1,9 +1,13 @@
# Category had-im_r History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (had-im_r-V11-00-01)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2021-12-10 Ben Morgan (had-im_r-V11-00-00)
- Change to new Markdown History format
@@ -41,7 +41,7 @@ public:
G4int Entries();
void AddCollision(G4double time, G4KineticTrack * proj,
G4KineticTrack * target = NULL);
G4KineticTrack * target = nullptr);
void AddCollision(G4CollisionInitialState * collision)
{
theCollisionList->push_back(collision);
@@ -60,26 +60,10 @@ private:
G4ListOfCollisions * theCollisionList; //was sorted (by time) vector...
};
inline G4int G4CollisionManager::Entries()
{
return theCollisionList->size();
return (G4int)theCollisionList->size();
}
#endif
@@ -85,21 +85,3 @@ private:
};
#endif
@@ -76,11 +76,8 @@ G4double G4CrossSectionComposite::CrossSection(const G4KineticTrack& trk1,
const G4CrossSectionVector* components = GetComponents();
if (components != 0)
{
G4int nComponents = this->GetComponents()->size();
// G4int nValid = 0;
G4int i;
for (i=0; i<nComponents; i++)
std::size_t nComponents = GetComponents()->size();
for (std::size_t i=0; i<nComponents; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
@@ -90,7 +87,6 @@ G4double G4CrossSectionComposite::CrossSection(const G4KineticTrack& trk1,
}
}
}
return crossSection;
}
@@ -102,9 +98,8 @@ G4bool G4CrossSectionComposite::IsValid(G4double e) const
const G4CrossSectionVector* components = GetComponents();
if (components != 0)
{
G4int n = components->size();
G4int i;
for (i=0; i<n; i++)
std::size_t n = components->size();
for (std::size_t i=0; i<n; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
@@ -77,11 +77,9 @@ G4double G4CrossSectionPatch::CrossSection(const G4KineticTrack& trk1,
const G4CrossSectionVector* components = GetComponents();
if (components != 0)
{
G4int nComponents = this->GetComponents()->size();
// G4int nValid = 0;
std::size_t nComponents = this->GetComponents()->size();
G4int i;
for (i=0; i<nComponents; i++)
for (std::size_t i=0; i<nComponents; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
@@ -113,9 +111,8 @@ G4bool G4CrossSectionPatch::IsValid(G4double e) const
const G4CrossSectionVector* components = GetComponents();
if (components != 0)
{
G4int n = components->size();
G4int i;
for (i=0; i<n; i++)
std::size_t n = components->size();
for (std::size_t i=0; i<n; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
@@ -76,24 +76,23 @@ G4bool G4PartialWidthTable::operator!=(const G4PartialWidthTable &right) const
G4int G4PartialWidthTable::NumberOfChannels() const
{
return widths.size();
return (G4int)widths.size();
}
const G4PhysicsVector* G4PartialWidthTable::Width(const G4String& name1, const G4String& name2) const
{
// Returned pointer is not owned by the client
G4int i;
G4PhysicsVector* width = 0;
G4int n = 0;
G4int entries = widths.size();
for (i=0; i<entries; i++)
std::size_t n = 0;
std::size_t entries = widths.size();
for (std::size_t i=0; i<entries; ++i)
{
if ( (daughter1[i] == name1 && daughter2[i] == name2) ||
(daughter2[i] == name1 && daughter1[i] == name2) )
{
width = (G4PhysicsVector*) (widths[i]);
n++;
++n;
}
}
if (n > 1) throw G4HadronicException(__FILE__, __LINE__, "G4PartialWidthTable::Width - ambiguity");
@@ -124,16 +123,14 @@ void G4PartialWidthTable::AddWidths(const G4double* channelWidth,
void G4PartialWidthTable::Dump() const
{
G4int entries = widths.size();
std::size_t entries = widths.size();
G4int i;
for (i=0; i<entries; i++)
for (std::size_t i=0; i<entries; ++i)
{
G4cout << " Channel " << i << ": "
<< daughter1[i] << " " << daughter2[i] << G4endl;
<< daughter1[i] << " " << daughter2[i] << G4endl;
G4PhysicsFreeVector* width = widths[i];
G4int j;
for (j=0; j<nEnergies; j++)
for (G4int j=0; j<nEnergies; ++j)
{
G4bool dummy = false;
G4double e = energy[i];
@@ -41,103 +41,105 @@ G4VCollision::~G4VCollision()
G4bool G4VCollision::operator==(const G4VCollision &right) const
{
return (this == (G4VCollision *) &right);
return (this == (G4VCollision *) &right);
}
G4bool G4VCollision::operator!=(const G4VCollision &right) const
{
return (this != (G4VCollision *) &right);
return (this != (G4VCollision *) &right);
}
G4double G4VCollision::CrossSection(const G4KineticTrack& aTrk1,
const G4KineticTrack& aTrk2) const
const G4KineticTrack& aTrk2) const
{
G4double sigma = 0.;
G4double sigma = 0.;
const G4VCrossSectionSource* xSource = GetCrossSectionSource();
const G4VCrossSectionSource* xSource = GetCrossSectionSource();
if (xSource != 0)
{
// There is a cross section for this Collision
sigma = xSource->CrossSection(aTrk1,aTrk2);
}
return sigma;
if (xSource != nullptr)
{
// There is a cross section for this Collision
sigma = xSource->CrossSection(aTrk1,aTrk2);
}
return sigma;
}
void G4VCollision::Print() const
{
G4String name = GetName();
G4String name = GetName();
G4cout << "---- " << name << "---- Cross section" << G4endl;
G4cout << "---- " << name << "---- Cross section" << G4endl;
const G4VCrossSectionSource* xSource = GetCrossSectionSource();
if (xSource) xSource->Print();
G4int nComponents = 0;
const G4CollisionVector* components = GetComponents();
if (components)
{
nComponents = components->size();
}
G4cout << "---- " << name << "---- has " << nComponents << " components" <<G4endl;
G4int i = 0;
G4CollisionVector::const_iterator iter;
if (components)
{
for (iter = components->begin(); iter != components->end(); ++iter)
{
G4cout << "---- " << name << " ---- Component " << i << G4endl;
((*iter))->Print();
i++;
}
}
const G4VCrossSectionSource* xSource = GetCrossSectionSource();
if (xSource) xSource->Print();
G4int nComponents = 0;
const G4CollisionVector* components = GetComponents();
if (components)
{
nComponents = (G4int)components->size();
}
G4cout << "---- " << name << "---- has " << nComponents << " components" <<G4endl;
G4int i = 0;
if (components)
{
for (auto iter = components->cbegin(); iter != components->cend(); ++iter)
{
G4cout << "---- " << name << " ---- Component " << i << G4endl;
((*iter))->Print();
++i;
}
}
}
void G4VCollision::Print(const G4KineticTrack& trk1,
const G4KineticTrack& trk2) const
const G4KineticTrack& trk2) const
{
G4String name = GetName();
G4String name = GetName();
if (IsInCharge(trk1,trk2))
{
G4cout << "---- " << name << "is in charge ---- " << G4endl;
}
else
{
G4cout << "---- " << name << "is not in charge ---- " << G4endl;
}
if (IsInCharge(trk1,trk2))
{
G4cout << "---- " << name << "is in charge ---- " << G4endl;
}
else
{
G4cout << "---- " << name << "is not in charge ---- " << G4endl;
}
G4cout << "---- " << name << "---- Cross section" << G4endl;
G4cout << "---- " << name << "---- Cross section" << G4endl;
const G4VCrossSectionSource* xSource = GetCrossSectionSource();
if (xSource) xSource->Print();
G4cout << "Cross section = " << CrossSection(trk1,trk2) << G4endl;
const G4VCrossSectionSource* xSource = GetCrossSectionSource();
if (xSource) xSource->Print();
G4cout << "Cross section = " << CrossSection(trk1,trk2) << G4endl;
G4int nComponents = 0;
const G4CollisionVector* components = GetComponents();
if (components)
{
nComponents = components->size();
}
G4cout << "---- " << name << "has " << nComponents << " components" <<G4endl;
G4int nComponents = 0;
const G4CollisionVector* components = GetComponents();
if (components)
{
nComponents = (G4int)components->size();
}
G4cout << "---- " << name << "has " << nComponents << " components" <<G4endl;
G4int i = 0;
G4CollisionVector::const_iterator iter;
if (components)
{
for (iter = components->begin(); iter != components->end(); ++iter)
{
G4cout << "Component " << i << G4endl;
((*iter))->Print();
i++;
}
}
G4int i = 0;
if (components)
{
for (auto iter = components->cbegin(); iter != components->cend(); ++iter)
{
G4cout << "Component " << i << G4endl;
((*iter))->Print();
++i;
}
}
}
G4VCollision::G4VCollision(void*, void*, void *, void *, void *, void *, void *){}
void G4VCollision::establish_G4MT_TLS_G4VCollision(){ }
G4VCollision::G4VCollision(void*, void*, void *, void *, void *, void *, void *)
{
}
void G4VCollision::establish_G4MT_TLS_G4VCollision()
{
}
@@ -85,15 +85,14 @@ G4bool G4VCrossSectionSource::operator!=(const G4VCrossSectionSource &right) con
void G4VCrossSectionSource::Print() const
{
G4int nComponents = 0;
std::size_t nComponents = 0;
const G4CrossSectionVector* components = GetComponents();
if (components)
{
nComponents = components->size();
}
G4cout << "---- " << this->Name() << " ---- has " << nComponents << " components" <<G4endl;
G4int i;
for (i=0; i<nComponents; i++)
for (std::size_t i=0; i<nComponents; ++i)
{
G4cout << "-" << this->Name() << " - Component " << i << ": " <<G4endl;
@@ -113,14 +112,13 @@ void G4VCrossSectionSource::PrintAll(const G4KineticTrack& trk1, const G4Kinetic
<< " Cross section = " << sigma << " mb "
<< G4endl;
G4int nComponents = 0;
std::size_t nComponents = 0;
const G4CrossSectionVector* components = GetComponents();
if (components != 0)
{
nComponents = components->size();
}
G4int i;
for (i=0; i<nComponents; i++)
for (std::size_t i=0; i<nComponents; ++i)
{
G4cout << "* Component " << i << ": ";
G4CrossSectionSourcePtr componentPtr = (*components)[i];
@@ -64,21 +64,20 @@ G4XNNElastic::G4XNNElastic()
G4XNNElastic::~G4XNNElastic()
{
if (components != 0)
if (components != nullptr)
{
G4int nComponents = this->GetComponents()->size();
G4int i;
for (i=0; i<nComponents; i++)
std::size_t nComponents = GetComponents()->size();
for (std::size_t i=0; i<nComponents; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
delete component;
component = 0;
componentPtr = 0;
component = nullptr;
componentPtr = nullptr;
}
}
delete components;
components = 0;
components = nullptr;
}
@@ -49,21 +49,20 @@ G4XNNTotal::G4XNNTotal()
G4XNNTotal::~G4XNNTotal()
{
if (components != 0)
if (components != nullptr)
{
G4int nComponents = this->GetComponents()->size();
G4int i;
for (i=0; i<nComponents; i++)
std::size_t nComponents = GetComponents()->size();
for (std::size_t i=0; i<nComponents; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
delete component;
component = 0;
componentPtr = 0;
component = nullptr;
componentPtr = nullptr;
}
}
delete components;
components = 0;
components = nullptr;
}
@@ -66,21 +66,20 @@ G4XnpElastic::G4XnpElastic()
G4XnpElastic::~G4XnpElastic()
{
if (components != 0)
if (components != nullptr)
{
G4int nComponents = this->GetComponents()->size();
G4int i;
for (i=0; i<nComponents; i++)
std::size_t nComponents = GetComponents()->size();
for (std::size_t i=0; i<nComponents; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
delete component;
component = 0;
componentPtr = 0;
component = nullptr;
componentPtr = nullptr;
}
}
delete components;
components = 0;
components = nullptr;
}
@@ -64,21 +64,20 @@ G4XnpTotal::G4XnpTotal()
G4XnpTotal::~G4XnpTotal()
{
if (components != 0)
if (components != nullptr)
{
G4int nComponents = this->GetComponents()->size();
G4int i;
for (i=0; i<nComponents; i++)
std::size_t nComponents = GetComponents()->size();
for (std::size_t i=0; i<nComponents; ++i)
{
G4CrossSectionSourcePtr componentPtr = (*components)[i];
G4VCrossSectionSource* component = componentPtr();
delete component;
component = 0;
componentPtr = 0;
component = nullptr;
componentPtr = nullptr;
}
}
delete components;
components = 0;
components = nullptr;
}
@@ -6,6 +6,21 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2022-11-26 Gabriele Cosmo (hadr-inclxx-V11-00-08)
- Fixed more compilation warnings for implicit type conversions.
## 2022-11-18 Gabriele Cosmo (hadr-inclxx-V11-00-07)
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
## 2022-11-11 Alberto Ribon (hadr-inclxx-V11-00-06)
- G4INCLXXInterface: introduced a protection against unphysical nuclear remnants
(i.e. unbound systems), and, if this is the case, resample the collision.
## 2022-10-07 Gabriele Cosmo (hadr-inclxx-V11-00-05)
- Fixed compilation warnings on Intel/icx compiler for variables set
but not used in G4INCLInvFInterpolationTable, G4INCLStore,
G4INCLNpiToMissingStrangenessChannel and G4INCLNNToMissingStrangenessChannel.
## 2022-05-25 Alberto Ribon (hadr-inclxx-V11-00-04)
- G4INCLParticle, G4INCLEventInfo, G4INCLNucleus, G4INCLDeltaDecayChannel,
G4INCLXXInterface : set and propagate the information on parent resonance.
@@ -182,7 +182,7 @@ namespace G4INCL {
/// \brief Get the number of the stored components
G4int getNumberStoredComponents() const {
return storedComponents.size();
return (G4int)storedComponents.size();
}
/// \brief Store the energy levels
@@ -282,13 +282,13 @@ namespace G4INCL {
// Fill in the event information
theEventInfo.projectileType = projectileSpecies.theType;
theEventInfo.Ap = projectileSpecies.theA;
theEventInfo.Zp = projectileSpecies.theZ;
theEventInfo.Sp = projectileSpecies.theS;
theEventInfo.Ap = (G4INCL::Short_t)projectileSpecies.theA;
theEventInfo.Zp = (G4INCL::Short_t)projectileSpecies.theZ;
theEventInfo.Sp = (G4INCL::Short_t)projectileSpecies.theS;
theEventInfo.Ep = kineticEnergy;
theEventInfo.At = nucleus->getA();
theEventInfo.Zt = nucleus->getZ();
theEventInfo.St = nucleus->getS();
theEventInfo.At = (G4INCL::Short_t)nucleus->getA();
theEventInfo.Zt = (G4INCL::Short_t)nucleus->getZ();
theEventInfo.St = (G4INCL::Short_t)nucleus->getS();
// Do nothing below the Coulomb barrier
if(maxImpactParameter<=0.) {
@@ -794,7 +794,7 @@ namespace G4INCL {
// Add the dynamical spectators to the bunch
ParticleList rejected = theProjectileRemnant->addAllDynamicalSpectators(dynSpectators);
// Put back the rejected spectators into the outgoing list
nUnmergedSpectators = rejected.size();
nUnmergedSpectators = (G4int)rejected.size();
nucleus->getStore()->addToOutgoing(rejected);
// Deal with the projectile remnant
@@ -80,7 +80,7 @@ namespace G4INCL {
// Keep track of the first entering particle
if(intersection.time < theFirstEntryTime) {
theFirstEntryTime = intersection.time;
theFirstID = (*p)->getID();
theFirstID = (G4int)(*p)->getID();
}
}
}
@@ -70,8 +70,6 @@ namespace G4INCL {
G4double rdm = Random::shoot();
G4int nbr_particle = 3;
if(rdm < 0.35){
// N-K-Lambda chosen
particle2->setType(Lambda);
@@ -81,7 +79,6 @@ namespace G4INCL {
}
else if((iso == 0 && rdm < 0.55) || rdm < 0.5){
// N-N-K-Kb chosen
nbr_particle++;
available_iso = 4;
min_pions = 1;
max_pions = G4int((sqrtS-2.*ParticleTable::getINCLMass(Proton)-2.*ParticleTable::getINCLMass(KZero))/ParticleTable::getINCLMass(PiPlus));
@@ -97,7 +94,6 @@ namespace G4INCL {
nbr_pions = std::min(max_pions,std::max(min_pions,G4int(intermediaire )));
available_iso += nbr_pions*2;
nbr_particle += nbr_pions;
ParticleList list;
ParticleType PionType = PiZero;
@@ -82,8 +82,6 @@ namespace G4INCL {
G4double rdm = Random::shoot();
G4int nbr_particle = 2;
if(rdm < 0.35){
// Lambda-K chosen
nucleon_initial->setType(Lambda);
@@ -93,7 +91,6 @@ namespace G4INCL {
}
else if((iso == 0 && rdm < 0.55) || rdm < 0.5){
// N-K-Kb chosen
nbr_particle++;
available_iso = 3;
min_pions = 1;
max_pions = G4int((sqrtS-ParticleTable::getINCLMass(Proton)-2.*ParticleTable::getINCLMass(KZero)-10.)/ParticleTable::getINCLMass(PiPlus));
@@ -109,7 +106,6 @@ namespace G4INCL {
nbr_pions = std::min(max_pions,std::max(min_pions,G4int(intermediaire )));
available_iso += nbr_pions*2;
nbr_particle += nbr_pions;
// Erase the parent resonance information of the initial particles
particle1->setParentResonancePDGCode(0);
@@ -790,7 +790,7 @@ namespace G4INCL {
theStore->addToOutgoing(*i);
(*i)->setParticleBias(Particle::getTotalBias());
}
return toEject.size();
return (G4int)toEject.size();
}
G4bool Nucleus::emitInsideKaon() {
@@ -1049,9 +1049,9 @@ namespace G4INCL {
eventInfo->ParticleBias[eventInfo->nParticles] = (*i)->getParticleBias();
eventInfo->A[eventInfo->nParticles] = (*i)->getA();
eventInfo->Z[eventInfo->nParticles] = (*i)->getZ();
eventInfo->S[eventInfo->nParticles] = (*i)->getS();
eventInfo->A[eventInfo->nParticles] = (G4INCL::Short_t)(*i)->getA();
eventInfo->Z[eventInfo->nParticles] = (G4INCL::Short_t)(*i)->getZ();
eventInfo->S[eventInfo->nParticles] = (G4INCL::Short_t)(*i)->getS();
eventInfo->emissionTime[eventInfo->nParticles] = (*i)->getEmissionTime();
eventInfo->EKin[eventInfo->nParticles] = (*i)->getKineticEnergy();
ThreeVector mom = (*i)->getMomentum();
@@ -1080,9 +1080,9 @@ namespace G4INCL {
// Projectile-like remnant characteristics
if(theProjectileRemnant && theProjectileRemnant->getA()>0) {
eventInfo->ARem[eventInfo->nRemnants] = theProjectileRemnant->getA();
eventInfo->ZRem[eventInfo->nRemnants] = theProjectileRemnant->getZ();
eventInfo->SRem[eventInfo->nRemnants] = theProjectileRemnant->getS();
eventInfo->ARem[eventInfo->nRemnants] = (G4INCL::Short_t)theProjectileRemnant->getA();
eventInfo->ZRem[eventInfo->nRemnants] = (G4INCL::Short_t)theProjectileRemnant->getZ();
eventInfo->SRem[eventInfo->nRemnants] = (G4INCL::Short_t)theProjectileRemnant->getS();
G4double eStar = theProjectileRemnant->getExcitationEnergy();
if(std::abs(eStar)<1E-10)
eStar = 0.0; // blame rounding and set the excitation energy to zero
@@ -1111,9 +1111,9 @@ namespace G4INCL {
// Target-like remnant characteristics
if(hasRemnant()) {
eventInfo->ARem[eventInfo->nRemnants] = getA();
eventInfo->ZRem[eventInfo->nRemnants] = getZ();
eventInfo->SRem[eventInfo->nRemnants] = getS();
eventInfo->ARem[eventInfo->nRemnants] = (G4INCL::Short_t)getA();
eventInfo->ZRem[eventInfo->nRemnants] = (G4INCL::Short_t)getZ();
eventInfo->SRem[eventInfo->nRemnants] = (G4INCL::Short_t)getS();
eventInfo->EStarRem[eventInfo->nRemnants] = getExcitationEnergy();
if(eventInfo->EStarRem[eventInfo->nRemnants]<0.) {
INCL_WARN("Negative excitation energy in target-like remnant! EStarRem = " << eventInfo->EStarRem[eventInfo->nRemnants] << " eventNumber=" << eventInfo->eventNumber << '\n');
@@ -66,7 +66,7 @@ namespace G4INCL {
boostV.setY(0.0);
boostV.setZ(0.0);
const size_t N = particles.size();
const std::size_t N = particles.size();
masses.resize(N);
sumMasses.resize(N);
std::transform(particles.begin(), particles.end(), masses.begin(), std::mem_fn(&Particle::getMass));
@@ -83,8 +83,8 @@ namespace G4INCL {
restParticle->setMass(sqrtS);
restParticle->adjustEnergyFromMomentum();
G4int k=N-1;
for (ParticleList::reverse_iterator p=particles.rbegin(); k>0; ++p, --k) {
G4int k=G4int(N-1);
for (auto p=particles.rbegin(); k>0; ++p, --k) {
const G4double mu = sumMasses[k-1];
T *= (k>1) ? betaKopylov(k) : 0.;

Some files were not shown because too many files have changed in this diff Show More