Import Geant4 0.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:09:25 +02:00
parent b97f8d0df7
commit aaa409b6ee
2922 changed files with 55107 additions and 81674 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DalitzDecayChannel.cc,v 2.4 1998/11/18 09:46:32 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4DalitzDecayChannel.cc,v 1.3 1999/04/13 08:00:14 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -44,7 +44,8 @@ G4DalitzDecayChannel::G4DalitzDecayChannel(
SetParent(theParentName);
SetBR(theBR);
SetNumberOfDaughters(3);
SetDaughter(idGamma, "gamma");
G4String gammaName = "gamma";
SetDaughter(idGamma, gammaName);
SetDaughter(idLepton, theLeptonName);
SetDaughter(idAntiLepton, theAntiLeptonName);
//
@@ -62,14 +63,14 @@ G4DecayProducts *G4DalitzDecayChannel::DecayIt(G4double)
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) G4cout << "G4DalitzDecayChannel::DecayIt ";
#endif
if (parent == NULL) FillParent();
if (daughters == NULL) FillDaughters();
if (parent == 0) FillParent();
if (daughters == 0) FillDaughters();
// parent mass
G4double parentmass = parent->GetPDGMass();
//create parent G4DynamicParticle at rest
G4ParticleMomentum dummy;
G4ThreeVector dummy;
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0);
//daughters'mass
@@ -101,7 +102,7 @@ G4DecayProducts *G4DalitzDecayChannel::DecayIt(G4double)
G4double costheta = 2.*G4UniformRand()-1.0;
G4double sintheta = sqrt((1.0 - costheta)*(1.0 + costheta));
G4double phi = 2.0*M_PI*G4UniformRand()*rad;
G4ParticleMomentum gdirection(sintheta*cos(phi),sintheta*sin(phi),costheta);
G4ThreeVector gdirection(sintheta*cos(phi),sintheta*sin(phi),costheta);
//create G4DynamicParticle for gamma
G4DynamicParticle * gammaparticle
@@ -117,7 +118,7 @@ G4DecayProducts *G4DalitzDecayChannel::DecayIt(G4double)
costheta = 2.*G4UniformRand()-1.0;
sintheta = sqrt((1.0 - costheta)*(1.0 + costheta));
phi = 2.0*M_PI*G4UniformRand()*rad;
G4ParticleMomentum ldirection(sintheta*cos(phi),sintheta*sin(phi),costheta);
G4ThreeVector ldirection(sintheta*cos(phi),sintheta*sin(phi),costheta);
//create G4DynamicParticle for leptons in the rest frame of (l+ l-)system
G4DynamicParticle * leptonparticle
= new G4DynamicParticle(daughters[idLepton] ,
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DecayProducts.cc,v 2.2 1998/11/13 17:04:39 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4DecayProducts.cc,v 1.4 1999/04/14 10:28:24 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -31,13 +31,13 @@ G4Allocator<G4DecayProducts> aDecayProductsAllocator;
G4DecayProducts::G4DecayProducts()
:numberOfProducts(0),theParentParticle(NULL)
:numberOfProducts(0),theParentParticle(0)
{
}
G4DecayProducts::G4DecayProducts(const G4DynamicParticle &aParticle)
:numberOfProducts(0),theParentParticle(NULL)
:numberOfProducts(0),theParentParticle(0)
{
theParentParticle = new G4DynamicParticle(aParticle);
}
@@ -62,7 +62,7 @@ G4DecayProducts & G4DecayProducts::operator=(const G4DecayProducts &right)
if (this != &right)
{
// recreate parent
if (theParentParticle != NULL) delete theParentParticle;
if (theParentParticle != 0) delete theParentParticle;
theParentParticle = new G4DynamicParticle(*right.theParentParticle);
// delete G4DynamicParticle objects
@@ -84,7 +84,7 @@ G4DecayProducts & G4DecayProducts::operator=(const G4DecayProducts &right)
G4DecayProducts::~G4DecayProducts()
{
//delete parent
if (theParentParticle != NULL) delete theParentParticle;
if (theParentParticle != 0) delete theParentParticle;
// delete G4DynamicParticle object
for (G4int index=0; index < numberOfProducts; index++)
@@ -100,7 +100,7 @@ G4DynamicParticle* G4DecayProducts::PopProducts()
numberOfProducts -= 1;
return theProductVector[numberOfProducts];
} else {
return NULL;
return 0;
}
}
@@ -111,9 +111,9 @@ G4int G4DecayProducts::PushProducts(G4DynamicParticle *aParticle)
numberOfProducts += 1;
} else {
#ifdef G4VERBOSE
G4cerr << "G4DecayProducts::PushProducts ";
G4cerr << " exceeds MaxNumberOfProducts(=" <<MaxNumberOfProducts << ")";
G4cerr << endl;
G4cout << "G4DecayProducts::PushProducts ";
G4cout << " exceeds MaxNumberOfProducts(=" <<MaxNumberOfProducts << ")";
G4cout << endl;
#endif
}
return numberOfProducts;
@@ -124,18 +124,18 @@ G4DynamicParticle* G4DecayProducts::operator[](G4int anIndex) const
if ((numberOfProducts > anIndex) && (anIndex >=0) ) {
return theProductVector[anIndex];
} else {
return NULL;
return 0;
}
}
void G4DecayProducts::SetParentParticle(const G4DynamicParticle &aParticle)
{
if (theParentParticle != NULL) delete theParentParticle;
if (theParentParticle != 0) delete theParentParticle;
theParentParticle = new G4DynamicParticle(aParticle);
}
void G4DecayProducts::Boost(G4double totalEnergy, const G4ParticleMomentum &momentumDirection)
void G4DecayProducts::Boost(G4double totalEnergy, const G4ThreeVector &momentumDirection)
{
// calcurate new beta
G4double mass = theParentParticle->GetMass();
@@ -152,7 +152,7 @@ void G4DecayProducts::Boost(G4double newbetax, G4double newbetay, G4double newbe
G4double energy = theParentParticle->GetTotalEnergy();
G4double momentum = 0.0;
G4ParticleMomentum direction(0.0,0.0,1.0);
G4ThreeVector direction(0.0,0.0,1.0);
G4LorentzVector p4;
if (energy - mass > DBL_MIN) {
@@ -206,7 +206,7 @@ G4bool G4DecayProducts::IsChecked()
// energy/momentum
G4double parent_mass = theParentParticle->GetMass();
G4double parent_energy = theParentParticle->GetTotalEnergy();
G4ParticleMomentum direction = theParentParticle->GetMomentumDirection();
G4ThreeVector direction = theParentParticle->GetMomentumDirection();
G4ThreeVector parent_momentum = direction*(theParentParticle->GetTotalMomentum());
// check momentum dirction is a unit vector
if ( (parent_momentum.mag() >0.0) && (abs(direction.mag()-1.0) >1.0e-6 ) ) {
@@ -263,7 +263,7 @@ void G4DecayProducts::DumpInfo()
{
G4cout << " ----- List of DecayProducts -----" << endl;
G4cout << " ------ Parent Particle ----------" << endl;
if (theParentParticle != NULL) theParentParticle->DumpInfo();
if (theParentParticle != 0) theParentParticle->DumpInfo();
G4cout << " ------ Daughter Particles ------" << endl;
for (G4int index=0; index < numberOfProducts; index++)
{
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DecayTable.cc,v 2.2 1998/10/13 11:25:40 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4DecayTable.cc,v 1.4 1999/05/25 02:01:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -19,10 +19,11 @@
// 27 July 1996 H.Kurashige
// ------------------------------------------------------------
#include "globals.hh"
#include "G4DecayTable.hh"
#include "Randomize.hh"
G4DecayTable::G4DecayTable():parent(NULL)
G4DecayTable::G4DecayTable():parent(0)
{
channels = new G4VDecayChannelVector;
}
@@ -34,12 +35,12 @@ G4DecayTable::~G4DecayTable()
}
void G4DecayTable::Insert( G4VDecayChannel * aChannel){
if (parent == NULL) { parent = aChannel->GetParent(); }
if (parent == 0) { parent = (G4ParticleDefinition*)(aChannel->GetParent()); }
if (parent != aChannel->GetParent()) {
#ifdef G4VERBOSE
G4cerr << " G4DecayTable::Insert :: bad G4VDecayChannel (mismatch parent) ";
G4cerr << " " << parent->GetParticleName();
G4cerr << " input:" << aChannel->GetParent()->GetParticleName() << endl;
G4cout << " G4DecayTable::Insert :: bad G4VDecayChannel (mismatch parent) ";
G4cout << " " << parent->GetParticleName();
G4cout << " input:" << aChannel->GetParent()->GetParticleName() << endl;
#endif
} else {
channels->insert(aChannel);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DecayTableMessenger.cc,v 2.3 1998/07/13 17:18:38 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4DecayTableMessenger.cc,v 1.2 1999/04/13 08:00:17 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
@@ -40,9 +40,9 @@
G4DecayTableMessenger::G4DecayTableMessenger(G4ParticleTable* pTable)
:theParticleTable(pTable)
{
if ( theParticleTable == NULL) theParticleTable = G4ParticleTable::GetParticleTable();
if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
currentParticle = NULL;
currentParticle = 0;
//Commnad /particle/property/decay/
thisDirectory = new G4UIdirectory("/particle/property/decay/");
@@ -54,7 +54,7 @@ G4DecayTableMessenger::G4DecayTableMessenger(G4ParticleTable* pTable)
selectCmd->SetParameterName("mode", true);
selectCmd->SetDefaultValue(0);
selectCmd->SetRange("mode >=0");
currentChannel = NULL;
currentChannel = 0;
//Commnad /particle/property/decay/dump
dumpCmd = new G4UIcmdWithoutParameter("/particle/property/decay/dump",this);
@@ -78,11 +78,11 @@ G4DecayTableMessenger::~G4DecayTableMessenger()
void G4DecayTableMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if (SetCurrentParticle()==NULL) {
if (SetCurrentParticle()==0) {
G4cout << "Particle is not selected yet !! Command ignored." << endl;
return;
}
if (currentDecayTable==NULL) {
if (currentDecayTable==0) {
G4cout << "The particle has no decay table !! Command ignored." << endl;
return;
}
@@ -95,14 +95,14 @@ void G4DecayTableMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
//Commnad /particle/property/decay/select
G4int index = selectCmd->GetNewIntValue(newValue) ;
currentChannel = currentDecayTable->GetDecayChannel(index);
if ( currentChannel == NULL ) {
if ( currentChannel == 0 ) {
G4cout << "Invalid index. Command ignored." << endl;
} else {
idxCurrentChannel = index;
}
} else {
if ( currentChannel == NULL ) {
if ( currentChannel == 0 ) {
G4cout << "Select a decay channel. Command ignored." << endl;
return;
}
@@ -127,12 +127,12 @@ G4ParticleDefinition* G4DecayTableMessenger::SetCurrentParticle()
G4String particleName = G4UImanager::GetUIpointer()->GetCurrentStringValue("/particle/select");
if (currentParticle != NULL ){
if (currentParticle != 0 ){
// check whether selection is changed
if (currentParticle->GetParticleName() != particleName) {
currentParticle = theParticleTable->FindParticle(particleName);
idxCurrentChannel = -1;
currentDecayTable = NULL;
currentDecayTable = 0;
} else {
// no change
return currentParticle;
@@ -140,16 +140,16 @@ G4ParticleDefinition* G4DecayTableMessenger::SetCurrentParticle()
} else {
currentParticle = theParticleTable->FindParticle(particleName);
idxCurrentChannel = -1;
currentDecayTable = NULL;
currentDecayTable = 0;
}
if (currentParticle != NULL ){
if (currentParticle != 0 ){
currentDecayTable = currentParticle->GetDecayTable();
if ((currentDecayTable != NULL ) && (idxCurrentChannel >0) ) {
if ((currentDecayTable != 0 ) && (idxCurrentChannel >0) ) {
currentChannel = currentDecayTable->GetDecayChannel(idxCurrentChannel);
} else {
idxCurrentChannel = -1;
currentChannel = NULL;
currentChannel = 0;
}
}
return currentParticle;
@@ -159,7 +159,7 @@ G4String G4DecayTableMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String returnValue('\0');
if (SetCurrentParticle()==NULL) {
if (SetCurrentParticle()==0) {
// no particle is selected. return null
return returnValue;
}
@@ -169,7 +169,7 @@ G4String G4DecayTableMessenger::GetCurrentValue(G4UIcommand * command)
returnValue = selectCmd->ConvertToString(idxCurrentChannel);
} else if( command == brCmd ){
if ( currentChannel != NULL) {
if ( currentChannel != 0) {
returnValue = brCmd->ConvertToString(currentChannel->GetBR());
}
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DynamicParticle.cc,v 2.4 1998/11/25 13:59:04 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4DynamicParticle.cc,v 1.4 1999/05/06 16:37:39 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -46,11 +46,11 @@ G4Allocator<G4DynamicParticle> aDynamicParticleAllocator;
static const G4double EnergyMomentumRelationAllowance = keV;
G4DynamicParticle::G4DynamicParticle():
theParticleDefinition(NULL),
theParticleDefinition(0),
theMomentumDirection(),
theKineticEnergy(0.0),
theProperTime(0.0),
thePreAssignedDecayProducts(NULL),
thePreAssignedDecayProducts(0),
verboseLevel(1)
{
theDynamicalMass = 0.0;
@@ -58,13 +58,13 @@ G4DynamicParticle::G4DynamicParticle():
// -- constructors ----
G4DynamicParticle::G4DynamicParticle(G4ParticleDefinition * aParticleDefinition,
const G4ParticleMomentum& aMomentumDirection,
const G4ThreeVector& aMomentumDirection,
G4double aKineticEnergy):
theParticleDefinition(aParticleDefinition),
theMomentumDirection(aMomentumDirection),
theKineticEnergy(aKineticEnergy),
theProperTime(0.0),
thePreAssignedDecayProducts(NULL),
thePreAssignedDecayProducts(0),
verboseLevel(1)
{
theDynamicalMass = aParticleDefinition->GetPDGMass();
@@ -74,7 +74,7 @@ G4DynamicParticle::G4DynamicParticle(G4ParticleDefinition * aParticleDefinition,
const G4ThreeVector& aParticleMomentum):
theParticleDefinition(aParticleDefinition),
theProperTime(0.0),
thePreAssignedDecayProducts(NULL),
thePreAssignedDecayProducts(0),
verboseLevel(1)
{
theDynamicalMass = aParticleDefinition->GetPDGMass();
@@ -96,7 +96,7 @@ G4DynamicParticle::G4DynamicParticle(G4ParticleDefinition * aParticleDefinition,
const G4LorentzVector &aParticleMomentum):
theParticleDefinition(aParticleDefinition),
theProperTime(0.0),
thePreAssignedDecayProducts(NULL),
thePreAssignedDecayProducts(0),
verboseLevel(1)
{
theDynamicalMass = aParticleDefinition->GetPDGMass();
@@ -127,7 +127,7 @@ G4DynamicParticle::G4DynamicParticle(G4ParticleDefinition * aParticleDefinition,
G4double totalEnergy,
const G4ThreeVector &aParticleMomentum):
theParticleDefinition(aParticleDefinition),
thePreAssignedDecayProducts(NULL),
thePreAssignedDecayProducts(0),
theProperTime(0.0),
verboseLevel(1)
{
@@ -138,7 +138,7 @@ G4DynamicParticle::G4DynamicParticle(G4ParticleDefinition * aParticleDefinition,
SetMomentumDirection(aParticleMomentum.x()/pModule,
aParticleMomentum.y()/pModule,
aParticleMomentum.z()/pModule);
if (totalEnergy > pModule2) {
if (totalEnergy > pModule) {
G4double mass = sqrt(totalEnergy*totalEnergy - pModule2);
theDynamicalMass = mass;
SetKineticEnergy(totalEnergy-mass);
@@ -154,18 +154,18 @@ G4DynamicParticle::G4DynamicParticle(G4ParticleDefinition * aParticleDefinition,
G4DynamicParticle::G4DynamicParticle(const G4DynamicParticle &right)
{
SetMass(right.theDynamicalMass);
SetDefinition(right.GetDefinition());
theMomentumDirection = right.GetMomentumDirection();
theKineticEnergy = right.GetKineticEnergy();
thePolarization = right.GetPolarization();
verboseLevel = right.GetVerboseLevel();
theDynamicalMass = right.theDynamicalMass;
theParticleDefinition = right.theParticleDefinition;
theMomentumDirection = right.theMomentumDirection;
theKineticEnergy = right.theKineticEnergy;
thePolarization = right.thePolarization;
verboseLevel = right.verboseLevel;
// proper time is set to zero
theProperTime = 0.0;
// thePreAssignedDecayProducts must not be copied.
thePreAssignedDecayProducts = NULL;
thePreAssignedDecayProducts = 0;
}
@@ -173,24 +173,23 @@ G4DynamicParticle::G4DynamicParticle(const G4DynamicParticle &right)
G4DynamicParticle::~G4DynamicParticle() {
// delete thePreAssignedDecayProducts
if (thePreAssignedDecayProducts != NULL) delete thePreAssignedDecayProducts;
thePreAssignedDecayProducts = NULL;
if (thePreAssignedDecayProducts != 0) delete thePreAssignedDecayProducts;
thePreAssignedDecayProducts = 0;
}
G4DynamicParticle & G4DynamicParticle::operator=(const G4DynamicParticle &right)
{
if (this != &right) {
SetDefinition(right.GetDefinition());
SetMass(right.theDynamicalMass);
theMomentumDirection = right.GetMomentumDirection();
theKineticEnergy = right.GetKineticEnergy();
thePolarization = right.GetPolarization();
theProperTime = right.GetProperTime();
verboseLevel = right.GetVerboseLevel();
theDynamicalMass = right.theDynamicalMass;
theParticleDefinition = right.theParticleDefinition;
theMomentumDirection = right.theMomentumDirection;
theKineticEnergy = right.theKineticEnergy;
thePolarization = right.thePolarization;
verboseLevel = right.verboseLevel;
// thePreAssignedDecayProducts must not be copied.
thePreAssignedDecayProducts = NULL;
thePreAssignedDecayProducts = 0;
}
return *this;
}
@@ -249,7 +248,7 @@ void G4DynamicParticle::Set4Momentum(const G4LorentzVector &momentum )
void G4DynamicParticle::DumpInfo() const
{
if (theParticleDefinition == NULL) {
if (theParticleDefinition == 0) {
G4cout << " G4DynamicParticle::DumpInfo():: !!!Particle type not defined !!!! " << endl;
} else {
G4cout << " Particle type - " << theParticleDefinition->GetParticleName() << endl
+84 -40
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IonTable.cc,v 2.17 1998/12/11 17:56:37 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4IonTable.cc,v 1.9 1999/05/06 16:37:40 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -40,9 +40,6 @@
G4IonTable::G4IonTable()
{
fIonList = new G4IonList();
protonMass=0.0;
neutronMass=0.0;
electronMass=0.0;
}
G4IonTable::~G4IonTable()
@@ -53,6 +50,8 @@ G4IonTable::~G4IonTable()
for (idx=(fIonList->entries()-1); idx >=0 ; idx--) {
G4ParticleDefinition* particle = (*fIonList)(idx);
name = particle->GetParticleName();
// keep the particle object if static
if (name == "alpha") {
} else if (name == "deuteron") {
@@ -60,18 +59,20 @@ G4IonTable::~G4IonTable()
} else if (name == "triton") {
} else if (name == "He3") {
} else if (name == "GenericIon") {
} else {
// delete if not static objects
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4IonTable:~IonTable() : delete ion of " << name << endl;
G4cout << "G4IonTable:~IonTable() : delete ion of " << name << endl;
}
#endif
delete particle;
}
}
// remove all scontents in the Ion List
// remove all contents in the Ion List
fIonList->clear();
delete fIonList;
@@ -84,21 +85,16 @@ G4int G4IonTable::GetVerboseLevel() const
G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4int J, G4int Q)
{
static G4double electronMass = 0.0;
// Search ions with A, Z
G4ParticleDefinition* ion;
G4bool isFound = false;
// check if proton/neutron/electron exits and get their masses
if (protonMass<=0.0) {
G4ParticleDefinition* proton = G4ParticleTable::GetParticleTable()->FindParticle("proton");
G4ParticleDefinition* neutron = G4ParticleTable::GetParticleTable()->FindParticle("neutron");
if ((proton == NULL)||(neutron == NULL)) {
G4Exception("G4IonTable: G4Proton or G4Neutron is not defined !!");
}
protonMass = proton->GetPDGMass();
neutronMass = neutron->GetPDGMass();
// check if electron exits and get their masses
if (electronMass<=0.0) {
G4ParticleDefinition* electron = G4ParticleTable::GetParticleTable()->FindParticle("e-");
if (electron == NULL) {
if (electron == 0) {
G4Exception("G4IonTable: G4Electron is not defined !!");
}
electronMass = electron->GetPDGMass();
@@ -125,13 +121,13 @@ G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4int J, G4int Q)
if ( name(0) == '?') {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4IonTable::GetIon() : can not create ions " << endl;
G4cerr << " Z =" << Z << " A = " << A << endl;
G4cout << "G4IonTable::GetIon() : can not create ions " << endl;
G4cout << " Z =" << Z << " A = " << A << endl;
}
#endif
return NULL;
return 0;
}
G4double mass = GetIonMass(Z, A) + electronMass*G4double(Q);
G4double mass = GetNucleusMass(Z, A) + electronMass*G4double(Z-Q);
G4double charge = G4double(Q)*eplus;
// create an ion
// spin, parity, isospin values are fixed
@@ -140,21 +136,47 @@ G4ParticleDefinition* G4IonTable::GetIon(G4int Z, G4int A, G4int J, G4int Q)
J, +1, 0,
0, 0, 0,
"nucleus", 0, A, 0,
true, -1.0, NULL);
true, -1.0, 0);
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cerr << "G4IonTable::GetIon() : create ion of " << name << endl;
G4cout << "G4IonTable::GetIon() : create ion of " << name << endl;
}
#endif
char cmd[60];
ostrstream os(cmd,60);
os << "/run/particle/addProcManager "<< name << '\0';
G4UImanager::GetUIpointer()->ApplyCommand(cmd);
G4ParticleDefinition* alpha=G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
if (alpha->GetEnergyCuts() != NULL) {
ion->SetCuts( alpha->GetLengthCuts());
// create command string for addProcManager
char cmdAdd[60];
ostrstream osAdd(cmdAdd,60);
osAdd << "/run/particle/addProcManager "<< name << '\0';
// set /control/verbose 0
G4int tempVerboseLevel = G4UImanager::GetUIpointer()->GetVerboseLevel();
G4UImanager::GetUIpointer()->SetVerboseLevel(0);
// issue /run/particle/addProcManage
G4UImanager::GetUIpointer()->ApplyCommand(cmdAdd);
// retreive /control/verbose
G4UImanager::GetUIpointer()->SetVerboseLevel(tempVerboseLevel);
// Set cut value same as "GenericIon"
G4ParticleDefinition* genericIon=G4ParticleTable::GetParticleTable()->FindParticle("GenericIon");
if (genericIon->GetEnergyCuts() != 0) {
ion->SetCuts( genericIon->GetLengthCuts());
#ifdef G4VERBOSE
if (GetVerboseLevel()> 1) {
G4cout << "G4IonTable::GetIon() : cut value =" << genericIon->GetLengthCuts()/mm << "[mm]" <<endl;
}
#endif
// Build Physics Tables for the ion
// create command string for buildPhysicsTable
char cmdBld[60];
ostrstream osBld(cmdBld,60);
osBld << "/run/particle/buildPhysicsTable "<< name << '\0';
// set /control/verbose 0
tempVerboseLevel = G4UImanager::GetUIpointer()->GetVerboseLevel();
G4UImanager::GetUIpointer()->SetVerboseLevel(0);
// issue /run/particle/buildPhysicsTable
G4UImanager::GetUIpointer()->ApplyCommand(cmdBld);
// retreive /control/verbose
G4UImanager::GetUIpointer()->SetVerboseLevel(tempVerboseLevel);
}
}
return ion;
@@ -175,9 +197,24 @@ G4String G4IonTable::GetIonName(G4int Z, G4int A, G4int J, G4int Q) const
return name;
}
G4double G4IonTable::GetIonMass(G4int Z, G4int A) const
G4double G4IonTable::GetNucleusMass(G4int Z, G4int A) const
{
G4ParticleDefinition* ion=NULL;
static G4double protonMass = 0.0;
static G4double neutronMass = 0.0;
// check if proton/neutron/electron exits and get their masses
if (protonMass<=0.0) {
G4ParticleDefinition* proton = G4ParticleTable::GetParticleTable()->FindParticle("proton");
G4ParticleDefinition* neutron = G4ParticleTable::GetParticleTable()->FindParticle("neutron");
if ((proton == 0)||(neutron == 0)) {
G4Exception("G4IonTable: G4Proton or G4Neutron is not defined !!");
}
protonMass = proton->GetPDGMass();
neutronMass = neutron->GetPDGMass();
}
// calculate nucleus mass
G4ParticleDefinition* ion=0;
G4double mass;
if ( (Z<=2) ) {
if ( (Z==1)&&(A==1) ) {
@@ -194,16 +231,23 @@ G4double G4IonTable::GetIonMass(G4int Z, G4int A) const
ion = G4ParticleTable::GetParticleTable()->FindParticle("He3"); // He3
}
}
if (ion!=NULL) {
if (ion!=0) {
mass = ion->GetPDGMass();
}else {
// This routine returns mass of nuclei (w/o including electron mass)
mass = G4NucleiProperties::GetAtomicMass(G4double(A),G4double(Z));
mass - electronMass*G4double(Z);
// mass = Z*proton_mass + (A-Z)*neutron_mass - binding energy
G4double bindingEnergy = G4NucleiPropertiesTable::GetBindingEnergy(Z, A);
mass = G4double(Z)*protonMass + G4double(A-Z)*neutronMass - bindingEnergy;
}
return mass;
}
G4double G4IonTable::GetIonMass(G4int Z, G4int A) const
{
return GetNucleusMass(Z,A);
}
G4bool G4IonTable::IsIon(G4ParticleDefinition* particle) const
{
return (particle->GetParticleType() == "nucleus");
@@ -216,8 +260,8 @@ void G4IonTable::Insert(G4ParticleDefinition* particle)
} else {
//#ifdef G4VERBOSE
//if (GetVerboseLevel()>0) {
// G4cerr << "G4IonTable::Insert :" << particle->GetParticleName() ;
// G4cerr << " is not ions" << endl;
// G4cout << "G4IonTable::Insert :" << particle->GetParticleName() ;
// G4cout << " is not ions" << endl;
//}
//#endif
}
@@ -230,8 +274,8 @@ void G4IonTable::Remove(G4ParticleDefinition* particle)
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4IonTable::Remove :" << particle->GetParticleName() ;
G4cerr << " is not ions" << endl;
G4cout << "G4IonTable::Remove :" << particle->GetParticleName() ;
G4cout << " is not ions" << endl;
}
#endif
}
+2 -2
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4Ions.cc,v 2.2 1998/11/18 17:38:19 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4Ions.cc,v 1.1 1999/01/07 16:10:33 gunter Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ----------------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4KL3DecayChannel.cc,v 2.4 1998/11/18 09:46:34 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4KL3DecayChannel.cc,v 1.3 1999/04/13 08:00:20 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -91,13 +91,13 @@ G4DecayProducts* G4KL3DecayChannel::DecayIt(G4double)
if (GetVerboseLevel()>1) G4cout << "G4KL3DecayChannel::DecayIt " << endl;
#endif
// fill parent particle and its mass
if (parent == NULL) {
if (parent == 0) {
FillParent();
}
massK = parent->GetPDGMass();
// fill daughter particles and their mass
if (daughters == NULL) {
if (daughters == 0) {
FillDaughters();
}
daughterM[idPi] = daughters[idPi]->GetPDGMass();
@@ -124,7 +124,7 @@ G4DecayProducts* G4KL3DecayChannel::DecayIt(G4double)
}
#endif
//create parent G4DynamicParticle at rest
G4ParticleMomentum* direction = new G4ParticleMomentum(1.0,0.0,0.0);
G4ThreeVector* direction = new G4ThreeVector(1.0,0.0,0.0);
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, *direction, 0.0);
delete direction;
@@ -142,7 +142,7 @@ G4DecayProducts* G4KL3DecayChannel::DecayIt(G4double)
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
direction = new G4ParticleMomentum(sintheta*cosphi,sintheta*sinphi,costheta);
direction = new G4ThreeVector(sintheta*cosphi,sintheta*sinphi,costheta);
G4ThreeVector momentum0 = (*direction)*daughterP[0];
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], momentum0);
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuonDecayChannel.cc,v 2.3 1998/11/18 09:46:36 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4MuonDecayChannel.cc,v 1.4 1999/04/14 10:28:27 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -78,8 +78,8 @@ G4DecayProducts *G4MuonDecayChannel::DecayIt(G4double)
if (GetVerboseLevel()>1) G4cout << "G4MuonDecayChannel::DecayIt ";
#endif
if (parent == NULL) FillParent();
if (daughters == NULL) FillDaughters();
if (parent == 0) FillParent();
if (daughters == 0) FillDaughters();
// parent mass
G4double parentmass = parent->GetPDGMass();
@@ -93,7 +93,7 @@ G4DecayProducts *G4MuonDecayChannel::DecayIt(G4double)
}
//create parent G4DynamicParticle at rest
G4ParticleMomentum dummy;
G4ThreeVector dummy;
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0);
//create G4Decayproducts
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
@@ -123,7 +123,7 @@ G4DecayProducts *G4MuonDecayChannel::DecayIt(G4double)
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
G4ParticleMomentum direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4ThreeVector direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]);
products->PushProducts(daughterparticle);
@@ -139,7 +139,7 @@ G4DecayProducts *G4MuonDecayChannel::DecayIt(G4double)
G4double sinphin = sin(phin);
G4double cosphin = cos(phin);
G4ParticleMomentum direction1(sinthetan*cosphin,sinthetan*sinphin,costhetan);
G4ThreeVector direction1(sinthetan*cosphin,sinthetan*sinphin,costhetan);
G4DynamicParticle * daughterparticle1
= new G4DynamicParticle( daughters[1], direction1*(vmass/2.));
G4DynamicParticle * daughterparticle2
@@ -161,26 +161,9 @@ G4DecayProducts *G4MuonDecayChannel::DecayIt(G4double)
// output message
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cout << " daughter 0:" << daughtermomentum[0]/GeV << "[GeV/c]" <<endl;
G4cout << " daughter 1:" << daughtermomentum[1]/GeV << "[GeV/c]" <<endl;
G4cout << " daughter 2:" << daughtermomentum[2]/GeV << "[GeV/c]" <<endl;
}
#endif
// if (!products->IsChecked()) {
// G4cout << " daughter 0:" << daughtermomentum[0]/GeV << "[GeV/c]" <<endl;
// G4cout << " daughter 1:" << daughtermomentum[1]/GeV << "[GeV/c]" <<endl;
// G4cout << " daughter 2:" << daughtermomentum[2]/GeV << "[GeV/c]" <<endl;
// G4cout << " costheta = " << costheta << " sinphi = " << sinphi <<endl;
// G4cout << " costhetan = " << costhetan << " sinphin = " << sinphin <<endl;
// products->DumpInfo();
// G4Exception(" ");
// }
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cout << "G4MuonDecayChannel::DecayIt ";
G4cout << " create decay products in rest frame " <<endl;
products->DumpInfo();
G4cout << "G4MuonDecayChannel::DecayIt ";
G4cout << " create decay products in rest frame " <<endl;
products->DumpInfo();
}
#endif
return products;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NucleiProperties.cc,v 2.6 1998/12/10 18:08:06 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4NucleiProperties.cc,v 1.3 1999/05/26 14:05:17 larazb Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -19,31 +19,60 @@
// Hadronic Process: Nuclear De-excitations
// by V. Lara (Oct 1998)
// Migrate into particles category by H.Kurashige (17 Nov. 98)
// Added Shell-Pairing corrections to the Cameron mass
// excess formula by V.Lara (9 May 99)
#include "G4NucleiProperties.hh"
G4double G4NucleiProperties::CameronMassExcess(const G4int A, const G4int Z)
{
const G4double A03 = pow(A,1.0/3.0);
const G4double A06 = A03*A03;
const G4double A13 = A06*A06;
const G4double Z13 = pow(Z,1.0+1.0/3.0);
const G4double D = (A - 2.0*Z)/A;
const G4double DR = 1.0 - 0.32052/A06;
// Surface term
G4double SurfaceEnergy = (25.8357-44.2355*D*D)*DR*DR*A06;
// Coulomb term
G4double CoulombEnergy = 0.779*(Z*(Z-1)/A03)*(1.0-1.5849/A06+1.2273/A+1.5772/A13);
// Exchange term
G4double ExchangeEnergy = -0.4323*(Z13/A03)*(1.0-0.57811/A03-0.14518/A06+0.49597/A);
// Volume term
G4double VolumeEnergy = A*(-17.0354+31.4506*D*D);
// Compute Mass Excess
// Neutron mass 8.07169 MeV Proton mass 7.2892 MeV
return (8.07169*A - 0.7892*Z + SurfaceEnergy + CoulombEnergy + ExchangeEnergy + VolumeEnergy)*MeV;
}
// G4double G4NucleiProperties::CameronMassExcess(const G4int A, const G4int Z)
// {
// const G4double alpha = -17.0354*MeV;
// const G4double beta = -31.4506*MeV;
// const G4double phi = 44.2355*MeV;
// const G4double gamma = 25.8357*MeV;
//
// const G4double A13 = pow(G4double(A),1.0/3.0);
// const G4double A23 = A13*A13;
// const G4double A43 = A23*A23;
// const G4double Z43 = pow(G4double(Z),4.0/3.0);
// G4double D = (G4double(A) - 2.0*G4double(Z))/G4double(A);
// D *= D; // D = pow((A-2Z)/A,2)
//
//
// // Surface term
// G4double SurfaceEnergy = (gamma - phi*D)*(1.0 - 0.62025/A23)*(1.0 - 0.62025/A23)*A23;
//
// // Coulomb term
// G4double CoulombEnergy = 0.779*MeV*(G4double(Z*(Z-1))/A13)*(1.0-1.5849/A23+1.2273/A+1.5772/A43);
//
// // Exchange term
// G4double ExchangeEnergy = -0.4323*MeV*(Z43/A13)*(1.0-0.57811/A13-0.14518/A23+0.49597/A);
//
// // Volume term
// G4double VolumeEnergy = G4double(A)*(alpha-beta*D);
//
// // Shell+Pairing corrections for protons
// G4double SPcorrectionZ;
// if (Z <= TableSize) SPcorrectionZ = SPZTable[Z-1]*MeV;
// else SPcorrectionZ = 0.0;
//
// // Shell+Pairing corrections for protons
// G4int N = A - Z;
// G4double SPcorrectionN;
// if (N <= TableSize) SPcorrectionN = SPNTable[N-1]*MeV;
// else SPcorrectionN = 0.0;
//
//
// // Mass Excess
// // First two terms give the mass excess of the neutrons and protons in the nucleus
// // (see Cameron, Canadian Journal of Physics, 35, 1957 page 1022)
// G4double MassExcess = 8.367*MeV*A - 0.783*MeV*Z +
// SurfaceEnergy + CoulombEnergy + ExchangeEnergy + VolumeEnergy +
// SPcorrectionZ + SPcorrectionN;
//
// return MassExcess;
// }
G4double G4NucleiProperties::AtomicMass(G4double Z, G4double A)
@@ -59,8 +88,8 @@ G4double G4NucleiProperties::AtomicMass(G4double Z, G4double A)
G4ParticleDefinition* proton = G4ParticleTable::GetParticleTable()->FindParticle("proton");
G4ParticleDefinition* neutron = G4ParticleTable::GetParticleTable()->FindParticle("neutron");
G4ParticleDefinition* electron = G4ParticleTable::GetParticleTable()->FindParticle("e-");
if ((proton == NULL)||(neutron == NULL)||(electron == NULL)) {
G4Exception("G4NucleiProperties: G4Proton or G4Neutron is not defined !!");
if ((proton == 0)||(neutron == 0)||(electron == 0)) {
G4Exception("G4NucleiProperties::AtomicMass G4Proton or G4Neutron is not defined !!");
}
const G4double proton_mass = proton->GetPDGMass();
const G4double neutron_mass = neutron->GetPDGMass();
@@ -83,77 +112,111 @@ G4double G4NucleiProperties::AtomicMass(G4double Z, G4double A)
return mass*MeV;
}
G4double G4NucleiProperties::BindingEnergy(G4double A, G4double Z)
{
//
// Weitzsaecker's Mass formula
//
G4int nNeutron = A-Z;
G4int ipp = G4int(nNeutron)%2; // pairing
G4int izz = G4int(Z)%2;
G4double binding =
- 15.67*A // nuclear volume
+ 17.23*pow(A,2./3.) // surface energy
+ 93.15*((A/2.-Z)*(A/2.-Z))/A // asymmetry
+ 0.6984523*Z*Z*pow(A,-1./3.); // coulomb
if( ipp == izz ) binding += (ipp+izz-1) * 12.0 / sqrt(A); // pairing
return -binding*MeV;
}
G4double G4NucleiProperties::GetNuclearMass(const G4double A, const G4double Z)
{
if (A < 1 || Z < 0 || Z > A) {
G4cout << "G4NucleiProperties::GetNuclearMass: Wrong values for A = " << A
<< " and Z = " << Z << endl;
return 0.0;
} else {
G4ParticleDefinition * nucleus = 0;
if ( (Z<=2) ) {
if ( (Z==1)&&(A==1) ) {
nucleus = G4ParticleTable::GetParticleTable()->FindParticle("proton"); // proton
} else if ( (Z==0)&&(A==1) ) {
nucleus = G4ParticleTable::GetParticleTable()->FindParticle("neutron"); // neutron
} else if ( (Z==1)&&(A==2) ) {
nucleus = G4ParticleTable::GetParticleTable()->FindParticle("deuteron"); // deuteron
} else if ( (Z==1)&&(A==3) ) {
nucleus = G4ParticleTable::GetParticleTable()->FindParticle("triton"); // tritoon
} else if ( (Z==2)&&(A==4) ) {
nucleus = G4ParticleTable::GetParticleTable()->FindParticle("alpha"); // alpha
} else if ( (Z==2)&&(A==3) ) {
nucleus = G4ParticleTable::GetParticleTable()->FindParticle("He3"); // He3
}
}
if (nucleus!=0) {
return nucleus->GetPDGMass();
}else {
G4double bindingEnergy = GetBindingEnergy(A,Z);
G4double protonMass = G4ParticleTable::GetParticleTable()->FindParticle("proton")->GetPDGMass();
G4double neutronMass = G4ParticleTable::GetParticleTable()->FindParticle("neutron")->GetPDGMass();
return Z*protonMass + (A-Z)*neutronMass - bindingEnergy;
}
}
}
// S(Z)+P(Z) from Tab. 1 from A.G.W. Cameron, Canad. J. Phys., 35(1957)1021
// or Delta M(Z) from Tab. 97 of book [1]
const G4double G4NucleiProperties::daTZ[G4NucleiProperties::NTZ] = {
20.80, 15.80, 21.00, 16.80, 19.80, 16.50, 18.80, 16.50, 18.50, 17.20, // 1
18.26, 15.05, 16.01, 12.04, 13.27, 11.09, 12.17, 10.26, 11.04, 8.41, // 2
9.79, 7.36, 8.15, 5.63, 5.88, 3.17, 3.32, .82, 1.83, .97, // 3
2.33, 1.27, 2.92, 1.61, 2.91, 1.35, 2.40, .89, 1.74, .36, // 4
0.95, -0.65, -0.04, -1.73, -0.96, -2.87, -2.05, -4.05, -3.40, -5.72, // 5
-3.75, -4.13, -2.42, -2.85, -1.01, -1.33, 0.54, -0.02, 1.74, 0.75, // 6
2.24, 1.00, 1.98, 0.79, 1.54, 0.39, 1.08, 0.00, 0.78, -0.35, // 7
0.58, -0.55, 0.59, -0.61, 0.59, -0.35, 0.32, -0.96, -0.52, -2.08, // 8
-2.46, -3.64, -1.55, -0.96, 0.97, 0.88, 2.37, 1.75, 2.72, 1.90, // 9
2.55, 1.46, 1.93, 0.86, 1.17, 0.08, 0.39, -0.76, -0.39, -1.51, // 0
-1.17, -2.36, -1.95, -3.06, -2.62, -3.55, -2.95, -3.75, -3.07, -3.79, // 1
-3.06, -3.77, -3.05, -3.78, -3.12, -3.90, -3.35, -4.24, -3.86, -4.92, // 2
-5.06, -6.77, -7.41, -9.18,-10.16,-11.12, -9.76, -9.23, -7.96, -7.65 // 3
};
// const G4double G4NucleiProperties::SPZTable[TableSize] = {
// 20.80, 15.80, 21.00, 16.80, 19.80, 16.50, 18.80, 16.50, 18.50, 17.20, // 1 - 10
// 18.26, 15.05, 16.01, 12.04, 13.27, 11.09, 12.17, 10.26, 11.04, 8.41, // 11 - 20
// 9.79, 7.36, 8.15, 5.63, 5.88, 3.17, 3.32, .82, 1.83, .97, // 21 - 30
// 2.33, 1.27, 2.92, 1.61, 2.91, 1.35, 2.40, .89, 1.74, .36, // 31
// 0.95, -0.65, -0.04, -1.73, -0.96, -2.87, -2.05, -4.05, -3.40, -5.72, // 41
// -3.75, -4.13, -2.42, -2.85, -1.01, -1.33, 0.54, -0.02, 1.74, 0.75, // 51
// 2.24, 1.00, 1.98, 0.79, 1.54, 0.39, 1.08, 0.00, 0.78, -0.35, // 61
// 0.58, -0.55, 0.59, -0.61, 0.59, -0.35, 0.32, -0.96, -0.52, -2.08, // 71
// -2.46, -3.64, -1.55, -0.96, 0.97, 0.88, 2.37, 1.75, 2.72, 1.90, // 81
// 2.55, 1.46, 1.93, 0.86, 1.17, 0.08, 0.39, -0.76, -0.39, -1.51, // 91 - 100
// -1.17, -2.36, -1.95, -3.06, -2.62, -3.55, -2.95, -3.75, -3.07, -3.79, // 101 - 110
// -3.06, -3.77, -3.05, -3.78, -3.12, -3.90, -3.35, -4.24, -3.86, -4.92, // 111 - 120
// -5.06, -6.77, -7.41, -9.18,-10.16,-11.12, -9.76, -9.23, -7.96, -7.65, // 121 - 130
// // --------- from this point there are not tabulated values -----------------------
// 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // 131 - 140
// 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // 141 - 150
// 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // 151
// 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // 161
// 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // 171
// 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, // 181
// 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00 // 191 - 200
// };
// S(N)+P(N) from Tab. 1 from A.G.W. Cameron, Canad. J. Phys., 35(1957)1021
// or Delta M(N) from Tab. 97 of book [1]
const G4double G4NucleiProperties::daTAZ[G4NucleiProperties::NTAZ] = {
-8.40,-12.90, -8.00, 11.90, -9.20,-12.50,-10.80,-13.60,-11.20,-12.20, // 1
-12.81,-15.40,-13.07,-15.80,-13.81,-14.98,-12.63,-13.76,-11.37,-12.38, // 2
-9.23, -9.65, -7.64, -9.17, -8.05, -9.72, -8.87,-10.76, -8.64, -8.89, // 3
-6.60, -7.13, -4.77, -5.33, -3.06, -3.79, -1.72, -2.79, -0.93, -2.19, // 4
-0.52, -1.90, -0.45, -2.20, -1.22, -3.07, -2.42, -4.37, -3.94, -6.08, // 5
-4.49, -4.50, -3.14, -2.93, -1.04, -1.36, 0.69, 0.21, 2.11, 1.33, // 6
3.29, 2.46, 4.30, 3.32, 4.79, 3.62, 4.97, 3.64, 4.63, 3.07, // 7
4.06, 2.49, 3.30, 1.46, 2.06, 0.51, 0.74, -1.18, -1.26, -3.54, // 8
-3.97, -5.26, -4.18, -3.71, -2.10, -1.70, -0.08, -0.18, 0.94, 0.27, // 9
1.13, 0.08, 0.91, -0.31, 0.49, -0.78, 0.08, -1.15, -0.23, -1.41, // 0
-0.42, -1.55, -0.55, -1.66, -0.66, -1.73, -0.75, -1.74, -0.78, -1.69, // 1
-0.78, -1.60, -0.75, -1.46, -0.67, -1.26, -0.51, -1.04, -0.53, -1.84, // 2
-2.42, -4.52, -4.76, -6.33, -6.76, -7.81, -5.80, -5.37, -3.63, -3.35, // 3
-1.75, -1.88, -0.61, -0.90, 0.09, -0.32, 0.55, -0.13, 0.70, -0.06, // 4
0.49, -0.20, 0.40, -0.22, 0.36, -0.09, 0.58, 0.12, 0.75, 0.15, // 5
0.70, 0.17, 1.11, 0.89, 1.85, 1.62, 2.54, 2.29, 3.20, 2.91, // 6
3.84, 3.53, 4.48, 4.15, 5.12, 4.78, 5.75, 5.39, 6.31, 5.91, // 7
6.87, 6.33, 7.13, 6.61, 7.30, 6.31, 6.27, 4.83, 4.49, 2.85, // 8
2.32, 0.58, -0.11, -0.98, 0.81, 1.77, 3.37, 4.13, 5.60, 6.15, // 9
7.29, 7.35, 7.95, 7.67, 8.16, 7.83, 8.31, 8.01, 8.53, 8.27 // 0
};
// const G4double G4NucleiProperties::SPNTable[TableSize] = {
// -8.40,-12.90, -8.00, 11.90, -9.20,-12.50,-10.80,-13.60,-11.20,-12.20, // 1 - 10
// -12.81,-15.40,-13.07,-15.80,-13.81,-14.98,-12.63,-13.76,-11.37,-12.38, // 11 - 20
// -9.23, -9.65, -7.64, -9.17, -8.05, -9.72, -8.87,-10.76, -8.64, -8.89, // 21 - 30
// -6.60, -7.13, -4.77, -5.33, -3.06, -3.79, -1.72, -2.79, -0.93, -2.19, // 31
// -0.52, -1.90, -0.45, -2.20, -1.22, -3.07, -2.42, -4.37, -3.94, -6.08, // 41
// -4.49, -4.50, -3.14, -2.93, -1.04, -1.36, 0.69, 0.21, 2.11, 1.33, // 51
// 3.29, 2.46, 4.30, 3.32, 4.79, 3.62, 4.97, 3.64, 4.63, 3.07, // 61
// 4.06, 2.49, 3.30, 1.46, 2.06, 0.51, 0.74, -1.18, -1.26, -3.54, // 71
// -3.97, -5.26, -4.18, -3.71, -2.10, -1.70, -0.08, -0.18, 0.94, 0.27, // 81
// 1.13, 0.08, 0.91, -0.31, 0.49, -0.78, 0.08, -1.15, -0.23, -1.41, // 91 - 100
// -0.42, -1.55, -0.55, -1.66, -0.66, -1.73, -0.75, -1.74, -0.78, -1.69, // 101 - 110
// -0.78, -1.60, -0.75, -1.46, -0.67, -1.26, -0.51, -1.04, -0.53, -1.84, // 111 - 120
// -2.42, -4.52, -4.76, -6.33, -6.76, -7.81, -5.80, -5.37, -3.63, -3.35, // 121 - 130
// -1.75, -1.88, -0.61, -0.90, 0.09, -0.32, 0.55, -0.13, 0.70, -0.06, // 131 - 140
// 0.49, -0.20, 0.40, -0.22, 0.36, -0.09, 0.58, 0.12, 0.75, 0.15, // 141 - 150
// 0.70, 0.17, 1.11, 0.89, 1.85, 1.62, 2.54, 2.29, 3.20, 2.91, // 151
// 3.84, 3.53, 4.48, 4.15, 5.12, 4.78, 5.75, 5.39, 6.31, 5.91, // 161
// 6.87, 6.33, 7.13, 6.61, 7.30, 6.31, 6.27, 4.83, 4.49, 2.85, // 171
// 2.32, 0.58, -0.11, -0.98, 0.81, 1.77, 3.37, 4.13, 5.60, 6.15, // 181
// 7.29, 7.35, 7.95, 7.67, 8.16, 7.83, 8.31, 8.01, 8.53, 8.27 // 191 - 200
// };
G4double G4NucleiProperties::PSCorrectedCameronMassExcess( const G4int A, const G4int Z )
{
if( Z >= G4NucleiProperties::NTZ || A - Z >= G4NucleiProperties::NTAZ )
G4Exception( "G4NucleiProperties::CameronMassExcess: Value parameters error!" );
const G4double A03 = pow(A,1.0/3.0);
const G4double A06 = A03*A03;
const G4double A13 = A06*A06;
const G4double Z13 = pow(Z,1.0+1.0/3.0);
const G4double D = (A - 2.0*Z)/A;
const G4double DR = 1.0 - 0.32052/A06;
// Surface term
G4double SurfaceEnergy = (25.8357 - 44.2355 * D * D) * DR*DR * A06;
// Coulomb term
G4double CoulombEnergy = 0.779* (Z*(Z-1)/A03)* (1.0 - 1.5849/A06 + 1.2273/A + 1.5772/A13);
// Exchange term
G4double ExchangeEnergy = -0.4323 * (Z13/A03) * (1.0 - 0.57811/A03 - 0.14518/A06 + 0.49597/A);
// Volume term
G4double VolumeEnergy = A* 8.367 + (31.4506/A) * (A - 2*Z)*(A - 2*Z) - 0.783* Z - 17.0354 * A;
// Compute Mass Excess
return (SurfaceEnergy + CoulombEnergy + ExchangeEnergy + VolumeEnergy + daTZ[Z] + daTAZ[A - Z])*MeV;
}
File diff suppressed because it is too large Load Diff
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleDefinition.cc,v 2.9 1998/11/26 10:13:39 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleDefinition.cc,v 1.3 1999/04/14 10:28:28 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -28,8 +28,7 @@
// added Resonance flag and ApplyCuts flag H.Kurashige 27 June 1998
// modify FillQuarkContents() for quarks/diquarks H.Kurashige 30 June 1998
// modify encoding rule H.Kurashige 23 Oct. 98
// commented out G4cout/G4cerr in the constructor 10 Nov.,98 H.Kurashige
// modify FillQuarkContents() for deltas 25 Nov.,98 H.Kurashige
// modify FillQuarkContents() for deltas 25 Nov.,98 H.Kurashige
// --------------------------------------------------------------
@@ -77,7 +76,7 @@ G4ParticleDefinition::G4ParticleDefinition(
thePDGStable(stable),
thePDGLifeTime(lifetime),
theDecayTable(decaytable),
theProcessManager(NULL),
theProcessManager(0),
fShortLivedFlag(shortlived),
fApplyCutsFlag(false),
verboseLevel(1)
@@ -85,32 +84,15 @@ G4ParticleDefinition::G4ParticleDefinition(
// check name and register this particle into ParticleTable
theParticleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition *ptr = theParticleTable->Insert(this);
//#ifdef G4VERBOSE
//if (ptr != this) {
// // Fail to register to ParticleTable
// if (ptr != NULL) {
// // particle with same name already exists in ParticleTable
// if (verboseLevel>0) {
// G4cerr << "Particle name of " << aName << " has already defined " <<endl;
// G4cerr << "This particle is not registered in ParticleTable " << endl;
// } else {
// if (verboseLevel>0) {
// G4cerr << "Particle name of " << aName;
// G4cerr << " is not registered in ParticleTable" <<endl;
// if (verboseLevel>1) this->DumpTable();
// }
// }
// }
//}
//#endif
// check quark contents
#ifdef G4VERBOSE
if (this->FillQuarkContents() != thePDGEncoding) {
if (verboseLevel>0) {
// G4cerr << "Particle " << aName << " has a strange PDGEncoding " <<endl;
// cerr bnot G4cerr is used intentionally
// because G4ParticleDefinition constructor may be called
// before G4cerr object is instantiated !!
cerr << "Particle " << aName << " has a strange PDGEncoding " <<endl;
// if (verboseLevel>1) this->DumpTable();
}
}
#endif
@@ -119,22 +101,17 @@ G4ParticleDefinition::G4ParticleDefinition(
G4ParticleDefinition::G4ParticleDefinition(const G4ParticleDefinition &right)
{
G4Exception("You call Copy Constructor of G4ParticleDefinition ");
//G4cerr << "You call Copy Constructor of G4ParticleDefinition " << endl;
//#ifdef G4VERBOSE
// if (verboseLevel>0) right.DumpTable();
//#endif
}
G4ParticleDefinition::G4ParticleDefinition()
{
G4Exception("You call Default Constructor of G4ParticleDefinition ");
//G4cerr << "You call Default Constructor of G4ParticleDefinition " << endl;
}
G4ParticleDefinition::~G4ParticleDefinition()
{
if (theDecayTable!= NULL) delete theDecayTable;
if (theDecayTable!= 0) delete theDecayTable;
}
@@ -194,23 +171,23 @@ G4int G4ParticleDefinition::FillQuarkContents()
if (theParticleType =="quarks") {
if ((quark1 !=0) || (quark2 !=0) || (quark3 !=0)) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " ??? unknown quark ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " ??? unknown quark ";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
// --- thePDGEncoding is wrong
tempPDGcode = 0;
} else {
quark1 = abs(tempPDGcode);
if (quark1>NumberOfQuarkFlavor){
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " ??? unknown quark ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
cout << " ??? unknown quark ";
cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
// --- thePDGEncoding is wrong
tempPDGcode = 0;
} else {
@@ -231,12 +208,12 @@ G4int G4ParticleDefinition::FillQuarkContents()
// --- thePDGEncoding is wrong
tempPDGcode = 0;
} else if (quark2>NumberOfQuarkFlavor){
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " ??? unknown quark ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " ??? unknown quark ";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
} else {
if (tempPDGcode>0){
@@ -264,50 +241,50 @@ G4int G4ParticleDefinition::FillQuarkContents()
}
if (quark1 !=0) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " meson has only quark and anti-quark pair";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " meson has only quark and anti-quark pair";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
if ((quark2==0)||(quark3==0)){
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " meson has quark and anti-quark pair";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " meson has quark and anti-quark pair";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
// check spin
if ( spin != thePDGiSpin) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " illegal SPIN (" << thePDGiSpin << "/2)";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal SPIN (" << thePDGiSpin << "/2)";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
if (quark2<quark3) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " illegal code for meson ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal code for meson ";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
// check quark flavor
if (quark2> NumberOfQuarkFlavor){
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " ??? unknown quark ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " ??? unknown quark ";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
// check heavier quark type
@@ -339,23 +316,23 @@ G4int G4ParticleDefinition::FillQuarkContents()
totalCharge += (-2./3.)*eplus*theAntiQuarkContent[flavor+1];
}
if (abs(totalCharge-thePDGCharge)>0.1*eplus) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " illegal charge for meson " << thePDGCharge/eplus;
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal charge for meson " << thePDGCharge/eplus;
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
} else if (theParticleType == "baryon"){
// check meson or not
if ((quark1==0)||(quark2==0)||(quark3==0)){
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " meson has three quark ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " meson has three quark ";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
//exceptions
@@ -399,31 +376,31 @@ G4int G4ParticleDefinition::FillQuarkContents()
// check spin
if (spin != thePDGiSpin) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " illegal SPIN (" << thePDGiSpin << "/2";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal SPIN (" << thePDGiSpin << "/2";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
// check quark flavor
if ((quark1<quark2)||(quark2<quark3)||(quark1<quark3)) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " illegal code for baryon ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal code for baryon ";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
if (quark1> NumberOfQuarkFlavor) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " ??? unknown quark ";
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " ??? unknown quark ";
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
if (tempPDGcode >0) {
@@ -444,12 +421,12 @@ G4int G4ParticleDefinition::FillQuarkContents()
totalCharge += (-2./3.)*eplus*theAntiQuarkContent[flavor+1];
}
if (abs(totalCharge-thePDGCharge)>0.1*eplus) {
//#ifdef G4VERBOSE
//if (verboseLevel>0) {
// G4cerr << " illegal charge for baryon " << thePDGCharge/eplus;
// G4cerr << " PDG code=" << thePDGEncoding <<endl;
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << " illegal charge for baryon " << thePDGCharge/eplus;
G4cout << " PDG code=" << thePDGEncoding <<endl;
}
#endif
tempPDGcode = 0;
}
} else {
@@ -497,7 +474,7 @@ void G4ParticleDefinition::DumpTable() const
if ( thePDGStable ){
G4cout << " Stable : stable" << endl;
} else {
if( theDecayTable != NULL ){
if( theDecayTable != 0 ){
theDecayTable->DumpInfo();
} else {
G4cout << "Decay Table is not defined !!" <<endl;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleMessenger.cc,v 2.5 1998/11/25 13:59:07 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleMessenger.cc,v 1.2 1999/04/13 08:00:30 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
@@ -40,7 +40,7 @@
G4ParticleMessenger::G4ParticleMessenger(G4ParticleTable* pTable)
{
// get the pointer to ParticleTable
if ( pTable == NULL) {
if ( pTable == 0) {
theParticleTable = G4ParticleTable::GetParticleTable();
} else {
theParticleTable = pTable;
@@ -70,7 +70,7 @@ G4ParticleMessenger::G4ParticleMessenger(G4ParticleTable* pTable)
findCmd->SetDefaultValue(0);
findCmd->SetParameterName("encoding", false);
currentParticle = NULL;
currentParticle = 0;
//UI messenger for Particle Properties
fParticlePropertyMessenger = new G4ParticlePropertyMessenger(theParticleTable);
@@ -112,13 +112,13 @@ void G4ParticleMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
} else if( command==selectCmd ){
//Commnad /particle/select
currentParticle = theParticleTable->FindParticle(newValues);
if(currentParticle == NULL) {
if(currentParticle == 0) {
G4cout << "Unknown particle [" << newValues << "]. Command ignored." << endl;
}
} else if( command==findCmd ){
//Commnad /particle/find
G4ParticleDefinition* tmp = theParticleTable->FindParticle( findCmd->GetNewIntValue(newValues));
if(tmp == NULL) {
if(tmp == 0) {
G4cout << "Unknown particle [" << newValues << "]. Command ignored." << endl;
} else {
G4cout << tmp->GetParticleName() << endl;
@@ -139,12 +139,13 @@ G4String G4ParticleMessenger::GetCurrentValue(G4UIcommand * command)
G4ParticleDefinition *particle = piter->value();
candidates += " " + particle->GetParticleName();
}
selectCmd->SetCandidates(candidates);
selectCmd->SetCandidates((const char *)(candidates));
static G4String noName("none");
// current value
if(currentParticle == NULL) {
if(currentParticle == 0) {
// no particle is selected. return null
return "none";
return noName;
} else {
return currentParticle->GetParticleName();
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticlePropertyMessenger.cc,v 2.4 1998/07/13 17:18:47 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticlePropertyMessenger.cc,v 1.2 1999/04/13 08:00:31 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
//---------------------------------------------------------------
@@ -40,10 +40,10 @@
G4ParticlePropertyMessenger::G4ParticlePropertyMessenger(G4ParticleTable* pTable)
:theParticleTable(pTable),
currentParticle(NULL),
fDecayTableMessenger(NULL)
currentParticle(0),
fDecayTableMessenger(0)
{
if ( theParticleTable == NULL) theParticleTable = G4ParticleTable::GetParticleTable();
if ( theParticleTable == 0) theParticleTable = G4ParticleTable::GetParticleTable();
//Commnad /particle/property/
thisDirectory = new G4UIdirectory("/particle/property/");
thisDirectory->SetGuidance("Paricle Table control commands.");
@@ -89,8 +89,8 @@ G4ParticlePropertyMessenger::G4ParticlePropertyMessenger(G4ParticleTable* pTable
G4ParticlePropertyMessenger::~G4ParticlePropertyMessenger()
{
if (fDecayTableMessenger !=NULL) delete fDecayTableMessenger;
fDecayTableMessenger = NULL;
if (fDecayTableMessenger !=0) delete fDecayTableMessenger;
fDecayTableMessenger = 0;
delete stableCmd;
delete verboseCmd;
@@ -101,7 +101,7 @@ G4ParticlePropertyMessenger::~G4ParticlePropertyMessenger()
void G4ParticlePropertyMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if (SetCurrentParticle()==NULL) {
if (SetCurrentParticle()==0) {
G4cout << "Particle is not selected yet !! Command ignored." << endl;
return;
}
@@ -138,7 +138,7 @@ G4ParticleDefinition* G4ParticlePropertyMessenger::SetCurrentParticle()
G4String particleName = G4UImanager::GetUIpointer()->GetCurrentStringValue("/particle/select");
if (currentParticle != NULL ){
if (currentParticle != 0 ){
// check whether selection is changed
if (currentParticle->GetParticleName() != particleName) {
currentParticle = theParticleTable->FindParticle(particleName);
@@ -153,7 +153,7 @@ G4String G4ParticlePropertyMessenger::GetCurrentValue(G4UIcommand * command)
{
G4String returnValue('\0');
if (SetCurrentParticle()==NULL) {
if (SetCurrentParticle()==0) {
// no particle is selected. return null
return returnValue;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleTable.cc,v 2.10 1998/11/13 17:37:33 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleTable.cc,v 1.6 1999/05/19 15:07:18 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
// class G4ParticleTable
//
@@ -20,7 +20,8 @@
// modified FindIon 02 Aug., 98 H.Kurashige
// added dictionary for encoding 24 Sep., 98 H.Kurashige
// fixed bugs in destruction of IonTable 08 Nov.,98 H.Kurashige
// commented out G4cout/G4cerr in the constructor 10 Nov.,98 H.Kurashige
// commented out G4cout/G4cout in the constructor 10 Nov.,98 H.Kurashige
// modified destructor for STL interface 18 May 1999
#include "G4ios.hh"
#include "globals.hh"
@@ -33,7 +34,7 @@
const G4int G4ParticleTableDefaultBucket = 32;
const G4int G4ParticleTableMaxInABucket = 64;
G4ParticleTable::G4ParticleTable():verboseLevel(0),fParticleMessenger(NULL)
G4ParticleTable::G4ParticleTable():verboseLevel(0),fParticleMessenger(0)
{
DictionaryBucketSize = G4ParticleTableDefaultBucket;
fDictionary = new G4PTblDictionary(G4ParticleTable::HashFun,DictionaryBucketSize);
@@ -50,30 +51,25 @@ G4ParticleTable::G4ParticleTable():verboseLevel(0),fParticleMessenger(NULL)
G4ParticleTable::~G4ParticleTable()
{
// delete G4String objects for key
G4String* pS;
if (fDictionary->entries()>0){
fIterator -> reset();
while( (*fIterator)() ){
if (pS = fIterator -> key()) delete pS;
if(fDictionary)
{
fDictionary->clear();
delete fDictionary;
}
fDictionary -> clear();
}
delete fIterator;
delete fDictionary;
if (fParticleMessenger!=NULL) delete fParticleMessenger;
if (fParticleMessenger!=0) delete fParticleMessenger;
// delete dictionary for encoding
if (fEncodingDictionary!=NULL){
if (fEncodingDictionary!=0){
fEncodingDictionary -> clear();
delete fEncodingDictionary;
}
//delete Ion Table and contents
if (fIonTable!=NULL) delete fIonTable;
if (fIonTable!=0) delete fIonTable;
// delete Short Lived table and contents
if (fShortLivedTable!=NULL) delete fShortLivedTable;
if (fShortLivedTable!=0) delete fShortLivedTable;
}
G4ParticleTable::G4ParticleTable(const G4ParticleTable &right)
@@ -97,7 +93,7 @@ G4ParticleTable* G4ParticleTable::GetParticleTable()
G4UImessenger* G4ParticleTable::CreateMessenger()
{
if (fParticleMessenger== NULL) {
if (fParticleMessenger== 0) {
//UI messenger
fParticleMessenger = new G4ParticleMessenger(this);
}
@@ -106,10 +102,10 @@ G4UImessenger* G4ParticleTable::CreateMessenger()
void G4ParticleTable::DeleteMessenger()
{
if (fParticleMessenger!= NULL) {
if (fParticleMessenger!= 0) {
//UI messenger
delete fParticleMessenger;
fParticleMessenger= NULL;
fParticleMessenger= 0;
// remove all items from G4ParticleTable
RemoveAllParticles();
}
@@ -120,67 +116,60 @@ void G4ParticleTable::RemoveAllParticles()
#ifdef G4VERBOSE
if (verboseLevel>1){
G4cerr << "G4ParticleTable::RemoveAllParticles() " << endl;
G4cout << "G4ParticleTable::RemoveAllParticles() " << endl;
}
#endif
//delete Ion Table and contents
if (fIonTable!=NULL) {
if (fIonTable!=0) {
delete fIonTable;
fIonTable = NULL;
fIonTable = 0;
}
// delete Short Lived table and contents
if (fShortLivedTable!=NULL) {
if (fShortLivedTable!=0) {
delete fShortLivedTable;
fShortLivedTable = NULL;
fShortLivedTable = 0;
}
// delete dictionary for encoding
if (fEncodingDictionary!=NULL){
G4int* pCode;
G4PTblEncodingDicIterator* fEncodeIterator;
fEncodeIterator = new G4PTblEncodingDicIterator(*fEncodingDictionary);
fEncodeIterator-> reset();
while( (*fEncodeIterator)() ){
if (pCode = fEncodeIterator-> key()) delete pCode;
}
fEncodingDictionary -> clear();
delete fEncodeIterator;
delete fEncodingDictionary;
fEncodingDictionary = NULL;
}
if (fEncodingDictionary)
{
fEncodingDictionary->clear();
delete fEncodingDictionary;
fEncodingDictionary = 0;
}
// delete G4String objects for key
G4String* pS;
fIterator -> reset();
while( (*fIterator)() ){
if (pS = fIterator -> key()) delete pS;
}
fDictionary -> clear();
if (fDictionary)
{
fDictionary->clear();
delete fDictionary;
fDictionary = 0;
}
}
G4ParticleDefinition* G4ParticleTable::Insert(G4ParticleDefinition *particle)
{
// check particle name
if ((particle == NULL) || (GetKey(particle).isNull())) {
//#ifdef G4VERBOSE
//if (verboseLevel>0){
// G4cerr << "The particle[Addr:" << particle << "] has no name "<< endl;
//}
//#endif
return NULL;
if ((particle == 0) || (GetKey(particle).isNull())) {
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "The particle[Addr:" << particle << "] has no name "<< endl;
}
#endif
return 0;
}else {
if (contains(particle)) {
//#ifdef G4VERBOSE
//if (verboseLevel>1){
// G4cerr << "The particle[Addr:" << particle;
// G4cerr << "] has same name as "<< endl;
// FindParticle(particle) -> DumpTable();
//}
//#endif
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cout << "The particle has same name "<< endl;
}
if (verboseLevel>1){
FindParticle(particle) -> DumpTable();
}
#endif
return FindParticle(particle);
} else {
G4PTblDictionary *pdic = GetDictionary();
@@ -189,14 +178,14 @@ G4ParticleDefinition* G4ParticleTable::Insert(G4ParticleDefinition *particle)
if (pdic -> entries() > G4ParticleTableMaxInABucket*DictionaryBucketSize) {
DictionaryBucketSize *= 2;
pdic -> resize(DictionaryBucketSize);
G4PTblDicIterator *piter = GetIterator();
G4PTblDicIterator *piter = fIterator;
piter -> reset();
}
// insert into EncodingDictionary
G4int code = particle->GetPDGEncoding();
if (code !=0 ) {
G4PTblEncodingDictionary *pedic = GetEncodingDictionary();
G4PTblEncodingDictionary *pedic = fEncodingDictionary;
pedic -> insertKeyAndValue(new G4int(code), particle);
}
@@ -217,7 +206,7 @@ G4ParticleDefinition* G4ParticleTable::Insert(G4ParticleDefinition *particle)
G4ParticleDefinition* G4ParticleTable::Remove(G4ParticleDefinition* particle)
{
if (! contains(particle) ) return NULL;
if (! contains(particle) ) return 0;
G4String particle_name = GetKey(particle);
fDictionary->remove(&particle_name );
@@ -225,7 +214,7 @@ G4ParticleDefinition* G4ParticleTable::Remove(G4ParticleDefinition* particle)
// remove from EncodingDictionary
G4int code = particle->GetPDGEncoding();
if (code !=0 ) {
G4PTblEncodingDictionary *pedic = GetEncodingDictionary();
G4PTblEncodingDictionary *pedic = fEncodingDictionary;
pedic -> remove(&code);
}
@@ -243,9 +232,9 @@ G4ParticleDefinition* G4ParticleTable::Remove(G4ParticleDefinition* particle)
G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4int J, G4int Q)
{
if (Z<=0) return NULL;
if (A<Z) return NULL;
if (J<0) return NULL;
if (Z<=0) return 0;
if (A<Z) return 0;
if (J<0) return 0;
if (Q<0) Q=Z;
return fIonTable->GetIon(Z, A, J, Q);
}
@@ -253,7 +242,7 @@ G4ParticleDefinition* G4ParticleTable::FindIon(G4int Z, G4int A, G4int J, G4int
G4ParticleDefinition* G4ParticleTable::GetParticle(G4int index)
{
if ( (index >=0) && (index < entries()) ) {
G4PTblDicIterator *piter = GetIterator();
G4PTblDicIterator *piter = fIterator;
piter -> reset();
G4int counter = 0;
while( (*piter)() ){
@@ -263,41 +252,41 @@ G4ParticleDefinition* G4ParticleTable::GetParticle(G4int index)
}
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cerr << " G4ParticleTable::GetParticle";
G4cerr << " invalid index (=" << index << ")" << endl;
G4cout << " G4ParticleTable::GetParticle";
G4cout << " invalid index (=" << index << ")" << endl;
}
#endif
return NULL;
return 0;
}
G4ParticleDefinition* G4ParticleTable::FindParticle(G4int aPDGEncoding ) const
G4ParticleDefinition* G4ParticleTable::FindParticle(G4int aPDGEncoding )
{
// check aPDGEncoding is valid
if (aPDGEncoding == 0){
#ifdef G4VERBOSE
if (verboseLevel>0){
G4cerr << "PDGEncoding [" << aPDGEncoding << "] is not valid " << endl;
G4cout << "PDGEncoding [" << aPDGEncoding << "] is not valid " << endl;
}
#endif
return NULL;
return 0;
}
G4PTblEncodingDictionary *pedic = GetEncodingDictionary();
G4PTblEncodingDictionary *pedic = fEncodingDictionary;
G4ParticleDefinition* particle = pedic -> findValue( &aPDGEncoding );
#ifdef G4VERBOSE
if ((particle == NULL) && (verboseLevel>0) ){
G4cerr << "CODE:" << aPDGEncoding << " does not exist in ParticleTable " << endl;
if ((particle == 0) && (verboseLevel>0) ){
G4cout << "CODE:" << aPDGEncoding << " does not exist in ParticleTable " << endl;
}
#endif
return particle;
}
void G4ParticleTable::DumpTable(const G4String &particle_name) const
void G4ParticleTable::DumpTable(const G4String &particle_name)
{
if (( particle_name == "ALL" ) || (particle_name == "all")){
// dump all particles
G4PTblDicIterator *piter = GetIterator();
G4PTblDicIterator *piter = fIterator;
piter -> reset();
while( (*piter)() ){
(piter->value())->DumpTable();
@@ -305,7 +294,7 @@ void G4ParticleTable::DumpTable(const G4String &particle_name) const
} else {
// dump only particle with name of particle_name
G4ParticleDefinition *ptr;
if ( (ptr = FindParticle(particle_name)) != NULL) {
if ( (ptr = FindParticle(particle_name)) != 0) {
ptr->DumpTable();
} else {
#ifdef G4VERBOSE
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleWithCuts.cc,v 2.12 1998/11/28 08:24:17 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ParticleWithCuts.cc,v 1.5 1999/06/09 08:56:54 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -30,6 +30,14 @@
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ios.hh"
#ifdef WIN32
# include <Strstrea.h>
#else
# include <strstream.h>
#endif
G4double G4ParticleWithCuts::LowestEnergy = 0.99e-3*MeV;
G4double G4ParticleWithCuts::HighestEnergy = 100.0e6*MeV;
@@ -59,10 +67,10 @@ G4ParticleWithCuts::G4ParticleWithCuts(
pType, lepton, baryon, encoding, stable,
lifetime, decaytable, shortlived),
NumberOfElements(0),
theLossTable(NULL),
theLossTable(0),
//-- members initialisation for SetCuts ------------------------------
theCutInMaxInteractionLength(-1.0),
theKineticEnergyCuts(NULL)
theKineticEnergyCuts(0)
{
// -- set ApplyCutsFlag in default ----------
SetApplyCutsFlag(false);
@@ -174,25 +182,20 @@ void G4ParticleWithCuts::BuildLossTable()
G4LossTable(G4Element::GetNumberOfElements());
#ifdef G4VERBOSE
if (GetVerboseLevel()>2) {
G4cerr << "G4ParticleWithCuts::BuildLossTable() ";
G4cerr << "Create theLossTable[" << theLossTable << "]";
G4cerr << " NumberOfElements=" << NumberOfElements <<endl;
G4cout << "G4ParticleWithCuts::BuildLossTable() ";
G4cout << "Create theLossTable[" << theLossTable << "]";
G4cout << " NumberOfElements=" << NumberOfElements <<endl;
}
#endif
} else {
if (NumberOfElements != G4Element::GetNumberOfElements())
{
G4String aErrorMessage("Error in G4ParticlWithCuts::BuildLossTable()");
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage;
G4cerr << "[" << this->GetParticleName() << "] " <<endl;
G4cerr <<"inconsistent G4Element::GetNumberOfElements";
G4cerr << G4Element::GetNumberOfElements();
G4cerr << " previous value" << NumberOfElements << endl;
}
#endif
G4Exception((const char*)aErrorMessage);
if (NumberOfElements != G4Element::GetNumberOfElements()){
char errMsg[1024];
ostrstream errOs(errMsg,1024);
errOs << "Error in G4ParticlWithCuts::BuildLossTable()";
errOs << "[" << this->GetParticleName() << "] ";
errOs << " : inconsistent G4Element::GetNumberOfElements =" << G4Element::GetNumberOfElements();
errOs << " previous value" << NumberOfElements << '\0';
G4Exception(errMsg);
}
}
@@ -250,10 +253,10 @@ G4double G4ParticleWithCuts::ConvertCutToKineticEnergy(G4RangeVector* rangeVecto
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "Error in G4ParticleWithCuts::ConvertCutToKineticEnergy" <<endl;
G4cerr << "******** ConvertCutToKineticEnergy for " << GetParticleName();
G4cerr << " ********************" << endl;
G4cerr << "The cut energy is set " << DBL_MAX/GeV << "GeV " <<endl;
G4cout << "Error in G4ParticleWithCuts::ConvertCutToKineticEnergy" <<endl;
G4cout << "******** ConvertCutToKineticEnergy for " << GetParticleName();
G4cout << " ********************" << endl;
G4cout << "The cut energy is set " << DBL_MAX/GeV << "GeV " <<endl;
}
#endif
return DBL_MAX;
@@ -281,29 +284,21 @@ G4double G4ParticleWithCuts::ConvertCutToKineticEnergy(G4RangeVector* rangeVecto
void G4ParticleWithCuts::CalcEnergyCuts(G4double aCut)
{
char errMsg[1024];
ostrstream errOs(errMsg,1024);
// check LowestEnergy/ HighestEnergy/TotBin
if (TotBin<1) {
G4String aErrorMessage("Error in G4ParticlWithCuts::G4ParticlWithCuts");
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage;
G4cerr << "[" << this->GetParticleName() << "]" << endl;
G4cerr << "not defined or illegal TotBin [" << TotBin << "]" <<endl;
}
#endif
G4Exception((const char*)aErrorMessage);
errOs << "Error in G4ParticlWithCuts::G4ParticlWithCuts" ;
errOs << "[" << this->GetParticleName() << "]";
errOs << " : not defined or illegal TotBin [" << TotBin << "]" << '\0';
G4Exception(errMsg);
}
if ( (LowestEnergy<0.0)||(HighestEnergy<=LowestEnergy) ){
G4String aErrorMessage("Error in G4ParticlWithCuts::G4ParticlWithCuts");
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << aErrorMessage;
G4cerr << "[" << this->GetParticleName() << "]" << endl;
G4cerr << " illegal energy range" << "(" << LowestEnergy/GeV;
G4cerr << "," << HighestEnergy/GeV << ") [GeV]" <<endl;
}
#endif
G4Exception((const char*)aErrorMessage);
errOs << "Error in G4ParticlWithCuts::G4ParticlWithCuts";
errOs << "[" << this->GetParticleName() << "]";
errOs << " : illegal energy range" << "(" << LowestEnergy/GeV;
errOs << "," << HighestEnergy/GeV << ") [GeV]" << '\0';
G4Exception(errMsg);
}
// Set cut in stopping range
@@ -318,48 +313,52 @@ void G4ParticleWithCuts::CalcEnergyCuts(G4double aCut)
G4double Charge = this->GetPDGCharge() ;
G4ParticleDefinition* theProton = G4ParticleTable::GetParticleTable()->FindParticle("proton");
G4bool useProtonCut =
((GetParticleName() != "gamma" ) &&
(GetParticleName() != "e-" ) &&
(GetParticleName() != "e+" ) &&
(GetParticleName() != "mu-" ) &&
(GetParticleName() != "mu+" ) &&
(GetParticleName() != "proton" ) &&
(GetParticleName() != "anti_proton" ) &&
(Charge != 0.) );
if (useProtonCut) {
if (theProton ==NULL) {
((GetParticleName() != "gamma" ) &&
(GetParticleName() != "e-" ) &&
(GetParticleName() != "e+" ) &&
(GetParticleName() != "mu-" ) &&
(GetParticleName() != "mu+" ) &&
(GetParticleName() != "proton" ) &&
(GetParticleName() != "anti_proton" ) &&
(Charge != 0.) );
static G4ParticleDefinition* theProton =0;
// check if the proton exists or not
if ((useProtonCut) && (theProton ==0)) {
theProton = G4ParticleTable::GetParticleTable()->FindParticle("proton");
if (theProton ==0) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << " G4ParticleWithCuts::CalcEnergyCuts ";
G4cerr << " proton is not defined !!" << endl;
G4cout << " G4ParticleWithCuts::CalcEnergyCuts ";
G4cout << " proton is not defined !!" << endl;
}
#endif
useProtonCut = false;
}
if (theProton->GetEnergyCuts()==NULL) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << " G4ParticleWithCuts::CalcEnergyCuts ";
G4cerr << " proton energy cut is not defined !!" << endl;
}
#endif
G4Exception("G4ParticleWithCuts::CalcEnergyCuts");
}
}
}
if ( useProtonCut &&
( abs(aCut-theProton->GetLengthCuts())<1.*nanometer) ){
// use energy cuts for Proton
if (useProtonCut) {
// check if cuts for the proton are defined or not
if (theProton->GetEnergyCuts()==0) {
errOs << " G4ParticleWithCuts::CalcEnergyCuts ";
errOs << " proton energy cut is not defined !!" << '\0';
G4Exception(errMsg);
}
// check if the cut in range is same as one fro the proton
useProtonCut = ( abs(aCut-theProton->GetLengthCuts())<1.*nanometer );
}
if (useProtonCut) {
// use energy cuts for Proton
#ifdef G4VERBOSE
if (GetVerboseLevel()>2) {
G4cerr << " G4ParticleWithCuts: [" << GetParticleName() <<"]";
G4cerr << " user Proton Cut " << endl;
G4cout << " G4ParticleWithCuts: [" << GetParticleName() <<"]";
G4cout << " uses Proton Cut " << endl;
}
#endif
G4double ChargeSquare = Charge*Charge ;
G4double ChargeSquare = Charge*Charge/(eplus*eplus) ;
G4double massRatio = proton_mass_c2/(this->GetPDGMass()) ;
for (G4int J=0; J<materialTable->length(); J +=1) {
@@ -367,14 +366,14 @@ void G4ParticleWithCuts::CalcEnergyCuts(G4double aCut)
// cut energy is rescaled by using charge and mass ratio
theKineticEnergyCuts[J] = ChargeSquare*protonEnergyCut/massRatio ;
if(theKineticEnergyCuts[J] < LowestEnergy) {
theKineticEnergyCuts[J] = LowestEnergy ;
theKineticEnergyCuts[J] = LowestEnergy ;
}
}
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>2) {
G4cerr << " G4ParticleWithCuts: [" << GetParticleName() <<"]";
G4cerr << " calcurate by using its own loss table " << endl;
G4cout << " G4ParticleWithCuts: [" << GetParticleName() <<"]";
G4cout << " calcurate by using its own loss table " << endl;
}
#endif
// Build the energy loss table
@@ -481,15 +480,13 @@ void G4ParticleWithCuts::BuildRangeVector(
const G4ElementVector* elementVector = aMaterial->GetElementVector();
const G4double* atomicNumDensityVector = aMaterial->GetAtomicNumDensityVector();
G4int NumEl = aMaterial->GetNumberOfElements();
if (rangeVector == NULL) {
G4String aErrorMessage("Error in G4ParticleWithCuts::BuildRangeVector()");
#ifdef G4VERBOSE
if (GetVerboseLevel() >0) {
G4cerr << aErrorMessage << "[" << this->GetParticleName() << "] " << endl;
G4cerr << "NULL pointer is found in absorptionLengthVector" << endl;
}
#endif
G4Exception((const char*)aErrorMessage);
if (rangeVector == 0) {
char errMsg[1024];
ostrstream errOs(errMsg,1024);
errOs << "Error in G4ParticleWithCuts::BuildRangeVector()";
errOs << "[" << this->GetParticleName() << "] ";
errOs << " : 0 pointer is found in absorptionLengthVector" << '\0';
G4Exception(errMsg);
}
// calculate parameters of the low energy part first
@@ -556,11 +553,11 @@ void G4ParticleWithCuts::BuildRangeVector(
if ( theCutInMaxInteractionLength >= rmax) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "Error in G4ParticleWithCuts::BuildRangeVector()" << endl;
G4cerr << " SetCuts for " << GetParticleName() << endl;
G4cerr << "The maximal meaningful cut is " << rmax/mm << " mm." << endl;
G4cerr << "All the " << GetParticleName() << "will be killed !" << endl;
G4cerr << "in the material " << aMaterial->GetName() << "." << endl;
G4cout << "Error in G4ParticleWithCuts::BuildRangeVector()" << endl;
G4cout << " SetCuts for " << GetParticleName() << endl;
G4cout << "The maximal meaningful cut is " << rmax/mm << " mm." << endl;
G4cout << "All the " << GetParticleName() << "will be killed !" << endl;
G4cout << "in the material " << aMaterial->GetName() << "." << endl;
}
#endif
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhaseSpaceDecayChannel.cc,v 2.5 1998/11/18 09:46:39 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4PhaseSpaceDecayChannel.cc,v 1.3 1999/04/13 08:00:34 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -64,10 +64,10 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::DecayIt(G4double parentMass)
if (GetVerboseLevel()>1) G4cout << "G4PhaseSpaceDecayChannel::DecayIt ";
#endif
G4DecayProducts * products = NULL;
G4DecayProducts * products = 0;
if (parent == NULL) FillParent();
if (daughters == NULL) FillDaughters();
if (parent == 0) FillParent();
if (daughters == 0) FillDaughters();
if (parentMass >0.0) parent_mass = parentMass;
switch (numberOfDaughters){
@@ -93,7 +93,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::DecayIt(G4double parentMass)
break;
}
#ifdef G4VERBOSE
if ((products == NULL) && (GetVerboseLevel()>0)) {
if ((products == 0) && (GetVerboseLevel()>0)) {
G4cout << "G4PhaseSpaceDecayChannel::DecayIt ";
G4cout << *parent_name << " can not decay " << endl;
DumpInfo();
@@ -111,7 +111,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::OneBodyDecayIt()
G4double daughtermass = daughters_mass[0];
//create parent G4DynamicParticle at rest
G4ParticleMomentum dummy;
G4ThreeVector dummy;
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0);
//create G4Decayproducts
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
@@ -147,7 +147,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::TwoBodyDecayIt()
G4double sumofdaughtermass = daughtermass[0] + daughtermass[1];
//create parent G4DynamicParticle at rest
G4ParticleMomentum dummy;
G4ThreeVector dummy;
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0);
//create G4Decayproducts
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
@@ -158,7 +158,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::TwoBodyDecayIt()
G4double costheta = 2.*G4UniformRand()-1.0;
G4double sintheta = sqrt((1.0 - costheta)*(1.0 + costheta));
G4double phi = 2.0*M_PI*G4UniformRand()*rad;
G4ParticleMomentum direction(sintheta*cos(phi),sintheta*sin(phi),costheta);
G4ThreeVector direction(sintheta*cos(phi),sintheta*sin(phi),costheta);
//create daughter G4DynamicParticle
G4DynamicParticle * daughterparticle = new G4DynamicParticle( daughters[0], direction*daughtermomentum);
@@ -193,7 +193,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
}
//create parent G4DynamicParticle at rest
G4ParticleMomentum dummy;
G4ThreeVector dummy;
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0);
//create G4Decayproducts
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
@@ -250,7 +250,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
G4ParticleMomentum direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4ThreeVector direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]);
products->PushProducts(daughterparticle);
@@ -260,7 +260,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ThreeBodyDecayIt()
phin = 2.0*M_PI*G4UniformRand()*rad;
sinphin = sin(phin);
cosphin = cos(phin);
G4ParticleMomentum direction2;
G4ThreeVector direction2;
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);
@@ -315,7 +315,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ManyBodyDecayIt()
//Calculate daughter momentum
G4double *daughtermomentum = new G4double[numberOfDaughters];
G4ParticleMomentum direction;
G4ThreeVector direction;
G4DynamicParticle **daughterparticle;
G4double *sm = new G4double[numberOfDaughters];
G4double tmas;
@@ -381,7 +381,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ManyBodyDecayIt()
delete [] sm;
delete [] daughtermass;
delete [] daughtermomentum;
return NULL; // Error detection
return 0; // Error detection
} else {
// calculate weight of this events
@@ -405,7 +405,7 @@ G4DecayProducts *G4PhaseSpaceDecayChannel::ManyBodyDecayIt()
delete [] sm;
delete [] daughtermass;
delete [] daughtermomentum;
return NULL; // Error detection
return 0; // Error detection
}
} while ( weight > G4UniformRand());
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ShortLivedTable.cc,v 2.4 1998/11/13 17:04:52 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4ShortLivedTable.cc,v 1.2 1999/04/14 10:28:31 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// --------------------------------------------------------------
@@ -61,8 +61,8 @@ void G4ShortLivedTable::Insert(G4ParticleDefinition* particle)
} else {
//#ifdef G4VERBOSE
//if (GetVerboseLevel()>0) {
// G4cerr << "G4ShortLivedTable::Insert :" << particle->GetParticleName() ;
// G4cerr << " is not short lived" << endl;
// G4cout << "G4ShortLivedTable::Insert :" << particle->GetParticleName() ;
// G4cout << " is not short lived" << endl;
//}
//#endif
}
@@ -75,8 +75,8 @@ void G4ShortLivedTable::Remove(G4ParticleDefinition* particle)
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4ShortLivedTable::Remove :" << particle->GetParticleName() ;
G4cerr << " is not short lived" << endl;
G4cout << "G4ShortLivedTable::Remove :" << particle->GetParticleName() ;
G4cout << " is not short lived" << endl;
}
#endif
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VDecayChannel.cc,v 2.5 1998/11/18 09:46:41 kurasige Exp $
// GEANT4 tag $Name: geant4-00 $
// $Id: G4VDecayChannel.cc,v 1.4 1999/06/16 11:42:33 kurasige Exp $
// GEANT4 tag $Name: geant4-00-01 $
//
//
// ------------------------------------------------------------
@@ -29,9 +29,9 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName, G4int Verbose)
:kinematics_name(aName),
verboseLevel(Verbose),rbranch(0.0),
numberOfDaughters(0),
parent_name(NULL),parent(NULL),parent_mass(0.0),
daughters_name(NULL),daughters(NULL),daughters_mass(NULL),
particletable(NULL)
parent_name(0),parent(0),parent_mass(0.0),
daughters_name(0),daughters(0),daughters_mass(0),
particletable(0)
{
// set pointer to G4ParticleTable (static and singleton object)
particletable = G4ParticleTable::GetParticleTable();
@@ -48,9 +48,9 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
:kinematics_name(aName),
verboseLevel(1),rbranch(theBR),
numberOfDaughters(theNumberOfDaughters),
parent_name(NULL),parent(NULL),parent_mass(0.0),
daughters_name(NULL),daughters(NULL),daughters_mass(NULL),
particletable(NULL)
parent_name(0),parent(0),parent_mass(0.0),
daughters_name(0),daughters(0),daughters_mass(0),
particletable(0)
{
// set pointer to G4ParticleTable (static and singleton object)
particletable = G4ParticleTable::GetParticleTable();
@@ -60,7 +60,7 @@ G4VDecayChannel::G4VDecayChannel(const G4String &aName,
// cleate array
daughters_name = new G4String*[numberOfDaughters];
for (G4int index=0;index<numberOfDaughters;index++) daughters_name[index]=NULL;
for (G4int index=0;index<numberOfDaughters;index++) daughters_name[index]=0;
// daughters' name
if (numberOfDaughters>0) daughters_name[0] = new G4String(theDaughterName1);
@@ -79,7 +79,7 @@ G4VDecayChannel::G4VDecayChannel(const G4VDecayChannel &right)
// copy parent name
parent_name = new G4String(*right.parent_name);
parent = NULL;
parent = 0;
parent_mass = 0.0;
//create array
@@ -95,8 +95,8 @@ G4VDecayChannel::G4VDecayChannel(const G4VDecayChannel &right)
}
//
daughters_mass = NULL;
daughters = NULL;
daughters_mass = 0;
daughters = 0;
// particle table
particletable = G4ParticleTable::GetParticleTable();
@@ -127,10 +127,10 @@ G4VDecayChannel & G4VDecayChannel::operator=(const G4VDecayChannel &right)
}
//
parent = NULL;
daughters = NULL;
parent = 0;
daughters = 0;
parent_mass = 0.0;
daughters_mass = NULL;
daughters_mass = 0;
// particle table
particletable = G4ParticleTable::GetParticleTable();
@@ -141,33 +141,33 @@ G4VDecayChannel & G4VDecayChannel::operator=(const G4VDecayChannel &right)
G4VDecayChannel::~G4VDecayChannel()
{
if (parent_name != NULL) delete parent_name;
if (parent_name != 0) delete parent_name;
ClearDaughtersName();
if (daughters_mass != NULL) delete [] daughters_mass;
if (daughters_mass != 0) delete [] daughters_mass;
}
void G4VDecayChannel::ClearDaughtersName()
{
if ( daughters_name != NULL) {
if ( daughters_name != 0) {
if (numberOfDaughters>0) {
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cerr << "G4VDecayChannel::ClearDaughtersName ";
G4cerr << "clear all daughters " << endl;
G4cout << "G4VDecayChannel::ClearDaughtersName ";
G4cout << "clear all daughters " << endl;
}
#endif
for (G4int index=0; index < numberOfDaughters; index++) {
if (daughters_name[index] != NULL) delete daughters_name[index];
if (daughters_name[index] != 0) delete daughters_name[index];
}
}
delete [] daughters_name;
daughters_name = NULL;
daughters_name = 0;
}
//
if (daughters != NULL) delete [] daughters;
if (daughters_mass != NULL) delete [] daughters_mass;
daughters = NULL;
daughters_mass = NULL;
if (daughters != 0) delete [] daughters;
if (daughters_mass != 0) delete [] daughters_mass;
daughters = 0;
daughters_mass = 0;
numberOfDaughters = 0;
}
@@ -179,7 +179,7 @@ void G4VDecayChannel::SetNumberOfDaughters(G4int size)
ClearDaughtersName();
// cleate array
daughters_name = new G4String*[size];
for (G4int index=0;index<size;index++) daughters_name[index]=NULL;
for (G4int index=0;index<size;index++) daughters_name[index]=0;
numberOfDaughters = size;
}
}
@@ -191,19 +191,19 @@ void G4VDecayChannel::SetDaughter(G4int anIndex,
if (numberOfDaughters<=0) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VDecayChannel::SetDaughter: ";
G4cerr << "Number of daughters is not defined" << endl;
G4cout << "G4VDecayChannel::SetDaughter: ";
G4cout << "Number of daughters is not defined" << endl;
}
#endif
return;
}
// check existence of daughters_name array
if (daughters_name == NULL) {
if (daughters_name == 0) {
// cleate array
daughters_name = new G4String*[numberOfDaughters];
for (G4int index=0;index<numberOfDaughters;index++) {
daughters_name[index]=NULL;
daughters_name[index]=0;
}
}
@@ -211,21 +211,21 @@ void G4VDecayChannel::SetDaughter(G4int anIndex,
if ( (anIndex<0) || (anIndex>=numberOfDaughters) ) {
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VDecayChannel::SetDaughter";
G4cerr << "index out of range " << anIndex << endl;
G4cout << "G4VDecayChannel::SetDaughter";
G4cout << "index out of range " << anIndex << endl;
}
#endif
} else {
// delete the old name if it exists
if (daughters_name[anIndex]!=NULL) delete daughters_name[anIndex];
if (daughters_name[anIndex]!=0) delete daughters_name[anIndex];
// fill the name
daughters_name[anIndex] = new G4String(particle_name);
// refill the array of daughters[] if it exists
if (daughters != NULL) FillDaughters();
if (daughters != 0) FillDaughters();
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cerr << "G4VDecayChannel::SetDaughter[" << anIndex <<"] :";
G4cerr << daughters_name[anIndex] << ":" << *daughters_name[anIndex]<<endl;
G4cout << "G4VDecayChannel::SetDaughter[" << anIndex <<"] :";
G4cout << daughters_name[anIndex] << ":" << *daughters_name[anIndex]<<endl;
}
#endif
}
@@ -233,7 +233,7 @@ void G4VDecayChannel::SetDaughter(G4int anIndex,
void G4VDecayChannel::SetDaughter(G4int anIndex, const G4ParticleDefinition * parent_type)
{
if (parent_type != NULL) SetDaughter(anIndex, parent_type->GetParticleName());
if (parent_type != 0) SetDaughter(anIndex, parent_type->GetParticleName());
}
void G4VDecayChannel::FillDaughters()
@@ -241,53 +241,53 @@ void G4VDecayChannel::FillDaughters()
G4int index;
#ifdef G4VERBOSE
if (verboseLevel>1) G4cerr << "G4VDecayChannel::FillDaughters()" <<endl;
if (verboseLevel>1) G4cout << "G4VDecayChannel::FillDaughters()" <<endl;
#endif
if (daughters != NULL) delete [] daughters;
if (daughters != 0) delete [] daughters;
// parent mass
if (parent == NULL) FillParent();
if (parent == 0) FillParent();
G4double parentmass = parent->GetPDGMass();
//
G4double sumofdaughtermass = 0.0;
if ((numberOfDaughters <=0) || (daughters_name == NULL) ){
if ((numberOfDaughters <=0) || (daughters_name == 0) ){
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VDecayChannel::FillDaughters ";
G4cerr << "numberOfDaughters is not defined yet";
G4cout << "G4VDecayChannel::FillDaughters ";
G4cout << "numberOfDaughters is not defined yet";
}
#endif
daughters = NULL;
daughters = 0;
G4Exception("G4VDecayChannel::FillDaughters");
}
//create and set the array of pointers to daughter particles
daughters = new G4ParticleDefinition*[numberOfDaughters];
if (daughters_mass != NULL) delete [] daughters_mass;
if (daughters_mass != 0) delete [] daughters_mass;
daughters_mass = new G4double[numberOfDaughters];
// loop over all daughters
for (index=0; index < numberOfDaughters; index++) {
if (daughters_name[index] == NULL) {
if (daughters_name[index] == 0) {
// daughter name is not defined
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VDecayChannel::FillDaughters ";
G4cerr << index << "-th daughter is not defined yet" << endl;
G4cout << "G4VDecayChannel::FillDaughters ";
G4cout << index << "-th daughter is not defined yet" << endl;
}
#endif
daughters[index] = NULL;
daughters[index] = 0;
G4Exception("G4VDecayChannel::FillDaughters");
}
//search daughter particles in the particle table
daughters[index] = particletable->FindParticle(*daughters_name[index]);
if (daughters[index] == NULL) {
if (daughters[index] == 0) {
// can not find the daughter particle
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VDecayChannel::FillDaughters ";
G4cerr << index << ":" << *daughters_name[index];
G4cerr << " is not defined !!" << endl;
G4cerr << " The BR of this decay mode is set to zero " << endl;
G4cout << "G4VDecayChannel::FillDaughters ";
G4cout << index << ":" << *daughters_name[index];
G4cout << " is not defined !!" << endl;
G4cout << " The BR of this decay mode is set to zero " << endl;
}
#endif
SetBR(0.0);
@@ -295,8 +295,8 @@ void G4VDecayChannel::FillDaughters()
}
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cerr << index << ":" << *daughters_name[index];
G4cerr << ":" << daughters[index] << endl;
G4cout << index << ":" << *daughters_name[index];
G4cout << ":" << daughters[index] << endl;
}
#endif
daughters_mass[index] = daughters[index]->GetPDGMass();
@@ -308,42 +308,44 @@ void G4VDecayChannel::FillDaughters()
// !!! illegal mass !!!
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr << "G4VDecayChannel::FillDaughters ";
G4cerr << " Energy/Momentum conserevation breaks " <<endl;
G4cerr << " parent:" << *parent_name;
G4cerr << " mass:" << parentmass/GeV << "[GeV/c/c]" <<endl;
for (index=0; index < 3; index++){
G4cerr << " daughter " << index << ":" << *daughters_name[index];
G4cerr << " mass:" << daughters[index]->GetPDGMass()/GeV << "[GeV/c/c]" <<endl;
G4cout << "G4VDecayChannel::FillDaughters ";
G4cout << " Energy/Momentum conserevation breaks " <<endl;
G4cout << " parent:" << *parent_name;
G4cout << " mass:" << parentmass/GeV << "[GeV/c/c]" <<endl;
for (index=0; index < numberOfDaughters; index++){
G4cout << " daughter " << index << ":" << *daughters_name[index];
G4cout << " mass:" << daughters[index]->GetPDGMass()/GeV << "[GeV/c/c]" <<endl;
}
}
#endif
G4Exception("G4VDecayChannel::FillDaughters");
if ( sumofdaughtermass > parentmass+parent->GetPDGWidth() ) {
G4Exception("G4VDecayChannel::FillDaughters");
}
}
}
void G4VDecayChannel::FillParent()
{
if (parent_name == NULL) {
if (parent_name == 0) {
// parent name is not defined
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VDecayChannel::FillParent ";
G4cerr << ": parent name is not defined !!" << endl;
G4cout << "G4VDecayChannel::FillParent ";
G4cout << ": parent name is not defined !!" << endl;
}
#endif
parent = NULL;
parent = 0;
G4Exception("G4VDecayChannel::FillParent");
}
// search parent particle in the particle table
parent = particletable->FindParticle(*parent_name);
if (parent == NULL) {
if (parent == 0) {
// parent particle does not exist
#ifdef G4VERBOSE
if (verboseLevel>0) {
G4cerr << "G4VDecayChannel::FillParent ";
G4cerr << *parent_name << " does not exist !!" << endl;
G4cout << "G4VDecayChannel::FillParent ";
G4cout << *parent_name << " does not exist !!" << endl;
}
#endif
G4Exception("G4VDecayChannel::FillParent");
@@ -353,7 +355,7 @@ void G4VDecayChannel::FillParent()
void G4VDecayChannel::SetParent(const G4ParticleDefinition * parent_type)
{
if (parent_type != NULL) SetParent(parent_type->GetParticleName());
if (parent_type != 0) SetParent(parent_type->GetParticleName());
}
void G4VDecayChannel::DumpInfo()
@@ -362,7 +364,7 @@ void G4VDecayChannel::DumpInfo()
G4cout << " : " ;
for (G4int index=0; index < numberOfDaughters; index++)
{
if(daughters_name[index] != NULL) {
if(daughters_name[index] != 0) {
G4cout << " " << *(daughters_name[index]);
} else {
G4cout << " not defined ";