Import Geant4 11.2.2 source tree
This commit is contained in:
@@ -6,6 +6,11 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-05-22 Gunter Folger (had-binary-V11-01-01)
|
||||
- Address problem reported by Atlas of throwing execption if momentum cannot
|
||||
be corrected. Problem ocurrs for D + H around 1600 MeV
|
||||
- The exception is removed,in this rare case the initial state is kept
|
||||
unchanged instead.
|
||||
|
||||
## 2023-04-28 Vladimir Ivantchenko (had-binary-V11-01-00)
|
||||
- G4BinaryCascade, G4BinaryLightIonReaction - do not call getenv, use
|
||||
|
||||
@@ -121,146 +121,135 @@ ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus & targetNucleus )
|
||||
{
|
||||
// G4cout << "Using pre-compound only, E= "<<mom.t()-mom.mag()<<G4endl;
|
||||
// m_nucl = mom.mag();
|
||||
cascaders=FuseNucleiAndPrompound(mom);
|
||||
if( !cascaders )
|
||||
{
|
||||
cascaders=FuseNucleiAndPrompound(mom);
|
||||
if( !cascaders )
|
||||
{
|
||||
|
||||
// abort!! happens for too low energy for nuclei to fuse
|
||||
// abort!! happens for too low energy for nuclei to fuse
|
||||
|
||||
theResult.Clear();
|
||||
theResult.SetStatusChange(isAlive);
|
||||
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
|
||||
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
|
||||
return &theResult;
|
||||
}
|
||||
theResult.Clear();
|
||||
theResult.SetStatusChange(isAlive);
|
||||
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
|
||||
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
|
||||
return &theResult;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result=Interact(mom,toBreit);
|
||||
|
||||
if(! result )
|
||||
{
|
||||
// abort!!
|
||||
if(! result )
|
||||
{
|
||||
// abort!!
|
||||
|
||||
G4cerr << "G4BinaryLightIonReaction no final state for: " << G4endl;
|
||||
G4cerr << " Primary " << aTrack.GetDefinition()
|
||||
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
|
||||
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
|
||||
<< ", kinetic energy " << aTrack.GetKineticEnergy()
|
||||
<< G4endl;
|
||||
G4cerr << " Target nucleus (A,Z)=("
|
||||
<< (swapped?pA:tA) << ","
|
||||
<< (swapped?pZ:tZ) << ")" << G4endl;
|
||||
G4cerr << " if frequent, please submit above information as bug report"
|
||||
<< G4endl << G4endl;
|
||||
G4cerr << "G4BinaryLightIonReaction no final state for: " << G4endl;
|
||||
G4cerr << " Primary " << aTrack.GetDefinition()
|
||||
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
|
||||
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
|
||||
<< ", kinetic energy " << aTrack.GetKineticEnergy()
|
||||
<< G4endl;
|
||||
G4cerr << " Target nucleus (A,Z)=("
|
||||
<< (swapped?pA:tA) << ","
|
||||
<< (swapped?pZ:tZ) << ")" << G4endl;
|
||||
G4cerr << " if frequent, please submit above information as bug report"
|
||||
<< G4endl << G4endl;
|
||||
|
||||
theResult.Clear();
|
||||
theResult.SetStatusChange(isAlive);
|
||||
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
|
||||
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
|
||||
return &theResult;
|
||||
}
|
||||
theResult.Clear();
|
||||
theResult.SetStatusChange(isAlive);
|
||||
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
|
||||
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
|
||||
return &theResult;
|
||||
}
|
||||
|
||||
// Calculate excitation energy,
|
||||
G4double theStatisticalExEnergy = GetProjectileExcitation();
|
||||
// Calculate excitation energy,
|
||||
G4double theStatisticalExEnergy = GetProjectileExcitation();
|
||||
|
||||
|
||||
pInitialState = mom;
|
||||
//G4cout << "BLIC: pInitialState from aTrack : " << pInitialState;
|
||||
pInitialState.setT(pInitialState.getT() +
|
||||
G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(tZ,tA));
|
||||
//G4cout << "BLIC: target nucleus added : " << pInitialState << G4endl;
|
||||
pInitialState = mom;
|
||||
//G4cout << "BLIC: pInitialState from aTrack : " << pInitialState;
|
||||
pInitialState.setT(pInitialState.getT() +
|
||||
G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass(tZ,tA));
|
||||
//G4cout << "BLIC: target nucleus added : " << pInitialState << G4endl;
|
||||
|
||||
delete target3dNucleus;target3dNucleus=0;
|
||||
delete projectile3dNucleus;projectile3dNucleus=0;
|
||||
delete target3dNucleus;target3dNucleus=0;
|
||||
delete projectile3dNucleus;projectile3dNucleus=0;
|
||||
|
||||
G4ReactionProductVector * spectators= new G4ReactionProductVector;
|
||||
G4ReactionProductVector * spectators= new G4ReactionProductVector;
|
||||
|
||||
cascaders = new G4ReactionProductVector;
|
||||
cascaders = new G4ReactionProductVector;
|
||||
|
||||
G4LorentzVector pspectators=SortResult(result,spectators,cascaders);
|
||||
// this also sets spectatorA and spectatorZ
|
||||
G4LorentzVector pspectators=SortResult(result,spectators,cascaders);
|
||||
// this also sets spectatorA and spectatorZ
|
||||
|
||||
// pFinalState=std::accumulate(cascaders->begin(),cascaders->end(),pFinalState,ReactionProduct4Mom);
|
||||
// pFinalState=std::accumulate(cascaders->begin(),cascaders->end(),pFinalState,ReactionProduct4Mom);
|
||||
|
||||
std::vector<G4ReactionProduct *>::iterator iter;
|
||||
std::vector<G4ReactionProduct *>::iterator iter;
|
||||
|
||||
// G4cout << "pInitialState, pFinalState / pspectators"<< pInitialState << " / " << pFinalState << " / " << pspectators << G4endl;
|
||||
// G4cout << "pInitialState, pFinalState / pspectators"<< pInitialState << " / " << pFinalState << " / " << pspectators << G4endl;
|
||||
// if ( spectA-spectatorA !=0 || spectZ-spectatorZ !=0)
|
||||
// {
|
||||
// G4cout << "spect Nucl != spectators: nucl a,z; spect a,z" <<
|
||||
// spectatorA <<" "<< spectatorZ <<" ; " << spectA <<" "<< spectZ << G4endl;
|
||||
// }
|
||||
delete result;
|
||||
result=0;
|
||||
G4LorentzVector momentum(pInitialState-pFinalState);
|
||||
G4int loopcount(0);
|
||||
//G4cout << "BLIC: momentum, pspectators : " << momentum << " / " << pspectators << G4endl;
|
||||
while (std::abs(momentum.e()-pspectators.e()) > 10*MeV) /* Loop checking, 31.08.2015, G.Folger */
|
||||
// see if on loopcount
|
||||
{
|
||||
G4LorentzVector pCorrect(pInitialState-pspectators);
|
||||
//G4cout << "BLIC:: BIC nonconservation? (pInitialState-pFinalState) / spectators :" << momentum << " / " << pspectators << "pCorrect "<< pCorrect<< G4endl;
|
||||
// Correct outgoing casacde particles.... to have momentum of (initial state - spectators)
|
||||
G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCorrect);
|
||||
if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults)
|
||||
{
|
||||
G4cout << "Warning - G4BinaryLightIonReaction E/P correction for cascaders failed" << G4endl;
|
||||
}
|
||||
pFinalState=G4LorentzVector(0,0,0,0);
|
||||
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
|
||||
{
|
||||
pFinalState += G4LorentzVector( (*iter)->GetMomentum(), (*iter)->GetTotalEnergy() );
|
||||
}
|
||||
momentum=pInitialState-pFinalState;
|
||||
if (++loopcount > 10 )
|
||||
{
|
||||
if ( momentum.vect().mag() - momentum.e()> 10*keV )
|
||||
{
|
||||
G4cerr << "G4BinaryLightIonReaction.cc: Cannot correct 4-momentum of cascade particles" << G4endl;
|
||||
throw G4HadronicException(__FILE__, __LINE__, "G4BinaryCasacde::ApplyCollision()");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (spectatorA > 0 )
|
||||
{
|
||||
// check spectator momentum
|
||||
if ( momentum.vect().mag() - momentum.e()< 10*keV )
|
||||
delete result;
|
||||
result=0;
|
||||
G4LorentzVector momentum(pInitialState-pFinalState);
|
||||
G4int loopcount(0);
|
||||
//G4cout << "BLIC: momentum, pspectators : " << momentum << " / " << pspectators << G4endl;
|
||||
while (std::abs(momentum.e()-pspectators.e()) > 10*MeV) /* Loop checking, 31.08.2015, G.Folger */
|
||||
// see if on loopcount
|
||||
{
|
||||
G4LorentzVector pCorrect(pInitialState-pspectators);
|
||||
//G4cout << "BLIC:: BIC nonconservation? (pInitialState-pFinalState) / spectators :" << momentum << " / " << pspectators << "pCorrect "<< pCorrect<< G4endl;
|
||||
// Correct outgoing casacde particles.... to have momentum of (initial state - spectators)
|
||||
G4bool EnergyIsCorrect=EnergyAndMomentumCorrector(cascaders, pCorrect);
|
||||
if ( ! EnergyIsCorrect && debug_G4BinaryLightIonReactionResults)
|
||||
{
|
||||
// DeExciteSpectatorNucleus() also handles also case of A=1, Z=0,1
|
||||
DeExciteSpectatorNucleus(spectators, cascaders, theStatisticalExEnergy, momentum);
|
||||
G4cout << "Warning - G4BinaryLightIonReaction E/P correction for cascaders failed" << G4endl;
|
||||
}
|
||||
pFinalState=G4LorentzVector(0,0,0,0);
|
||||
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
|
||||
{
|
||||
pFinalState += G4LorentzVector( (*iter)->GetMomentum(), (*iter)->GetTotalEnergy() );
|
||||
}
|
||||
momentum=pInitialState-pFinalState;
|
||||
if (++loopcount > 10 )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else { // momentum non-conservation --> fail
|
||||
for (iter=spectators->begin();iter!=spectators->end();iter++)
|
||||
{
|
||||
delete *iter;
|
||||
}
|
||||
delete spectators;
|
||||
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
|
||||
{
|
||||
delete *iter;
|
||||
}
|
||||
delete cascaders;
|
||||
// Check if Energy/Momemtum is now ok, if not return initial state
|
||||
if ( std::abs(momentum.e()-pspectators.e()) > 10*MeV )
|
||||
{
|
||||
for (iter=spectators->begin();iter!=spectators->end();iter++)
|
||||
{
|
||||
delete *iter;
|
||||
}
|
||||
delete spectators;
|
||||
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
|
||||
{
|
||||
delete *iter;
|
||||
}
|
||||
delete cascaders;
|
||||
|
||||
G4cout << "G4BinaryLightIonReaction.cc: mom check: " << momentum
|
||||
<< " 3.mag "<< momentum.vect().mag() << G4endl
|
||||
<< " .. pInitialState/pFinalState/spectators " << pInitialState <<" "
|
||||
<< pFinalState << " " << pspectators << G4endl
|
||||
<< " .. A,Z " << spectatorA <<" "<< spectatorZ << G4endl;
|
||||
G4cout << "G4BinaryLightIonReaction invalid final state for: " << G4endl;
|
||||
G4cout << " Primary " << aTrack.GetDefinition()
|
||||
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
|
||||
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
|
||||
<< ", kinetic energy " << aTrack.GetKineticEnergy()
|
||||
<< G4endl;
|
||||
G4cout << " Target nucleus (A,Z)=(" << targetNucleus.GetA_asInt()
|
||||
<< "," << targetNucleus.GetZ_asInt() << ")" << G4endl;
|
||||
G4cout << " if frequent, please submit above information as bug report"
|
||||
<< G4endl << G4endl;
|
||||
G4cout << "G4BinaryLightIonReaction.cc: mom check: " << G4endl
|
||||
<< " initial - final " << momentum << " 3.mag "<< momentum.vect().mag() << G4endl
|
||||
<< " .. pInitialState/pFinalState/spectators " << G4endl
|
||||
<< pInitialState << G4endl
|
||||
<< pFinalState << G4endl
|
||||
<< pspectators << G4endl
|
||||
<< " .. A,Z " << spectatorA <<" "<< spectatorZ << G4endl;
|
||||
G4cout << "G4BinaryLightIonReaction invalid final state for: " << G4endl;
|
||||
G4cout << " Primary " << aTrack.GetDefinition()
|
||||
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
|
||||
<< "," << aTrack.GetDefinition()->GetPDGCharge()/eplus << ") "
|
||||
<< ", kinetic energy " << aTrack.GetKineticEnergy()
|
||||
<< G4endl;
|
||||
G4cout << " Target nucleus (A,Z)=(" << targetNucleus.GetA_asInt()
|
||||
<< "," << targetNucleus.GetZ_asInt() << ")" << G4endl;
|
||||
G4cout << " if frequent, please submit above information as bug report"
|
||||
<< G4endl << G4endl;
|
||||
#ifdef debug_G4BinaryLightIonReaction
|
||||
G4ExceptionDescription ed;
|
||||
ed << "G4BinaryLightIonreaction: Terminate for above error" << G4endl;
|
||||
@@ -268,15 +257,20 @@ ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus & targetNucleus )
|
||||
ed);
|
||||
|
||||
#endif
|
||||
theResult.Clear();
|
||||
theResult.SetStatusChange(isAlive);
|
||||
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
|
||||
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
|
||||
return &theResult;
|
||||
}
|
||||
} else { // no spectators
|
||||
delete spectators;
|
||||
}
|
||||
theResult.Clear();
|
||||
theResult.SetStatusChange(isAlive);
|
||||
theResult.SetEnergyChange(aTrack.GetKineticEnergy());
|
||||
theResult.SetMomentumChange(aTrack.Get4Momentum().vect().unit());
|
||||
return &theResult;
|
||||
|
||||
}
|
||||
if (spectatorA > 0 )
|
||||
{
|
||||
// DeExciteSpectatorNucleus() also handles also case of A=1, Z=0,1
|
||||
DeExciteSpectatorNucleus(spectators, cascaders, theStatisticalExEnergy, momentum);
|
||||
} else { // no spectators
|
||||
delete spectators;
|
||||
}
|
||||
}
|
||||
// Rotate to lab
|
||||
G4LorentzRotation toZ;
|
||||
@@ -289,12 +283,12 @@ ApplyYourself(const G4HadProjectile &aTrack, G4Nucleus & targetNucleus )
|
||||
theResult.Clear();
|
||||
theResult.SetStatusChange(stopAndKill);
|
||||
G4LorentzVector ptot(0);
|
||||
G4ReactionProductVector::iterator iter;
|
||||
#ifdef debug_BLIR_result
|
||||
G4LorentzVector p_raw;
|
||||
#endif
|
||||
//G4int i=0;
|
||||
#ifdef debug_BLIR_result
|
||||
G4LorentzVector p_raw;
|
||||
#endif
|
||||
//G4int i=0;
|
||||
|
||||
G4ReactionProductVector::iterator iter;
|
||||
for(iter=cascaders->begin(); iter!=cascaders->end(); iter++)
|
||||
{
|
||||
if((*iter)->GetNewlyAdded())
|
||||
@@ -557,21 +551,27 @@ G4ReactionProductVector * G4BinaryLightIonReaction::Interact(G4LorentzVector & m
|
||||
|
||||
result=theModel->Propagate(initalState, target3dNucleus);
|
||||
#ifdef debug_BLIR_finalstate
|
||||
if( result && result->size()>0)
|
||||
{
|
||||
G4LorentzVector presult;
|
||||
G4ReactionProductVector::iterator iter;
|
||||
G4ReactionProduct xp;
|
||||
for (iter=result->begin(); iter !=result->end(); ++iter)
|
||||
{
|
||||
presult += G4LorentzVector((*iter)->GetMomentum(),(*iter)->GetTotalEnergy());
|
||||
}
|
||||
if( result && result->size()>0)
|
||||
{
|
||||
G4cout << " Cascade result " << G4endl;
|
||||
G4LorentzVector presult;
|
||||
G4ReactionProductVector::iterator iter;
|
||||
G4ReactionProduct xp;
|
||||
for (iter=result->begin(); iter !=result->end(); ++iter)
|
||||
{
|
||||
presult += G4LorentzVector((*iter)->GetMomentum(),(*iter)->GetTotalEnergy());
|
||||
G4cout << (*iter)->GetDefinition()->GetParticleName() << " : "
|
||||
<< "("<< (*iter)->GetMomentum().x()<<","
|
||||
<< (*iter)->GetMomentum().y()<<","
|
||||
<< (*iter)->GetMomentum().z()<<";"
|
||||
<< (*iter)->GetTotalEnergy() <<")"<< G4endl;
|
||||
}
|
||||
|
||||
G4cout << "BLIC check result : initial " << pinitial << " mass tgt " << target3dNucleus->GetMass()
|
||||
<< " final " << presult
|
||||
<< " IF - FF " << pinitial +G4LorentzVector(target3dNucleus->GetMass()) - presult << G4endl;
|
||||
G4cout << "BLIC check result : initial " << pinitial << " mass tgt " << target3dNucleus->GetMass()
|
||||
<< " final " << presult
|
||||
<< " IF - FF " << pinitial +G4LorentzVector(target3dNucleus->GetMass()) - presult << G4endl;
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if( result && result->size()==0)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,10 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-05-02 Gabriele Cosmo (hadr-cohe-V11-01-05)
|
||||
- Fixed compilation warnings for potentially uninitialised local variables in
|
||||
SampleThetaCMS() for G4DiffuseElastic and G4NuclNuclDiffuseElastic.
|
||||
|
||||
## 2023-10-23 Vladimir Ivanchenko (hadr-cohe-V11-01-04)
|
||||
- G4ChargeExchange - address interface change in G4ChargeExchangeXS
|
||||
|
||||
|
||||
@@ -735,7 +735,8 @@ G4DiffuseElastic::SampleThetaCMS(const G4ParticleDefinition* particle,
|
||||
G4double momentum, G4double A)
|
||||
{
|
||||
G4int i, iMax = 100;
|
||||
G4double norm, result, theta1, theta2, thetaMax, sum = 0.;
|
||||
G4double norm, theta1, theta2, thetaMax;
|
||||
G4double result = 0., sum = 0.;
|
||||
|
||||
fParticle = particle;
|
||||
fWaveVector = momentum/hbarc;
|
||||
|
||||
@@ -724,7 +724,8 @@ G4NuclNuclDiffuseElastic::SampleThetaCMS(const G4ParticleDefinition* particle,
|
||||
G4double momentum, G4double A)
|
||||
{
|
||||
G4int i, iMax = 100;
|
||||
G4double norm, result, theta1, theta2, thetaMax, sum = 0.;
|
||||
G4double norm, theta1, theta2, thetaMax;
|
||||
G4double result = 0., sum = 0.;
|
||||
|
||||
fParticle = particle;
|
||||
fWaveVector = momentum/hbarc;
|
||||
|
||||
@@ -6,6 +6,9 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-04-12 Jean-Christophe David (hadr-inclxx-V11-01-05)
|
||||
- Fix in G4INCLInteractionAvatar to not use local energy for all antibaryons.
|
||||
|
||||
## 2023-12-01 Ben Morgan (hadr-inclxx-V11-01-04)
|
||||
- Replace raw std::getenv calls wih G4FindDataDir for G4INCLDATA location.
|
||||
|
||||
|
||||
@@ -447,9 +447,8 @@ namespace G4INCL {
|
||||
(*i)->setPotentialEnergy(0.);
|
||||
}
|
||||
|
||||
//jcd if(shouldUseLocalEnergy && !(*i)->isPion()) { // This translates AECSVT's loops 1, 3 and 4
|
||||
if(shouldUseLocalEnergy && !(*i)->isPion() && !(*i)->isEta() && !(*i)->isOmega() &&
|
||||
!(*i)->isKaon() && !(*i)->isAntiKaon() && !(*i)->isSigma() && !(*i)->isPhoton() && !(*i)->isLambda() && !(*i)->isAntiNucleon()) { // This translates AECSVT's loops 1, 3 and 4
|
||||
if(shouldUseLocalEnergy && !(*i)->isPion() && !(*i)->isEta() && !(*i)->isOmega() &&
|
||||
!(*i)->isKaon() && !(*i)->isAntiKaon() && !(*i)->isSigma() && !(*i)->isPhoton() && !(*i)->isLambda() && !(*i)->isAntiBaryon()) { // This translates AECSVT's loops 1, 3 and 4
|
||||
// assert(theNucleus); // Local energy without a nucleus doesn't make sense
|
||||
const G4double energy = (*i)->getEnergy(); // Store the energy of the particle
|
||||
G4double locE = KinematicsUtils::getLocalEnergy(theNucleus, *i); // Initial value of local energy
|
||||
|
||||
@@ -6,6 +6,16 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-05-02 Gabriele Cosmo (hadr-lend-V11-01-04)
|
||||
- Fixed compilation warnings for potentially initialised local variables in
|
||||
ptwXY_createFromFunctionZeroCrossing().
|
||||
|
||||
## 2024-04-24 Pere Mato
|
||||
- Math macros such as M_PI are not standard. To define them the macro
|
||||
_USE_MATH_DEFINES needs to be defined before including <cmath>.
|
||||
- macro WIN32 is not standard, the correect macro is _WIN32.
|
||||
- <BaseTsd.h> should be <basetsd.h> for MinGW.
|
||||
|
||||
## 2024-01-29 Vladimir Ivanchenko (hadr-lend-V11-01-03)
|
||||
- MCGIDI_product, MCGIDI_outputChannel, MCGIDI_distribution - fixed alma9-gcc131
|
||||
compilation warnings seen in CMSSW
|
||||
|
||||
@@ -9,10 +9,6 @@
|
||||
#define MCGIDI_VERSION_MINOR 0
|
||||
#define MCGIDI_VERSION_PATCHLEVEL 0
|
||||
|
||||
#ifdef WIN32
|
||||
#define M_PI 3.141592653589793238463
|
||||
#endif
|
||||
|
||||
#include <GIDI_settings.hh>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@@ -6,15 +6,12 @@
|
||||
#ifndef specialFunctions_h_included
|
||||
#define specialFunctions_h_included
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include "nf_utilities.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define M_PI 3.141592653589793238463
|
||||
#endif
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
namespace GIDI {
|
||||
|
||||
@@ -3,11 +3,9 @@
|
||||
# <<END-copyright>>
|
||||
*/
|
||||
#include <string.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
#ifdef WIN32
|
||||
#define M_PI 3.141592653589793238463
|
||||
#endif
|
||||
|
||||
#include "MCGIDI_fromTOM.h"
|
||||
#include "MCGIDI_misc.h"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# <<END-copyright>>
|
||||
*/
|
||||
#include <string.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
#include "MCGIDI.h"
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
|
||||
#include "nf_specialFunctions.h"
|
||||
|
||||
@@ -120,7 +120,7 @@ static nfu_status ptwXY_createFromFunctionZeroCrossing( ptwXYPoints *ptwXY, doub
|
||||
if ( y2 == y1 ) return ( nfu_badInput );
|
||||
|
||||
int i;
|
||||
double x, y;
|
||||
double x = 0, y = 0;
|
||||
nfu_status status;
|
||||
|
||||
for( i = 0; i < 16; i++ ) {
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(WIN32) || defined(__MINGW32__)
|
||||
#include <BaseTsd.h>
|
||||
#if defined(_WIN32)
|
||||
#include <basetsd.h>
|
||||
#include <io.h>
|
||||
#include <windows.h>
|
||||
#define realpath( a, b ) GetFullPathName( a, PATH_MAX, b, NULL )
|
||||
|
||||
@@ -6,6 +6,23 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-04-21 Gabriele Cosmo (hadr-hpp-V11-01-26)
|
||||
- Fixed compilation error in G4ParticleHPManager and G4ParticleHPNames on
|
||||
Windows VC++ with C++20 Standard enabled.
|
||||
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
|
||||
|
||||
## 2024-02-26 Vladimir Ivanchenko
|
||||
- G4CrossSectionHP - fixed method takeing into account temperatue effect
|
||||
(the difference due to this fix is small), fixed elastic and capture
|
||||
cross-sections in Argon by using only the main isotope Z=18, A=40 (there
|
||||
was up to 50% overestimation of cross sections due to wrong data for
|
||||
rare isotopes of argon); fixed cross sections for rare target atoms
|
||||
Promethium, Astatine, Radon, Francium.
|
||||
|
||||
## 2024-02-12 Gabriele Cosmo
|
||||
- Fixed remaining compilation warnings on gcc compiler when LTO settings
|
||||
are enabled.
|
||||
|
||||
## 2024-01-30 Vladimir Ivanchenko (hadr-hpp-V11-01-25)
|
||||
- G4ParticleHPFSFissionFS, G4ParticleHPFissionBaseFS - substitute
|
||||
C-arrays with std::vector in order to reduce compilation warnings on gcc
|
||||
|
||||
@@ -85,6 +85,8 @@ class G4CrossSectionHP : public G4VCrossSectionDataSet
|
||||
|
||||
inline G4double GetMaxHPEnergy() const;
|
||||
|
||||
inline void SetBinSearch(G4int n);
|
||||
|
||||
private:
|
||||
|
||||
void Initialise(const G4int Z);
|
||||
@@ -102,6 +104,7 @@ class G4CrossSectionHP : public G4VCrossSectionDataSet
|
||||
inline G4bool CheckCache(const G4int Z);
|
||||
|
||||
const G4ParticleDefinition* fParticle;
|
||||
const G4ParticleDefinition* fNeutron;
|
||||
G4ParticleHPManager* fManagerHP;
|
||||
|
||||
const G4double emax;
|
||||
@@ -113,6 +116,8 @@ class G4CrossSectionHP : public G4VCrossSectionDataSet
|
||||
|
||||
const G4int minZ;
|
||||
const G4int maxZ;
|
||||
|
||||
G4int binSearch{2};
|
||||
std::size_t index{0};
|
||||
G4bool fPrinted{false};
|
||||
|
||||
@@ -157,4 +162,9 @@ inline G4double G4CrossSectionHP::GetMaxHPEnergy() const
|
||||
return emax;
|
||||
}
|
||||
|
||||
inline void G4CrossSectionHP::SetBinSearch(G4int n)
|
||||
{
|
||||
if (n > 0) { binSearch = n; }
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -55,13 +55,14 @@ class G4ParticleHPArbitaryTab : public G4VParticleHPEDis
|
||||
|
||||
inline void Init(std::istream& theData) override
|
||||
{
|
||||
G4int i;
|
||||
std::size_t i;
|
||||
theFractionalProb.Init(theData, CLHEP::eV);
|
||||
theData >> nDistFunc; // = number of incoming n energy points
|
||||
theDistFunc = new G4ParticleHPVector[nDistFunc];
|
||||
const std::size_t dsize = nDistFunc > 0 ? nDistFunc : 1;
|
||||
theDistFunc = new G4ParticleHPVector[dsize];
|
||||
theManager.Init(theData);
|
||||
G4double currentEnergy;
|
||||
for (i = 0; i < nDistFunc; i++) {
|
||||
for (i = 0; i < dsize; ++i) {
|
||||
theData >> currentEnergy;
|
||||
theDistFunc[i].SetLabel(currentEnergy * CLHEP::eV);
|
||||
theDistFunc[i].Init(theData, CLHEP::eV);
|
||||
@@ -76,17 +77,17 @@ class G4ParticleHPArbitaryTab : public G4VParticleHPEDis
|
||||
//************************************************************************
|
||||
// EMendoza:
|
||||
// Here we calculate the thresholds for the 2D sampling:
|
||||
for (i = 0; i < nDistFunc; i++) {
|
||||
for (i = 0; i < dsize; ++i) {
|
||||
G4int np = theDistFunc[i].GetVectorLength();
|
||||
theLowThreshold[i] = theDistFunc[i].GetEnergy(0);
|
||||
theHighThreshold[i] = theDistFunc[i].GetEnergy(np - 1);
|
||||
for (G4int j = 0; j < np - 1; j++) {
|
||||
for (G4int j = 0; j < np - 1; ++j) {
|
||||
if (theDistFunc[i].GetXsec(j + 1) > 1.e-20) {
|
||||
theLowThreshold[i] = theDistFunc[i].GetEnergy(j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (G4int j = 1; j < np; j++) {
|
||||
for (G4int j = 1; j < np; ++j) {
|
||||
if (theDistFunc[i].GetXsec(j - 1) > 1.e-20) {
|
||||
theHighThreshold[i] = theDistFunc[i].GetEnergy(j);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "G4ParticleHPLegendreTable.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
class G4ParticleHPLegendreStore
|
||||
@@ -40,11 +41,11 @@ class G4ParticleHPLegendreStore
|
||||
public:
|
||||
G4ParticleHPLegendreStore(G4int n)
|
||||
{
|
||||
theCoeff = new G4ParticleHPLegendreTable[n];
|
||||
theCoeff.resize(n);
|
||||
nEnergy = n;
|
||||
}
|
||||
|
||||
~G4ParticleHPLegendreStore() { delete[] theCoeff; }
|
||||
~G4ParticleHPLegendreStore() {}
|
||||
|
||||
inline void Init(G4int i, G4double e, G4int n) { theCoeff[i].Init(e, n); }
|
||||
inline void SetNPoints(G4int n) { nEnergy = n; }
|
||||
@@ -77,7 +78,7 @@ class G4ParticleHPLegendreStore
|
||||
|
||||
private:
|
||||
G4int nEnergy;
|
||||
G4ParticleHPLegendreTable* theCoeff;
|
||||
std::vector<G4ParticleHPLegendreTable> theCoeff;
|
||||
G4InterpolationManager theManager; // interpolate between different Tables
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -64,6 +64,7 @@ G4CrossSectionHP::G4CrossSectionHP(const G4ParticleDefinition* p,
|
||||
G4int zmin, G4int zmax)
|
||||
: G4VCrossSectionDataSet(nameData),
|
||||
fParticle(p),
|
||||
fNeutron(G4Neutron::Neutron()),
|
||||
fManagerHP(G4ParticleHPManager::GetInstance()),
|
||||
emax(emaxHP),
|
||||
emaxT(fManagerHP->GetMaxEnergyDoppler()),
|
||||
@@ -161,30 +162,35 @@ G4double G4CrossSectionHP::IsoCrossSection(const G4double ekin,
|
||||
} else {
|
||||
|
||||
// Doppler broading
|
||||
G4double lambda = 1.0/(CLHEP::k_Boltzmann*T);
|
||||
G4double e0 = CLHEP::k_Boltzmann*T;
|
||||
G4double mass = fParticle->GetPDGMass();
|
||||
G4double massTarget = G4NucleiProperties::GetNuclearMass(A, Z);
|
||||
G4LorentzVector lv(0., 0., 0., mass + ekin);
|
||||
|
||||
// projectile
|
||||
G4LorentzVector lv(0., 0., std::sqrt(ekin*(ekin + 2*mass)), mass + ekin);
|
||||
|
||||
// limits of integration
|
||||
const G4double lim = 1.01;
|
||||
const G4int nmin = 3;
|
||||
G4int i;
|
||||
G4int ii = 0;
|
||||
const G4int nn = 20;
|
||||
G4double xs2 = 0.0;
|
||||
|
||||
for (i=1; i<nn; ++i) {
|
||||
G4double erand = G4RandGamma::shoot(2.0, lambda);
|
||||
for (G4int i=0; i<nn; ++i) {
|
||||
G4double erand = G4RandGamma::shoot(2.0, e0);
|
||||
auto mom = G4RandomDirection()*std::sqrt(2*massTarget*erand);
|
||||
fLV.set(mom.x(), mom.y(), mom.z(), mass + erand);
|
||||
fLV.set(mom.x(), mom.y(), mom.z(), massTarget + erand);
|
||||
fBoost = fLV.boostVector();
|
||||
G4double e = lv.boost(fBoost).e() - mass;
|
||||
fLV = lv.boost(fBoost);
|
||||
if (fLV.pz() <= 0.0) { continue; }
|
||||
++ii;
|
||||
G4double e = fLV.e() - mass;
|
||||
G4double y = pv->Value(e, index);
|
||||
xs += y;
|
||||
xs2 += y*y;
|
||||
if (i >= nmin && i*xs2 <= lim*xs*xs) { break; }
|
||||
if (ii >= nmin && ii*xs2 <= lim*xs*xs) { break; }
|
||||
}
|
||||
xs /= (G4double)std::min(i, nn-1);
|
||||
if (ii > 0) { xs /= (G4double)(ii); }
|
||||
}
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel > 1) {
|
||||
@@ -317,8 +323,7 @@ void G4CrossSectionHP::DumpPhysicsTable(const G4ParticleDefinition&)
|
||||
const G4ElementTable* table = G4Element::GetElementTable();
|
||||
for ( auto const & elm : *table ) {
|
||||
G4int Z = elm->GetZasInt();
|
||||
if (Z >= minZ && Z <= maxZ &&
|
||||
nullptr != fData->GetElementData(Z - minZ)) {
|
||||
if (Z >= minZ && Z <= maxZ && nullptr != fData->GetElementData(Z - minZ)) {
|
||||
G4cout << "---------------------------------------------------" << G4endl;
|
||||
G4cout << elm->GetName() << G4endl;
|
||||
std::size_t n = fData->GetNumberOfComponents(Z);
|
||||
@@ -369,31 +374,36 @@ void G4CrossSectionHP::Initialise(const G4int Z)
|
||||
G4bool noComp = true;
|
||||
for (G4int A=amin[Z]; A<=amax[Z]; ++A) {
|
||||
std::ostringstream ost;
|
||||
ost << fDataDirectory << Z << "_";
|
||||
if (6 == Z && 12 == A) {
|
||||
ost << "nat_";
|
||||
ost << fDataDirectory;
|
||||
// first check special cases
|
||||
if (6 == Z && 12 == A && fParticle == fNeutron) {
|
||||
ost << Z << "_nat_" << elementName[Z];
|
||||
} else if (18 == Z && 40 != A) {
|
||||
continue;
|
||||
} else if (27 == Z && 62 == A) {
|
||||
ost << "62m1_";
|
||||
ost << Z << "_62m1_" << elementName[Z];
|
||||
} else if (47 == Z && 106 == A) {
|
||||
ost << "106m1_";
|
||||
ost << Z << "_106m1_" << elementName[Z];
|
||||
} else if (48 == Z && 115 == A) {
|
||||
ost << "115m1_";
|
||||
ost << Z << "_115m1_" << elementName[Z];
|
||||
} else if (52 == Z && 127 == A) {
|
||||
ost << "127m1_";
|
||||
ost << Z << "_127m1_" << elementName[Z];
|
||||
} else if (52 == Z && 129 == A) {
|
||||
ost << "129m1_";
|
||||
ost << Z << "_129m1_" << elementName[Z];
|
||||
} else if (52 == Z && 131 == A) {
|
||||
ost << "131m1_";
|
||||
ost << Z << "_131m1_" << elementName[Z];
|
||||
} else if (61 == Z && 145 == A) {
|
||||
ost << Z << "_147_" << elementName[Z];
|
||||
} else if (67 == Z && 166 == A) {
|
||||
ost << "166m1_";
|
||||
ost << Z << "_166m1_" << elementName[Z];
|
||||
} else if (73 == Z && 180 == A) {
|
||||
ost << "180m1_";
|
||||
ost << Z << "_180m1_" << elementName[Z];
|
||||
} else if ((Z == 85 && A == 210) || (Z == 86 && A == 222) || (Z == 87 && A == 223)) {
|
||||
ost << "84_209_" << elementName[84];
|
||||
} else {
|
||||
ost << A << "_";
|
||||
// the main file name
|
||||
ost << Z << "_" << A << "_" << elementName[Z];
|
||||
}
|
||||
ost << elementName[Z];
|
||||
std::ifstream filein(ost.str().c_str());
|
||||
//G4cout << "File: " << ost.str() << " " << G4endl;
|
||||
std::istringstream theXSData(tnam, std::ios::in);
|
||||
fManagerHP->GetDataStream(ost.str().c_str(), theXSData);
|
||||
if (theXSData) {
|
||||
@@ -408,11 +418,11 @@ void G4CrossSectionHP::Initialise(const G4int Z)
|
||||
for (G4int i=0; i<n; ++i) {
|
||||
theXSData >> x >> y;
|
||||
x *= CLHEP::eV;
|
||||
y *= CLHEP::barn;
|
||||
y *= CLHEP::barn;
|
||||
//G4cout << " e=" << x << " xs=" << y << G4endl;
|
||||
v->PutValues((std::size_t)i, x, y);
|
||||
}
|
||||
v->EnableLogBinSearch(2);
|
||||
v->EnableLogBinSearch(binSearch);
|
||||
if (noComp) {
|
||||
G4int nmax = amax[Z] - A + 1;
|
||||
fData->InitialiseForComponent(Z - minZ, nmax);
|
||||
|
||||
@@ -112,14 +112,15 @@ G4bool G4ParticleHPChannel::Register(G4ParticleHPFinalState* theFS)
|
||||
G4int Z = theElement->GetZasInt();
|
||||
|
||||
niso = (G4int)theElement->GetNumberOfIsotopes();
|
||||
const std::size_t nsize = niso > 0 ? niso : 1;
|
||||
|
||||
delete[] theIsotopeWiseData;
|
||||
theIsotopeWiseData = new G4ParticleHPIsoData[niso];
|
||||
theIsotopeWiseData = new G4ParticleHPIsoData[nsize];
|
||||
delete[] active;
|
||||
active = new G4bool[niso];
|
||||
active = new G4bool[nsize];
|
||||
|
||||
delete[] theFinalStates;
|
||||
theFinalStates = new G4ParticleHPFinalState*[niso];
|
||||
theFinalStates = new G4ParticleHPFinalState*[nsize];
|
||||
delete theChannelData;
|
||||
theChannelData = new G4ParticleHPVector;
|
||||
for (G4int i = 0; i < niso; ++i) {
|
||||
|
||||
@@ -93,7 +93,8 @@ G4ParticleHPContAngularPar::G4ParticleHPContAngularPar(G4ParticleHPContAngularPa
|
||||
theDiscreteEnergiesOwn = val.theDiscreteEnergiesOwn;
|
||||
toBeCached v;
|
||||
fCache.Put(v);
|
||||
theAngular = new G4ParticleHPList[nEnergies];
|
||||
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
|
||||
theAngular = new G4ParticleHPList[esize];
|
||||
for (G4int ie = 0; ie < nEnergies; ++ie) {
|
||||
theAngular[ie].SetLabel(val.theAngular[ie].GetLabel());
|
||||
for (G4int ip = 0; ip < nAngularParameters; ++ip) {
|
||||
@@ -116,7 +117,8 @@ void G4ParticleHPContAngularPar::Init(std::istream& aDataFile, const G4ParticleD
|
||||
|
||||
aDataFile >> theEnergy >> nEnergies >> nDiscreteEnergies >> nAngularParameters;
|
||||
theEnergy *= eV;
|
||||
theAngular = new G4ParticleHPList[nEnergies];
|
||||
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
|
||||
theAngular = new G4ParticleHPList[esize];
|
||||
G4double sEnergy;
|
||||
for (G4int i = 0; i < nEnergies; ++i) {
|
||||
aDataFile >> sEnergy;
|
||||
@@ -840,7 +842,8 @@ void G4ParticleHPContAngularPar::BuildByInterpolation(G4double anEnergy,
|
||||
nEnergies = nDiscreteEnergies + (G4int)theEnergiesTransformed.size();
|
||||
|
||||
// Create final array of angular parameters
|
||||
auto theNewAngular = new G4ParticleHPList[nEnergies];
|
||||
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
|
||||
auto theNewAngular = new G4ParticleHPList[esize];
|
||||
|
||||
// Copy discrete energies and interpolated parameters to new array
|
||||
|
||||
|
||||
@@ -54,7 +54,8 @@ G4ParticleHPContEnergyAngular::~G4ParticleHPContEnergyAngular()
|
||||
void G4ParticleHPContEnergyAngular::Init(std::istream& aDataFile)
|
||||
{
|
||||
aDataFile >> theTargetCode >> theAngularRep >> theInterpolation >> nEnergy;
|
||||
theAngular = new G4ParticleHPContAngularPar[nEnergy];
|
||||
const std::size_t esize = nEnergy > 0 ? nEnergy : 1;
|
||||
theAngular = new G4ParticleHPContAngularPar[esize];
|
||||
theManager.Init(aDataFile);
|
||||
for (G4int i = 0; i < nEnergy; ++i) {
|
||||
theAngular[i].Init(aDataFile, theProjectile);
|
||||
|
||||
@@ -63,8 +63,9 @@ void G4ParticleHPDiscreteTwoBody::Init(std::istream& aDataFile)
|
||||
{
|
||||
aDataFile >> nEnergy;
|
||||
theManager.Init(aDataFile);
|
||||
theCoeff = new G4ParticleHPLegendreTable[nEnergy];
|
||||
for (G4int i = 0; i < nEnergy; i++) {
|
||||
const std::size_t tsize = nEnergy > 0 ? nEnergy : 1;
|
||||
theCoeff = new G4ParticleHPLegendreTable[tsize];
|
||||
for (std::size_t i = 0; i < tsize; ++i) {
|
||||
G4double energy;
|
||||
G4int aRep, nCoeff;
|
||||
aDataFile >> energy >> aRep >> nCoeff;
|
||||
|
||||
@@ -60,7 +60,8 @@ void G4ParticleHPElementData::Init(G4Element* theElement,
|
||||
{
|
||||
auto nIso = (G4int)theElement->GetNumberOfIsotopes();
|
||||
auto Z = theElement->GetZasInt();
|
||||
theIsotopeWiseData = new G4ParticleHPIsoData[nIso];
|
||||
const std::size_t dsize = nIso > 0 ? nIso : 1;
|
||||
theIsotopeWiseData = new G4ParticleHPIsoData[dsize];
|
||||
|
||||
for (G4int i1 = 0; i1 < nIso; ++i1) {
|
||||
G4int A = theElement->GetIsotope(i1)->GetN();
|
||||
|
||||
@@ -63,10 +63,9 @@ void G4ParticleHPEnAngCorrelation::Init(std::istream& aDataFile)
|
||||
{
|
||||
inCharge = true;
|
||||
aDataFile >> targetMass >> frameFlag >> nProducts;
|
||||
//G4cout << "G4ParticleHPEnAngCorrelation::Init " << theProjectile->GetParticleName()
|
||||
// << " frameFlag=" << frameFlag << " N=" << nProducts << " Mass=" << targetMass << G4endl;
|
||||
theProducts = new G4ParticleHPProduct[nProducts];
|
||||
for (G4int i = 0; i < nProducts; ++i) {
|
||||
const std::size_t psize = nProducts > 0 ? nProducts : 1;
|
||||
theProducts = new G4ParticleHPProduct[psize];
|
||||
for (std::size_t i = 0; i < psize; ++i) {
|
||||
theProducts[i].Init(aDataFile, theProjectile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ G4double G4ParticleHPField::GetY(G4double e, G4int j)
|
||||
void G4ParticleHPField::Dump()
|
||||
{
|
||||
G4cout << nEntries << G4endl;
|
||||
for (G4int i = 0; i < nEntries; i++) {
|
||||
for (G4int i = 0; i < nEntries; ++i) {
|
||||
G4cout << theData[i].GetX() << " ";
|
||||
for (G4int j = 0; j < theData[i].GetDepth(); j++) {
|
||||
for (G4int j = 0; j < theData[i].GetDepth(); ++j) {
|
||||
G4cout << theData[i].GetY(j) << " ";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
@@ -107,12 +107,11 @@ void G4ParticleHPField::Check(G4int i)
|
||||
"Skipped some index numbers in G4ParticleHPField");
|
||||
if (i == nPoints) {
|
||||
nPoints += 50;
|
||||
auto buff = new G4ParticleHPFieldPoint[nPoints];
|
||||
// G4cout << "copying 1"<<G4endl;
|
||||
for (G4int j = 0; j < nEntries; j++) {
|
||||
const std::size_t fsize = nPoints > 0 ? nPoints : 1;
|
||||
auto buff = new G4ParticleHPFieldPoint[fsize];
|
||||
for (G4int j = 0; j < nEntries; ++j) {
|
||||
buff[j] = theData[j];
|
||||
}
|
||||
// G4cout << "copying 2"<<G4endl;
|
||||
delete[] theData;
|
||||
theData = buff;
|
||||
}
|
||||
|
||||
@@ -52,18 +52,20 @@ void G4ParticleHPLabAngularEnergy::Init(std::istream& aDataFile)
|
||||
{
|
||||
aDataFile >> nEnergies;
|
||||
theManager.Init(aDataFile);
|
||||
theEnergies = new G4double[nEnergies];
|
||||
nCosTh = new G4int[nEnergies];
|
||||
theData = new G4ParticleHPVector*[nEnergies];
|
||||
theSecondManager = new G4InterpolationManager[nEnergies];
|
||||
for (G4int i = 0; i < nEnergies; i++) {
|
||||
const std::size_t esize = nEnergies > 0 ? nEnergies : 1;
|
||||
theEnergies = new G4double[esize];
|
||||
nCosTh = new G4int[esize];
|
||||
theData = new G4ParticleHPVector*[esize];
|
||||
theSecondManager = new G4InterpolationManager[esize];
|
||||
for (G4int i = 0; i < nEnergies; ++i) {
|
||||
aDataFile >> theEnergies[i];
|
||||
theEnergies[i] *= eV;
|
||||
aDataFile >> nCosTh[i];
|
||||
theSecondManager[i].Init(aDataFile);
|
||||
theData[i] = new G4ParticleHPVector[nCosTh[i]];
|
||||
const std::size_t dsize = nCosTh[i] > 0 ? nCosTh[i] : 1;
|
||||
theData[i] = new G4ParticleHPVector[dsize];
|
||||
G4double label;
|
||||
for (G4int ii = 0; ii < nCosTh[i]; ii++) {
|
||||
for (std::size_t ii = 0; ii < dsize; ++ii) {
|
||||
aDataFile >> label;
|
||||
theData[i][ii].SetLabel(label);
|
||||
theData[i][ii].Init(aDataFile, eV);
|
||||
|
||||
@@ -72,7 +72,7 @@ G4ParticleHPManager::G4ParticleHPManager()
|
||||
// path may be defined by two environment variables
|
||||
// it is not mandatory to access PHP data - path may be not defined
|
||||
const char* ttp = G4FindDataDir("G4PARTICLEHPDATA");
|
||||
G4String tendl = (nullptr == ttp) ? "" : G4String(ttp);
|
||||
G4String tendl = (nullptr == ttp) ? G4String("") : G4String(ttp);
|
||||
const char* ssp = G4FindDataDir("G4PROTONHPDATA");
|
||||
fDataPath[1] = (nullptr == ssp) ? tendl + "/Proton" : G4String(ssp);
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ G4ParticleHPNames::G4ParticleHPNames(G4int maxOffSet) : theMaxOffSet(maxOffSet)
|
||||
|
||||
G4String G4ParticleHPNames::GetName(G4int i)
|
||||
{
|
||||
return (i > 0 && i < 100) ? theString[i] : "";
|
||||
return (i > 0 && i < 100) ? theString[i] : G4String("");
|
||||
}
|
||||
|
||||
G4String G4ParticleHPNames::itoa(G4int current)
|
||||
|
||||
@@ -61,11 +61,12 @@ G4bool G4ParticleHPPhotonDist::InitMean(std::istream& aDataFile)
|
||||
if (repFlag == 1) {
|
||||
// multiplicities
|
||||
aDataFile >> nDiscrete;
|
||||
disType = new G4int[nDiscrete];
|
||||
energy = new G4double[nDiscrete];
|
||||
// actualMult = new G4int[nDiscrete];
|
||||
theYield = new G4ParticleHPVector[nDiscrete];
|
||||
for (G4int i = 0; i < nDiscrete; ++i) {
|
||||
const std::size_t msize = nDiscrete > 0 ? nDiscrete : 1;
|
||||
disType = new G4int[msize];
|
||||
energy = new G4double[msize];
|
||||
// actualMult = new G4int[msize];
|
||||
theYield = new G4ParticleHPVector[msize];
|
||||
for (std::size_t i = 0; i < msize; ++i) {
|
||||
aDataFile >> disType[i] >> energy[i];
|
||||
energy[i] *= eV;
|
||||
theYield[i].Init(aDataFile, eV);
|
||||
@@ -77,11 +78,12 @@ G4bool G4ParticleHPPhotonDist::InitMean(std::istream& aDataFile)
|
||||
theBaseEnergy *= eV;
|
||||
aDataFile >> theInternalConversionFlag;
|
||||
aDataFile >> nGammaEnergies;
|
||||
theLevelEnergies = new G4double[nGammaEnergies];
|
||||
theTransitionProbabilities = new G4double[nGammaEnergies];
|
||||
const std::size_t esize = nGammaEnergies > 0 ? nGammaEnergies : 1;
|
||||
theLevelEnergies = new G4double[esize];
|
||||
theTransitionProbabilities = new G4double[esize];
|
||||
if (theInternalConversionFlag == 2)
|
||||
thePhotonTransitionFraction = new G4double[nGammaEnergies];
|
||||
for (G4int ii = 0; ii < nGammaEnergies; ++ii) {
|
||||
thePhotonTransitionFraction = new G4double[esize];
|
||||
for (std::size_t ii = 0; ii < esize; ++ii) {
|
||||
if (theInternalConversionFlag == 1) {
|
||||
aDataFile >> theLevelEnergies[ii] >> theTransitionProbabilities[ii];
|
||||
theLevelEnergies[ii] *= eV;
|
||||
@@ -146,8 +148,9 @@ void G4ParticleHPPhotonDist::InitAngular(std::istream& aDataFile)
|
||||
vct_pXS_par.push_back(hpv);
|
||||
}
|
||||
}
|
||||
if (theGammas == nullptr) theGammas = new G4double[nDiscrete2];
|
||||
if (theShells == nullptr) theShells = new G4double[nDiscrete2];
|
||||
const std::size_t psize = nDiscrete2 > 0 ? nDiscrete2 : 1;
|
||||
if (theGammas == nullptr) theGammas = new G4double[psize];
|
||||
if (theShells == nullptr) theShells = new G4double[psize];
|
||||
|
||||
for (i = 0; i < nIso; ++i) // isotropic photons
|
||||
{
|
||||
@@ -155,15 +158,17 @@ void G4ParticleHPPhotonDist::InitAngular(std::istream& aDataFile)
|
||||
theGammas[i] *= eV;
|
||||
theShells[i] *= eV;
|
||||
}
|
||||
nNeu = new G4int[nDiscrete2 - nIso];
|
||||
if (tabulationType == 1) theLegendre = new G4ParticleHPLegendreTable*[nDiscrete2 - nIso];
|
||||
if (tabulationType == 2) theAngular = new G4ParticleHPAngularP*[nDiscrete2 - nIso];
|
||||
const std::size_t tsize = nDiscrete2 - nIso > 0 ? nDiscrete2 - nIso : 1;
|
||||
nNeu = new G4int[tsize];
|
||||
if (tabulationType == 1) theLegendre = new G4ParticleHPLegendreTable*[tsize];
|
||||
if (tabulationType == 2) theAngular = new G4ParticleHPAngularP*[tsize];
|
||||
for (i = nIso; i < nDiscrete2; ++i) {
|
||||
if (tabulationType == 1) {
|
||||
aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i - nIso];
|
||||
theGammas[i] *= eV;
|
||||
theShells[i] *= eV;
|
||||
theLegendre[i - nIso] = new G4ParticleHPLegendreTable[nNeu[i - nIso]];
|
||||
const std::size_t lsize = nNeu[i - nIso] > 0 ? nNeu[i - nIso] : 1;
|
||||
theLegendre[i - nIso] = new G4ParticleHPLegendreTable[lsize];
|
||||
theLegendreManager.Init(aDataFile);
|
||||
for (ii = 0; ii < nNeu[i - nIso]; ++ii) {
|
||||
theLegendre[i - nIso][ii].Init(aDataFile);
|
||||
@@ -173,7 +178,8 @@ void G4ParticleHPPhotonDist::InitAngular(std::istream& aDataFile)
|
||||
aDataFile >> theGammas[i] >> theShells[i] >> nNeu[i - nIso];
|
||||
theGammas[i] *= eV;
|
||||
theShells[i] *= eV;
|
||||
theAngular[i - nIso] = new G4ParticleHPAngularP[nNeu[i - nIso]];
|
||||
const std::size_t asize = nNeu[i - nIso] > 0 ? nNeu[i - nIso] : 1;
|
||||
theAngular[i - nIso] = new G4ParticleHPAngularP[asize];
|
||||
for (ii = 0; ii < nNeu[i - nIso]; ++ii) {
|
||||
theAngular[i - nIso][ii].Init(aDataFile);
|
||||
}
|
||||
@@ -213,9 +219,10 @@ void G4ParticleHPPhotonDist::InitEnergies(std::istream& aDataFile)
|
||||
}
|
||||
if (energyDistributionsNeeded == 0) return;
|
||||
aDataFile >> nPartials;
|
||||
distribution = new G4int[nPartials];
|
||||
probs = new G4ParticleHPVector[nPartials];
|
||||
partials = new G4ParticleHPPartial*[nPartials];
|
||||
const std::size_t dsize = nPartials > 0 ? nPartials : 1;
|
||||
distribution = new G4int[dsize];
|
||||
probs = new G4ParticleHPVector[dsize];
|
||||
partials = new G4ParticleHPPartial*[dsize];
|
||||
G4int nen;
|
||||
G4int dummy;
|
||||
for (i = 0; i < nPartials; ++i) {
|
||||
@@ -236,13 +243,13 @@ void G4ParticleHPPhotonDist::InitPartials(std::istream& aDataFile, G4ParticleHPV
|
||||
if (nDiscrete != 1) {
|
||||
theTotalXsec.Init(aDataFile, eV);
|
||||
}
|
||||
G4int i;
|
||||
theGammas = new G4double[nDiscrete];
|
||||
theShells = new G4double[nDiscrete];
|
||||
isPrimary = new G4int[nDiscrete];
|
||||
disType = new G4int[nDiscrete];
|
||||
thePartialXsec = new G4ParticleHPVector[nDiscrete];
|
||||
for (i = 0; i < nDiscrete; ++i) {
|
||||
const std::size_t dsize = nDiscrete > 0 ? nDiscrete : 1;
|
||||
theGammas = new G4double[dsize];
|
||||
theShells = new G4double[dsize];
|
||||
isPrimary = new G4int[dsize];
|
||||
disType = new G4int[dsize];
|
||||
thePartialXsec = new G4ParticleHPVector[dsize];
|
||||
for (std::size_t i = 0; i < dsize; ++i) {
|
||||
aDataFile >> theGammas[i] >> theShells[i] >> isPrimary[i] >> disType[i];
|
||||
theGammas[i] *= eV;
|
||||
theShells[i] *= eV;
|
||||
|
||||
@@ -6,6 +6,18 @@ It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2024-04-08 Vladimir Ivanchenko, Alvaro Tolosa Delgado (radioactive_decay-V11-01-11)
|
||||
- G4BetaPlusDecay, G4BetaMinusDecay - minor fix of radioactive_decay-V11-02-02
|
||||
In case Q-value is bigger than mass diference, betas in the tail of the spectrum
|
||||
may have more energy than residual free energy. To minimize the non-conservation
|
||||
of 4-momentum, in such cases neutrino and daughter nucleus are given 1 eV, leading
|
||||
to non conservation of linear momentum because momentum of beta is not counterbalanced.
|
||||
|
||||
## 2024-02-20 Vladimir Ivanchenko
|
||||
- G4BetaPlusDecay, G4BetaMinusDecay - added extra numerical protection on
|
||||
level of 1 eV to avoid precision lost and production of neutrino with
|
||||
negative kinetic energy
|
||||
|
||||
## 2024-02-13 Vladimir Ivanchenko (radioactive_decay-V11-01-10)
|
||||
- G4BetaPlusDecay, G4BetaMinusDecay - fixed sampling algorithm (problem #2588)
|
||||
|
||||
|
||||
@@ -65,6 +65,7 @@ G4double G4BetaDecayCorrections::FermiFunction(const G4double& W)
|
||||
{
|
||||
// Calculate the relativistic Fermi function. Argument W is the
|
||||
// total electron energy in units of electron mass.
|
||||
// Ref: E. Feenberg, G. Trigg, Reviews of Modern Physics, 22(1950)
|
||||
|
||||
G4double Wprime;
|
||||
if (Z < 0) {
|
||||
|
||||
@@ -116,13 +116,12 @@ G4DecayProducts* G4BetaMinusDecay::DecayIt(G4double)
|
||||
G4LorentzVector lv(-eMomentum*dir.x(), -eMomentum*dir.y(), -eMomentum*dir.z(),
|
||||
parentMass - eKE - eMass);
|
||||
|
||||
G4double edel = std::max(lv.e() - resMass, 0.0);
|
||||
// Free energy should be above zero
|
||||
if (edel > 0.0) {
|
||||
|
||||
// centrum of mass system
|
||||
G4double M = lv.mag();
|
||||
|
||||
// centrum of mass system
|
||||
G4double M = lv.mag();
|
||||
const G4double elim = CLHEP::eV;
|
||||
G4double edel = M - resMass;
|
||||
// Free energy should be above limit
|
||||
if (edel >= elim) {
|
||||
// neutrino
|
||||
G4double eNu = 0.5*(M - resMass*resMass/M);
|
||||
G4LorentzVector lvnu(eNu*G4RandomDirection(), eNu);
|
||||
@@ -139,8 +138,8 @@ G4DecayProducts* G4BetaMinusDecay::DecayIt(G4double)
|
||||
products->PushProducts(dp);
|
||||
|
||||
} else {
|
||||
// neglecting relativistic kinematic and giving all energy to neutrino
|
||||
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), edel);
|
||||
// neglecting relativistic kinematic and giving some energy to neutrino
|
||||
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), elim);
|
||||
products->PushProducts(dp);
|
||||
dp = new G4DynamicParticle(fResIon, G4ThreeVector(0.0,0.0,1.0), 0.0);
|
||||
products->PushProducts(dp);
|
||||
|
||||
@@ -117,13 +117,12 @@ G4DecayProducts* G4BetaPlusDecay::DecayIt(G4double)
|
||||
G4LorentzVector lv(-eMomentum*dir.x(), -eMomentum*dir.y(), -eMomentum*dir.z(),
|
||||
parentMass - eKE - eMass);
|
||||
|
||||
G4double edel = std::max(lv.e() - resMass, 0.0);
|
||||
// Free energy should be above zero
|
||||
if (edel > 0.0) {
|
||||
|
||||
// centrum of mass system
|
||||
G4double M = lv.mag();
|
||||
|
||||
const G4double elim = CLHEP::eV;
|
||||
// centrum of mass system
|
||||
G4double M = lv.mag();
|
||||
G4double edel = M - resMass;
|
||||
// Free energy should be above limit
|
||||
if (edel >= elim) {
|
||||
// neutrino
|
||||
G4double eNu = 0.5*(M - resMass*resMass/M);
|
||||
G4LorentzVector lvnu(eNu*G4RandomDirection(), eNu);
|
||||
@@ -141,7 +140,7 @@ G4DecayProducts* G4BetaPlusDecay::DecayIt(G4double)
|
||||
|
||||
} else {
|
||||
// neglecting relativistic kinematic and giving all energy to neutrino
|
||||
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), edel);
|
||||
dp = new G4DynamicParticle(fNeutrino, G4RandomDirection(), elim);
|
||||
products->PushProducts(dp);
|
||||
dp = new G4DynamicParticle(fResIon, G4ThreeVector(0.0,0.0,1.0), 0.0);
|
||||
products->PushProducts(dp);
|
||||
|
||||
Reference in New Issue
Block a user