Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
@@ -457,8 +457,10 @@ G4ReactionProductVector * G4BinaryCascade::Propagate(
G4bool haveProducts = false;
#ifdef debug_BIC_Propagate_Collisions
G4int collisionCount=0;
G4int collisionLoopMaxCount=1000000;
#endif
G4int collisionLoopMaxCount=1000000;
while(theCollisionMgr->Entries() > 0 && currentZ && --collisionLoopMaxCount>0) /* Loop checking, 31.08.2015, G.Folger */
{
if(Absorb()) { // absorb secondaries, pions only
@@ -495,9 +497,9 @@ G4ReactionProductVector * G4BinaryCascade::Propagate(
{
//G4cerr << "ApplyCollision success " << G4endl;
haveProducts = true;
#ifdef debug_BIC_Propagate_Collisions
collisionCount++;
//_CheckChargeAndBaryonNumber_("ApplyCollision");
//_DebugEpConservation("ApplyCollision");
#endif
} else {
//G4cerr << "ApplyCollision failure " << G4endl;
@@ -1691,7 +1693,6 @@ void G4BinaryCascade::StepParticlesOut()
while( theSecondaryList.size() > 0 ) /* Loop checking, 31.08.2015, G.Folger */
// if countreset reaches limit, there is a break from while, see below.
{
G4int nsec=0;
G4double minTimeStep = 1.e-12*ns; // about 30*fermi/(0.1*c_light);1.e-12*ns
// i.e. a big step
std::vector<G4KineticTrack *>::iterator i;
@@ -1700,7 +1701,6 @@ void G4BinaryCascade::StepParticlesOut()
G4KineticTrack * kt = *i;
if( kt->GetState() == G4KineticTrack::inside )
{
nsec++;
G4double tStep(0), tdummy(0);
G4bool intersect =
((G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(kt,tdummy,tStep);
@@ -1724,7 +1724,6 @@ void G4BinaryCascade::StepParticlesOut()
}
}
minTimeStep *= 1.2;
// G4cerr << "CaptureCount = "<<counter<<" "<<nsec<<" "<<minTimeStep<<" "<<1*ns<<G4endl;
G4double timeToCollision=DBL_MAX;
G4CollisionInitialState * nextCollision=0;
if(theCollisionMgr->Entries() > 0)
@@ -1920,11 +1919,9 @@ void G4BinaryCascade::CorrectFinalPandE()
G4cerr << " -CorrectFinalPandE 3" << G4endl;
#endif
G4LorentzVector pFinals(0);
G4int nFinals(0);
for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
{
pFinals += (*i)->Get4Momentum();
++nFinals;
#ifdef debug_BIC_CorrectFinalPandE
G4cout <<"CorrectFinalPandE a final " << (*i)->GetDefinition()->GetParticleName()
<< " 4mom " << (*i)->Get4Momentum()<< G4endl;
@@ -1978,7 +1975,6 @@ void G4BinaryCascade::CorrectFinalPandE()
{
G4ThreeVector p3finals=pInCM*pFinals.vect().unit();
// G4ThreeVector deltap=(p3finals - pFinals.vect() ) / nFinals;
G4double factor=std::max(0.98,pInCM/pFinals.vect().mag()); // small correction
G4LorentzVector qFinals(0);
for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
@@ -2496,7 +2492,7 @@ G4Fragment * G4BinaryCascade::FindFragments()
<< G4endl;
#endif
G4int a = theTargetList.size()+theCapturedList.size();
G4int a = G4int(theTargetList.size()+theCapturedList.size());
G4int zTarget = 0;
G4KineticTrackVector::iterator i;
for(i = theTargetList.begin(); i != theTargetList.end(); ++i)
@@ -2543,8 +2539,8 @@ G4Fragment * G4BinaryCascade::FindFragments()
// if(getenv("BCDEBUG") ) G4cerr << "Fragment A, Z "<< a <<" "<< z<<G4endl;
if ( z < 1 ) return 0;
G4int holes = the3DNucleus->GetMassNumber() - theTargetList.size();
G4int excitons = theCapturedList.size();
G4int holes = G4int(the3DNucleus->GetMassNumber() - theTargetList.size());
G4int excitons = (G4int)theCapturedList.size();
#ifdef debug_BIC_FindFragments
G4cout << "Fragment: a= " << a << " z= " << z << " particles= " << excitons
<< " Charged= " << zCaptured << " holes= " << holes
@@ -2891,11 +2887,11 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
// return product when nucleus is destroyed, i.e. charge=0, or theTargetList.size()=0
G4double Esecondaries(0.);
G4LorentzVector psecondaries;
std::vector<G4KineticTrack *>::iterator iter;
std::vector<G4ReactionProduct *>::iterator rpiter;
std::vector<G4KineticTrack *>::const_iterator iter;
std::vector<G4ReactionProduct *>::const_iterator rpiter;
decayKTV.Decay(&theFinalState);
for(iter = theFinalState.begin(); iter != theFinalState.end(); ++iter)
for(iter = theFinalState.cbegin(); iter != theFinalState.cend(); ++iter)
{
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
aNew->SetMomentum((*iter)->Get4Momentum().vect());
@@ -2951,7 +2947,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
transferCorrection= theMomentumTransfer /(theSecondaryList.size() + theCapturedList.size());
}
for(iter = theSecondaryList.begin(); iter != theSecondaryList.end(); ++iter)
for(iter = theSecondaryList.cbegin(); iter != theSecondaryList.cend(); ++iter)
{
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
(*iter)->Update4Momentum((*iter)->Get4Momentum().vect()+transferCorrection);
@@ -2966,7 +2962,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
products->push_back(aNew);
}
for(iter = theCapturedList.begin(); iter != theCapturedList.end(); ++iter)
for(iter = theCapturedList.cbegin(); iter != theCapturedList.cend(); ++iter)
{
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
(*iter)->Update4Momentum((*iter)->Get4Momentum().vect()+transferCorrection);
@@ -2983,7 +2979,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
G4double SumMassNucleons(0.);
G4LorentzVector pNucleons(0.);
for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter)
for(iter = theTargetList.cbegin(); iter != theTargetList.cend(); ++iter)
{
SumMassNucleons += (*iter)->GetDefinition()->GetPDGMass();
pNucleons += (*iter)->Get4Momentum();
@@ -3002,7 +2998,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
G4double Ekineticrdm(0);
if (theTargetList.size()) Ekineticrdm = ( 0.1 + G4UniformRand()*5.) * MeV; // leave some Energy for Nucleons
G4double TotalEkin(Ekineticrdm);
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
TotalEkin+=(*rpiter)->GetKineticEnergy();
}
G4double correction(1.);
@@ -3015,7 +3011,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
}
#endif
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
(*rpiter)->SetKineticEnergy((*rpiter)->GetKineticEnergy()*correction); // this sets kinetic & total energy
(*rpiter)->SetMomentum((*rpiter)->GetTotalMomentum() * (*rpiter)->GetMomentum().unit());
@@ -3026,7 +3022,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
}
for(iter = theTargetList.begin(); iter != theTargetList.end(); ++iter) {
for(iter = theTargetList.cbegin(); iter != theTargetList.cend(); ++iter) {
// set Nucleon it to be hit - as it is in fact
(*iter)->Hit();
G4ReactionProduct * aNew = new G4ReactionProduct((*iter)->GetDefinition());
@@ -3041,7 +3037,7 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
psecondaries += G4LorentzVector(aNew->GetMomentum(),aNew->GetTotalEnergy() );
}
psecondaries=G4LorentzVector(0);
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
psecondaries += G4LorentzVector((*rpiter)->GetMomentum(),(*rpiter)->GetTotalEnergy() );
}
@@ -3055,24 +3051,22 @@ G4ReactionProductVector * G4BinaryCascade::FillVoidNucleusProducts(G4ReactionPro
SumMom=initial4Mom.vect()-SumMom;
G4int loopcount(0);
std::vector<G4ReactionProduct *>::reverse_iterator reverse; // start to correct last added first
// reverse_iterator reverse - start to correct last added first
while ( SumMom.mag() > 0.1*MeV && loopcount++ < 10) /* Loop checking, 31.08.2015, G.Folger */
{
G4int index=products->size();
for (reverse=products->rbegin(); reverse!=products->rend(); ++reverse, --index){
SumMom=initial4Mom.vect();
for (rpiter=products->begin(); rpiter!=products->end(); ++rpiter){
SumMom-=(*rpiter)->GetMomentum();
}
G4double p=((*reverse)->GetMomentum()).mag();
(*reverse)->SetMomentum( p*(((*reverse)->GetMomentum()+SumMom).unit()));
}
G4int index=(G4int)products->size();
for (auto reverse=products->crbegin(); reverse!=products->crend(); ++reverse, --index){
SumMom=initial4Mom.vect();
for (rpiter=products->cbegin(); rpiter!=products->cend(); ++rpiter){
SumMom-=(*rpiter)->GetMomentum();
}
G4double p=((*reverse)->GetMomentum()).mag();
(*reverse)->SetMomentum( p*(((*reverse)->GetMomentum()+SumMom).unit()));
}
}
return products;
}
G4ReactionProductVector * G4BinaryCascade::HighEnergyModelFSProducts(G4ReactionProductVector * products,
G4KineticTrackVector * secondaries)
{
@@ -49,6 +49,7 @@
#include "G4KineticTrackVector.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
#include "G4Lambda.hh"
#include "G4Deuteron.hh"
#include "G4Triton.hh"
@@ -60,6 +61,7 @@
#include "G4AntiProton.hh"
#include "G4AntiNeutron.hh"
#include "G4AntiLambda.hh"
#include "G4AntiDeuteron.hh"
#include "G4AntiTriton.hh"
#include "G4AntiHe3.hh"
@@ -100,6 +102,7 @@ G4GeneratorPrecompoundInterface::G4GeneratorPrecompoundInterface(G4VPreCompoundM
{
proton = G4Proton::Proton();
neutron = G4Neutron::Neutron();
lambda = G4Lambda::Lambda();
deuteron=G4Deuteron::Deuteron();
triton =G4Triton::Triton();
@@ -747,6 +750,7 @@ PropagateNuclNucl(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus
const G4ParticleDefinition * LastFragment=aFragment;
if (aFragment == proton) {LastFragment=G4AntiProton::AntiProtonDefinition();}
else if(aFragment == neutron) {LastFragment=G4AntiNeutron::AntiNeutronDefinition();}
else if(aFragment == lambda) {LastFragment=G4AntiLambda::AntiLambdaDefinition();}
else if(aFragment == deuteron){LastFragment=G4AntiDeuteron::AntiDeuteronDefinition();}
else if(aFragment == triton) {LastFragment=G4AntiTriton::AntiTritonDefinition();}
else if(aFragment == He3) {LastFragment=G4AntiHe3::AntiHe3Definition();}
@@ -802,7 +806,7 @@ void G4GeneratorPrecompoundInterface::MakeCoalescence(G4KineticTrackVector *trac
G4double MassCut = deuteron->GetPDGMass() + DeltaM; // In MeV
for ( size_t i = 0; i < tracks->size(); ++i ) { // search for protons
for ( std::size_t i = 0; i < tracks->size(); ++i ) { // search for protons
G4KineticTrack* trackP = (*tracks)[i];
if ( ! trackP ) continue;
@@ -811,7 +815,7 @@ void G4GeneratorPrecompoundInterface::MakeCoalescence(G4KineticTrackVector *trac
G4LorentzVector Prot4Mom = trackP->Get4Momentum();
G4LorentzVector ProtSPposition = G4LorentzVector(trackP->GetPosition(), trackP->GetFormationTime());
for ( size_t j = 0; j < tracks->size(); ++j ) { // search for neutron
for ( std::size_t j = 0; j < tracks->size(); ++j ) { // search for neutron
G4KineticTrack* trackN = (*tracks)[j];
if (! trackN ) continue;
@@ -837,9 +841,7 @@ void G4GeneratorPrecompoundInterface::MakeCoalescence(G4KineticTrackVector *trac
}
// Find and remove null pointers created by decays above
for ( int jj = tracks->size()-1; jj >= 0; --jj ) {
for ( G4int jj = (G4int)tracks->size()-1; jj >= 0; --jj ) {
if ( ! (*tracks)[jj] ) tracks->erase(tracks->begin()+jj);
}
}
@@ -60,13 +60,13 @@ G4double G4RKFieldIntegrator::CalculateTotalEnergy(const G4KineticTrackVector& B
const G4double GammaY = 1.4*fermi;
G4double Etot = 0;
G4int nBarion = Barions.size();
for(G4int c1 = 0; c1 < nBarion; c1++)
G4int nBarion = (G4int)Barions.size();
for(G4int c1 = 0; c1 < nBarion; ++c1)
{
G4KineticTrack* p1 = Barions.operator[](c1);
// Ekin
Etot += p1->Get4Momentum().e();
for(G4int c2 = c1 + 1; c2 < nBarion; c2++)
for(G4int c2 = c1 + 1; c2 < nBarion; ++c2)
{
G4KineticTrack* p2 = Barions.operator[](c2);
G4double r12 = (p1->GetPosition() - p2->GetPosition()).mag()*fermi;
@@ -186,7 +186,7 @@ G4double G4RKFieldIntegrator::GetExcitationEnergy(G4int nHitNucleons, const G4Ki
{
const G4double MeanE = 50;
G4double Sum = 0;
for(G4int c1 = 0; c1 < nHitNucleons; c1++)
for(G4int c1 = 0; c1 < nHitNucleons; ++c1)
{
Sum += -MeanE*G4Log(G4UniformRand());
}
@@ -198,7 +198,7 @@ G4double G4RKFieldIntegrator::GetExcitationEnergy(G4int nHitNucleons, const G4Ki
//This is free propagation of particles for CASCADE mode. Target nucleons should be frozen
void G4RKFieldIntegrator::Integrate(G4KineticTrackVector& theParticles)
{
for(G4int cParticle = 0; cParticle < theParticles.length(); cParticle++)
for(G4int cParticle = 0; cParticle < theParticles.length(); ++cParticle)
{
G4KineticTrack* pKineticTrack = theParticles.at(cParticle);
pKineticTrack->SetPosition(pKineticTrack->GetPosition() + theTimeStep*pKineticTrack->Get4Momentum().boostVector());
@@ -209,7 +209,7 @@ void G4RKFieldIntegrator::Integrate(G4KineticTrackVector& theParticles)
void G4RKFieldIntegrator::Integrate(const G4KineticTrackVector& theBarions, G4double theTimeStep)
{
for(size_t cParticle = 0; cParticle < theBarions.size(); cParticle++)
for(std::size_t cParticle = 0; cParticle < theBarions.size(); ++cParticle)
{
G4KineticTrack* pKineticTrack = theBarions[cParticle];
pKineticTrack->SetPosition(pKineticTrack->GetPosition() + theTimeStep*pKineticTrack->Get4Momentum().boostVector());