Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
+53 -14
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4IonTable.cc 77085 2013-11-21 10:37:09Z gcosmo $
// $Id: G4IonTable.cc 86833 2014-11-19 08:24:49Z gcosmo $
//
//
// --------------------------------------------------------------
@@ -43,7 +43,6 @@
// New design using G4VIsotopeTable 5 Oct. 99 H.Kurashige
// Modified Element Name for Z>103 06 Apr. 01 H.Kurashige
// Remove test of cuts in SetCuts 16 Jan 03 V.Ivanchenko
// Add G4IsomerTable 5 May. 2013 H.Kurashige
#include <iostream>
#include <iomanip>
@@ -64,7 +63,6 @@
#include "G4IsotopeProperty.hh"
#include "G4VIsotopeTable.hh"
#include "G4IsomerTable.hh"
#include "G4NuclideTable.hh"
// It is very important for multithreaded Geant4 to keep only one copy of the
@@ -118,7 +116,7 @@ G4Mutex G4IonTable::ionTableMutex = G4MUTEX_INITIALIZER;
////////////////////
G4IonTable::G4IonTable()
: pIsomerTable(0),pNuclideTable(0),
: pNuclideTable(0),
isIsomerCreated(false),
n_error(0)
{
@@ -139,6 +137,9 @@ G4IonTable::G4IonTable()
{
fIsotopeTableListShadow = fIsotopeTableList;
}
PrepareNuclideTable();
RegisterIsotopeTable(pNuclideTable);
}
// This method is used by each worker thread to copy the content
@@ -327,6 +328,19 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4double E)
// Add process manager to the ion
AddProcessManager(ion);
#ifdef G4MULTITHREADED
// Fill decay channels if this method is invoked from worker
if(G4Threading::IsWorkerThread())
{
if(!stable && decayTable)
{
G4int nCh = decayTable->entries();
for(G4int iCh=0;iCh<nCh;iCh++)
{ decayTable->GetDecayChannel(iCh)->GetDaughter(0); }
}
}
#endif
return ion;
}
@@ -945,16 +959,18 @@ G4bool G4IonTable::GetNucleusByEncoding(G4int encoding,
return true;
}
#include "G4AutoDelete.hh"
/////////////////
const G4String& G4IonTable::GetIonName(G4int Z, G4int A, G4double E) const
{
static G4ThreadLocal G4String *pname = 0;
if (!pname) { pname = new G4String(""); }
if (!pname) { pname = new G4String(""); G4AutoDelete::Register(pname); }
G4String &name = *pname;
static G4ThreadLocal std::ostringstream* os = 0;
if ( ! os ) {
os = new std::ostringstream();
G4AutoDelete::Register(os);
os->setf(std::ios::fixed);
os->precision(3);
}
@@ -978,7 +994,7 @@ const G4String& G4IonTable::GetIonName(G4int Z, G4int A, G4int L, G4double E) co
{
if (L==0) return GetIonName(Z, A, E);
static G4ThreadLocal G4String *pname = 0;
if (!pname) { pname = new G4String(""); }
if (!pname) { pname = new G4String(""); G4AutoDelete::Register(pname); }
G4String &name = *pname;
name = "";
for (int i =0; i<L; i++){
@@ -992,12 +1008,13 @@ const G4String& G4IonTable::GetIonName(G4int Z, G4int A, G4int L, G4double E) co
const G4String& G4IonTable::GetIonName(G4int Z, G4int A, G4int lvl) const
{
static G4ThreadLocal G4String *pname = 0;
if (!pname) { pname = new G4String(""); }
if (!pname) { pname = new G4String(""); G4AutoDelete::Register(pname); }
G4String &name = *pname;
static G4ThreadLocal std::ostringstream* os = 0;
if ( ! os ) {
os = new std::ostringstream();
G4AutoDelete::Register(os);
os->setf(std::ios::fixed);
}
@@ -1030,7 +1047,7 @@ const G4String& G4IonTable::GetIonName(G4int Z, G4int A, G4int L, G4int lvl) con
{
if (L==0) return GetIonName(Z, A, lvl);
static G4ThreadLocal G4String *pname = 0;
if (!pname) { pname = new G4String(""); }
if (!pname) { pname = new G4String(""); G4AutoDelete::Register(pname); }
G4String &name = *pname;
for (int i =0; i<L; i++){
name +="L";
@@ -1510,17 +1527,18 @@ void G4IonTable::CreateAllIsomer()
PreloadNuclide();
}
////////////////////
void G4IonTable::PrepareNuclideTable()
{
if(pNuclideTable==0) pNuclideTable = G4NuclideTable::GetNuclideTable();
}
////////////////////
void G4IonTable::PreloadNuclide()
{
if (isIsomerCreated) return;
if ( isIsomerCreated || !G4Threading::IsMultithreadedApplication() ) return;
if (pNuclideTable==0) {
pNuclideTable = G4NuclideTable::GetNuclideTable();
pNuclideTable->GenerateNuclide();
RegisterIsotopeTable(pNuclideTable);
}
pNuclideTable->GenerateNuclide();
for ( size_t i = 0 ; i != pNuclideTable->entries() ; i++ ) {
const G4IsotopeProperty* fProperty = pNuclideTable->GetIsotopeByIndex( i );
@@ -1716,6 +1734,27 @@ G4ParticleDefinition* G4IonTable::FindIonInMaster(G4int Z, G4int A, G4int L, G4i
}
////////////////////
G4double G4IonTable::GetLifeTime(const G4ParticleDefinition* particle) const
{
if(!(particle->IsGeneralIon())) return particle->GetPDGLifeTime();
const G4Ions* ion = static_cast<const G4Ions*>(particle);
G4int Z = ion->GetAtomicNumber();
G4int A = ion->GetAtomicMass();
G4double E = ion->GetExcitationEnergy();
if(!pNuclideTable)
{
G4Exception("G4IonTable::GetLifeTime()","ParticleIon1001",FatalException,
"Method is invoked before G4IonTable is initialized.");
return 0.;
} else {
G4IsotopeProperty* isoP = pNuclideTable->GetIsotope(Z,A,E);
if(!isoP) return -1001.0;
return isoP->GetLifeTime();
}
}