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
@@ -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;