Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -59,7 +59,8 @@
G4QuasiElasticChannel::G4QuasiElasticChannel()
: theQuasiElastic(new G4QuasiElRatios),
: G4HadronicInteraction("QuasiElastic"),
theQuasiElastic(new G4QuasiElRatios),
the3DNucleus(new G4Fancy3DNucleus) {
}
@@ -38,10 +38,10 @@
G4TheoFSGenerator::G4TheoFSGenerator(const G4String& name)
: G4HadronicInteraction(name)
, theTransport(0), theHighEnergyGenerator(0)
, theQuasielastic(0)
{
theParticleChange = new G4HadFinalState;
, theTransport(nullptr), theHighEnergyGenerator(nullptr)
, theQuasielastic(nullptr)
{
theParticleChange = new G4HadFinalState;
}
G4TheoFSGenerator::~G4TheoFSGenerator()
@@ -52,9 +52,8 @@ G4TheoFSGenerator::~G4TheoFSGenerator()
void G4TheoFSGenerator::ModelDescription(std::ostream& outFile) const
{
outFile << GetModelName() <<" consists of a " << theHighEnergyGenerator->GetModelName()
<< " string model and a stage to de-excite the excited nuclear fragment."
<< "\n<p>"
<< "The string model simulates the interaction of\n"
<< " string model and a stage to de-excite the excited nuclear fragment.\n<p>"
<< "The string model simulates the interaction of\n"
<< "an incident hadron with a nucleus, forming \n"
<< "excited strings, decays these strings into hadrons,\n"
<< "and leaves an excited nucleus. \n"
@@ -64,7 +63,6 @@ void G4TheoFSGenerator::ModelDescription(std::ostream& outFile) const
theTransport->PropagateModelDescription(outFile);
}
G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePrimary, G4Nucleus &theNucleus)
{
// init particle change
@@ -76,8 +74,8 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
const G4DynamicParticle aPart(thePrimary.GetDefinition(),thePrimary.Get4Momentum().vect());
if ( theQuasielastic ) {
if ( theQuasielastic )
{
if ( theQuasielastic->GetFraction(theNucleus, aPart) > G4UniformRand() )
{
//G4cout<<"___G4TheoFSGenerator: before Scatter (1) QE=" << theQuasielastic<<G4endl;
@@ -85,42 +83,41 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
//G4cout << "^^G4TheoFSGenerator: after Scatter (1) " << G4endl;
if (result)
{
for(unsigned int i=0; i<result->size(); i++)
for(auto & ptr : *result)
{
G4DynamicParticle * aNew =
new G4DynamicParticle(result->operator[](i)->GetDefinition(),
result->operator[](i)->Get4Momentum().e(),
result->operator[](i)->Get4Momentum().vect());
new G4DynamicParticle(ptr->GetDefinition(),
ptr->Get4Momentum().e(),
ptr->Get4Momentum().vect());
theParticleChange->AddSecondary(aNew);
delete result->operator[](i);
delete ptr;
}
delete result;
} else
delete result;
}
else
{
theParticleChange->SetStatusChange(isAlive);
theParticleChange->SetEnergyChange(thePrimary.GetKineticEnergy());
theParticleChange->SetMomentumChange(thePrimary.Get4Momentum().vect().unit());
}
return theParticleChange;
return theParticleChange;
}
}
// get result from high energy model
// get result from high energy model
G4KineticTrackVector * theInitialResult =
theHighEnergyGenerator->Scatter(theNucleus, aPart);
//#define DEBUG_initial_result
//#define DEBUG_initial_result
#ifdef DEBUG_initial_result
G4double E_out(0);
G4IonTable * ionTable=G4ParticleTable::GetParticleTable()->GetIonTable();
std::vector<G4KineticTrack *>::iterator ir_iter;
for(ir_iter=theInitialResult->begin(); ir_iter!=theInitialResult->end(); ir_iter++)
for(auto & ptr : *theInitialResult)
{
//G4cout << "TheoFS secondary, mom " << (*ir_iter)->GetDefinition()->GetParticleName() << " " << (*ir_iter)->Get4Momentum() << G4endl;
E_out += (*ir_iter)->Get4Momentum().e();
//G4cout << "TheoFS secondary, mom " << ptr->GetDefinition()->GetParticleName()
// << " " << ptr->Get4Momentum() << G4endl;
E_out += ptr->Get4Momentum().e();
}
G4double init_mass= ionTable->GetIonMass(theNucleus.GetZ_asInt(),theNucleus.GetA_asInt());
G4double init_E=aPart.Get4Momentum().e();
@@ -130,15 +127,15 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
G4int resZ(0),resA(0);
G4double delta_m(0);
for(size_t them=0; them<thy.size(); them++)
for(auto & nuc : thy)
{
if(thy[them].AreYouHit()) {
if(nuc.AreYouHit()) {
++resA;
if ( thy[them].GetDefinition() == G4Proton::Proton() ) {
++resZ;
delta_m +=G4Proton::Proton()->GetPDGMass();
if ( nuc.GetDefinition() == G4Proton::Proton() ) {
++resZ;
delta_m += CLHEP::proton_mass_c2;
} else {
delta_m +=G4Neutron::Neutron()->GetPDGMass();
delta_m += CLHEP::neutron_mass_c2;
}
}
}
@@ -153,65 +150,64 @@ G4HadFinalState * G4TheoFSGenerator::ApplyYourself(const G4HadProjectile & thePr
G4cout << " final E, mass = " << E_out <<", " << final_mass << " excitation_E " << E_excit << G4endl;
#endif
G4ReactionProductVector * theTransportResult = NULL;
G4ReactionProductVector * theTransportResult = nullptr;
// Uzhi Nov. 2012
// Uzhi Nov. 2012 for nucleus-nucleus collision
G4V3DNucleus* theProjectileNucleus = theHighEnergyGenerator->GetProjectileNucleus();
if(theProjectileNucleus == 0) // Uzhi Nov. 2012
{ // Uzhi Nov. 2012
G4int hitCount = 0;
const std::vector<G4Nucleon>& they = theHighEnergyGenerator->GetWoundedNucleus()->GetNucleons();
for(size_t them=0; them<they.size(); them++)
if(theProjectileNucleus == nullptr)
{
if(they[them].AreYouHit()) hitCount ++;
}
if(hitCount != theHighEnergyGenerator->GetWoundedNucleus()->GetMassNumber() )
{
theTransport->SetPrimaryProjectile(thePrimary); // For Bertini Cascade
theTransportResult =
theTransport->Propagate(theInitialResult, theHighEnergyGenerator->GetWoundedNucleus());
if ( !theTransportResult ) {
G4cout << "G4TheoFSGenerator: null ptr from transport propagate " << G4endl;
throw G4HadronicException(__FILE__, __LINE__, "Null ptr from transport propagate");
}
}
else
{
theTransportResult = theDecay.Propagate(theInitialResult, theHighEnergyGenerator->GetWoundedNucleus());
if ( !theTransportResult ) {
G4cout << "G4TheoFSGenerator: null ptr from decay propagate " << G4endl;
throw G4HadronicException(__FILE__, __LINE__, "Null ptr from decay propagate");
}
}
} else // Uzhi Nov. 2012
{ // Uzhi Nov. 2012
G4int hitCount = 0;
const std::vector<G4Nucleon>& they = theHighEnergyGenerator->GetWoundedNucleus()->GetNucleons();
for(auto & nuc : they)
{
if(nuc.AreYouHit()) ++hitCount;
}
if(hitCount != theHighEnergyGenerator->GetWoundedNucleus()->GetMassNumber() )
{
theTransport->SetPrimaryProjectile(thePrimary); // For Bertini Cascade
theTransportResult =
theTransport->Propagate(theInitialResult,
theHighEnergyGenerator->GetWoundedNucleus());
if ( !theTransportResult ) {
G4cout << "G4TheoFSGenerator: null ptr from transport propagate " << G4endl;
throw G4HadronicException(__FILE__, __LINE__, "Null ptr from transport propagate");
}
}
else
{
theTransportResult = theDecay.Propagate(theInitialResult,
theHighEnergyGenerator->GetWoundedNucleus());
if ( theTransportResult == nullptr ) {
G4cout << "G4TheoFSGenerator: null ptr from decay propagate " << G4endl;
throw G4HadronicException(__FILE__, __LINE__, "Null ptr from decay propagate");
}
}
}
else
{
theTransport->SetPrimaryProjectile(thePrimary);
theTransportResult =
theTransport->PropagateNuclNucl(theInitialResult,
theTransportResult = theTransport->PropagateNuclNucl(theInitialResult,
theHighEnergyGenerator->GetWoundedNucleus(),
theHighEnergyGenerator->GetProjectileNucleus());
theProjectileNucleus);
if ( !theTransportResult ) {
G4cout << "G4TheoFSGenerator: null ptr from transport propagate " << G4endl;
throw G4HadronicException(__FILE__, __LINE__, "Null ptr from transport propagate");
}
} // Uzhi Nov. 2012
}
// Fill particle change
for(auto i=theTransportResult->begin(); i!=theTransportResult->end(); i++)
for(auto & ptr : *theTransportResult)
{
G4DynamicParticle * aNewDP =
new G4DynamicParticle((*i)->GetDefinition(),
(*i)->GetTotalEnergy(),
(*i)->GetMomentum());
G4HadSecondary aNew = G4HadSecondary(aNewDP);
G4double time=(*i)->GetFormationTime();
if(time < 0.0) { time = 0.0; }
new G4DynamicParticle(ptr->GetDefinition(),
ptr->GetTotalEnergy(),
ptr->GetMomentum());
G4HadSecondary aNew = G4HadSecondary(aNewDP);
G4double time = std::max(ptr->GetFormationTime(), 0.0);
aNew.SetTime(timePrimary + time);
aNew.SetCreatorModelType((*i)->GetCreatorModel());
aNew.SetCreatorModelType(ptr->GetCreatorModel());
theParticleChange->AddSecondary(aNew);
delete (*i);
delete ptr;
}
// some garbage collection