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
+24 -34
View File
@@ -28,50 +28,45 @@
// Author: H.Kurashige, 7 July 1996
// --------------------------------------------------------------------
#include "globals.hh"
#include "G4DecayTable.hh"
#include "Randomize.hh"
#include "globals.hh"
G4DecayTable::G4DecayTable()
{
channels = new G4VDecayChannelVector;
channels = new G4VDecayChannelVector;
}
G4DecayTable::~G4DecayTable()
{
// remove and delete all contents
for (const auto channel : *channels)
{
// remove and delete all contents
for (const auto channel : *channels) {
delete channel;
}
channels->clear();
delete channels;
delete channels;
channels = nullptr;
parent = nullptr;
}
}
void G4DecayTable::Insert(G4VDecayChannel* aChannel)
{
if (parent == nullptr)
{
parent = (G4ParticleDefinition*)(aChannel->GetParent());
if (parent == nullptr) {
parent = (G4ParticleDefinition*)(aChannel->GetParent());
}
if (parent != aChannel->GetParent())
{
if (parent != aChannel->GetParent()) {
#ifdef G4VERBOSE
G4cout << " G4DecayTable::Insert :: bad G4VDecayChannel (mismatch parent) "
<< " " << parent->GetParticleName()
<< " input:" << aChannel->GetParent()->GetParticleName() << G4endl;
#endif
}
else
{
else {
G4double br = aChannel->GetBR();
for (auto iCh = channels->cbegin(); iCh!= channels->cend(); ++iCh)
{
if (br > (*iCh)->GetBR())
{
channels->insert(iCh,aChannel);
for (auto iCh = channels->cbegin(); iCh != channels->cend(); ++iCh) {
if (br > (*iCh)->GetBR()) {
channels->insert(iCh, aChannel);
return;
}
}
@@ -84,16 +79,14 @@ G4VDecayChannel* G4DecayTable::SelectADecayChannel(G4double parentMass)
// check if contents exist
if (channels->empty()) return nullptr;
if(parentMass < 0.) parentMass=parent->GetPDGMass();
if (parentMass < 0.) parentMass = parent->GetPDGMass();
G4double sumBR = 0.;
for (const auto channel : *channels)
{
if ( !(channel->IsOKWithParentMass(parentMass)) ) continue;
for (const auto channel : *channels) {
if (!(channel->IsOKWithParentMass(parentMass))) continue;
sumBR += channel->GetBR();
}
if (sumBR <= 0.0)
{
if (sumBR <= 0.0) {
#ifdef G4VERBOSE
G4cout << " G4DecayTable::SelectADecayChannel :: no possible DecayChannel"
<< " " << parent->GetParticleName() << G4endl;
@@ -102,15 +95,13 @@ G4VDecayChannel* G4DecayTable::SelectADecayChannel(G4double parentMass)
}
const std::size_t MAX_LOOP = 10000;
for (std::size_t loop_counter=0; loop_counter<MAX_LOOP; ++loop_counter)
{
for (std::size_t loop_counter = 0; loop_counter < MAX_LOOP; ++loop_counter) {
G4double sum = 0.0;
G4double br= sumBR*G4UniformRand();
G4double br = sumBR * G4UniformRand();
// select decay channel
for (const auto channel : *channels)
{
for (const auto channel : *channels) {
sum += channel->GetBR();
if ( !(channel->IsOKWithParentMass(parentMass)) ) continue;
if (!(channel->IsOKWithParentMass(parentMass))) continue;
if (br < sum) return channel;
}
}
@@ -120,9 +111,8 @@ G4VDecayChannel* G4DecayTable::SelectADecayChannel(G4double parentMass)
void G4DecayTable::DumpInfo() const
{
G4cout << "G4DecayTable: " << parent->GetParticleName() << G4endl;
G4int index =0;
for (const auto channel : *channels)
{
G4int index = 0;
for (const auto channel : *channels) {
G4cout << index << ": ";
channel->DumpInfo();
index += 1;