Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
@@ -31,8 +31,39 @@
// by T. Koi
//
// P. Arce, Dec-2014 Conversion neutron_hp to particle_hp
// V. Ivanchenko, July-2023 Basic revision of particle HP classes
//
#include "G4ParticleHPContEnergyAngular.hh"
#include "G4HadronicException.hh"
#include "G4Neutron.hh"
G4ParticleHPContEnergyAngular::G4ParticleHPContEnergyAngular(const G4ParticleDefinition* proj)
{
theProjectile = (nullptr == proj) ? G4Neutron::Neutron() : proj;
currentMeanEnergy.Put(-2);
fCacheAngular.Put(nullptr);
}
G4ParticleHPContEnergyAngular::~G4ParticleHPContEnergyAngular()
{
delete[] theAngular;
delete fCacheAngular.Get();
}
void G4ParticleHPContEnergyAngular::Init(std::istream& aDataFile)
{
aDataFile >> theTargetCode >> theAngularRep >> theInterpolation >> nEnergy;
theAngular = new G4ParticleHPContAngularPar[nEnergy];
theManager.Init(aDataFile);
for (G4int i = 0; i < nEnergy; ++i) {
theAngular[i].Init(aDataFile, theProjectile);
theAngular[i].SetInterpolation(theInterpolation);
#ifndef PHP_AS_HP
theAngular[i].PrepareTableInterpolation();
#endif
}
}
G4ReactionProduct* G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4double massCode,
G4double /*mass*/)
@@ -40,7 +71,7 @@ G4ReactionProduct* G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4do
G4ReactionProduct* result;
G4int i(0);
G4int it(0);
for (i = 0; i < nEnergy; i++) {
for (i = 0; i < nEnergy; ++i) {
it = i;
#ifdef PHP_AS_HP
if (theAngular[i].GetEnergy() > anEnergy) break;
@@ -48,8 +79,11 @@ G4ReactionProduct* G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4do
if (theAngular[i].GetEnergy() >= anEnergy) break;
#endif
}
G4double targetMass = GetTarget()->GetMass();
/*
G4cout << "G4ParticleHPContEnergyAngular::Sample E="<<anEnergy<<" code="<< massCode<< " it=" << it
<< " M=" << targetMass << G4endl;
*/
if (it == 0) {
theAngular[0].SetTarget(GetTarget());
theAngular[0].SetTargetCode(theTargetCode);
@@ -74,6 +108,7 @@ G4ReactionProduct* G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4do
theAngular[it].SetPrimary(GetProjectileRP());
result = theAngular[it].Sample(anEnergy, massCode, targetMass, theAngularRep, theInterpolation);
currentMeanEnergy.Put(theAngular[it].MeanEnergyOfThisInteraction());
#else
if (fCacheAngular.Get() == nullptr) {
auto angpar = new G4ParticleHPContAngularPar(theProjectile);
@@ -91,27 +126,28 @@ G4ReactionProduct* G4ParticleHPContEnergyAngular::Sample(G4double anEnergy, G4do
currentMeanEnergy.Put(fCacheAngular.Get()->MeanEnergyOfThisInteraction());
#endif
} // end (it != 0) branch
//G4cout << "+!+ Emin=" << currentMeanEnergy.Get() << G4endl;
return result;
}
G4double G4ParticleHPContEnergyAngular::MeanEnergyOfThisInteraction()
{
//G4cout << "+++ Emin=" << currentMeanEnergy.Get() << G4endl;
G4double result(0);
if (currentMeanEnergy.Get() < -1) {
if (currentMeanEnergy.Get() < -1.0) {
throw G4HadronicException(__FILE__, __LINE__,
"G4ParticleHPContEnergyAngular: Logical error in Product class");
}
result = currentMeanEnergy.Get();
currentMeanEnergy.Put(-2);
currentMeanEnergy.Put(-2.0);
return result;
}
void G4ParticleHPContEnergyAngular::ClearHistories()
{
if (theAngular != nullptr) {
for (G4int i = 0; i < nEnergy; i++)
for (G4int i = 0; i < nEnergy; ++i)
theAngular[i].ClearHistories();
}