Import Geant4 0.1.0 source tree
This commit is contained in:
@@ -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 ";
|
||||
|
||||
Reference in New Issue
Block a user