Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -211,6 +211,11 @@ G4HadFinalState * G4BinaryCascade::ApplyYourself(const G4HadProjectile & aTrack,
theParticleChange.SetStatusChange(stopAndKill);
G4ReactionProductVector::iterator iter;
G4double Efinal=0;
if (abs(theParticleChange.GetWeightChange() -1 ) > 1e-5 )
{
G4cout <<" BIC-weight change " << theParticleChange.GetWeightChange()<< G4endl;
}
for(iter = products->begin(); iter != products->end(); ++iter)
{
G4DynamicParticle * aNew =
@@ -245,6 +250,10 @@ G4HadFinalState * G4BinaryCascade::ApplyYourself(const G4HadProjectile & aTrack,
the3DNucleus = NULL; // protect from wrong usage...
if(getenv("BCDEBUG") ) G4cerr << " ######### Binary Cascade Reaction number ends ######### "<<eventcounter<<G4endl;
if (abs(theParticleChange.GetWeightChange() -1 ) > 1e-5 )
{
G4cout <<" BIC-fin-weight change " << theParticleChange.GetWeightChange()<< G4endl;
}
return &theParticleChange;
}
@@ -425,6 +434,12 @@ G4ReactionProductVector * G4BinaryCascade::Propagate(
PrintKTVector(&theFinalState,std::string(" FinalState uncorrected"));
#endif
//
CorrectFinalPandE();
#ifdef debug_G4BinaryCascade
@@ -436,41 +451,34 @@ G4ReactionProductVector * G4BinaryCascade::Propagate(
G4double ExcitationEnergy=GetExcitationEnergy();
// G4cerr <<"mon - all pushed to limit 2"<<G4endl;
//#ifdef HKM_DEBUG
// G4cout << " Excitation Energy final, Ekinout, #collisions: "
// << ExcitationEnergy << " "
// << Ekinout << " "
// << collisionCount <<G4endl;
// G4cout << " Out from casc: " << theFinalState.size() << G4endl;
//#endif
#ifdef debug_G4BinaryCascade
G4cout << " Excitation Energy final, #collisions:, out, captured "
<< ExcitationEnergy << " "
<< collisionCount << " "
<< theFinalState.size() << " "
<< theCapturedList.size()<<G4endl;
#endif
if ( ExcitationEnergy < 0. )
{
// if ( ExcitationEnergy < 0. )
{
#ifdef debug_G4BinaryCascade
G4cerr << "G4BinaryCascade-Warning: negative excitation energy ";
G4cerr <<ExcitationEnergy<<G4endl;
PrintKTVector(&theFinalState,std::string("FinalState"));
PrintKTVector(&theCapturedList,std::string("captured"));
G4cout << "negative ExE:Final 4Momentum .mag: " << GetFinal4Momentum()
<< " "<< GetFinal4Momentum().mag()<< G4endl
<< "negative ExE:FinalNucleusMom .mag: " << GetFinalNucleusMomentum()
<< " "<< GetFinalNucleusMomentum().mag()<< G4endl;
#endif
//#ifdef debug_G4BinaryCascade
// G4cerr << "G4BinaryCascade-Warning: negative excitation energy ";
// G4cerr <<ExcitationEnergy<<G4endl;
// PrintKTVector(&theFinalState,std::string("FinalState"));
// PrintKTVector(&theCapturedList,std::string("captured"));
// G4cout << "negative ExE:Final 4Momentum .mag: " << GetFinal4Momentum()
// << " "<< GetFinal4Momentum().mag()<< G4endl
// << "negative ExE:FinalNucleusMom .mag: " << GetFinalNucleusMomentum()
// << " "<< GetFinalNucleusMomentum().mag()<< G4endl;
//#endif
}
ClearAndDestroy(products);
return products; // return empty products
}
//#ifdef HKM_DEBUG
// G4cout << " Excitation Energy final, Ekinout, #collisions: "
// << ExcitationEnergy << " "
// << Ekinout << " "
// << collisionCount <<G4endl;
// G4cout << " Out from casc: " << theFinalState.size() << G4endl;
//#endif
// find a fragment and call the precompound model.
G4Fragment * fragment = 0;
@@ -808,7 +816,11 @@ void G4BinaryCascade::FindCollisions(G4KineticTrackVector * secondaries)
for(std::vector<G4KineticTrack *>::iterator i = secondaries->begin();
i != secondaries->end(); ++i)
{
for(std::vector<G4BCAction *>::iterator j = theImR.begin();
if ( (*i)->GetTrackingMomentum().mag2() < -1.*eV )
{
G4cout << "G4BinaryCascade::FindCollisions(): negative m2:" << (*i)->GetTrackingMomentum().mag2() << G4endl;
}
for(std::vector<G4BCAction *>::iterator j = theImR.begin();
j!=theImR.end(); j++)
{
const std::vector<G4CollisionInitialState *> & aCandList
@@ -1157,7 +1169,6 @@ void G4BinaryCascade::StepParticlesOut()
{
G4int counter=0;
G4int countreset=0;
G4double steplength=1.0 * fermi;
//G4cout << " nucl. Radius " << radius << G4endl;
// G4cerr <<"pre-while- theSecondaryList "<<G4endl;
while( theSecondaryList.size() > 0 )
@@ -1171,27 +1182,24 @@ void G4BinaryCascade::StepParticlesOut()
G4KineticTrack * kt = *i;
if( kt->GetState() == G4KineticTrack::inside )
{
if((kt->GetDefinition() == G4Proton::Proton()) || // @@@ GF why only for nucleons?
(kt->GetDefinition() == G4Neutron::Neutron()))
{
nsec++;
G4double tStep = steplength / ( kt->Get4Momentum().beta() * c_light );
G4double tStep(0), tdummy(0);
((G4RKPropagation*)thePropagator)->GetSphereIntersectionTimes(kt,tdummy,tStep);
#ifdef debug_G4BinaryCascade
G4cout << " minTimeStep, tStep Particle " <<minTimeStep << " " <<tStep
<< " " <<kt->GetDefinition()->GetParticleName() << " 4mom " << kt->GetTrackingMomentum()<<G4endl;
<< " " <<kt->GetDefinition()->GetParticleName()
<< " 4mom " << kt->GetTrackingMomentum()<<G4endl;
#endif
if(tStep<minTimeStep)
if(tStep<minTimeStep && tStep> 0 )
{
minTimeStep = tStep;
// G4cerr <<"Position "<<kt->GetPosition().mag()<<" "
// <<kt->GetTrackingMomentum().e()-kt->GetTrackingMomentum().mag()<<G4endl;
}
}
} else if ( kt->GetState() != G4KineticTrack::outside ){
PrintKTVector(&theSecondaryList, std::string(" state ERROR....."));
throw G4HadronicException(__FILE__, __LINE__, "G4BinaryCascade::StepParticlesOut() particle not in nucleus");
}
}
minTimeStep *= 1.2;
// G4cerr << "CaptureCount = "<<counter<<" "<<nsec<<" "<<minTimeStep<<" "<<1*ns<<G4endl;
G4double timeToCollision=DBL_MAX;
G4CollisionInitialState * nextCollision=0;
@@ -1281,11 +1289,22 @@ void G4BinaryCascade::StepParticlesOut()
void G4BinaryCascade::CorrectFinalPandE()
//----------------------------------------------------------------------------
{
if ( theFinalState.size() == 0 ) return;
#ifdef debug_G4BinaryCascade
G4cerr << " -CorrectFinalPandE 1" << G4endl;
#endif
if ( theFinalState.size() == 0 ) return;
#ifdef debug_G4BinaryCascade
G4cerr << " -CorrectFinalPandE 2" << G4endl;
#endif
G4KineticTrackVector::iterator i;
G4LorentzVector pNucleus=GetFinal4Momentum();
if ( pNucleus.e() == 0 ) return; // check against explicit 0 from GetNucleus4Momentum()
#ifdef debug_G4BinaryCascade
G4cerr << " -CorrectFinalPandE 3" << G4endl;
#endif
G4LorentzVector pFinals(0);
G4int nFinals(0);
for(i = theFinalState.begin(); i != theFinalState.end(); ++i)
@@ -1309,6 +1328,7 @@ void G4BinaryCascade::CorrectFinalPandE()
G4cout << "CorrectFinalPandE pCM, CMS pCM " << pCM << " " <<toCMS*pCM<< G4endl;
G4cout << "CorrectFinal CMS pN pF " <<toCMS*pNucleus << " "
<<pFinals << G4endl
<< " nucleus initial mass : " <<GetFinal4Momentum().mag()
<<" massInNucleus m(nucleus) m(finals) sqrt(s): " << massInNucleus << " " <<pNucleus.mag()<< " "
<< pFinals.mag() << " " << pCM.mag() << G4endl;
#endif
@@ -1316,12 +1336,23 @@ void G4BinaryCascade::CorrectFinalPandE()
G4LorentzRotation toLab = toCMS.inverse();
G4double s = pCM.mag2();
G4double m10 = massInNucleus; //pNucleus.mag();
// G4double m10 = massInNucleus; //pNucleus.mag();
G4double m10 = GetIonMass(currentZ,currentA);
G4double m20 = pFinals.mag();
if( s-(m10+m20)*(m10+m20) < 0 )
{
#ifdef debug_G4BinaryCascade
G4cout << "G4BinaryCascade::CorrectFinalPandE() : error! " << G4endl;
G4cout << "not enough mass to correct: mass, A,Z, mass(nucl), mass(finals) "
<< sqrt(-s+(m10+m20)*(m10+m20)) << " "
<< currentA << " " << currentZ << " "
<< m10 << " " << m20
<< G4endl;
G4cerr << " -CorrectFinalPandE 4" << G4endl;
PrintKTVector(&theFinalState," mass problem");
#endif
return;
}
@@ -1329,10 +1360,14 @@ void G4BinaryCascade::CorrectFinalPandE()
// Three momentum in cm system
G4double pInCM = sqrt((s-(m10+m20)*(m10+m20))*(s-(m10-m20)*(m10-m20))/(4.*s));
#ifdef debug_G4BinaryCascade
G4cout <<" CorrectFinalPandE pInCM current/new : " <<(pFinals).vect().mag() << " " <<pInCM << G4endl;
G4cout <<" CorrectFinalPandE pInCM new, CURRENT, ratio : " << pInCM
<< " " << (pFinals).vect().mag()<< " " << pInCM/(pFinals).vect().mag() << G4endl;
#endif
if ( pFinals.vect().mag() > pInCM )
{
#ifdef debug_G4BinaryCascade
G4cerr << " -CorrectFinalPandE 5" << G4endl;
#endif
G4ThreeVector p3finals=pInCM*pFinals.vect().unit();
// G4ThreeVector deltap=(p3finals - pFinals.vect() ) / nFinals;
@@ -1356,7 +1391,10 @@ void G4BinaryCascade::CorrectFinalPandE()
<< " CMS pFinals , mag, 3.mag : " << qFinals << " " << qFinals.mag() << " " << qFinals.vect().mag()<< G4endl;
#endif
}
#ifdef debug_G4BinaryCascade
else { G4cerr << " -CorrectFinalPandE 6" << G4endl; }
#endif
}
//----------------------------------------------------------------------------
@@ -1963,7 +2001,7 @@ G4LorentzVector G4BinaryCascade::GetFinalNucleusMomentum()
G4LorentzRotation nucleusBoost( -boost );
precompoundLorentzboost.set( boost );
#ifdef debug_G4BinaryCascade
G4cout << "it "<<NucleusMomentum<<" "<<CapturedMomentum<<" "<<G4endl;
G4cout << "GetFinalNucleusMomentum be4 boostNucleusMomentum, CapturedMomentum"<<NucleusMomentum<<" "<<CapturedMomentum<<" "<<G4endl;
#endif
NucleusMomentum *= nucleusBoost;
#ifdef debug_G4BinaryCascade
@@ -131,6 +131,7 @@
G4LorentzVector it;
G4FermiMomentum theFermi;
G4int tryCount(0);
while(!result)
{
projectile = new G4Fancy3DNucleus;
@@ -197,6 +198,28 @@
delete result; result=0;
delete fancyNucleus;
delete projectile;
if (++tryCount > 100)
{
// abort!!
G4cerr << "G4BinaryLightIonReaction no final state for: " << G4endl;
G4cerr << " Primary " << aTrack.GetDefinition()
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
<< "," << aTrack.GetDefinition()->GetPDGCharge() << ") "
<< ", kinetic energy " << aTrack.GetKineticEnergy()
<< G4endl;
G4cerr << " Target nucleus (A,Z)=(" << targetNucleus.GetN()
<< "," << targetNucleus.GetZ() << 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;
}
}
else
{
@@ -366,11 +389,27 @@
proFrag = theHandler.BreakItUp(aProRes);
if ( momentum.vect().mag() > momentum.e() )
{
G4cout << "mom check: " << momentum
G4cerr << "mom check: " << momentum
<< " 3.mag "<< momentum.vect().mag() << G4endl
<< " .. iState/fState/spectators " << iState <<" "
<< fState << " " << pspectators << G4endl
<< " .. A,Z " << resA <<" "<< resZ << G4endl;
G4cerr << "G4BinaryLightIonReaction no final state for: " << G4endl;
G4cerr << " Primary " << aTrack.GetDefinition()
<< ", (A,Z)=(" << aTrack.GetDefinition()->GetBaryonNumber()
<< "," << aTrack.GetDefinition()->GetPDGCharge() << ") "
<< ", kinetic energy " << aTrack.GetKineticEnergy()
<< G4endl;
G4cerr << " Target nucleus (A,Z)=(" << targetNucleus.GetN()
<< "," << targetNucleus.GetZ() << 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;
}
G4LorentzRotation boost_fragments_here(momentum.boostVector());
@@ -477,6 +516,7 @@
if(swapped)
{
tmp*=toBreit.inverse();
tmp.setVect(-tmp.vect());
}
tmp *= toLab;
aNew->Set4Momentum(tmp);
@@ -240,7 +240,7 @@ void G4RKPropagation::Init(G4V3DNucleus * nucleus)
}
//#define debug_1_RKPropagation 1
//----------------------------------------------------------------------------
void G4RKPropagation::Transport(G4KineticTrackVector & active,
//----------------------------------------------------------------------------
@@ -328,7 +328,7 @@ void G4RKPropagation::Transport(G4KineticTrackVector & active,
if(newE <= kt->GetActualMass()) // the particle cannot enter the nucleus
{
// FixMe: should be "pushed back?"
// for the moment take it past teh nucleus, so we'll not worry next time..
// for the moment take it past the nucleus, so we'll not worry next time..
FreeTransport(kt, 1.1*t_leave); // take past nucleus
kt->SetState(G4KineticTrack::miss_nucleus);
continue;
@@ -623,15 +623,15 @@ G4bool G4RKPropagation::GetSphereIntersectionTimes(const G4KineticTrack * kt,
G4double radius = theOuterRadius + 3*fermi; // "safety" of 3 fermi
G4ThreeVector speed = kt->GetTrackingMomentum().vect()/kt->GetTrackingMomentum().e(); // bost vector
G4double scalarProd = kt->GetPosition().dot(speed);
G4double speedMag = speed.mag();
G4double speedMag2 = speed.mag2();
G4double sqrtArg = scalarProd*scalarProd -
speedMag*speedMag*(kt->GetPosition().mag2()-radius*radius);
speedMag2*(kt->GetPosition().mag2()-radius*radius);
if(sqrtArg <= 0.) // particle will not intersect the sphere
{
return false;
}
t1 = (-scalarProd - sqrt(sqrtArg))/speedMag/speedMag/c_light;
t2 = (-scalarProd + sqrt(sqrtArg))/speedMag/speedMag/c_light;
t1 = (-scalarProd - sqrt(sqrtArg))/speedMag2/c_light;
t2 = (-scalarProd + sqrt(sqrtArg))/speedMag2/c_light;
return true;
}