Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
+43 -14
View File
@@ -1,26 +1,55 @@
-------------------------------------------------------------------
==========================================================
Geant4 - an Object-Oriented Toolkit for Physics Simulation
==========================================================
# Category hadr-util History
History file for hadronic/util directory
----------------------------------------
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!
This file should be used to summarize modifications introduced in the
code and to keep track of all tags.
-------------------------------------------------------------------------------
---------------------------------------------------------------
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
## 2022-06-09 Laurie Nevay (hadr-util-V11-00-07)
- Add option to G4HadronicParameters to control diffraction for baryon
number greater than 10.
09 February 2022 Gabriele Cosmo (hadr-util-V10-07-09)
-----------------------------------------------------
## 2022-05-25 Alberto Ribon (hadr-util-V11-00-06)
- G4KineticTrack, G4HadSecondary, G4ReactionProduct, G4DecayKineticTracks,
G4DecayStrongResonances: propagate the information on parent resonance
## 2022-05-14 Vladimir Ivanchenko (hadr-util-V11-00-05)
- G4HadronicParameters - changed integral flags from per particle
to for elastic and inelastic processes; by default enable
for inelastic
## 2022-05-04 Vladimir Ivanchenko (hadr-util-V11-00-04)
- G4HadronicParameters - moved G4Threading header to the source;
added flags for integral method per particle type for
protons, pions, kaons, and anti-protons
## 2022-04-04 Vladimir Ivanchenko (hadr-util-V11-00-03)
- G4Fragment - fixed computation of binding energy for hypernuclei;
added a new private method to recompute ground state mass,
excitation energy, and to check consistency of input;
left inlined only simple methods; added new methods
SetZAandMomentum(...) and RecomputeGroundStateMass();
improved comments and warning messages
## 2022-02-09 Gabriele Cosmo (hadr-util-V11-00-02)
- Fixed compilation warning on Intel compilers for unused variables
and deprecated declaration of operator=().
## 2021-12-11 Vladimir Ivanchenko (hadr-util-V11-00-01)
- G4Fragment - added IsLongLived flag and Get/Set methods needed
for the de-excitation module; clean-up inline methods.
## 2021-12-10 Ben Morgan (hadr-util-V11-00-00)
- Change to new Markdown History format.
---
# History entries prior to 11.0
05 November 2021 Alberto Ribon (hadr-util-V10-07-08)
----------------------------------------------------
--------------------------------------------------------
- G4Nucleus : the method GetBiasedThermalNucleus has been rewritten
(by Loic Thulliez and Eric Dumonteil of CEA Saclay) according to the
Sampling of the Velocity of the Target nucleus (SVT) algorithm.
@@ -80,10 +80,11 @@ public:
G4Fragment(const G4Fragment &right);
// A,Z and 4-momentum - main constructor for fragment
G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum, G4bool warning=true);
G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum);
// A,Z,numberOfLambdas and 4-momentum
G4Fragment(G4int A, G4int Z, G4int numberOfLambdas, const G4LorentzVector& aMomentum, G4bool warning=true);
G4Fragment(G4int A, G4int Z, G4int numberOfLambdas,
const G4LorentzVector& aMomentum);
// 4-momentum and pointer to G4particleDefinition (for gammas, e-)
G4Fragment(const G4LorentzVector& aMomentum,
@@ -105,24 +106,41 @@ public:
inline G4int GetZ_asInt() const;
inline G4int GetA_asInt() const;
inline void SetZandA_asInt(G4int Znew, G4int Anew);
// update number of nucleons without check on input
// ground state mass is not recomputed
inline void SetZandA_asInt(G4int Znew, G4int Anew, G4int Lnew=0);
// non-negative number of lambdas/anti-lambdas
// ground state mass is not recomputed
void SetNumberOfLambdas(G4int numberOfLambdas);
inline G4int GetNumberOfLambdas() const;
inline void SetNumberOfLambdas(G4int numberOfLambdas);
// Non-negative number of lambdas/anti-lambdas inside the nucleus/anti-nucleus
inline G4double GetExcitationEnergy() const;
inline void SetExcEnergyAndMomentum(G4double eexc, const G4LorentzVector&);
inline G4double GetGroundStateMass() const;
inline G4double GetBindingEnergy() const;
inline const G4LorentzVector& GetMomentum() const;
// ground state mass and excitation energy are recomputed
inline G4double RecomputeGroundStateMass();
// update main fragment parameters full check on input
// ground state mass and excitation energy are recomputed
inline void SetMomentum(const G4LorentzVector& value);
// computation of mass for any Z, A and numberOfLambdas
inline G4double ComputeGroundStateMass(G4int Z, G4int A, G4int numberOfLambdas = 0) const;
inline void SetZAandMomentum(const G4LorentzVector&,
G4int Z, G4int A,
G4int nLambdas = 0);
// ground state mass is not recomputed
void SetExcEnergyAndMomentum(G4double eexc, const G4LorentzVector&);
G4double GetBindingEnergy() const;
// computation of mass for any imput Z, A and number of Lambdas
// no check on input values
inline G4double ComputeGroundStateMass(G4int Z, G4int A,
G4int nLambdas = 0) const;
// extra methods
inline G4double GetSpin() const;
@@ -131,8 +149,10 @@ public:
inline G4int GetCreatorModelID() const;
inline void SetCreatorModelID(G4int value);
inline G4bool IsLongLived() const;
inline void SetLongLived(G4bool value);
// obsolete methods
inline G4double GetZ() const;
inline G4double GetA() const;
inline void SetZ(G4double value);
@@ -181,21 +201,20 @@ public:
private:
void CalculateMassAndExcitationEnergy();
void ExcitationEnergyWarning();
void NumberOfExitationWarning(const G4String&);
inline void CalculateExcitationEnergy(G4bool warning=true);
inline void CalculateGroundStateMass();
// ============= DATA MEMBERS ==================
G4int theA;
G4int theZ;
G4int theL; // Non-negative number of lambdas/anti-lambdas inside the nucleus/anti-nucleus
// Non-negative number of lambdas/anti-lambdas inside the nucleus/anti-nucleus
G4int theL;
G4double theExcitationEnergy;
@@ -224,7 +243,7 @@ private:
G4double spin;
G4double theCreationTime;
static const G4double minFragExcitation;
G4bool isLongLived = false;
};
// ============= INLINE METHOD IMPLEMENTATIONS ===================
@@ -237,7 +256,9 @@ private:
inline void * G4Fragment::operator new(size_t)
{
if (!pFragmentAllocator()) { pFragmentAllocator() = new G4Allocator<G4Fragment>; }
if (!pFragmentAllocator()) {
pFragmentAllocator() = new G4Allocator<G4Fragment>;
}
return (void*) pFragmentAllocator()->MallocSingle();
}
@@ -246,26 +267,18 @@ inline void G4Fragment::operator delete(void * aFragment)
pFragmentAllocator()->FreeSingle((G4Fragment *) aFragment);
}
inline void G4Fragment::CalculateExcitationEnergy(G4bool warning)
inline G4double
G4Fragment::ComputeGroundStateMass(G4int Z, G4int A, G4int nLambdas) const
{
theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
if(theExcitationEnergy < minFragExcitation) {
if(theExcitationEnergy < -minFragExcitation && warning) { ExcitationEnergyWarning(); }
theExcitationEnergy = 0.0;
}
return ( nLambdas <= 0 )
? G4NucleiProperties::GetNuclearMass(A, Z)
: G4HyperNucleiProperties::GetNuclearMass(A, Z, nLambdas);
}
inline G4double
G4Fragment::ComputeGroundStateMass(G4int Z, G4int A, G4int numberOfLambdas) const
inline G4double G4Fragment::RecomputeGroundStateMass()
{
if ( numberOfLambdas <= 0 ) return G4NucleiProperties::GetNuclearMass(A, Z);
else return G4HyperNucleiProperties::GetNuclearMass(A, Z, numberOfLambdas);
}
inline void G4Fragment::CalculateGroundStateMass()
{
if ( theL <= 0 ) theGroundStateMass = G4NucleiProperties::GetNuclearMass(theA, theZ);
else theGroundStateMass = G4HyperNucleiProperties::GetNuclearMass(theA, theZ, theL);
CalculateMassAndExcitationEnergy();
return theGroundStateMass;
}
inline G4int G4Fragment::GetA_asInt() const
@@ -278,11 +291,17 @@ inline G4int G4Fragment::GetZ_asInt() const
return theZ;
}
inline void G4Fragment::SetZandA_asInt(G4int Znew, G4int Anew)
inline void
G4Fragment::SetZandA_asInt(G4int Znew, G4int Anew, G4int Lnew)
{
theZ = Znew;
theA = Anew;
CalculateGroundStateMass();
theL = std::max(Lnew, 0);
}
inline void G4Fragment::SetNumberOfLambdas(G4int Lnew)
{
theL = std::max(Lnew, 0);
}
inline G4int G4Fragment::GetNumberOfLambdas() const
@@ -290,12 +309,6 @@ inline G4int G4Fragment::GetNumberOfLambdas() const
return theL;
}
inline void G4Fragment::SetNumberOfLambdas(G4int numberOfLambdas)
{
theL = std::max( numberOfLambdas, 0 ); // Cannot be negative
CalculateGroundStateMass();
}
inline G4double G4Fragment::GetExcitationEnergy() const
{
return theExcitationEnergy;
@@ -306,20 +319,6 @@ inline G4double G4Fragment::GetGroundStateMass() const
return theGroundStateMass;
}
inline void G4Fragment::SetExcEnergyAndMomentum(G4double eexc,
const G4LorentzVector& v)
{
theExcitationEnergy = eexc;
theMomentum.set(0.0, 0.0, 0.0, theGroundStateMass + eexc);
theMomentum.boost(v.boostVector());
}
inline G4double G4Fragment::GetBindingEnergy() const
{
return (theA-theZ)*CLHEP::neutron_mass_c2 + theZ*CLHEP::proton_mass_c2
- theGroundStateMass;
}
inline const G4LorentzVector& G4Fragment::GetMomentum() const
{
return theMomentum;
@@ -328,29 +327,35 @@ inline const G4LorentzVector& G4Fragment::GetMomentum() const
inline void G4Fragment::SetMomentum(const G4LorentzVector& value)
{
theMomentum = value;
CalculateExcitationEnergy();
CalculateMassAndExcitationEnergy();
}
inline void
G4Fragment::SetZAandMomentum(const G4LorentzVector& v,
G4int Z, G4int A, G4int nLambdas)
{
SetZandA_asInt(Z, A, nLambdas);
SetMomentum(v);
}
inline G4double G4Fragment::GetZ() const
{
return G4double(theZ);
return static_cast<G4double>(theZ);
}
inline G4double G4Fragment::GetA() const
{
return G4double(theA);
return static_cast<G4double>(theA);
}
inline void G4Fragment::SetZ(const G4double value)
{
theZ = G4lrint(value);
CalculateGroundStateMass();
}
inline void G4Fragment::SetA(const G4double value)
{
theA = G4lrint(value);
CalculateGroundStateMass();
}
inline G4int G4Fragment::GetNumberOfExcitons() const
@@ -440,6 +445,16 @@ inline void G4Fragment::SetSpin(G4double value)
spin = value;
}
inline G4bool G4Fragment::IsLongLived() const
{
return isLongLived;
}
inline void G4Fragment::SetLongLived(G4bool value)
{
isLongLived = value;
}
inline G4int G4Fragment::GetFloatingLevelNumber() const
{
return xLevel;
@@ -487,5 +502,3 @@ inline void G4Fragment::SetNuclearPolarization(G4NuclearPolarization* p)
}
#endif
@@ -31,6 +31,7 @@
#include "globals.hh"
class G4DynamicParticle;
class G4ParticleDefinition;
class G4HadSecondary
{
@@ -47,7 +48,11 @@ public:
inline G4double GetTime() const {return theTime;}
inline void SetCreatorModelID(G4int id) {theCreatorModel = id;}
inline G4int GetCreatorModelID() const {return theCreatorModel;}
inline const G4ParticleDefinition* GetParentResonanceDef() const {return theParentResonanceDef;}
inline void SetParentResonanceDef(const G4ParticleDefinition* parentDef) {theParentResonanceDef = parentDef;}
inline G4int GetParentResonanceID() const {return theParentResonanceID;}
inline void SetParentResonanceID(const G4int parentID) {theParentResonanceID = parentID;}
private:
G4HadSecondary(){};
@@ -56,6 +61,8 @@ private:
G4double theWeight;
G4double theTime;
G4int theCreatorModel;
const G4ParticleDefinition* theParentResonanceDef = nullptr;
G4int theParentResonanceID;
};
#endif
@@ -40,7 +40,6 @@
#define G4HadronicParameters_h 1
#include "globals.hh"
#include "G4Threading.hh"
class G4HadronicParametersMessenger;
@@ -125,15 +124,24 @@ class G4HadronicParameters {
// Boolean switch that allows to apply the Cosmic Ray (CR) coalescence algorithm
// to the secondaries produced by a string model. By default it is disabled.
inline G4bool EnableIntegralInelasticXS() const;
inline G4bool EnableIntegralElasticXS() const;
void SetEnableIntegralInelasticXS( G4bool val );
void SetEnableIntegralElasticXS( G4bool val );
// Enable/disable integral method for main hadrons
inline G4bool EnableDiffDissociationForBGreater10() const;
/// For nucleon-hadron interactions, it's not decided what to do with diffraction
/// dissociation. For the moment, they are turned off. This option allows it to
/// be turned back on. Applies to Baryon Number > 10 or # target nucleons > 10.
void SetEnableDiffDissociationForBGreater10(G4bool val);
private:
G4HadronicParameters();
G4bool IsLocked() const;
static G4HadronicParameters* sInstance;
#ifdef G4MULTITHREADED
static G4Mutex paramMutex;
#endif
G4HadronicParametersMessenger* fMessenger;
@@ -157,6 +165,9 @@ class G4HadronicParameters {
G4bool fEnableHyperNuclei = false;
G4bool fApplyFactorXS = false;
G4bool fEnableCRCoalescence = false;
G4bool fEnableIntegralInelasticXS = true;
G4bool fEnableIntegralElasticXS = true;
G4bool fEnableDiffDissociationForBGreater10 = false;
};
inline G4double G4HadronicParameters::GetMaxEnergy() const {
@@ -230,4 +241,16 @@ inline G4bool G4HadronicParameters::EnableCRCoalescence() const {
return fEnableCRCoalescence;
}
inline G4bool G4HadronicParameters::EnableIntegralInelasticXS() const {
return fEnableIntegralInelasticXS;
}
inline G4bool G4HadronicParameters::EnableIntegralElasticXS() const {
return fEnableIntegralElasticXS;
}
inline G4bool G4HadronicParameters::EnableDiffDissociationForBGreater10() const {
return fEnableDiffDissociationForBGreater10;
}
#endif
@@ -125,7 +125,12 @@ class G4KineticTrack : public G4VKineticNucleon
void SetCreatorModelID(G4int id);
G4int GetCreatorModelID() const;
const G4ParticleDefinition* GetParentResonanceDef() const;
void SetParentResonanceDef(const G4ParticleDefinition* parent);
G4int GetParentResonanceID() const;
void SetParentResonanceID(const G4int parentID);
private:
@@ -190,6 +195,9 @@ public:
G4double theProjectilePotential;
G4int theCreatorModel;
const G4ParticleDefinition* theParentResonanceDef = nullptr;
G4int theParentResonanceID;
};
// extern G4Allocator<G4KineticTrack> theKTAllocator;
@@ -437,7 +445,28 @@ G4int G4KineticTrack::GetCreatorModelID() const
return theCreatorModel;
}
inline
const G4ParticleDefinition* G4KineticTrack::GetParentResonanceDef() const
{
return theParentResonanceDef;
}
inline
void G4KineticTrack::SetParentResonanceDef(const G4ParticleDefinition* parentDef)
{
theParentResonanceDef = parentDef;
}
inline
G4int G4KineticTrack::GetParentResonanceID() const
{
return theParentResonanceID;
}
inline
void G4KineticTrack::SetParentResonanceID(const G4int parentID)
{
theParentResonanceID = parentID;
}
#endif
@@ -167,6 +167,17 @@ class G4ReactionProduct
inline G4int GetCreatorModelID() const
{ return theCreatorModel; }
inline const G4ParticleDefinition* GetParentResonanceDef() const
{ return theParentResonanceDef; }
inline void SetParentResonanceDef( const G4ParticleDefinition* parentDef )
{ theParentResonanceDef = parentDef; }
inline G4int GetParentResonanceID() const { return theParentResonanceID; }
inline void SetParentResonanceID ( const G4int parentID )
{ theParentResonanceID = parentID; }
inline void SetNewlyAdded( const G4bool f )
{ NewlyAdded = f; }
@@ -237,6 +248,9 @@ private:
G4int theCreatorModel;
const G4ParticleDefinition* theParentResonanceDef = nullptr;
G4int theParentResonanceID;
// NewlyAdded refers to particles added by "nuclear excitation", or as
// "black track" particles, or as deuterons, tritons, and alphas
G4bool NewlyAdded;
@@ -54,10 +54,17 @@ void G4DecayKineticTracks::Decay(G4KineticTrackVector *tracks) const {
daughters = track->GetDefinition()->IsShortLived() ? track->Decay() : 0;
if (daughters) {
// Use the integer round mass in keV to get an unique ID for the parent resonance
G4int uniqueID = static_cast< G4int >( round( track->Get4Momentum().mag() / CLHEP::keV ) );
// Assign to the daughters the creator model ID of their parent
for (size_t k=0; k<daughters->size(); ++k) {
G4KineticTrack* aDaughter = (*daughters)[k];
if (aDaughter) aDaughter->SetCreatorModelID(track->GetCreatorModelID());
if (aDaughter) {
aDaughter->SetCreatorModelID(track->GetCreatorModelID());
aDaughter->SetParentResonanceDef(track->GetDefinition());
aDaughter->SetParentResonanceID(uniqueID);
}
}
tracks->insert(tracks->end(), daughters->begin(), daughters->end());
@@ -74,6 +74,8 @@ G4DecayStrongResonances::Propagate(G4KineticTrackVector* theSecondaries,
it->SetTotalEnergy(aSecondary->Get4Momentum().t());
it->SetMomentum(aSecondary->Get4Momentum().vect());
it->SetCreatorModelID(aSecondary->GetCreatorModelID());
it->SetParentResonanceDef(aSecondary->GetParentResonanceDef());
it->SetParentResonanceID(aSecondary->GetParentResonanceID());
delete aSecondary;
try { theResult->push_back(it); }
catch(...){
@@ -39,18 +39,17 @@
// 27.10.2021 A.Ribon extension for hypernuclei.
#include "G4Fragment.hh"
#include "G4SystemOfUnits.hh"
#include "G4HadronicException.hh"
#include "G4ios.hh"
#include <iomanip>
G4Allocator<G4Fragment>*& pFragmentAllocator()
{
G4ThreadLocalStatic G4Allocator<G4Fragment>* _instance = nullptr;
return _instance;
G4ThreadLocalStatic G4Allocator<G4Fragment>* _instance = nullptr;
return _instance;
}
const G4double G4Fragment::minFragExcitation = 10.*CLHEP::eV;
// Default constructor
G4Fragment::G4Fragment() :
theA(0),
@@ -90,13 +89,14 @@ G4Fragment::G4Fragment(const G4Fragment &right) :
xLevel(right.xLevel),
theParticleDefinition(right.theParticleDefinition),
spin(right.spin),
theCreationTime(right.theCreationTime)
theCreationTime(right.theCreationTime),
isLongLived(right.isLongLived)
{}
G4Fragment::~G4Fragment()
{}
G4Fragment::G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum, G4bool warning) :
G4Fragment::G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum) :
theA(A),
theZ(Z),
theL(0),
@@ -116,12 +116,12 @@ G4Fragment::G4Fragment(G4int A, G4int Z, const G4LorentzVector& aMomentum, G4boo
theCreationTime(0.0)
{
if(theA > 0) {
CalculateGroundStateMass();
CalculateExcitationEnergy(warning);
CalculateMassAndExcitationEnergy();
}
}
G4Fragment::G4Fragment(G4int A, G4int Z, G4int numberOfLambdas, const G4LorentzVector& aMomentum, G4bool warning) :
G4Fragment::G4Fragment(G4int A, G4int Z, G4int numberOfLambdas,
const G4LorentzVector& aMomentum) :
theA(A),
theZ(Z),
theL(std::max(numberOfLambdas,0)),
@@ -141,8 +141,7 @@ G4Fragment::G4Fragment(G4int A, G4int Z, G4int numberOfLambdas, const G4LorentzV
theCreationTime(0.0)
{
if(theA > 0) {
CalculateGroundStateMass();
CalculateExcitationEnergy(warning);
CalculateMassAndExcitationEnergy();
}
}
@@ -175,6 +174,48 @@ G4Fragment::G4Fragment(const G4LorentzVector& aMomentum,
theGroundStateMass = aParticleDefinition->GetPDGMass();
}
void G4Fragment::CalculateMassAndExcitationEnergy()
{
// check input
if(theZ > theA || theZ + theL > theA) {
G4String text = "G4Fragment::CalculateMassAndExcitationEnergy: inconsistent number of nucleons is ignored";
G4cout << text << G4endl;
G4cout << " Z=" << theZ << " A=" << theA
<< " nLambdas=" << theL << G4endl;
throw G4HadronicException(__FILE__, __LINE__, text);
}
// compute mass
theGroundStateMass = ( theL == 0 )
? G4NucleiProperties::GetNuclearMass(theA, theZ)
: G4HyperNucleiProperties::GetNuclearMass(theA, theZ, theL);
// excitation energy
const G4double minFragExcitation = 10.*CLHEP::eV;
theExcitationEnergy = theMomentum.mag() - theGroundStateMass;
if(theExcitationEnergy < minFragExcitation) {
if(theExcitationEnergy < -minFragExcitation) {
ExcitationEnergyWarning();
}
theExcitationEnergy = 0.0;
}
}
void G4Fragment::SetExcEnergyAndMomentum(G4double eexc,
const G4LorentzVector& v)
{
theExcitationEnergy = eexc;
theMomentum.set(0.0, 0.0, 0.0, theGroundStateMass + eexc);
theMomentum.boost(v.boostVector());
}
G4double G4Fragment::GetBindingEnergy() const
{
const G4double lambdaMass = 1.115683*CLHEP::GeV;
return (theA-theZ-theL)*CLHEP::neutron_mass_c2
+ theZ*CLHEP::proton_mass_c2 + theL*lambdaMass
- theGroundStateMass;
}
G4Fragment & G4Fragment::operator=(const G4Fragment &right)
{
if (this != &right) {
@@ -195,6 +236,7 @@ G4Fragment & G4Fragment::operator=(const G4Fragment &right)
theParticleDefinition = right.theParticleDefinition;
spin = right.spin;
theCreationTime = right.theCreationTime;
isLongLived = right.isLongLived;
}
return *this;
}
@@ -264,7 +306,9 @@ std::ostream& operator << (std::ostream &out, const G4Fragment &theFragment)
void G4Fragment::ExcitationEnergyWarning()
{
#ifdef G4VERBOSE
G4cout << "G4Fragment::CalculateExcitationEnergy(): WARNING "<<G4endl;
G4cout << "G4Fragment::CalculateExcitationEnergy(): WARNING "
<< " GraundStateMass(MeV)= " << theGroundStateMass
<<G4endl;
G4cout << *this << G4endl;
#endif
}
@@ -25,11 +25,13 @@
//
#include "G4HadSecondary.hh"
#include "G4DynamicParticle.hh"
#include "G4ParticleDefinition.hh"
#include "G4HadronicException.hh"
G4HadSecondary::G4HadSecondary(G4DynamicParticle * aT, G4double aWeight,
G4int mod) :
theP(aT), theWeight(aWeight), theTime(-1), theCreatorModel(mod)
theP(aT), theWeight(aWeight), theTime(-1), theCreatorModel(mod),
theParentResonanceDef(nullptr), theParentResonanceID(0)
{
if(aT->GetKineticEnergy()<0)
{
@@ -41,26 +41,24 @@
#include "G4ApplicationState.hh"
#include "G4StateManager.hh"
#include "G4HadronicParametersMessenger.hh"
#include "G4Threading.hh"
#include "G4AutoLock.hh"
G4HadronicParameters* G4HadronicParameters::sInstance = nullptr;
#ifdef G4MULTITHREADED
G4Mutex G4HadronicParameters::paramMutex = G4MUTEX_INITIALIZER;
#endif
namespace
{
G4Mutex paramMutex = G4MUTEX_INITIALIZER;
}
G4HadronicParameters* G4HadronicParameters::Instance() {
if ( sInstance == nullptr ) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK( &paramMutex );
G4AutoLock l(&paramMutex);
if ( sInstance == nullptr ) {
#endif
static G4HadronicParameters theHadronicParametersObject;
sInstance = &theHadronicParametersObject;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&paramMutex);
#endif
l.unlock();
}
return sInstance;
}
@@ -200,3 +198,17 @@ void G4HadronicParameters::SetApplyFactorXS( G4bool val ) {
void G4HadronicParameters::SetEnableCRCoalescence( G4bool val ) {
if ( ! IsLocked() ) fEnableCRCoalescence = val;
}
void G4HadronicParameters::SetEnableIntegralInelasticXS( G4bool val ) {
if ( ! IsLocked() ) fEnableIntegralInelasticXS = val;
}
void G4HadronicParameters::SetEnableIntegralElasticXS( G4bool val ) {
if ( ! IsLocked() ) fEnableIntegralElasticXS = val;
}
void G4HadronicParameters::SetEnableDiffDissociationForBGreater10(G4bool val) {
if ( ! IsLocked() ) fEnableDiffDissociationForBGreater10 = val;
}
@@ -79,7 +79,9 @@ G4KineticTrack::G4KineticTrack() :
theDaughterWidth(0),
theStateToNucleus(undefined),
theProjectilePotential(0),
theCreatorModel(-1)
theCreatorModel(-1),
theParentResonanceDef(nullptr),
theParentResonanceID(0)
{
////////////////
// DEBUG //
@@ -116,9 +118,12 @@ G4KineticTrack::G4KineticTrack(const G4KineticTrack &right) : G4VKineticNucleon(
}
theDaughterMass = 0;
theDaughterWidth = 0;
theStateToNucleus=right.theStateToNucleus;
theProjectilePotential=right.theProjectilePotential;
theStateToNucleus = right.theStateToNucleus;
theProjectilePotential = right.theProjectilePotential;
theCreatorModel = right.GetCreatorModelID();
theParentResonanceDef = right.GetParentResonanceDef();
theParentResonanceID = right.GetParentResonanceID();
////////////////
// DEBUG //
////////////////
@@ -148,7 +153,9 @@ G4KineticTrack::G4KineticTrack(const G4ParticleDefinition* aDefinition,
theNucleon(0),
theStateToNucleus(undefined),
theProjectilePotential(0),
theCreatorModel(-1)
theCreatorModel(-1),
theParentResonanceDef(nullptr),
theParentResonanceID(0)
{
if(G4KaonZero::KaonZero() == theDefinition ||
G4AntiKaonZero::AntiKaonZero() == theDefinition)
@@ -429,7 +436,9 @@ G4KineticTrack::G4KineticTrack(G4Nucleon * nucleon,
theDaughterWidth(0),
theStateToNucleus(undefined),
theProjectilePotential(0),
theCreatorModel(-1)
theCreatorModel(-1),
theParentResonanceDef(nullptr),
theParentResonanceID(0)
{
theFermi3Momentum.setE(0);
Set4Momentum(a4Momentum);
@@ -455,13 +464,15 @@ G4KineticTrack& G4KineticTrack::operator=(const G4KineticTrack& right)
the4Momentum = right.GetTrackingMomentum();
theFermi3Momentum = right.theFermi3Momentum;
theTotal4Momentum = right.theTotal4Momentum;
theNucleon=right.theNucleon;
theStateToNucleus=right.theStateToNucleus;
theNucleon = right.theNucleon;
theStateToNucleus = right.theStateToNucleus;
if (theActualWidth != 0) delete [] theActualWidth;
nChannels = right.GetnChannels();
theActualWidth = new G4double[nChannels];
for (G4int i = 0; i < nChannels; ++i) theActualWidth[i] = right.theActualWidth[i];
theCreatorModel = right.GetCreatorModelID();
theParentResonanceDef = right.GetParentResonanceDef();
theParentResonanceID = right.GetParentResonanceID();
}
return *this;
}
@@ -710,6 +721,8 @@ G4KineticTrackVector* G4KineticTrack::Decay()
G4KineticTrackVector* theDecayProductList = new G4KineticTrackVector;
G4int dEntries = theDecayProducts->entries();
const G4ParticleDefinition * aProduct = 0;
// Use the integer round mass in keV to get an unique ID for the parent resonance
G4int uniqueID = static_cast< G4int >( round( Get4Momentum().mag() / CLHEP::keV ) );
for (G4int i=dEntries; i > 0; --i)
{
theDynamicParticle = theDecayProducts->PopProducts();
@@ -723,7 +736,12 @@ G4KineticTrackVector* G4KineticTrack::Decay()
formationTime,
position,
momentum);
if (aDaughter != nullptr) aDaughter->SetCreatorModelID(GetCreatorModelID());
if (aDaughter != nullptr)
{
aDaughter->SetCreatorModelID(GetCreatorModelID());
aDaughter->SetParentResonanceDef(GetDefinition());
aDaughter->SetParentResonanceID(uniqueID);
}
theDecayProductList->push_back(aDaughter);
delete theDynamicParticle;
}
@@ -46,6 +46,8 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
timeOfFlight(0.0),
side(0),
theCreatorModel(-1),
theParentResonanceDef(nullptr),
theParentResonanceID(0),
NewlyAdded(false),
MayBeKilled(true)
{
@@ -67,6 +69,8 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
(aParticleDefinition->GetPDGEncoding()<0) ? timeOfFlight=-1.0 : timeOfFlight=1.0;
side = 0;
theCreatorModel = -1;
theParentResonanceDef = nullptr;
theParentResonanceID = 0;
NewlyAdded = false;
MayBeKilled = true;
}
@@ -85,6 +89,8 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
timeOfFlight = right.timeOfFlight;
side = right.side;
theCreatorModel = right.theCreatorModel;
theParentResonanceDef = right.theParentResonanceDef;
theParentResonanceID = right.theParentResonanceID;
NewlyAdded = right.NewlyAdded;
MayBeKilled = right.MayBeKilled;
}
@@ -104,6 +110,8 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
timeOfFlight = right.timeOfFlight;
side = right.side;
theCreatorModel = right.theCreatorModel;
theParentResonanceDef = right.theParentResonanceDef;
theParentResonanceID = right.theParentResonanceID;
NewlyAdded = right.NewlyAdded;
MayBeKilled = right.MayBeKilled;
}
@@ -124,6 +132,8 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
(right.GetDefinition()->GetPDGEncoding()<0) ? timeOfFlight=-1.0 : timeOfFlight=1.0;
side = 0;
theCreatorModel = -1;
theParentResonanceDef = nullptr;
theParentResonanceID = 0;
NewlyAdded = false;
MayBeKilled = true;
return *this;
@@ -143,6 +153,8 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
(right.GetDefinition()->GetPDGEncoding()<0) ? timeOfFlight=-1.0 : timeOfFlight=1.0;
side = 0;
theCreatorModel = -1;
theParentResonanceDef = nullptr;
theParentResonanceID = 0;
NewlyAdded = false;
MayBeKilled = true;
return *this;
@@ -200,6 +212,8 @@ G4Allocator<G4ReactionProduct>*& aRPAllocator()
timeOfFlight = 0.0;
side = 0;
theCreatorModel = -1;
theParentResonanceDef = nullptr;
theParentResonanceID = 0;
NewlyAdded = false;
SetPositionInNucleus( 0.0, 0.0, 0.0 );
formationTime = 0.0;