Import Geant4 10.1.0 source tree
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DecayTableMessenger.cc 67971 2013-03-13 10:13:24Z gcosmo $
|
||||
// $Id: G4DecayTableMessenger.cc 81373 2014-05-27 13:06:32Z gcosmo $
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------
|
||||
@@ -56,7 +56,10 @@
|
||||
#include <iomanip> // Include from 'system'
|
||||
|
||||
G4DecayTableMessenger::G4DecayTableMessenger(G4ParticleTable* pTable)
|
||||
:theParticleTable(pTable)
|
||||
:theParticleTable(pTable),
|
||||
currentParticle(0), currentDecayTable(0),
|
||||
idxCurrentChannel(-1), currentChannel(0),
|
||||
thisDirectory(0),dumpCmd(0),selectCmd(0),brCmd(0)
|
||||
{
|
||||
if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4DynamicParticle.cc 72152 2013-07-11 12:49:58Z gcosmo $
|
||||
// $Id: G4DynamicParticle.cc 81373 2014-05-27 13:06:32Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -117,6 +117,28 @@ G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefin
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////
|
||||
G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
|
||||
const G4ThreeVector& aMomentumDirection,
|
||||
G4double aKineticEnergy,
|
||||
const G4double dynamicalMass):
|
||||
theMomentumDirection(aMomentumDirection),
|
||||
theParticleDefinition(aParticleDefinition),
|
||||
theKineticEnergy(aKineticEnergy),
|
||||
theProperTime(0.0),
|
||||
theDynamicalMass(dynamicalMass),
|
||||
theDynamicalCharge(aParticleDefinition->GetPDGCharge()),
|
||||
theDynamicalSpin(aParticleDefinition->GetPDGSpin()),
|
||||
theDynamicalMagneticMoment(aParticleDefinition->GetPDGMagneticMoment()),
|
||||
theElectronOccupancy(0),
|
||||
thePreAssignedDecayProducts(0),
|
||||
thePreAssignedDecayTime(-1.0),
|
||||
verboseLevel(1),
|
||||
primaryParticle(0),
|
||||
thePDGcode(0)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////
|
||||
G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
|
||||
const G4ThreeVector& aParticleMomentum):
|
||||
@@ -137,6 +159,7 @@ G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefin
|
||||
SetMomentum(aParticleMomentum); // 3-dim momentum is given
|
||||
}
|
||||
|
||||
|
||||
////////////////////
|
||||
G4DynamicParticle::G4DynamicParticle(const G4ParticleDefinition * aParticleDefinition,
|
||||
const G4LorentzVector &aParticleMomentum):
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ElectronOccupancy.cc 67971 2013-03-13 10:13:24Z gcosmo $
|
||||
// $Id: G4ElectronOccupancy.cc 79357 2014-02-25 10:06:54Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -38,6 +38,7 @@
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
#include "G4ElectronOccupancy.hh"
|
||||
#include <sstream>
|
||||
|
||||
G4ThreadLocal G4Allocator<G4ElectronOccupancy> *aElectronOccupancyAllocator = 0;
|
||||
|
||||
@@ -131,3 +132,42 @@ void G4ElectronOccupancy::DumpInfo() const
|
||||
<< theOccupancies[index] << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
G4int G4ElectronOccupancy::AddElectron(G4int orbit, G4int number)
|
||||
{
|
||||
G4int value =0;
|
||||
if (orbit>=theSizeOfOrbit){
|
||||
std::ostringstream smsg;
|
||||
smsg<< "Orbit (" << orbit
|
||||
<<") exceeds the maximum("
|
||||
<<theSizeOfOrbit-1<<") ";
|
||||
G4String msg = smsg.str();
|
||||
G4Exception("G4ElectronOccupancy::AddElectron()","PART131",
|
||||
JustWarning, msg);
|
||||
} else if (orbit >=0) {
|
||||
theOccupancies[orbit] += number;
|
||||
theTotalOccupancy += number;
|
||||
value = number;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
G4int G4ElectronOccupancy::RemoveElectron(G4int orbit, G4int number)
|
||||
{
|
||||
G4int value =0;
|
||||
if (orbit>=theSizeOfOrbit){
|
||||
std::ostringstream smsg;
|
||||
smsg<< "Orbit (" << orbit
|
||||
<<") exceeds the maximum("
|
||||
<<theSizeOfOrbit-1 <<") ";
|
||||
G4String msg = smsg.str();
|
||||
G4Exception("G4ElectronOccupancy::RemoveElectron()","PART131",
|
||||
JustWarning, msg);
|
||||
} else if (orbit >=0) {
|
||||
if ( theOccupancies[orbit] < number ) number = theOccupancies[orbit];
|
||||
theOccupancies[orbit] -= number;
|
||||
theTotalOccupancy -= number;
|
||||
value = number;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,230 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
// MODULE: G4IsomerTable.cc
|
||||
//
|
||||
// Date: 5/05/13
|
||||
// Author: H.Kurashige
|
||||
//
|
||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
//
|
||||
// HISTORY
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
#include "G4IsomerTable.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "globals.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
const G4double G4IsomerTable::levelTolerance = 1.0*keV;
|
||||
// torelance for excitation energy
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
G4IsomerTable::G4IsomerTable()
|
||||
:G4VIsotopeTable("Isomer"),
|
||||
fIsotopeList(0)
|
||||
{
|
||||
SetVerboseLevel(G4ParticleTable::GetParticleTable()->GetVerboseLevel());
|
||||
FillIsotopeList();
|
||||
return;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void G4IsomerTable::FillIsotopeList()
|
||||
{
|
||||
if(fIsotopeList !=0) return;
|
||||
|
||||
fIsotopeList = new G4IsotopeList();
|
||||
fIsotopeList->reserve(nEntries);
|
||||
|
||||
for (size_t i=0; i<nEntries; i++) {
|
||||
G4int pid = (G4int)(isomerTable[i][idxPID]);
|
||||
G4int ionZ = pid/10000;
|
||||
G4int ionA = (pid-ionZ*10000)/10;
|
||||
G4int lvl = pid%10;
|
||||
G4double ionE = isomerTable[i][idxEnergy]*keV;
|
||||
G4double ionLife = isomerTable[i][idxLife]*ns;
|
||||
G4int ionJ = (G4int)(isomerTable[i][idxSpin]);
|
||||
G4double ionMu = isomerTable[i][idxMu]*(joule/tesla);
|
||||
|
||||
G4IsotopeProperty* fProperty = new G4IsotopeProperty();
|
||||
// Set Isotope Property
|
||||
fProperty->SetAtomicNumber(ionZ);
|
||||
fProperty->SetAtomicMass(ionA);
|
||||
fProperty->SetIsomerLevel(lvl);
|
||||
fProperty->SetEnergy(ionE);
|
||||
fProperty->SetiSpin(ionJ);
|
||||
fProperty->SetLifeTime(ionLife);
|
||||
fProperty->SetDecayTable(0);
|
||||
fProperty->SetMagneticMoment(ionMu);
|
||||
|
||||
fIsotopeList->push_back(fProperty);
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
G4IsomerTable::~G4IsomerTable()
|
||||
{
|
||||
if (fIsotopeList!=0) {
|
||||
for (size_t i = 0 ; i<fIsotopeList->size(); i++) {
|
||||
delete (*fIsotopeList)[i];
|
||||
}
|
||||
fIsotopeList->clear();
|
||||
delete fIsotopeList;
|
||||
fIsotopeList = 0;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
G4IsomerTable::G4IsomerTable(const G4IsomerTable & right)
|
||||
:G4VIsotopeTable(right),
|
||||
fIsotopeList(0)
|
||||
{
|
||||
FillIsotopeList();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
G4IsomerTable & G4IsomerTable::operator= (const G4IsomerTable &)
|
||||
{
|
||||
FillIsotopeList();
|
||||
return *this;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4IsotopeProperty* G4IsomerTable::GetIsotope(G4int Z, G4int A, G4double E)
|
||||
{
|
||||
G4IsotopeProperty* fProperty = 0;
|
||||
if ((Z<MinZ)||(Z>MaxZ)||(A>MaxA)) return fProperty; // not found
|
||||
|
||||
G4int low = 0;
|
||||
G4int high = entries() -1;
|
||||
G4int ptr = (low+high)/2;
|
||||
|
||||
// find Z
|
||||
G4int zptr = (*fIsotopeList)[ptr]->GetAtomicNumber();
|
||||
while ( high-low > 1){
|
||||
if (zptr == Z){
|
||||
while ((zptr == Z)&&(ptr>0)) {
|
||||
ptr -= 1;
|
||||
zptr = (*fIsotopeList)[ptr]->GetAtomicNumber();
|
||||
}
|
||||
if (ptr!=0) ptr += 1;
|
||||
break;
|
||||
} else if (zptr >Z) {
|
||||
high = ptr;
|
||||
ptr = (low+high)/2;
|
||||
} else {
|
||||
low = ptr;
|
||||
ptr = (low+high)/2;
|
||||
}
|
||||
zptr = (*fIsotopeList)[ptr]->GetAtomicNumber();
|
||||
}
|
||||
if ( Z == (*fIsotopeList)[low]->GetAtomicNumber()) ptr =low;
|
||||
else if ( Z != zptr ) return fProperty; // not found
|
||||
|
||||
// find A
|
||||
G4int aptr = (*fIsotopeList)[ptr]->GetAtomicMass();
|
||||
while ( (aptr<A) && (ptr+1<(G4int)(entries())) ) {
|
||||
ptr +=1;
|
||||
aptr = (*fIsotopeList)[ptr]->GetAtomicMass();
|
||||
if (Z != (*fIsotopeList)[ptr]->GetAtomicNumber()) break;
|
||||
}
|
||||
if ( aptr != A) return fProperty; // not found
|
||||
|
||||
// find E
|
||||
G4double ptrE = (*fIsotopeList)[ptr]->GetEnergy();
|
||||
while ( (ptrE < E-levelTolerance ) && (ptr+1<(G4int)(entries())) ){
|
||||
ptr +=1;
|
||||
ptrE = (*fIsotopeList)[ptr]->GetEnergy();
|
||||
if (A != (*fIsotopeList)[ptr]->GetAtomicMass()) return fProperty; // not found
|
||||
}
|
||||
if (ptrE > E+levelTolerance) return fProperty; // not found
|
||||
|
||||
// FOUND !!
|
||||
fProperty = (*fIsotopeList)[ptr];
|
||||
|
||||
return fProperty;
|
||||
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
G4IsotopeProperty*
|
||||
G4IsomerTable::GetIsotopeByIsoLvl(G4int Z, G4int A, G4int lvl)
|
||||
{
|
||||
G4IsotopeProperty* fProperty = 0;
|
||||
if ((Z<MinZ)||(Z>MaxZ)||(A>MaxA)) return fProperty; // not found
|
||||
|
||||
G4int low = 0;
|
||||
G4int high = entries() -1;
|
||||
G4int ptr = (low+high)/2;
|
||||
|
||||
|
||||
// find PID
|
||||
const G4int PID = 10000*Z +10*A + lvl;
|
||||
G4int id = (fIsotopeList->at(ptr))->GetAtomicNumber() *10000
|
||||
+ (fIsotopeList->at(ptr))->GetAtomicMass() *10
|
||||
+ (fIsotopeList->at(ptr))->GetIsomerLevel();
|
||||
while ( high-low > 1){
|
||||
if (id == PID){
|
||||
break;
|
||||
} else if (id >PID) {
|
||||
high = ptr;
|
||||
ptr = (low+high)/2;
|
||||
} else {
|
||||
low = ptr;
|
||||
ptr = (low+high)/2;
|
||||
}
|
||||
id = (fIsotopeList->at(ptr))->GetAtomicNumber() *10000
|
||||
+ (fIsotopeList->at(ptr))->GetAtomicMass() *10
|
||||
+ (fIsotopeList->at(ptr))->GetIsomerLevel();
|
||||
}
|
||||
|
||||
if (id == PID) {
|
||||
fProperty = (*fIsotopeList)[ptr];
|
||||
} else {
|
||||
id = (fIsotopeList->at(low))->GetAtomicNumber() *10000
|
||||
+ (fIsotopeList->at(low))->GetAtomicMass() *10
|
||||
+ (fIsotopeList->at(low))->GetIsomerLevel();
|
||||
if (id == PID) {
|
||||
fProperty = (*fIsotopeList)[low];
|
||||
} else {
|
||||
id = (fIsotopeList->at(high))->GetAtomicNumber() *10000
|
||||
+ (fIsotopeList->at(high))->GetAtomicMass() *10
|
||||
+ (fIsotopeList->at(high))->GetIsomerLevel();
|
||||
if (id == PID) fProperty = (*fIsotopeList)[high];
|
||||
}
|
||||
}
|
||||
return fProperty;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -64,7 +64,7 @@ G4NuclideTable::G4NuclideTable()
|
||||
fUserDefinedList(NULL),
|
||||
fIsotopeList(0)
|
||||
{
|
||||
SetVerboseLevel(G4ParticleTable::GetParticleTable()->GetVerboseLevel());
|
||||
//SetVerboseLevel(G4ParticleTable::GetParticleTable()->GetVerboseLevel());
|
||||
FillHardCodeList();
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ void G4NuclideTable::GenerateNuclide()
|
||||
G4int ionJ = (G4int)(exciteStateTable[i][idxSpin]);
|
||||
G4double ionMu = exciteStateTable[i][idxMu]*(joule/tesla);
|
||||
|
||||
if (( ionLife < 0.0 || ionLife > threshold_of_half_life )
|
||||
if (( ionLife < 0.0 || ionLife*ionLife*std::log(2.0) > threshold_of_half_life )
|
||||
&& (ionE > levelTolerance+previousE)) {
|
||||
previousE = ionE;
|
||||
iLevel++;
|
||||
@@ -410,6 +410,7 @@ void G4NuclideTable::GenerateNuclide()
|
||||
if ( !path ) {
|
||||
G4Exception("G4NuclideTable", "PART70000",
|
||||
FatalException, "G4ENSDFSTATEDATA environment variable must be set");
|
||||
return;
|
||||
}
|
||||
|
||||
std::fstream ifs;
|
||||
@@ -421,6 +422,7 @@ void G4NuclideTable::GenerateNuclide()
|
||||
if ( !ifs.good() ) {
|
||||
G4Exception("G4NuclideTable", "PART70001",
|
||||
FatalException, "ENSDFSTATE.dat is not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -277,6 +277,7 @@ const G4double G4NuclideTable::groundStateTable[G4NuclideTable::nEntries_ground_
|
||||
{ 17, 32, 0, 4.299231e+08, 0, 0}, // 32CL
|
||||
{ 17, 33, 0, 3.622607e+09, 3, 3.812245e-27}, // 33CL
|
||||
{ 17, 34, 0, 2.202418e+09, 0, 0}, // 34CL
|
||||
{ 17, 35, 0, -1, 0, 0}, // 35CL
|
||||
{ 17, 36, 0, 1.371758e+22, 4, 6.491623e-27}, // 36CL
|
||||
{ 17, 37, 0, -1, 3, 3.45482418e-27}, // 37CL
|
||||
{ 17, 38, 0, 3.223558e+12, 4, 1.03525e-26}, // 38CL
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleDefinition.cc 73598 2013-09-02 09:18:28Z gcosmo $
|
||||
// $Id: G4ParticleDefinition.cc 79342 2014-02-24 11:42:42Z gcosmo $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "G4DecayTable.hh"
|
||||
#include "G4PDGCodeChecker.hh"
|
||||
#include "G4StateManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
// This static member is thread local. For each thread, it holds the array
|
||||
// size of G4PDefData instances.
|
||||
@@ -308,6 +309,14 @@ G4int G4ParticleDefinition::FillQuarkContents()
|
||||
return temp;
|
||||
}
|
||||
|
||||
G4double G4ParticleDefinition::GetIonLifeTime() const
|
||||
{
|
||||
if(!isGeneralIon) return thePDGLifeTime;
|
||||
|
||||
G4IonTable* ionTable = G4IonTable::GetIonTable();
|
||||
return ionTable->GetLifeTime(this);
|
||||
}
|
||||
|
||||
void G4ParticleDefinition::DumpTable() const
|
||||
{
|
||||
G4cout << G4endl;
|
||||
@@ -354,16 +363,31 @@ void G4ParticleDefinition::DumpTable() const
|
||||
G4cout << " ShortLived : ON" << G4endl;
|
||||
}
|
||||
|
||||
if ( thePDGStable ){
|
||||
G4cout << " Stable : stable" << G4endl;
|
||||
} else {
|
||||
if( theDecayTable != 0 ){
|
||||
theDecayTable->DumpInfo();
|
||||
} else {
|
||||
G4cout << "Decay Table is not defined !!" <<G4endl;
|
||||
if ( IsGeneralIon() ) {
|
||||
G4double lftm = GetIonLifeTime();
|
||||
if(lftm<-1000.)
|
||||
{ G4cout << " Stable : No data found -- unknown" << G4endl; }
|
||||
else if(lftm<0.)
|
||||
{ G4cout << " Stable : stable" << G4endl; }
|
||||
else
|
||||
{
|
||||
G4cout << " Stable : unstable -- lifetime = " << G4BestUnit(lftm,"Time")
|
||||
<< "\n Decay table should be consulted to G4RadioactiveDecayProcess."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( thePDGStable ){
|
||||
G4cout << " Stable : stable" << G4endl;
|
||||
} else {
|
||||
if( theDecayTable != 0 ){
|
||||
theDecayTable->DumpInfo();
|
||||
} else {
|
||||
G4cout << "Decay Table is not defined !!" <<G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void G4ParticleDefinition::SetApplyCutsFlag(G4bool flg)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ParticleTable.cc 77085 2013-11-21 10:37:09Z gcosmo $
|
||||
// $Id: G4ParticleTable.cc 86781 2014-11-18 08:40:18Z gcosmo $
|
||||
//
|
||||
// class G4ParticleTable
|
||||
//
|
||||
@@ -46,6 +46,7 @@
|
||||
// implement new version for using STL map instaed of
|
||||
// RW PtrHashedDictionary 28 Oct., 99 H.Kurashige
|
||||
// remove G4ShortLivedTable 25 July, 13 H.Kurashige
|
||||
// remove FindIon/GetIon 25 Sep. 14 H.Kurashige
|
||||
//
|
||||
|
||||
#include "globals.hh"
|
||||
@@ -295,7 +296,7 @@ void G4ParticleTable::DeleteAllParticles()
|
||||
|
||||
// delete all particles
|
||||
G4PTblDicIterator *piter = fIterator;
|
||||
piter -> reset();
|
||||
piter -> reset(false);
|
||||
while( (*piter)() ){
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>2){
|
||||
@@ -468,83 +469,6 @@ G4ParticleDefinition* G4ParticleTable::Remove(G4ParticleDefinition* particle)
|
||||
return particle;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// NOTE ::
|
||||
// Following FindIon/GetIon methods will be removed in future relases
|
||||
// Use FindIon/GetIon methods of G4IonTable instead
|
||||
//
|
||||
////////////////////
|
||||
G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4int , G4int )
|
||||
{
|
||||
G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
|
||||
"This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
|
||||
CheckReadiness();
|
||||
if (Z<=0) return 0;
|
||||
if (A<Z) return 0;
|
||||
return fIonTable->GetIon(Z, A);
|
||||
}
|
||||
|
||||
////////////////////
|
||||
G4ParticleDefinition* G4ParticleTable::GetIon(G4int Z, G4int A, G4double E)
|
||||
{
|
||||
G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
|
||||
"This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
|
||||
CheckReadiness();
|
||||
if (Z<=0) return 0;
|
||||
if (A<Z) return 0;
|
||||
if (E<0.) return 0;
|
||||
return fIonTable->GetIon(Z, A, E);
|
||||
}
|
||||
|
||||
////////////////////
|
||||
G4ParticleDefinition* G4ParticleTable::GetIon(G4int Z, G4int A, G4int L, G4double E)
|
||||
{
|
||||
G4Exception("G4ParticleTable::GetIon()","PART11117",JustWarning,
|
||||
"This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
|
||||
CheckReadiness();
|
||||
if (Z<=0) return 0;
|
||||
if (A-L<Z) return 0;
|
||||
if (L<0) return 0;
|
||||
if (E<0.) return 0;
|
||||
return fIonTable->GetIon(Z, A, L, E);
|
||||
}
|
||||
|
||||
G4ParticleDefinition* G4ParticleTable::GetIon(G4int Z, G4int A, G4int level)
|
||||
{
|
||||
G4Exception("G4ParticleTable::GetIon()","PART11117",JustWarning,
|
||||
"This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
|
||||
CheckReadiness();
|
||||
if (Z <= 0) return 0;
|
||||
if (A < Z) return 0;
|
||||
if (level < 0) return 0;
|
||||
return fIonTable->GetIon(Z, A, level);
|
||||
}
|
||||
|
||||
////////////////////
|
||||
G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4double E)
|
||||
{
|
||||
G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
|
||||
"This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
|
||||
CheckReadiness();
|
||||
if (Z<=0) return 0;
|
||||
if (A<Z) return 0;
|
||||
if (E<0.) return 0;
|
||||
return fIonTable->FindIon(Z, A, E);
|
||||
}
|
||||
|
||||
////////////////////
|
||||
G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4int L, G4double E)
|
||||
{
|
||||
G4Exception("G4ParticleTable::FindIon()","PART11117",JustWarning,
|
||||
"This method is obsolete and will be dropped from v10.0. Use G4IonTable::FindIon().");
|
||||
CheckReadiness();
|
||||
if (Z<=0) return 0;
|
||||
if (A-L<Z) return 0;
|
||||
if (L<0) return 0;
|
||||
if (E<0.) return 0;
|
||||
return fIonTable->FindIon(Z, A, L, E);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////
|
||||
G4ParticleDefinition* G4ParticleTable::GetParticle(G4int index) const
|
||||
@@ -552,7 +476,7 @@ G4ParticleDefinition* G4ParticleTable::GetParticle(G4int index) const
|
||||
CheckReadiness();
|
||||
if ( (index >=0) && (index < entries()) ) {
|
||||
G4PTblDicIterator *piter = fIterator;
|
||||
piter -> reset();
|
||||
piter -> reset(false);
|
||||
G4int counter = 0;
|
||||
while( (*piter)() ){
|
||||
if ( counter == index ) return piter->value();
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
#include "G4ParticlesWorkspace.hh"
|
||||
|
||||
//Note: G4ParticlesWorkspacePool is typedef to G4TWorkspacePool<G4ParticlesWorkspace>
|
||||
template<> G4ThreadLocal G4ParticlesWorkspace* G4ParticlesWorkspace::pool_type::fMyWorkspace = 0;
|
||||
|
||||
namespace {
|
||||
G4ParticlesWorkspace::pool_type thePool;
|
||||
}
|
||||
|
||||
G4ParticlesWorkspace::pool_type*
|
||||
G4ParticlesWorkspace::GetPool() { return &thePool; }
|
||||
|
||||
G4ParticlesWorkspace::G4ParticlesWorkspace(G4bool verbose)
|
||||
: fVerbose(verbose)
|
||||
{
|
||||
fpPDefSIM =
|
||||
&const_cast<G4PDefManager&>(G4ParticleDefinition::GetSubInstanceManager());
|
||||
|
||||
// Copy information from master into PolyCone/Gon Sides in this thread.
|
||||
InitialiseWorkspace();
|
||||
|
||||
// Capture its address of ParticleDefinition split-class in this thread
|
||||
fpPDefOffset = fpPDefSIM->GetOffset();
|
||||
}
|
||||
|
||||
G4ParticlesWorkspace::~G4ParticlesWorkspace()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Static methods
|
||||
// For with current (original) G4WorkerThread -- which uses static methods
|
||||
|
||||
void
|
||||
G4ParticlesWorkspace::UseWorkspace()
|
||||
{
|
||||
if( fVerbose )
|
||||
G4cout << "G4ParticlesWorkspace::UseWorkspace: Copying particles-definition Split-Class - Start " << G4endl;
|
||||
|
||||
// Implementation copied from G4WorkerThread::BuildGeometryAndPhysicsVector()
|
||||
|
||||
//Geometry related, split classes mechanism: instantiate sub-instance for this thread
|
||||
fpPDefSIM->UseWorkArea(fpPDefOffset);
|
||||
}
|
||||
|
||||
|
||||
void G4ParticlesWorkspace::ReleaseWorkspace()
|
||||
// The opposite of Use Workspace - let go of it.
|
||||
{
|
||||
fpPDefSIM->UseWorkArea(0);
|
||||
}
|
||||
|
||||
void G4ParticlesWorkspace::InitialiseParticles()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
G4ParticlesWorkspace::InitialiseWorkspace()
|
||||
{
|
||||
if( fVerbose )
|
||||
G4cout << "G4ParticlesWorkspace::InitialiseWorkspace: "
|
||||
<< "Copying particles-definition Split-Class - Start " << G4endl;
|
||||
|
||||
//Particles related, split classes mechanism:
|
||||
// Do *NOT* instantiate sub-instance for this thread,
|
||||
// just copy the contents !!
|
||||
fpPDefSIM->NewSubInstances();
|
||||
|
||||
// Additional initialization if needed - beyond copying memory
|
||||
InitialiseParticles();
|
||||
|
||||
if( fVerbose )
|
||||
G4cout << "G4ParticlesWorkspace::CreateAndUseWorkspace: "
|
||||
<< "Copying particles-definition Split-Class - Done!" << G4endl;
|
||||
}
|
||||
|
||||
void G4ParticlesWorkspace::DestroyWorkspace()
|
||||
{
|
||||
fpPDefSIM->FreeSlave();
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhaseSpaceDecayChannel.cc 74261 2013-10-02 14:36:19Z gcosmo $
|
||||
// $Id: G4PhaseSpaceDecayChannel.cc 82335 2014-06-16 10:00:42Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -158,11 +158,13 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::TwoBodyDecayIt()
|
||||
// parent mass
|
||||
G4double parentmass = current_parent_mass;
|
||||
|
||||
//daughters'mass
|
||||
G4double daughtermass[2];
|
||||
//daughters'mass, width
|
||||
G4double daughtermass[2], daughterwidth[2];
|
||||
G4double daughtermomentum;
|
||||
daughtermass[0] = G4MT_daughters_mass[0];
|
||||
daughtermass[1] = G4MT_daughters_mass[1];
|
||||
daughterwidth[0] = G4MT_daughters_width[0];
|
||||
daughterwidth[1] = G4MT_daughters_width[1];
|
||||
|
||||
//create parent G4DynamicParticle at rest
|
||||
G4ThreeVector dummy;
|
||||
@@ -171,23 +173,54 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::TwoBodyDecayIt()
|
||||
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
|
||||
delete parentparticle;
|
||||
|
||||
G4bool withWidth = (daughterwidth[0]>1.0e-3*daughtermass[0]) || (daughterwidth[1]>1.0e-3*daughtermass[1]);
|
||||
if (withWidth) {
|
||||
G4double sumofdaughterwidthsq = daughterwidth[0]*daughterwidth[0]+daughterwidth[1]*daughterwidth[1];
|
||||
// check parent mass and daughter mass
|
||||
G4double maxDev = (parentmass - daughtermass[0] - daughtermass[1] )/std::sqrt(sumofdaughterwidthsq);
|
||||
if (maxDev < -0.9*rangeMass ){
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cout << "G4PhaseSpaceDecayChannel::TwoBodyDecayIt "
|
||||
<< "sum of daughter mass is larger than parent mass" << G4endl;
|
||||
G4cout << "parent :" << G4MT_parent->GetParticleName() << " " << current_parent_mass/GeV << G4endl;
|
||||
G4cout << "daughter 1 :" << G4MT_daughters[0]->GetParticleName() << " " << daughtermass[0]/GeV << G4endl;
|
||||
G4cout << "daughter 2:" << G4MT_daughters[1]->GetParticleName() << " " << daughtermass[1]/GeV << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4PhaseSpaceDecayChannel::TwoBodyDecayIt",
|
||||
"PART112", JustWarning,
|
||||
"Can not create decay products: sum of daughter mass is larger than parent mass");
|
||||
return products;
|
||||
}
|
||||
G4double dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
|
||||
G4double dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
|
||||
while (dm1+dm2>parentmass){
|
||||
dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
|
||||
dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
|
||||
}
|
||||
daughtermass[0] = dm1;
|
||||
daughtermass[1] = dm2;
|
||||
} else {
|
||||
if (parentmass < daughtermass[0] + daughtermass[1] ){
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cout << "G4PhaseSpaceDecayChannel::TwoBodyDecayIt "
|
||||
<< "sum of daughter mass is larger than parent mass" << G4endl;
|
||||
G4cout << "parent :" << G4MT_parent->GetParticleName() << " " << current_parent_mass/GeV << G4endl;
|
||||
G4cout << "daughter 1 :" << G4MT_daughters[0]->GetParticleName() << " " << daughtermass[0]/GeV << G4endl;
|
||||
G4cout << "daughter 2:" << G4MT_daughters[1]->GetParticleName() << " " << daughtermass[1]/GeV << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4PhaseSpaceDecayChannel::TwoBodyDecayIt",
|
||||
"PART112", JustWarning,
|
||||
"Can not create decay products: sum of daughter mass is larger than parent mass");
|
||||
return products;
|
||||
}
|
||||
}
|
||||
|
||||
//calculate daughter momentum
|
||||
daughtermomentum = Pmx(parentmass,daughtermass[0],daughtermass[1]);
|
||||
if (daughtermomentum <0.0) {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cout << "G4PhaseSpaceDecayChannel::TwoBodyDecayIt "
|
||||
<< "sum of daughter mass is larger than parent mass" << G4endl;
|
||||
G4cout << "parent :" << G4MT_parent->GetParticleName() << " " << current_parent_mass/GeV << G4endl;
|
||||
G4cout << "daughter 1 :" << G4MT_daughters[0]->GetParticleName() << " " << daughtermass[0]/GeV << G4endl;
|
||||
G4cout << "daughter 2:" << G4MT_daughters[1]->GetParticleName() << " " << daughtermass[1]/GeV << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4PhaseSpaceDecayChannel::TwoBodyDecayIt",
|
||||
"PART112", JustWarning,
|
||||
"Can not create decay products: sum of daughter mass is larger than parent mass");
|
||||
return products;
|
||||
}
|
||||
|
||||
G4double costheta = 2.*G4UniformRand()-1.0;
|
||||
G4double sintheta = std::sqrt((1.0 - costheta)*(1.0 + costheta));
|
||||
@@ -195,9 +228,11 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::TwoBodyDecayIt()
|
||||
G4ThreeVector direction(sintheta*std::cos(phi),sintheta*std::sin(phi),costheta);
|
||||
|
||||
//create daughter G4DynamicParticle
|
||||
G4DynamicParticle * daughterparticle = new G4DynamicParticle( G4MT_daughters[0], direction*daughtermomentum);
|
||||
G4double Ekin = std::sqrt(daughtermomentum*daughtermomentum + daughtermass[0]*daughtermass[0]) - daughtermass[0];
|
||||
G4DynamicParticle * daughterparticle = new G4DynamicParticle( G4MT_daughters[0], direction, Ekin, daughtermass[0]);
|
||||
products->PushProducts(daughterparticle);
|
||||
daughterparticle = new G4DynamicParticle( G4MT_daughters[1], direction*(-1.0*daughtermomentum));
|
||||
Ekin = std::sqrt(daughtermomentum*daughtermomentum + daughtermass[1]*daughtermass[1]) - daughtermass[1];
|
||||
daughterparticle = new G4DynamicParticle( G4MT_daughters[1], -1.0*direction, Ekin, daughtermass[1]);
|
||||
products->PushProducts(daughterparticle);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
@@ -219,11 +254,16 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
|
||||
// parent mass
|
||||
G4double parentmass = current_parent_mass;
|
||||
//daughters'mass
|
||||
G4double daughtermass[3];
|
||||
G4double daughtermass[3], daughterwidth[3];
|
||||
G4double sumofdaughtermass = 0.0;
|
||||
G4double sumofdaughterwidthsq = 0.0;
|
||||
G4bool withWidth = false;
|
||||
for (G4int index=0; index<3; index++){
|
||||
daughtermass[index] = G4MT_daughters_mass[index];
|
||||
sumofdaughtermass += daughtermass[index];
|
||||
daughterwidth[index] = G4MT_daughters_width[index];
|
||||
sumofdaughterwidthsq += daughterwidth[index]*daughterwidth[index];
|
||||
withWidth = withWidth ||(daughterwidth[index]>1.0e-3*daughtermass[index]);
|
||||
}
|
||||
|
||||
//create parent G4DynamicParticle at rest
|
||||
@@ -235,21 +275,53 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
|
||||
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
|
||||
delete parentparticle;
|
||||
|
||||
if (sumofdaughtermass >parentmass) {
|
||||
if (withWidth){
|
||||
G4double maxDev = (parentmass - sumofdaughtermass )/std::sqrt(sumofdaughterwidthsq) ;
|
||||
if (maxDev < -0.9*rangeMass ){
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cout << "G4PhaseSpaceDecayChannel::ThreeBodyDecayIt "
|
||||
<< "sum of daughter mass is larger than parent mass" << G4endl;
|
||||
G4cout << "parent :" << G4MT_parent->GetParticleName() << " " << current_parent_mass/GeV << G4endl;
|
||||
G4cout << "daughter 1 :" << G4MT_daughters[0]->GetParticleName() << " " << daughtermass[0]/GeV << G4endl;
|
||||
G4cout << "daughter 2:" << G4MT_daughters[1]->GetParticleName() << " " << daughtermass[1]/GeV << G4endl;
|
||||
G4cout << "daughter 3:" << G4MT_daughters[2]->GetParticleName() << " " << daughtermass[2]/GeV << G4endl;
|
||||
}
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cout << "G4PhaseSpaceDecayChannel::ThreeBodyDecayIt "
|
||||
<< "sum of daughter mass is larger than parent mass" << G4endl;
|
||||
G4cout << "parent :" << G4MT_parent->GetParticleName() << " " << current_parent_mass/GeV << G4endl;
|
||||
G4cout << "daughter 1 :" << G4MT_daughters[0]->GetParticleName() << " " << daughtermass[0]/GeV << G4endl;
|
||||
G4cout << "daughter 2:" << G4MT_daughters[1]->GetParticleName() << " " << daughtermass[1]/GeV << G4endl;
|
||||
G4cout << "daughter 3:" << G4MT_daughters[2]->GetParticleName() << " " << daughtermass[2]/GeV << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4PhaseSpaceDecayChannel::ThreeBodyDecayIt",
|
||||
"PART112", JustWarning,
|
||||
"Can not create decay products: sum of daughter mass is larger than parent mass");
|
||||
return products;
|
||||
G4Exception("G4PhaseSpaceDecayChannel::ThreeBodyDecayIt",
|
||||
"PART112", JustWarning,
|
||||
"Can not create decay products: sum of daughter mass is larger than parent mass");
|
||||
return products;
|
||||
}
|
||||
G4double dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
|
||||
G4double dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
|
||||
G4double dm3= DynamicalMass(daughtermass[2],daughterwidth[2], maxDev);
|
||||
while (dm1+dm2+dm3>parentmass){
|
||||
dm1= DynamicalMass(daughtermass[0],daughterwidth[0], maxDev);
|
||||
dm2= DynamicalMass(daughtermass[1],daughterwidth[1], maxDev);
|
||||
dm3= DynamicalMass(daughtermass[2],daughterwidth[2], maxDev);
|
||||
}
|
||||
daughtermass[0] = dm1;
|
||||
daughtermass[1] = dm2;
|
||||
daughtermass[2] = dm3;
|
||||
|
||||
} else {
|
||||
if (sumofdaughtermass >parentmass) {
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
G4cout << "G4PhaseSpaceDecayChannel::ThreeBodyDecayIt "
|
||||
<< "sum of daughter mass is larger than parent mass" << G4endl;
|
||||
G4cout << "parent :" << G4MT_parent->GetParticleName() << " " << current_parent_mass/GeV << G4endl;
|
||||
G4cout << "daughter 1 :" << G4MT_daughters[0]->GetParticleName() << " " << daughtermass[0]/GeV << G4endl;
|
||||
G4cout << "daughter 2:" << G4MT_daughters[1]->GetParticleName() << " " << daughtermass[1]/GeV << G4endl;
|
||||
G4cout << "daughter 3:" << G4MT_daughters[2]->GetParticleName() << " " << daughtermass[2]/GeV << G4endl;
|
||||
}
|
||||
#endif
|
||||
G4Exception("G4PhaseSpaceDecayChannel::ThreeBodyDecayIt",
|
||||
"PART112", JustWarning,
|
||||
"Can not create decay products: sum of daughter mass is larger than parent mass");
|
||||
return products;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -305,9 +377,12 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
|
||||
phi = twopi*G4UniformRand()*rad;
|
||||
sinphi = std::sin(phi);
|
||||
cosphi = std::cos(phi);
|
||||
|
||||
G4ThreeVector direction0(sintheta*cosphi,sintheta*sinphi,costheta);
|
||||
G4DynamicParticle * daughterparticle
|
||||
= new G4DynamicParticle( G4MT_daughters[0], direction0*daughtermomentum[0]);
|
||||
G4double Ekin = std::sqrt(daughtermomentum[0]*daughtermomentum[0] + daughtermass[0]*daughtermass[0]) - daughtermass[0];
|
||||
G4DynamicParticle * daughterparticle = new G4DynamicParticle( G4MT_daughters[0],
|
||||
direction0,
|
||||
Ekin, daughtermass[0]);
|
||||
products->PushProducts(daughterparticle);
|
||||
|
||||
costhetan = (daughtermomentum[1]*daughtermomentum[1]-daughtermomentum[2]*daughtermomentum[2]-daughtermomentum[0]*daughtermomentum[0])/(2.0*daughtermomentum[2]*daughtermomentum[0]);
|
||||
@@ -319,14 +394,19 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
|
||||
direction2.setX( sinthetan*cosphin*costheta*cosphi - sinthetan*sinphin*sinphi + costhetan*sintheta*cosphi);
|
||||
direction2.setY( sinthetan*cosphin*costheta*sinphi + sinthetan*sinphin*cosphi + costhetan*sintheta*sinphi);
|
||||
direction2.setZ( -sinthetan*cosphin*sintheta + costhetan*costheta);
|
||||
daughterparticle = new G4DynamicParticle( G4MT_daughters[2], direction2*(daughtermomentum[2]/direction2.mag()));
|
||||
G4ThreeVector pmom = daughtermomentum[2]*direction2/direction2.mag();
|
||||
Ekin = std::sqrt(pmom.mag2() + daughtermass[2]*daughtermass[2]) - daughtermass[2];
|
||||
daughterparticle = new G4DynamicParticle( G4MT_daughters[2],
|
||||
pmom/pmom.mag(),
|
||||
Ekin, daughtermass[2]);
|
||||
products->PushProducts(daughterparticle);
|
||||
|
||||
daughterparticle =
|
||||
new G4DynamicParticle(
|
||||
G4MT_daughters[1],
|
||||
(direction0*daughtermomentum[0] + direction2*(daughtermomentum[2]/direction2.mag()))*(-1.0)
|
||||
);
|
||||
pmom = (direction0*daughtermomentum[0] + direction2*(daughtermomentum[2]/direction2.mag()))*(-1.0);
|
||||
Ekin = std::sqrt(pmom.mag2() + daughtermass[1]*daughtermass[1]) - daughtermass[1];
|
||||
daughterparticle = new G4DynamicParticle(
|
||||
G4MT_daughters[1],
|
||||
pmom/pmom.mag(),
|
||||
Ekin, daughtermass[1]);
|
||||
products->PushProducts(daughterparticle);
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PrimaryParticle.cc 67971 2013-03-13 10:13:24Z gcosmo $
|
||||
// $Id: G4PrimaryParticle.cc 81373 2014-05-27 13:06:32Z gcosmo $
|
||||
//
|
||||
|
||||
#include "G4PrimaryParticle.hh"
|
||||
@@ -79,7 +79,7 @@ G4PrimaryParticle::G4PrimaryParticle(G4int Pcode,
|
||||
:PDGcode(Pcode),
|
||||
direction(0.,0.,1.),kinE(0.),
|
||||
nextParticle(0),daughterParticle(0),trackID(-1),
|
||||
charge(0.),polX(0.),polY(0.),polZ(0.),
|
||||
mass(-1.),charge(0.),polX(0.),polY(0.),polZ(0.),
|
||||
Weight0(1.0),properTime(0.0),userInfo(0)
|
||||
{
|
||||
G4code = G4ParticleTable::GetParticleTable()->FindParticle(Pcode);
|
||||
@@ -125,7 +125,7 @@ G4PrimaryParticle::G4PrimaryParticle(const G4ParticleDefinition* Gcode,
|
||||
:PDGcode(0),G4code(Gcode),
|
||||
direction(0.,0.,1.),kinE(0.),
|
||||
nextParticle(0),daughterParticle(0),trackID(-1),
|
||||
charge(0.),polX(0.),polY(0.),polZ(0.),
|
||||
mass(-1.),charge(0.),polX(0.),polY(0.),polZ(0.),
|
||||
Weight0(1.0),properTime(0.0),userInfo(0)
|
||||
{
|
||||
if (G4code !=0) {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VDecayChannel.cc 77085 2013-11-21 10:37:09Z gcosmo $
|
||||
// $Id: G4VDecayChannel.cc 82270 2014-06-13 13:51:56Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -66,6 +66,7 @@ G4VDecayChannel::G4VDecayChannel()
|
||||
rbranch(0.0),
|
||||
numberOfDaughters(0),
|
||||
parent_name(0), daughters_name(0),
|
||||
rangeMass(1.0),
|
||||
particletable(0),
|
||||
verboseLevel(1)
|
||||
{
|
||||
@@ -74,6 +75,7 @@ G4VDecayChannel::G4VDecayChannel()
|
||||
G4MT_daughters = 0;
|
||||
G4MT_parent_mass = 0.0;
|
||||
G4MT_daughters_mass = 0;
|
||||
G4MT_daughters_width = 0;
|
||||
|
||||
// set pointer to G4ParticleTable (static and singleton object)
|
||||
particletable = G4ParticleTable::GetParticleTable();
|
||||
@@ -84,6 +86,7 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName, G4int Verbose)
|
||||
rbranch(0.0),
|
||||
numberOfDaughters(0),
|
||||
parent_name(0), daughters_name(0),
|
||||
rangeMass(1.0),
|
||||
particletable(0),
|
||||
verboseLevel(Verbose)
|
||||
{
|
||||
@@ -92,6 +95,7 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName, G4int Verbose)
|
||||
G4MT_daughters = 0;
|
||||
G4MT_parent_mass = 0.0;
|
||||
G4MT_daughters_mass = 0;
|
||||
G4MT_daughters_width = 0;
|
||||
|
||||
// set pointer to G4ParticleTable (static and singleton object)
|
||||
particletable = G4ParticleTable::GetParticleTable();
|
||||
@@ -109,6 +113,7 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
|
||||
rbranch(theBR),
|
||||
numberOfDaughters(theNumberOfDaughters),
|
||||
parent_name(0), daughters_name(0),
|
||||
rangeMass(1.0),
|
||||
particletable(0),
|
||||
verboseLevel(1)
|
||||
{
|
||||
@@ -117,6 +122,7 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
|
||||
G4MT_daughters = 0;
|
||||
G4MT_parent_mass = 0.0;
|
||||
G4MT_daughters_mass = 0;
|
||||
G4MT_daughters_width = 0;
|
||||
|
||||
// set pointer to G4ParticleTable (static and singleton object)
|
||||
particletable = G4ParticleTable::GetParticleTable();
|
||||
@@ -142,6 +148,7 @@ G4VDecayChannel::G4VDecayChannel(const G4VDecayChannel &right)
|
||||
kinematics_name = right.kinematics_name;
|
||||
verboseLevel = right.verboseLevel;
|
||||
rbranch = right.rbranch;
|
||||
rangeMass = right.rangeMass;
|
||||
|
||||
// copy parent name
|
||||
parent_name = new G4String(*right.parent_name);
|
||||
@@ -164,6 +171,7 @@ G4VDecayChannel::G4VDecayChannel(const G4VDecayChannel &right)
|
||||
//
|
||||
G4MT_daughters_mass = 0;
|
||||
G4MT_daughters = 0;
|
||||
G4MT_daughters_width = 0;
|
||||
|
||||
// particle table
|
||||
particletable = G4ParticleTable::GetParticleTable();
|
||||
@@ -175,6 +183,7 @@ G4VDecayChannel & G4VDecayChannel::operator=(const G4VDecayChannel &right)
|
||||
kinematics_name = right.kinematics_name;
|
||||
verboseLevel = right.verboseLevel;
|
||||
rbranch = right.rbranch;
|
||||
rangeMass = right.rangeMass;
|
||||
|
||||
// copy parent name
|
||||
parent_name = new G4String(*right.parent_name);
|
||||
@@ -199,6 +208,7 @@ G4VDecayChannel & G4VDecayChannel::operator=(const G4VDecayChannel &right)
|
||||
G4MT_daughters = 0;
|
||||
G4MT_parent_mass = 0.0;
|
||||
G4MT_daughters_mass = 0;
|
||||
G4MT_daughters_width = 0;
|
||||
|
||||
// particle table
|
||||
particletable = G4ParticleTable::GetParticleTable();
|
||||
@@ -213,6 +223,8 @@ G4VDecayChannel::~G4VDecayChannel()
|
||||
parent_name = 0;
|
||||
if (G4MT_daughters_mass != 0) delete [] G4MT_daughters_mass;
|
||||
G4MT_daughters_mass =0;
|
||||
if (G4MT_daughters_width != 0) delete [] G4MT_daughters_width;
|
||||
G4MT_daughters_width = 0;
|
||||
}
|
||||
|
||||
/////@@const G4DecayChannelManager& G4VDecayChannel::GetSubInstanceManager()
|
||||
@@ -240,8 +252,11 @@ void G4VDecayChannel::ClearDaughtersName()
|
||||
//
|
||||
if (G4MT_daughters != 0) delete [] G4MT_daughters;
|
||||
if (G4MT_daughters_mass != 0) delete [] G4MT_daughters_mass;
|
||||
if (G4MT_daughters_width != 0) delete [] G4MT_daughters_width;
|
||||
G4MT_daughters_width = 0;
|
||||
G4MT_daughters = 0;
|
||||
G4MT_daughters_mass = 0;
|
||||
G4MT_daughters_width = 0;
|
||||
|
||||
numberOfDaughters = 0;
|
||||
}
|
||||
@@ -328,6 +343,8 @@ void G4VDecayChannel::FillDaughters()
|
||||
|
||||
//
|
||||
G4double sumofdaughtermass = 0.0;
|
||||
G4double sumofdaughterwidthsq = 0.0;
|
||||
|
||||
if ((numberOfDaughters <=0) || (daughters_name == 0) ){
|
||||
#ifdef G4VERBOSE
|
||||
if (verboseLevel>0) {
|
||||
@@ -345,7 +362,9 @@ void G4VDecayChannel::FillDaughters()
|
||||
//create and set the array of pointers to daughter particles
|
||||
G4MT_daughters = new G4ParticleDefinition*[numberOfDaughters];
|
||||
if (G4MT_daughters_mass != 0) delete [] G4MT_daughters_mass;
|
||||
if (G4MT_daughters_width != 0) delete [] G4MT_daughters_width;
|
||||
G4MT_daughters_mass = new G4double[numberOfDaughters];
|
||||
G4MT_daughters_width = new G4double[numberOfDaughters];
|
||||
// loop over all daughters
|
||||
for (index=0; index < numberOfDaughters; index++) {
|
||||
if (daughters_name[index] == 0) {
|
||||
@@ -385,13 +404,16 @@ void G4VDecayChannel::FillDaughters()
|
||||
}
|
||||
#endif
|
||||
G4MT_daughters_mass[index] = G4MT_daughters[index]->GetPDGMass();
|
||||
G4double d_width = G4MT_daughters[index]->GetPDGWidth();
|
||||
G4MT_daughters_width[index] = d_width;
|
||||
sumofdaughtermass += G4MT_daughters[index]->GetPDGMass();
|
||||
sumofdaughterwidthsq += d_width*d_width;
|
||||
} // end loop over all daughters
|
||||
|
||||
// check sum of daghter mass
|
||||
G4double widthMass = G4MT_parent->GetPDGWidth();
|
||||
G4double widthMass = std::sqrt(G4MT_parent->GetPDGWidth()*G4MT_parent->GetPDGWidth()+sumofdaughterwidthsq);
|
||||
if ( (G4MT_parent->GetParticleType() != "nucleus") &&
|
||||
(sumofdaughtermass > parentmass + 5*widthMass) ){
|
||||
(sumofdaughtermass > parentmass + rangeMass*widthMass) ){
|
||||
// !!! illegal mass !!!
|
||||
#ifdef G4VERBOSE
|
||||
if (GetVerboseLevel()>0) {
|
||||
@@ -529,3 +551,19 @@ const G4String& G4VDecayChannel::GetNoName() const
|
||||
{
|
||||
return noName;
|
||||
}
|
||||
|
||||
#include "Randomize.hh"
|
||||
G4double G4VDecayChannel::DynamicalMass(G4double massPDG, G4double width, G4double maxDev ) const
|
||||
{
|
||||
if (maxDev >rangeMass) maxDev = rangeMass;
|
||||
if (maxDev <-1.*rangeMass) return massPDG; // can not calculate
|
||||
|
||||
G4double x = G4UniformRand()*(maxDev+rangeMass) - rangeMass;
|
||||
G4double y = G4UniformRand();
|
||||
while ( y * (width*width*x*x + massPDG*massPDG*width*width) > massPDG*massPDG*width*width ){
|
||||
x = G4UniformRand()*(maxDev+rangeMass) - rangeMass;
|
||||
y = G4UniformRand();
|
||||
}
|
||||
G4double mass = massPDG + x*width;
|
||||
return mass;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user