Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
+32 -42
View File
@@ -23,24 +23,16 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4DecayTable class implementation
//
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, based on object model of
// 27 July 1996 H.Kurashige
// ----------------------------------------
// implementation for STL 14 Feb. 2000 H.Kurashige
// ------------------------------------------------------------
// Author: H.Kurashige, 7 July 1996
// --------------------------------------------------------------------
#include "globals.hh"
#include "G4DecayTable.hh"
#include "Randomize.hh"
G4DecayTable::G4DecayTable()
:parent(nullptr), channels(nullptr)
{
channels = new G4VDecayChannelVector;
}
@@ -48,8 +40,8 @@ G4DecayTable::G4DecayTable()
G4DecayTable::~G4DecayTable()
{
// remove and delete all contents
G4VDecayChannelVector::iterator iCh;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
for (auto iCh = channels->cbegin(); iCh!= channels->cend(); ++iCh)
{
delete (*iCh);
}
channels->clear();
@@ -58,43 +50,50 @@ G4DecayTable::~G4DecayTable()
parent = nullptr;
}
void G4DecayTable::Insert( G4VDecayChannel * aChannel){
if (parent == nullptr) {
void G4DecayTable::Insert(G4VDecayChannel* aChannel)
{
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();
G4VDecayChannelVector::iterator iCh;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
if (br > (*iCh)->GetBR()) {
channels->insert(iCh,aChannel);
return;
for (auto iCh = channels->cbegin(); iCh!= channels->cend(); ++iCh)
{
if (br > (*iCh)->GetBR())
{
channels->insert(iCh,aChannel);
return;
}
}
channels->push_back(aChannel);
}
}
G4VDecayChannel *G4DecayTable::SelectADecayChannel(G4double parentMass)
G4VDecayChannel* G4DecayTable::SelectADecayChannel(G4double parentMass)
{
// check if contents exist
if (channels->size()<1) return nullptr;
if(parentMass < 0.) parentMass=parent->GetPDGMass();
G4VDecayChannelVector::iterator iCh;
G4double sumBR = 0.;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
for (auto iCh = channels->cbegin(); iCh!= channels->cend(); ++iCh)
{
if ( !((*iCh)->IsOKWithParentMass(parentMass)) ) continue;
sumBR += (*iCh)->GetBR();
}
if (sumBR <= 0.0) {
if (sumBR <= 0.0)
{
#ifdef G4VERBOSE
G4cout << " G4DecayTable::SelectADecayChannel :: no possible DecayChannel"
<< " " << parent->GetParticleName() << G4endl;
@@ -102,12 +101,14 @@ G4VDecayChannel *G4DecayTable::SelectADecayChannel(G4double parentMass)
return nullptr;
}
const size_t MAX_LOOP = 10000;
for (size_t loop_counter=0; loop_counter <MAX_LOOP; ++loop_counter){
const std::size_t MAX_LOOP = 10000;
for (std::size_t loop_counter=0; loop_counter<MAX_LOOP; ++loop_counter)
{
G4double sum = 0.0;
G4double br= sumBR*G4UniformRand();
// select decay channel
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
for (auto iCh = channels->cbegin(); iCh!= channels->cend(); ++iCh)
{
sum += (*iCh)->GetBR();
if ( !((*iCh)->IsOKWithParentMass(parentMass)) ) continue;
if (br < sum) return (*iCh);
@@ -120,22 +121,11 @@ void G4DecayTable::DumpInfo() const
{
G4cout << "G4DecayTable: " << parent->GetParticleName() << G4endl;
G4int index =0;
G4VDecayChannelVector::iterator iCh;
for (iCh = channels->begin(); iCh!= channels->end(); ++iCh) {
for (auto iCh = channels->cbegin(); iCh!= channels->cend(); ++iCh)
{
G4cout << index << ": ";
(*iCh)->DumpInfo();
index += 1;
}
G4cout << G4endl;
}