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