Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DalitzDecayChannel.cc,v 1.3.8.1.2.1 1999/12/08 17:34:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4DalitzDecayChannel.cc,v 1.4 1999/12/15 14:51:12 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DecayProducts.cc,v 1.4.8.1.2.1 1999/12/08 17:34:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4DecayProducts.cc,v 1.5 1999/12/15 14:51:12 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
+39 -28
View File
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DecayTable.cc,v 1.4.8.1.2.1 1999/12/08 17:34:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4DecayTable.cc,v 1.6 2000/02/25 07:36:23 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
@@ -15,8 +15,9 @@
// For information related to this code contact:
// CERN, CN Division, ASD group
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// 27 July 1996 H.Kurashige
// ----------------------------------------
// implementation for STL 14 Feb. 2000 H.Kurashige
// ------------------------------------------------------------
#include "globals.hh"
@@ -30,8 +31,14 @@ G4DecayTable::G4DecayTable():parent(0)
G4DecayTable::~G4DecayTable()
{
channels->clearAndDestroy();
delete channels;
// remove and delete all contents
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
delete (*i);
}
channels->clear();
delete channels;
channels = 0;
}
void G4DecayTable::Insert( G4VDecayChannel * aChannel){
@@ -43,43 +50,47 @@ void G4DecayTable::Insert( G4VDecayChannel * aChannel){
G4cout << " input:" << aChannel->GetParent()->GetParticleName() << G4endl;
#endif
} else {
channels->insert(aChannel);
G4double r = aChannel->GetBR();
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
if (r > (*i)->GetBR()) {
channels->insert(i,aChannel);
return;
}
}
channels->push_back(aChannel);
}
}
G4VDecayChannel *G4DecayTable::SelectADecayChannel()
{
// make cumlative table for branching ratio
G4double sumBR = 0.0;
G4int index;
G4int numberofchannels = channels->entries();
G4double *cumBR = new G4double[numberofchannels];
for (index=numberofchannels-1; index >=0 ; index--) {
sumBR += ((*channels)(index))->GetBR();
cumBR[index] = sumBR;
}
// check if contents exist
if (channels->size()<1) return 0;
// select decay channel
G4double r = sumBR* G4UniformRand();
G4VDecayChannel *channel;
for (index= numberofchannels-1; index >=0 ; index--) {
if (r < cumBR[index]) {
channel = (*channels)(index);
break;
while (1) {
G4double sumBR = 0.0;
G4double r= G4UniformRand();
// select decay channel
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
sumBR += (*i)->GetBR();
if (r < sumBR) {
return (*i);
}
}
}
delete [] cumBR;
return channel;
return 0;
}
void G4DecayTable::DumpInfo() const
{
G4cout << "G4DecayTable: " << parent->GetParticleName() << G4endl;
G4int numberofchannels = channels->entries();
for (G4int index= numberofchannels -1; index >=0 ; index -=1)
{
G4int index =0;
G4VDecayChannelVector::iterator i;
for (i = channels->begin(); i!= channels->end(); ++i) {
G4cout << index << ": ";
((*channels)(index))->DumpInfo();
(*i)->DumpInfo();
index +=1;
}
G4cout << G4endl;
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DecayTableMessenger.cc,v 1.2.8.1.2.3 1999/12/14 07:08:14 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4DecayTableMessenger.cc,v 1.3 1999/12/15 14:51:12 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DynamicParticle.cc,v 1.5.6.1.2.1 1999/12/08 17:34:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4DynamicParticle.cc,v 1.6 1999/12/15 14:51:12 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ElectronOccupancy.cc,v 1.4.6.1.2.1 1999/12/08 17:34:08 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ElectronOccupancy.cc,v 1.5 1999/12/15 14:51:12 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ----------------------------------------------------------------------
+10 -47
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 1.22.4.6 1999/12/14 09:16:47 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4IonTable.cc,v 1.25 2000/02/25 07:36:23 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -61,15 +61,9 @@ G4IonTable::~G4IonTable()
// delete ion objects
G4ParticleDefinition* particle;
#ifdef G4USE_STL
G4IonList::reverse_iterator i;
for (i = fIonList->rbegin(); i!= fIonList->rend(); ++i) {
particle = *i;
#else
G4int idx;
for (idx=(fIonList->entries()-1); idx >=0 ; idx--) {
particle = (*fIonList)(idx);
#endif
if ( !IsLightIon(particle) ) {
// delete if not static objects
@@ -114,6 +108,7 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4double E, G4int
G4double life = -1.0;
G4DecayTable* decayTable =0;
G4bool stable = true;
G4IsotopeProperty* fProperty = FindIsotope(Z, A, E, J);
if (fProperty !=0 ){
@@ -122,7 +117,7 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4double E, G4int
life = fProperty->GetLifeTime();
decayTable = fProperty->GetDecayTable();
}
stable = (life <= 0.);
G4double mass = GetNucleusMass(Z, A)+ E;
G4double charge = G4double(Z)*eplus;
@@ -133,7 +128,10 @@ G4ParticleDefinition* G4IonTable::CreateIon(G4int Z, G4int A, G4double E, G4int
J, +1, 0,
0, 0, 0,
"nucleus", 0, A, 0,
true, life, decayTable);
stable, life, decayTable);
// Set Excitation Energy
((G4Ions*)(ion))->SetExcitationEnergy(E);
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
@@ -209,15 +207,9 @@ G4ParticleDefinition* G4IonTable::FindIon(G4int Z, G4int A, G4double E, G4int J)
G4bool isFound = false;
// -- loop over all particles in Ion table
#ifdef G4USE_STL
G4IonList::iterator idx;
for (idx = fIonList->begin(); idx!= fIonList->end(); ++idx) {
ion = *idx;
#else
G4int idx;
for (idx= 0; idx < fIonList->entries() ; ++idx) {
ion = (*fIonList)(idx);
#endif
// Z = Atomic Number
G4int anAtomicNumber = 0;
@@ -373,11 +365,7 @@ G4double G4IonTable::GetIonMass(G4int Z, G4int A) const
void G4IonTable::Insert(G4ParticleDefinition* particle)
{
if (IsIon(particle)) {
#ifdef G4USE_STL
fIonList->push_back(particle);
#else
fIonList->insert(particle);
#endif
} else {
//#ifdef G4VERBOSE
//if (GetVerboseLevel()>0) {
@@ -392,17 +380,12 @@ void G4IonTable::Insert(G4ParticleDefinition* particle)
void G4IonTable::Remove(G4ParticleDefinition* particle)
{
if (IsIon(particle)) {
#ifdef G4USE_STL
G4IonList::iterator idx;
for (idx = fIonList->begin(); idx!= fIonList->end(); ++idx) {
if ( particle == *idx) {
fIonList->erase(idx);
}
}
#else
fIonList->remove(particle);
#endif
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
@@ -422,14 +405,9 @@ void G4IonTable::Remove(G4ParticleDefinition* particle)
void G4IonTable::DumpTable(const G4String &particle_name) const
{
G4ParticleDefinition* ion;
#ifdef G4USE_STL
G4IonList::iterator idx;
for (idx = fIonList->begin(); idx!= fIonList->end(); ++idx) {
ion = *idx;
#else
for (G4int idx= 0; idx < fIonList->entries() ; idx++) {
ion = (*fIonList)(idx);
#endif
if (( particle_name == "ALL" ) || (particle_name == "all")){
ion->DumpTable();
} else if ( particle_name == ion->GetParticleName() ) {
@@ -543,25 +521,10 @@ G4VIsotopeTable* G4IonTable::GetIsotopeTable() const
////////////////////
G4IsotopeProperty* G4IonTable::FindIsotope(G4int Z, G4int A, G4double E, G4int J)
{
G4IsotopeProperty* fProperty = new G4IsotopeProperty();
// Set Isotope Property
fProperty->SetAtomicNumber(Z);
fProperty->SetAtomicMass(A);
fProperty->SetEnergy(E);
fProperty->SetiSpin(J);
fProperty->SetLifeTime(-1.0);
fProperty->SetDecayTable(0);
if (fIsotopeTable ==0) return 0;
// ask IsotopeTable
if (fIsotopeTable->FindIsotope(fProperty)) {
return fProperty;
} else {
delete fProperty;
return 0;
}
// ask IsotopeTable // ask IsotopeTable
return fIsotopeTable->GetIsotope(Z,A,E);
}
+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 1.3.6.1.2.2 1999/12/14 07:08:14 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4Ions.cc,v 1.4 1999/12/15 14:51:12 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ----------------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4IsotopeProperty.cc,v 1.1.8.4 1999/12/14 07:08:14 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4IsotopeProperty.cc,v 1.2 1999/12/15 14:51:12 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ----------------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4KL3DecayChannel.cc,v 1.3.8.1.2.1 1999/12/08 17:34:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4KL3DecayChannel.cc,v 1.4 1999/12/15 14:51:13 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4MuonDecayChannel.cc,v 1.4.8.1.2.1 1999/12/08 17:34:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4MuonDecayChannel.cc,v 1.6 2000/02/25 07:36:24 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
@@ -32,13 +32,6 @@ G4MuonDecayChannel::G4MuonDecayChannel(const G4String& theParentName,
G4double theBR)
:G4VDecayChannel("Muon Decay",1)
{
//#ifdef G4VERBOSE
//if (GetVerboseLevel()>1) {
// G4cout << "G4MuonDecayChannel:: constructor ";
// G4cout << "addr[" << this << "]" << G4endl;
//}
//#endif
// set names for daughter particles
if (theParentName == "mu+") {
SetBR(theBR);
@@ -55,13 +48,13 @@ G4MuonDecayChannel::G4MuonDecayChannel(const G4String& theParentName,
SetDaughter(1, "anti_nu_e");
SetDaughter(2, "nu_mu");
} else {
//#ifdef G4VERBOSE
// if (GetVerboseLevel()>0) {
// G4cout << "G4MuonDecayChannel:: constructor :";
// G4cout << " parent particle is not muon but ";
// G4cout << theParentName << G4endl;
// }
//#endif
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout << "G4MuonDecayChannel:: constructor :";
G4cout << " parent particle is not muon but ";
G4cout << theParentName << G4endl;
}
#endif
}
}
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NucleiProperties.cc,v 1.5.6.1.2.1 1999/12/08 17:34:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4NucleiProperties.cc,v 1.6 1999/12/15 14:51:13 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NucleiPropertiesTableA.cc,v 1.4.6.1 1999/12/07 20:49:56 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4NucleiPropertiesTableA.cc,v 1.5 1999/12/15 14:51:13 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// -------------------------------------------------------------------
// GEANT 4 class file --- Copyright CERN 1997
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4NucleiPropertiesTableB.cc,v 1.3.6.1 1999/12/07 20:49:57 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4NucleiPropertiesTableB.cc,v 1.4 1999/12/15 14:51:14 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// -------------------------------------------------------------------
// GEANT 4 class file --- Copyright CERN 1997
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PDGCodeChecker.cc,v 1.2.6.1.2.3 1999/12/14 07:08:15 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PDGCodeChecker.cc,v 1.3 1999/12/15 14:51:14 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ----------------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleDefinition.cc,v 1.6.6.1.2.1 1999/12/08 17:34:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ParticleDefinition.cc,v 1.9 2000/02/27 06:44:29 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -72,6 +72,7 @@ G4ParticleDefinition::G4ParticleDefinition(
thePDGIsospin(iIsospin*0.5),
thePDGIsospin3(iIsospin3*0.5),
theParticleType(pType),
theParticleSubType(""),
theLeptonNumber(lepton),
theBaryonNumber(baryon),
thePDGEncoding(encoding),
@@ -214,7 +215,8 @@ void G4ParticleDefinition::DumpTable() const
G4cout << ", " << theAntiQuarkContent[5] << G4endl;
G4cout << " Lepton number : " << theLeptonNumber;
G4cout << " Baryon number : " << theBaryonNumber << G4endl;
G4cout << " Particle type : " << theParticleType << G4endl;
G4cout << " Particle type : " << theParticleType ;
G4cout << " [" << theParticleSubType << "]" << G4endl;
if ( fShortLivedFlag ){
G4cout << " ShortLived : ON" << G4endl;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleMessenger.cc,v 1.3.6.1.2.3 1999/12/14 07:08:15 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ParticleMessenger.cc,v 1.4 1999/12/15 14:51:14 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticlePropertyMessenger.cc,v 1.2.8.1.2.3 1999/12/14 07:08:15 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ParticlePropertyMessenger.cc,v 1.3 1999/12/15 14:51:14 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//---------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleTable.cc,v 1.14.4.1.2.1 1999/12/08 17:34:09 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ParticleTable.cc,v 1.16 2000/02/25 07:36:24 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4ParticleTable
//
@@ -37,24 +37,13 @@
#include "G4IonTable.hh"
#include "G4ShortLivedTable.hh"
#ifndef G4USE_STL
const G4int G4ParticleTableDefaultBucket = 32;
const G4int G4ParticleTableMaxInABucket = 64;
#endif
////////////////////
G4ParticleTable::G4ParticleTable():verboseLevel(0),fParticleMessenger(0),noName(" ")
{
#ifdef G4USE_STL
fDictionary = new G4PTblDictionary();
fIterator = new G4PTblDicIterator( *fDictionary );
fEncodingDictionary = new G4PTblEncodingDictionary();
#else
DictionaryBucketSize = G4ParticleTableDefaultBucket;
fDictionary = new G4PTblDictionary(G4ParticleTable::HashFun,DictionaryBucketSize);
fIterator = new G4PTblDicIterator( *fDictionary );
fEncodingDictionary = new G4PTblEncodingDictionary(G4ParticleTable::EncodingHashFun,DictionaryBucketSize);
#endif
// Ion Table
fIonTable = new G4IonTable();
@@ -211,29 +200,13 @@ G4ParticleDefinition* G4ParticleTable::Insert(G4ParticleDefinition *particle)
G4PTblDictionary *pdic = fDictionary;
G4PTblEncodingDictionary *pedic = fEncodingDictionary;
#ifdef G4USE_STL
(*pdic)[GetKey(particle)] = particle;
// insert into EncodingDictionary
G4int code = particle->GetPDGEncoding();
if (code !=0 ) {
(*pedic)[code] = particle;
}
#else
pdic -> insertKeyAndValue(new G4String(GetKey(particle)), particle);
// if HashDictionary get too big, rehash all of the key
if (pdic -> entries() > G4ParticleTableMaxInABucket*DictionaryBucketSize) {
DictionaryBucketSize *= 2;
pdic -> resize(DictionaryBucketSize);
G4PTblDicIterator *piter = fIterator;
piter -> reset();
}
// insert into EncodingDictionary
G4int code = particle->GetPDGEncoding();
if (code !=0 ) {
pedic -> insertKeyAndValue(new G4int(code), particle);
}
#endif
// insert it in IonTable if "nucleus"
if (fIonTable->IsIon(particle) ){
fIonTable->Insert(particle);
@@ -253,8 +226,6 @@ G4ParticleDefinition* G4ParticleTable::Insert(G4ParticleDefinition *particle)
////////////////////
G4ParticleDefinition* G4ParticleTable::Remove(G4ParticleDefinition* particle)
{
#ifdef G4USE_STL
G4PTblDictionary::iterator it = fDictionary->find(GetKey(particle));
if (it != fDictionary->end()) {
fDictionary->erase(it);
@@ -266,20 +237,7 @@ G4ParticleDefinition* G4ParticleTable::Remove(G4ParticleDefinition* particle)
} else {
return 0;
}
#else
if (! contains(particle) ) return 0;
G4String particle_name = GetKey(particle);
fDictionary->remove(&particle_name );
// remove from EncodingDictionary
G4int code = particle->GetPDGEncoding();
if (code !=0 ) {
G4PTblEncodingDictionary *pedic = fEncodingDictionary;
pedic -> remove(&code);
}
#endif
// remove it from IonTable if "nucleus"
if (fIonTable->IsIon(particle) ){
fIonTable->Remove(particle);
@@ -361,14 +319,11 @@ G4ParticleDefinition* G4ParticleTable::FindParticle(G4int aPDGEncoding )
G4PTblEncodingDictionary *pedic = fEncodingDictionary;
G4ParticleDefinition* particle =0;
#ifdef G4USE_STL
G4PTblEncodingDictionary::iterator it = pedic->find(aPDGEncoding );
if (it != pedic->end()) {
particle = (*it).second;
}
#else
particle = pedic -> findValue( &aPDGEncoding );
#endif
#ifdef G4VERBOSE
if ((particle == 0) && (verboseLevel>0) ){
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ParticleWithCuts.cc,v 1.5.8.1.2.5 1999/12/14 09:16:48 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ParticleWithCuts.cc,v 1.6 1999/12/15 14:51:14 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhaseSpaceDecayChannel.cc,v 1.3.8.1.2.1 1999/12/08 17:34:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PhaseSpaceDecayChannel.cc,v 1.4 1999/12/15 14:51:15 gunter Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4ShortLivedTable.cc,v 1.7.4.1.2.5 1999/12/14 09:16:48 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4ShortLivedTable.cc,v 1.9 2000/02/25 07:36:24 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// --------------------------------------------------------------
@@ -37,15 +37,11 @@ G4ShortLivedTable::~G4ShortLivedTable()
{
if (fShortLivedList ==0) return;
// remove all contents in the short lived List and delete all particles
#ifdef G4USE_STL
G4ShortLivedList::iterator i;
for (i = fShortLivedList->begin(); i!= fShortLivedList->end(); ++i) {
delete (*i);
}
fShortLivedList->clear();
#else
fShortLivedList->clearAndDestroy();
#endif
delete fShortLivedList;
fShortLivedList =0;
}
@@ -63,35 +59,19 @@ G4bool G4ShortLivedTable::IsShortLived(G4ParticleDefinition* particle) const
void G4ShortLivedTable::Insert(G4ParticleDefinition* particle)
{
if (IsShortLived(particle)) {
#ifdef G4USE_STL
fShortLivedList->push_back(particle);
#else
fShortLivedList->insert(particle);
#endif
} else {
//#ifdef G4VERBOSE
//if (GetVerboseLevel()>0) {
// G4cout << "G4ShortLivedTable::Insert :" << particle->GetParticleName() ;
// G4cout << " is not short lived" << G4endl;
//}
//#endif
}
}
}
void G4ShortLivedTable::Remove(G4ParticleDefinition* particle)
{
if (IsShortLived(particle)) {
#ifdef G4USE_STL
G4ShortLivedList::iterator idx;
for (idx = fShortLivedList->begin(); idx!= fShortLivedList->end(); ++idx) {
if ( particle == *idx) {
fShortLivedList->erase(idx);
}
}
#else
fShortLivedList->remove(particle);
#endif
} else {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
@@ -107,15 +87,9 @@ void G4ShortLivedTable::DumpTable(const G4String &particle_name) const
{
G4ParticleDefinition* particle;
#ifdef G4USE_STL
G4ShortLivedList::iterator idx;
for (idx = fShortLivedList->begin(); idx!= fShortLivedList->end(); ++idx) {
particle = *idx;
#else
for (G4int idx= 0; idx < fShortLivedList->entries() ; idx++) {
particle = (*fShortLivedList)(idx);
#endif
if (( particle_name == "ALL" ) || (particle_name == "all")){
particle->DumpTable();
} else if ( particle_name == particle->GetParticleName() ) {
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VDecayChannel.cc,v 1.5.6.1.2.1 1999/12/08 17:34:10 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VDecayChannel.cc,v 1.8 2000/05/29 01:30:52 kurasige Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// ------------------------------------------------------------
@@ -17,6 +17,7 @@
// History: first implementation, based on object model of
// 27 July 1996 H.Kurashige
// 30 May 1997 H.Kurashige
// 23 Mar. 2000 H.Weber : add GetAngularMomentum
// ------------------------------------------------------------
#include "G4ParticleDefinition.hh"
@@ -360,6 +361,59 @@ void G4VDecayChannel::SetParent(const G4ParticleDefinition * parent_type)
if (parent_type != 0) SetParent(parent_type->GetParticleName());
}
G4int G4VDecayChannel::GetAngularMomentum()
{
// determine angular momentum
// fill pointers to daughter particles if not yet set
if (daughters == 0) FillDaughters();
const G4int PiSpin = parent->GetPDGiSpin();
const G4int PParity = parent->GetPDGiParity();
if (2==numberOfDaughters) { // up to now we can only handle two particle decays
const G4int D1iSpin = daughters[0]->GetPDGiSpin();
const G4int D1Parity = daughters[0]->GetPDGiParity();
const G4int D2iSpin = daughters[1]->GetPDGiSpin();
const G4int D2Parity = daughters[1]->GetPDGiParity();
const G4int MiniSpin = abs (D1iSpin - D2iSpin);
const G4int MaxiSpin = D1iSpin + D2iSpin;
const G4int lMax = (PiSpin+D1iSpin+D2iSpin)/2; // l is allways int
G4int lMin;
#ifdef G4VERBOSE
if (verboseLevel>1) {
G4cout << "iSpin: " << PiSpin << " -> " << D1iSpin << " + " << D2iSpin << G4endl;
G4cout << "2*jmin, 2*jmax, lmax " << MiniSpin << " " << MaxiSpin << " " << lMax << G4endl;
}
#endif
for (G4int j=MiniSpin; j<=MaxiSpin; j+=2){ // loop over all possible spin couplings
lMin = abs(PiSpin-j)/2;
#ifdef G4VERBOSE
if (verboseLevel>1)
G4cout << "-> checking 2*j=" << j << G4endl;
#endif
for (G4int l=lMin; l<=lMax; l++) {
#ifdef G4VERBOSE
if (verboseLevel>1)
G4cout << " checking l=" << l << G4endl;
#endif
if (l%2==0) {
if (PParity == D1Parity*D2Parity) { // check parity for this l
return l;
}
} else {
if (PParity == -1*D1Parity*D2Parity) { // check parity for this l
return l;
}
}
}
}
} else {
G4Exception ("G4VDecayChannel::GetAngularMomentum: Sorry, can't handle 3 particle decays (up to now)");
}
G4Exception ("G4VDecayChannel::GetAngularMomentum: Can't find angular momentum for this decay!");
return 0;
}
void G4VDecayChannel::DumpInfo()
{
G4cout << " BR: " << rbranch << " [" << kinematics_name << "]";
@@ -375,9 +429,3 @@ void G4VDecayChannel::DumpInfo()
G4cout << G4endl;
}