Import Geant4 11.0.2 source tree

This commit is contained in:
Gabriele Cosmo
2022-05-25 15:50:57 +02:00
parent de4f28d823
commit b3bf75a2a1
341 changed files with 93127 additions and 39343 deletions
@@ -33,101 +33,106 @@
//
#include "G4ParticleHPContEnergyAngular.hh"
G4ReactionProduct * G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4double massCode, G4double /*mass*/)
G4ReactionProduct*
G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4double massCode,
G4double /*mass*/)
{
G4ReactionProduct * result;
G4int i(0);
G4int it(0);
for(i=0;i<nEnergy;i++)
{
it = i;
G4ReactionProduct* result;
G4int i(0);
G4int it(0);
for (i = 0; i < nEnergy; i++) {
it = i;
#ifdef PHP_AS_HP
if(theAngular[i].GetEnergy()>anEnergy) break;
if(theAngular[i].GetEnergy() > anEnergy) break;
#else
if(theAngular[i].GetEnergy()>=anEnergy) break;
if(theAngular[i].GetEnergy() >= anEnergy) break;
#endif
}
if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular dataE " << theAngular[i].GetEnergy() << " > " << anEnergy << " it_theAngular " << it << " interpolation " << theInterpolation << G4endl; //GDEB
G4double targetMass = GetTarget()->GetMass();
if(it==0)
{
theAngular[0].SetTarget(GetTarget());
theAngular[0].SetTargetCode(theTargetCode);
theAngular[0].SetPrimary(GetProjectileRP());
result = theAngular[0].Sample(anEnergy, massCode, targetMass,
}
if (std::getenv("G4PHPTEST") )
G4cout << i << " G4ParticleHPContEnergyAngular dataE "
<< theAngular[i].GetEnergy()
<< " > " << anEnergy << " it_theAngular " << it << " interpolation "
<< theInterpolation << G4endl; //GDEB
G4double targetMass = GetTarget()->GetMass();
if (it == 0) {
theAngular[0].SetTarget(GetTarget());
theAngular[0].SetTargetCode(theTargetCode);
theAngular[0].SetPrimary(GetProjectileRP());
result = theAngular[0].Sample(anEnergy, massCode, targetMass,
theAngularRep, theInterpolation);
currentMeanEnergy.Put( theAngular[0].MeanEnergyOfThisInteraction() );
}
else
{
currentMeanEnergy.Put(theAngular[0].MeanEnergyOfThisInteraction() );
} else {
// interpolation through alternating sampling. This needs improvement @@@
// This is the cause of the He3 problem !!!!!!!!
// See to it, if you can improve this.
//080714 TK commnet Randomizing use angular distribution
//080714 TK Always use the upper side distribution. enabling ClearHistories method.
//G4double random = G4UniformRand();
//G4double deltaE = theAngular[it].GetEnergy()-theAngular[it-1].GetEnergy();
//G4double offset = theAngular[it].GetEnergy()-anEnergy;
//if(random<offset/deltaE) it--;
//--- create new
// if( theManager.GetScheme(0) != LINLIN ) { // asserted in G4ParticleHPContEnergyAngular::init there is only one range
// if (theManager.GetScheme(0) != LINLIN) {
// // asserted in G4ParticleHPContEnergyAngular::init there is only one range
#ifdef PHP_AS_HP
theAngular[it].SetTarget(GetTarget());
theAngular[it].SetTargetCode(theTargetCode);
theAngular[it].SetPrimary(GetProjectileRP());
result = theAngular[it].Sample(anEnergy, massCode, targetMass,
theAngular[it].SetTarget(GetTarget());
theAngular[it].SetTargetCode(theTargetCode);
theAngular[it].SetPrimary(GetProjectileRP());
result = theAngular[it].Sample(anEnergy, massCode, targetMass,
theAngularRep, theInterpolation);
currentMeanEnergy.Put( theAngular[it].MeanEnergyOfThisInteraction() );
currentMeanEnergy.Put(theAngular[it].MeanEnergyOfThisInteraction() );
#else
if( std::getenv("G4PHPTEST") ) G4cout << i << " G4ParticleHPContEnergyAngular To BUILDBYINTERPOLATION " << it << " : " << theAngular[it].GetEnergy()<< " , " << theAngular[it].GetNEnergies() << " " << it-1 << " : " << theAngular[it-1].GetEnergy()<< " : " << theAngular[it-1].GetNEnergies() << G4endl; //GDEB
if (std::getenv("G4PHPTEST") )
G4cout << i << " G4ParticleHPContEnergyAngular To BUILDBYINTERPOLATION "
<< it << " : " << theAngular[it].GetEnergy()<< " , "
<< theAngular[it].GetNEnergies() << " " << it-1 << " : "
<< theAngular[it-1].GetEnergy()<< " : "
<< theAngular[it-1].GetNEnergies() << G4endl; //GDEB
// G4ParticleHPContAngularPar * fAngular = new G4ParticleHPContAngularPar(theProjectile ); //fix start
if (fCacheAngular.Get() == NULL) {
G4ParticleHPContAngularPar* angpar = new G4ParticleHPContAngularPar(theProjectile);
fCacheAngular.Put(angpar);
}
fCacheAngular.Get()->SetInterpolation(theInterpolation);
fCacheAngular.Get()->BuildByInterpolation( anEnergy, theManager.GetScheme(0), (theAngular[it-1]), (theAngular[it]) );
fCacheAngular.Get()->SetTarget(GetTarget());
fCacheAngular.Get()->SetTargetCode(theTargetCode);
fCacheAngular.Get()->SetPrimary(GetProjectileRP());
result = fCacheAngular.Get()->Sample(anEnergy, massCode, targetMass,
theAngularRep, theInterpolation);
currentMeanEnergy.Put( fCacheAngular.Get()->MeanEnergyOfThisInteraction() );
fCacheAngular.Get()->ClearHistories();
// delete fAngular; //fix end
if (fCacheAngular.Get() == NULL) {
G4ParticleHPContAngularPar* angpar = new G4ParticleHPContAngularPar(theProjectile);
fCacheAngular.Put(angpar);
}
fCacheAngular.Get()->SetInterpolation(theInterpolation);
fCacheAngular.Get()->BuildByInterpolation(anEnergy, theManager.GetScheme(0),
(theAngular[it-1]), (theAngular[it]) );
fCacheAngular.Get()->SetTarget(GetTarget());
fCacheAngular.Get()->SetTargetCode(theTargetCode);
fCacheAngular.Get()->SetPrimary(GetProjectileRP());
result = fCacheAngular.Get()->Sample(anEnergy, massCode, targetMass,
theAngularRep, theInterpolation);
currentMeanEnergy.Put(fCacheAngular.Get()->MeanEnergyOfThisInteraction() );
#endif
}
} // end (it != 0) branch
// G4cout << " 0 0 @@@ G4ParticleHPContEnergyAngular::Sample " << result->GetDefinition()->GetParticleName() << " E= " << result->GetKineticEnergy() << G4endl;//GDEB
return result;
return result;
}
G4double G4ParticleHPContEnergyAngular::
MeanEnergyOfThisInteraction()
G4double G4ParticleHPContEnergyAngular::MeanEnergyOfThisInteraction()
{
G4double result(0);
if(currentMeanEnergy.Get()<-1)
{
throw G4HadronicException(__FILE__, __LINE__, "G4ParticleHPContEnergyAngular: Logical error in Product class");
}
else
{
result = currentMeanEnergy.Get();
}
currentMeanEnergy.Put( -2 );
return result;
G4double result(0);
if (currentMeanEnergy.Get() < -1) {
throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPContEnergyAngular: Logical error in Product class");
} else {
result = currentMeanEnergy.Get();
}
currentMeanEnergy.Put(-2);
return result;
}
void G4ParticleHPContEnergyAngular::ClearHistories()
{
if ( theAngular!= NULL )
{
for ( G4int i = 0 ; i< nEnergy ; i++ )
theAngular[i].ClearHistories();
}
if (theAngular!= NULL) {
for (G4int i = 0; i < nEnergy; i++) theAngular[i].ClearHistories();
}
// Added fCacheAngular ClearHistories() - this is the one actually used!
// Maybe theAngular does not even need ClearHistories()?
if (fCacheAngular.Get() != 0) fCacheAngular.Get()->ClearHistories();
}