Import Geant4 6.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:41:53 +02:00
parent 4aea781e80
commit 96686e0c8f
6560 changed files with 153347 additions and 238155 deletions
@@ -0,0 +1,93 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
#include "globals.hh"
#include "G4BetaFermiFunction.hh"
const G4double G4BetaFermiFunction::PI=3.14159;
//////////////////////////////////////////////////////////////////
//
// calculate the Fermi Function foe energy E0
//
G4double G4BetaFermiFunction::GetFF( const G4double E0)
{
G4double A1, A2;
G4double P, U, S, Y;
G4double F2;
G4double E = E0+1.;
P=sqrt(E*E-1.0) ;
U=Z/137.0;
S=sqrt(1.0-U*U) - 1.;
Y = 2*PI*U*E/P;
A1 = U*U*E*E + P*P/4.;
A2 = fabs(Y/(1-exp(-Y)));
F2 = pow(A1,S) * A2;
return F2;
}
//////////////////////////////////////////////////////////////////
//
// calculate the Fermi normalization factor
// here E0 is the end point energy of the beta decay
//
G4double G4BetaFermiFunction::GetFFN(const G4double E0)
{
G4double A1, A2;
G4double P, U, S, Y;
G4double F2,E;
G4double EE = E0/100.;
U=Z/137.0;
S=sqrt(1.0-U*U) - 1.;
G4double F1 = 1E-10;
for (G4int i = 1; i<=100 ; i++) {
E = G4double(i)*EE + 1.;
P=sqrt(E*E-1.0) ;
Y = 2*PI*U*E/P;
A1 = U*U*E*E + P*P/4.;
A2 = fabs(Y/(1-exp(-Y)));
F2 = pow(A1,S) * A2;
if (F2 > F1) F1 = F2;
}
return F1;
}
@@ -0,0 +1,678 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// MODULES: G4NuclearDecayChannel.cc
//
// Version: 0.b.4
// Date: 14/04/00
// Author: F Lei & P R Truscott
// Organisation: DERA UK
// Customer: ESA/ESTEC, NOORDWIJK
// Contract: 12115/96/JG/NL Work Order No. 3
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// CHANGE HISTORY
// --------------
//
// 29 February 2000, P R Truscott, DERA UK
// 0.b.3 release.
//
// 18 October 2002, F Lei
// modified link metheds in DecayIt() to G4PhotoEvaporation() in order to
// use the new Internal Coversion feature.
// 13 April 2000, F Lei, DERA UK
// Changes made are:
// 1) Use PhotonEvaporation instead of DiscreteGammaDeexcitation
// 2) verbose control
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
///////////////////////////////////////////////////////////////////////////////
//
#include "G4NuclearLevelManager.hh"
#include "G4NuclearLevelStore.hh"
#include "G4NuclearDecayChannel.hh"
#include "G4DynamicParticle.hh"
#include "G4DecayProducts.hh"
#include "G4DecayTable.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleChangeForRadDecay.hh"
#include "G4IonTable.hh"
#include "G4BetaFermiFunction.hh"
#include "G4PhotonEvaporation.hh"
#include "G4AtomicDeexcitation.hh"
const G4double G4NuclearDecayChannel:: pTolerance = 0.001;
const G4double G4NuclearDecayChannel:: levelTolerance = 2.0*keV;
//const G4bool G4NuclearDecayChannel:: FermiOn = true;
///////////////////////////////////////////////////////////////////////////////
//
//
// Constructor for one decay product (the nucleus).
//
G4NuclearDecayChannel::G4NuclearDecayChannel
(const G4RadioactiveDecayMode &theMode,
G4int Verbose,
const G4ParticleDefinition *theParentNucleus,
G4double theBR,
G4double theQtransition,
G4int A,
G4int Z,
G4double theDaughterExcitation) :
G4GeneralPhaseSpaceDecay(Verbose), decayMode(theMode)
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<"G4NuclearDecayChannel constructor for " <<G4int(theMode) <<G4endl;}
#endif
SetParent(theParentNucleus);
FillParent();
parent_mass = theParentNucleus->GetPDGMass();
SetBR (theBR);
SetNumberOfDaughters (1);
FillDaughterNucleus (0, A, Z, theDaughterExcitation);
Qtransition = theQtransition;
}
///////////////////////////////////////////////////////////////////////////////
//
//
// Constructor for a daughter nucleus and one other particle.
//
G4NuclearDecayChannel::G4NuclearDecayChannel
(const G4RadioactiveDecayMode &theMode,
G4int Verbose,
const G4ParticleDefinition *theParentNucleus,
G4double theBR,
G4double theQtransition,
G4int A,
G4int Z,
G4double theDaughterExcitation,
const G4String theDaughterName1) :
G4GeneralPhaseSpaceDecay(Verbose), decayMode(theMode)
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<"G4NuclearDecayChannel constructor for " <<G4int(theMode) <<G4endl;}
#endif
SetParent (theParentNucleus);
FillParent();
parent_mass = theParentNucleus->GetPDGMass();
SetBR (theBR);
SetNumberOfDaughters (2);
SetDaughter(0, theDaughterName1);
FillDaughterNucleus (1, A, Z, theDaughterExcitation);
Qtransition = theQtransition;
}
///////////////////////////////////////////////////////////////////////////////
//
//
// Constructor for a daughter nucleus and two other particles.
//
G4NuclearDecayChannel::G4NuclearDecayChannel
(const G4RadioactiveDecayMode &theMode,
G4int Verbose,
const G4ParticleDefinition *theParentNucleus,
G4double theBR,
G4double theFFN,
G4bool betaS,
RandGeneral* randBeta,
G4double theQtransition,
G4int A,
G4int Z,
G4double theDaughterExcitation,
const G4String theDaughterName1,
const G4String theDaughterName2) :
G4GeneralPhaseSpaceDecay(Verbose), decayMode(theMode)
//,BetaSimple(betaS),
// RandomEnergy(randBeta), Qtransition(theQtransition),FermiFN(theFFN)
{
#ifdef G4VERBOSE
if (GetVerboseLevel()>1)
{G4cout <<"G4NuclearDecayChannel constructor for " <<G4int(theMode) <<G4endl;}
#endif
SetParent (theParentNucleus);
FillParent();
parent_mass = theParentNucleus->GetPDGMass();
SetBR (theBR);
SetNumberOfDaughters (3);
SetDaughter(0, theDaughterName1);
SetDaughter(2, theDaughterName2);
FillDaughterNucleus(1, A, Z, theDaughterExcitation);
BetaSimple = betaS;
RandomEnergy = randBeta;
Qtransition = theQtransition;
FermiFN = theFFN;
}
////////////////////////////////////////////////////////////////////////////////
//
//
//
//
#include "G4HadTmpUtil.hh"
void G4NuclearDecayChannel::FillDaughterNucleus (G4int index, G4int A, G4int Z,
G4double theDaughterExcitation)
{
//
//
// Determine if the proposed daughter nucleus has a sensible A, Z and excitation
// energy.
//
if (A<1 || Z<0 || theDaughterExcitation <0.0)
{
G4cerr <<"Error in G4NuclearDecayChannel::FillDaughterNucleus";
G4cerr <<"Inappropriate values of daughter A, Z or excitation" <<G4endl;
G4cerr <<"A = " <<A <<" and Z = " <<Z;
G4cerr <<" Ex = " <<theDaughterExcitation*MeV <<"MeV" <<G4endl;
G4Exception(__FILE__, G4inttostring(__LINE__), FatalException, "G4NuclearDecayChannel::FillDaughterNucleus");
}
//
//
// Save A and Z to local variables. Find the GROUND STATE of the daughter
// nucleus and save this, as an ion, in the array of daughters.
//
daughterA = A;
daughterZ = Z;
G4IonTable *theIonTable = (G4IonTable*)(G4ParticleTable::GetParticleTable()->GetIonTable());
// daughterNucleus = theIonTable->GetIon(daughterZ, daughterA, 0.0*keV);
//
//
// Determine the excitation state corresponds to an actual level in the
// photo-evaporation data. Flag an error if the difference is too large.
//
/*
if (theDaughterExcitation > 0.0) {
G4NuclearLevelManager * levelManager = G4NuclearLevelStore::GetInstance()->GetManager(daughterZ, daughterA);
if ( levelManager->NumberOfLevels() ) {
const G4NuclearLevel* level = levelManager->NearestLevel (theDaughterExcitation);
daughterExcitation = level->Energy();
if (abs(daughterExcitation-theDaughterExcitation)>levelTolerance){
#ifdef G4VERBOSE
if (GetVerboseLevel()>1){
G4cout <<"In G4NuclearDecayChannel::FillDaughterNucleus" <<G4endl;
G4cout <<"Difference in daughter excitation and G4NuclearLevelManager data ";
G4cout <<"exceeds tolerance" <<G4endl;
G4cout <<"Level requested = " <<theDaughterExcitation*MeV <<" MeV" <<G4endl;
G4cout <<"Level found = " <<daughterExcitation*MeV <<" MeV" <<G4endl;
G4cout << " -- The requested energy level will be used!-- "<< G4endl;
}
#endif
daughterExcitation = theDaughterExcitation;
}
// Level hafe life is in ns and I want to set the gate as 1 micros
// also we have to force the IT case in all conditions
if (level->HalfLife() <= 1000. || index == 0) {
daughterNucleus = theIonTable->GetIon(daughterZ, daughterA, 0.0*keV);
}
else{
daughterNucleus = theIonTable->GetIon(daughterZ, daughterA, daughterExcitation);
daughterExcitation = 0.0;
}
}
else{
#ifdef G4VERBOSE
if (GetVerboseLevel()>0){
G4cout << "Error in G4NuclearDecayChannel::FillDaughterNucleus" <<G4endl;
G4cout << "PhotonEvaporation data is not available " <<G4endl;
G4cout << "RDM could crash during Photo De-excitaion "<< G4endl;
}
#endif
daughterNucleus = theIonTable->GetIon(daughterZ, daughterA, 0.0*keV);
daughterExcitation = theDaughterExcitation;
}
}
else {
daughterExcitation = 0.0;
daughterNucleus = theIonTable->GetIon(daughterZ, daughterA, 0.0*keV);
}
*/
daughterNucleus = theIonTable->GetIon(daughterZ, daughterA, theDaughterExcitation*MeV);
daughterExcitation = theDaughterExcitation;
SetDaughter(index, daughterNucleus);
}
///////////////////////////////////////////////////////////////////////////////
//
//
//
//
G4DecayProducts *G4NuclearDecayChannel::DecayIt (G4double theParentMass)
{
//
//
// Load-up the details of the parent and daughter particles if they have not
// been defined properly.
//
if (parent == NULL) FillParent();
if (daughters == NULL) FillDaughters();
//
//
// THIS IS A CHEAT! We want to ensure that the difference between the total
// parent and daughter masses equals the energy liberated by the transition.
//
theParentMass = 0.0;
for( G4int index=0; index < numberOfDaughters; index++)
{theParentMass += daughters[index]->GetPDGMass();}
theParentMass += Qtransition ;
// bug fix for beta+ decay (flei 25/09/01)
if (decayMode == 2) theParentMass -= 2*0.511 * MeV;
if (GetVerboseLevel()>1) {
G4cout << "G4NuclearDecayChannel::DecayIt ";
G4cout << "the decay mass = " << theParentMass << G4endl;
}
SetParentMass (theParentMass);
//
//
// Define a product vector.
//
G4DecayProducts *products = NULL;
//
//
// Depending upon the number of daughters, select the appropriate decay
// kinematics scheme.
//
switch (numberOfDaughters)
{
case 0:
if (GetVerboseLevel()>0)
{
G4cout << "G4NuclearDecayChannel::DecayIt ";
G4cout << " daughters not defined " <<G4endl;
}
break;
case 1:
products = OneBodyDecayIt();
break;
case 2:
products = TwoBodyDecayIt();
break;
case 3:
products = BetaDecayIt();
break;
default:
G4cerr <<"Error in G4NuclearDecayChannel::DecayIt" <<G4endl;
G4cerr <<"Number of daughters in decay = " <<numberOfDaughters <<G4endl;
G4Exception(__FILE__, G4inttostring(__LINE__), FatalException, "G4NuclearDecayChannel::DecayIt");
}
if ((products == NULL) && (GetVerboseLevel()>0)) {
G4cerr << "G4NuclearDecayChannel::DecayIt ";
G4cerr << *parent_name << " can not decay " << G4endl;
DumpInfo();
}
// It seems the ARM in G4 is not working properly yet. So this feature will not be released yet!
//
// now we have to take care of the EC product which have go through the ARM
if (decayMode == 3 || decayMode == 4 || decayMode == 5) {
G4int eShell = 0;
switch (decayMode)
{
case KshellEC:
//
{
eShell = 1;
}
break;
case LshellEC:
//
{
eShell = G4int(G4UniformRand()*3)+1;
}
break;
case MshellEC:
//
{
eShell = G4int(G4UniformRand()*5)+4;
}
break;
case ERROR:
default:
G4cout << " There is an error in decay mode selection! exit RDM now" << G4endl;
exit(0);
}
G4int aZ = daughterZ;
G4AtomicDeexcitation* atomDeex = new G4AtomicDeexcitation();
//no Auger electron generation
atomDeex->ActivateAugerElectronProduction(0);
std::vector<G4DynamicParticle*>* armProducts = atomDeex->GenerateParticles(aZ,eShell);
// pop up the daughter before insertion
dynamicDaughter = products->PopProducts();
for (size_t i = 0; i < armProducts->size(); i++)
products->PushProducts ((*armProducts)[i]);
delete armProducts;
delete atomDeex;
products->PushProducts (dynamicDaughter);
}
//
// If the decay is to an excited state of the daughter nuclide, we need
// to apply the photo-evaporation process.
//
if (daughterExcitation > 0.0)
{
//
//
// Pop the daughter nucleus off the product vector - we need to retain
// the momentum of this particle.
//
dynamicDaughter = products->PopProducts();
G4LorentzVector daughterMomentum = dynamicDaughter->Get4Momentum();
G4ThreeVector const daughterMomentum1(static_cast<const G4LorentzVector> (daughterMomentum));
//
//
// Now define a G4Fragment with the correct A, Z and excitation, and declare and
// initialise a G4DiscreteGammaDeexcitation object.
//
// daughterMomentum.setT(daughterMomentum.t()+G4ParticleTable::GetParticleTable()->GetIonTable()->GetIonMass( daughterZ, daughterA )+daughterExcitation);
// daughterMomentum.setT(daughterMomentum.t()+daughterExcitation);
G4Fragment nucleus(daughterA, daughterZ, daughterMomentum);
//G4LorentzVector p4(0.,0.,0.,G4NucleiProperties::GetNuclearMass(daughterA,daughterZ)
// +daughterExcitation);
//G4Fragment nucleus(daughterA, daughterZ, p4);
// nucleus.SetExcitationEnergy(daughterExcitation);
// G4VGammaDeexcitation* deexcitation = new G4DiscreteGammaDeexcitation;
G4PhotonEvaporation* deexcitation = new G4PhotonEvaporation;
deexcitation->SetVerboseLevel(GetVerboseLevel());
// deexcitation->Initialize(nucleus);
deexcitation->SetICM(true);
if (decayMode == 0) {
deexcitation->RDMForced(true);
} else {
deexcitation->RDMForced(false);
}
// ARM in G4 is applied but no auger electrons!
deexcitation->SetARM(true);
// deexcitation->SetARM(false);
deexcitation->SetMaxHalfLife(1e-6*second);
//
// Get the gammas by deexciting the nucleus.
//
G4FragmentVector* gammas = deexcitation->BreakItUp(nucleus);
// in the case of BreakItUp(nucleus), the returned G4FragmentVector contains the residual nuclide
// as its last entry.
G4int nGammas=gammas->size()-1;
//
//
// Go through each gamma/e- and add it to the decay product. The angular distribution
// of the gammas is isotropic, and the residual nucleus is assumed not to suffer
// any recoil as a result of this de-excitation.
//
for (G4int ig=0; ig<nGammas; ig++)
{
// G4double costheta = 2.0*G4UniformRand() - 1.0;
// G4double sintheta = sqrt((1.0 - costheta) * (1.0+costheta));
// G4double phi = twopi * G4UniformRand();
// G4ParticleMomentum gDirection
// (sintheta*cos(phi),sintheta*sin(phi),costheta);
//G4double gEnergy = gammas->operator[](ig)->GetMomentum().e()
// - gammas->operator[](ig)->GetParticleDefinition()->GetPDGMass() ;
G4DynamicParticle *theGammaRay = new
G4DynamicParticle (gammas->operator[](ig)->GetParticleDefinition(),
gammas->operator[](ig)->GetMomentum());
theGammaRay -> SetProperTime(gammas->operator[](ig)->GetCreationTime());
products->PushProducts (theGammaRay);
}
//
// now the nucleus
G4double finalDaughterExcitation = gammas->operator[](nGammas)->GetExcitationEnergy();
// f.lei (03/01/03) this is needed to fix the crach in test18
if (finalDaughterExcitation <= 1.0*keV) finalDaughterExcitation = 0 ;
G4IonTable *theIonTable = (G4IonTable*)(G4ParticleTable::GetParticleTable()->GetIonTable());
dynamicDaughter = new G4DynamicParticle
(theIonTable->GetIon(daughterZ,daughterA,finalDaughterExcitation),
daughterMomentum1);
products->PushProducts (dynamicDaughter);
//
// Delete/reset variables associated with the gammas.
//
// if (nGammas != 0) gammas->clearAndDestroy();
while (!gammas->empty()) {
delete *(gammas->end()-1);
gammas->pop_back();
}
// gammas->clearAndDestroy();
delete gammas;
delete deexcitation;
}
return products;
}
////////////////////////////////////////////////////////////////////////////////
//
G4DecayProducts *G4NuclearDecayChannel::BetaDecayIt()
{
if (GetVerboseLevel()>1) G4cout << "G4Decay::BetaDecayIt()"<<G4endl;
//daughters'mass
G4double daughtermass[3];
G4double sumofdaughtermass = 0.0;
G4double pmass = GetParentMass();
for (G4int index=0; index<3; index++)
{
daughtermass[index] = daughters[index]->GetPDGMass();
sumofdaughtermass += daughtermass[index];
}
//create parent G4DynamicParticle at rest
G4ParticleMomentum dummy;
G4DynamicParticle * parentparticle = new G4DynamicParticle( parent, dummy, 0.0);
//create G4Decayproducts
G4DecayProducts *products = new G4DecayProducts(*parentparticle);
delete parentparticle;
G4double Q = pmass - sumofdaughtermass;
if (BetaSimple == true) {
// Use the histogramed distribution to generate the beta energy
G4double daughtermomentum[2];
G4double daughterenergy[2];
daughterenergy[0] = RandomEnergy->shoot() * Q;
daughtermomentum[0] = sqrt(daughterenergy[0]*daughterenergy[0] +
2.0*daughterenergy[0] * daughtermass[0]);
// the recoil neuleus is asummed to have a maximum energy of Q/daughterA/1000.
daughterenergy[1] = G4UniformRand() * Q/(1000.*daughterA);
daughtermomentum[1] = sqrt(daughterenergy[1]*daughterenergy[1] +
2.0*daughterenergy[1] * daughtermass[1]);
//
//create daughter G4DynamicParticle
G4double costheta, sintheta, phi, sinphi, cosphi;
// G4double costhetan, sinthetan, phin, sinphin, cosphin;
costheta = 2.*G4UniformRand()-1.0;
sintheta = sqrt((1.0-costheta)*(1.0+costheta));
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
G4ParticleMomentum direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]);
products->PushProducts(daughterparticle);
// The two products are independent in directions
costheta = 2.*G4UniformRand()-1.0;
sintheta = sqrt((1.0-costheta)*(1.0+costheta));
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
G4ParticleMomentum direction1(sintheta*cosphi,sintheta*sinphi,costheta);
daughterparticle
= new G4DynamicParticle( daughters[1], direction1*daughtermomentum[1]);
products->PushProducts(daughterparticle);
// the neutrino is igored in this case
} else {
//calculate daughter momentum
// Generate two
G4double rd1, rd2;
G4double daughtermomentum[3];
G4double daughterenergy[3];
G4double momentummax=0.0, momentumsum = 0.0;
G4double fermif;
G4BetaFermiFunction* aBetaFermiFunction;
if (decayMode == 1) {
// beta-decay
aBetaFermiFunction = new G4BetaFermiFunction (daughterA, daughterZ);
} else {
// beta+decay
aBetaFermiFunction = new G4BetaFermiFunction (daughterA, -daughterZ);
}
if (GetVerboseLevel()>1) {
G4cout<< " Q = " <<Q<<G4endl;
G4cout<< " daughterA = " <<daughterA<<G4endl;
G4cout<< " daughterZ = " <<daughterZ<<G4endl;
G4cout<< " decayMode = " <<static_cast<G4int>(decayMode) << G4endl;
G4cout<< " FermiFN = " <<FermiFN<<G4endl;
}
do
{
rd1 = G4UniformRand();
rd2 = G4UniformRand();
momentummax = 0.0;
momentumsum = 0.0;
// daughter 0
// energy = rd2*(pmass - sumofdaughtermass);
daughtermomentum[0] = sqrt(rd2) * sqrt((Q + 2.0*daughtermass[0])*Q);
daughterenergy[0] = sqrt(daughtermomentum[0]*daughtermomentum[0] +
daughtermass[0] * daughtermass[0]) - daughtermass[0];
if ( daughtermomentum[0] >momentummax )momentummax = daughtermomentum[0];
momentumsum += daughtermomentum[0];
// daughter 2
// energy = (1.-rd1)*(pmass - sumofdaughtermass);
daughtermomentum[2] = sqrt(rd1)*sqrt((Q + 2.0*daughtermass[2])*Q);
daughterenergy[2] = sqrt(daughtermomentum[2]*daughtermomentum[2] +
daughtermass[2] * daughtermass[2]) - daughtermass[2];
if ( daughtermomentum[2] >momentummax )momentummax = daughtermomentum[2];
momentumsum += daughtermomentum[2];
// daughter 1
daughterenergy[1] = Q - daughterenergy[0] - daughterenergy[2];
if (daughterenergy[1] > 0.0) {
daughtermomentum[1] = sqrt(daughterenergy[1]*daughterenergy[1] +
2.0*daughterenergy[1] * daughtermass[1]);
if ( daughtermomentum[1] >momentummax ) momentummax =
daughtermomentum[1];
momentumsum += daughtermomentum[1];
} else {
momentummax = momentumsum = Q;
}
// beta particles is sampled with no coulomb effects applied above. Now
// apply the Fermi function using rejection method.
daughterenergy[0] = daughterenergy[0]*MeV/0.511;
fermif = aBetaFermiFunction->GetFF(daughterenergy[0])/FermiFN;
// fermif: normalised Fermi factor
if (G4UniformRand() > fermif) momentummax = momentumsum = Q;
// rejection method
} while (momentummax > momentumsum - momentummax );
delete aBetaFermiFunction;
// output message
if (GetVerboseLevel()>1) {
G4cout <<" daughter 0:" <<daughtermomentum[0]/GeV <<"[GeV/c]" <<G4endl;
G4cout <<" daughter 1:" <<daughtermomentum[1]/GeV <<"[GeV/c]" <<G4endl;
G4cout <<" daughter 2:" <<daughtermomentum[2]/GeV <<"[GeV/c]" <<G4endl;
G4cout <<" momentum sum:" <<momentumsum/GeV <<"[GeV/c]" <<G4endl;
}
//create daughter G4DynamicParticle
G4double costheta, sintheta, phi, sinphi, cosphi;
G4double costhetan, sinthetan, phin, sinphin, cosphin;
costheta = 2.*G4UniformRand()-1.0;
sintheta = sqrt((1.0-costheta)*(1.0+costheta));
phi = 2.0*M_PI*G4UniformRand()*rad;
sinphi = sin(phi);
cosphi = cos(phi);
G4ParticleMomentum direction0(sintheta*cosphi,sintheta*sinphi,costheta);
G4DynamicParticle * daughterparticle
= new G4DynamicParticle( daughters[0], direction0*daughtermomentum[0]);
products->PushProducts(daughterparticle);
costhetan = (daughtermomentum[1]*daughtermomentum[1]-
daughtermomentum[2]*daughtermomentum[2]-
daughtermomentum[0]*daughtermomentum[0])/
(2.0*daughtermomentum[2]*daughtermomentum[0]);
sinthetan = sqrt((1.0-costhetan)*(1.0+costhetan));
phin = 2.0*M_PI*G4UniformRand()*rad;
sinphin = sin(phin);
cosphin = cos(phin);
G4ParticleMomentum 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);
daughterparticle = new G4DynamicParticle
( daughters[2], direction2*(daughtermomentum[2]/direction2.mag()));
products->PushProducts(daughterparticle);
daughterparticle =
new G4DynamicParticle (daughters[1],
(direction0*daughtermomentum[0] +
direction2*(daughtermomentum[2]/direction2.mag()))*(-1.0));
products->PushProducts(daughterparticle);
}
// delete daughterparticle;
if (GetVerboseLevel()>1) {
G4cout << "G4NuclearDecayChannel::BetaDecayIt ";
G4cout << " create decay products in rest frame " <<G4endl;
products->DumpInfo();
}
return products;
}
@@ -0,0 +1,136 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// MODULE: G4NucleusLimits.cc
//
// Version: 0.b.4
// Date: 14/04/00
// Author: F Lei & P R Truscott
// Organisation: DERA UK
// Customer: ESA/ESTEC, NOORDWIJK
// Contract: 12115/96/JG/NL Work Order No. 3
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// CHANGE HISTORY
// --------------
//
// 29 February 2000, P R Truscott, DERA UK
// 0.b.3 release.
//
// 14 April 2000, F Lei, DERA UK
// 0.b.4 release. No change in this class
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
///////////////////////////////////////////////////////////////////////////////
//
#include "G4NucleusLimits.hh"
////////////////////////////////////////////////////////////////////////////////
//
G4NucleusLimits::G4NucleusLimits ()
: aMin(1), aMax(250), zMin(0), zMax(100)
//
//
// Default constructor sets the limits to cover all nuclei with Z<100.
//
{;}
////////////////////////////////////////////////////////////////////////////////
//
G4NucleusLimits::G4NucleusLimits
(G4int aMin1, G4int aMax1, G4int zMin1, G4int zMax1)
{
//
//
// check that aMin1 is within [1, 250].
//
if (aMin1 < 1) {aMin = 1;}
else if (aMin1 > 250) {aMin = 240;}
else {aMin = aMin1;}
//
//
// check that aMax1 is within [1, 250].
//
if (aMax1 < 1) {aMax = 1;}
else if (aMax1 > 250) {aMax = 250;}
else {aMax = aMax1;}
//
//
// If aMin > aMax then swap them.
//
if (aMin > aMax) {
G4int t = aMin;
aMin = aMax;
aMax = t;
}
//
//
// check that zMin1 is within [0, 100].
//
if (zMin1 < 0) {zMin = 0;}
else if (zMin1 > 100) {zMin = 100;}
else {zMin = zMin1;}
//
//
// check that zMax1 is within [0, 100].
//
if (zMax1 < 0) {zMax = 0;}
else if (zMax1 > 100) {zMax = 100;}
else {zMax = zMax1;}
//
//
// If zMin > zMax then swap them.
//
if (zMin > zMax) {
G4int t = zMin;
zMin = zMax;
zMax = t;
}
}
////////////////////////////////////////////////////////////////////////////////
//
G4NucleusLimits::~G4NucleusLimits ()
{;}
////////////////////////////////////////////////////////////////////////////////
//
std::ostream &operator << (std::ostream &s, const G4NucleusLimits &q)
//
//
// Definition of the insertion operator << to provide the nucleus limits to
// ostream.
//
{
s <<"Atomic weight: " <<q.GetAMin() <<"->" <<q.GetAMax()
<<"Atomic number: " <<q.GetZMin() <<"->" <<q.GetZMax();
return s;
}
////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,273 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// MODULE: G4RIsotopeTable.cc
//
// Version: 0.b.4
// Date: 14/04/00
// Author: F Lei & P R Truscott
// Organisation: DERA UK
// Customer: ESA/ESTEC, NOORDWIJK
// Contract: 12115/96/JG/NL Work Order No. 3
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// CHANGE HISTORY
// --------------
//
// 29 February 2000, P R Truscott, DERA UK
// 0.b.3 release.
//
// 14 April 2000, F Lei, DERA UK
// 0.b.4 release. Minor changes to
// 1) levelTolerance = 2.0 keV
// 2) changes to verbose control
//
// 18,July 2001 F.Lei
// tidy up the print out at run level
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
///////////////////////////////////////////////////////////////////////////////
//
#include "G4DecayTable.hh"
#include "G4ParticleTable.hh"
#include "G4IsotopeProperty.hh"
#include "G4RIsotopeTable.hh"
/*
#include "G4RadioactiveDecayMode.hh"
#include "G4ITDecayChannel.hh"
#include "G4BetaMinusDecayChannel.hh"
#include "G4BetaPlusDecayChannel.hh"
#include "G4KshellECDecayChannel.hh"
#include "G4LshellECDecayChannel.hh"
#include "G4AlphaDecayChannel.hh"
*/
#include "G4ios.hh"
#include "globals.hh"
#include <iomanip>
#include <fstream>
#include <strstream>
const G4double G4RIsotopeTable::levelTolerance = 2.0*keV;
///////////////////////////////////////////////////////////////////////////////
//
G4RIsotopeTable::G4RIsotopeTable()
{
;
}
///////////////////////////////////////////////////////////////////////////////
//
G4RIsotopeTable::~G4RIsotopeTable()
{
fIsotopeList.clear();
fIsotopeNameList.clear();
}
///////////////////////////////////////////////////////////////////////////////
//
G4int G4RIsotopeTable::GetVerboseLevel() const
{
return G4ParticleTable::GetParticleTable()->GetVerboseLevel();
}
///////////////////////////////////////////////////////////////////////////////
//
G4bool G4RIsotopeTable::FindIsotope(G4IsotopeProperty* )
{
// do nothing, it is here just for the compiler
// it is required by the base class
return true;
}
///////////////////////////////////////////////////////////////////////////////
//
G4IsotopeProperty* G4RIsotopeTable::GetIsotope(G4int Z, G4int A, G4double E)
{
G4String fname = GetIsotopeName(Z, A, E);
G4int j = -1;
for (G4int i = 0 ; i< Entries(); i++) {
if(fIsotopeNameList[i] == fname) j = i;}
if (j >=0) {
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetIsotope No. : ";
G4cout <<j<<G4endl;
}
#endif
return GetIsotope(j);}
// isotope property data has been loaded already and just return the pointer
else{
G4double meanlife = GetMeanLifeTime(Z, A, E);
// E is pass as a refence hence on entry E is supplied by the user and it
// could be slightly different from the returned value which is the one
// defined in the database.
// this call is to ensure the code uses a consistane E value through out.
//
G4IsotopeProperty* fProperty = new G4IsotopeProperty();
// Set Isotope Property
fProperty->SetLifeTime(meanlife);
fProperty->SetAtomicNumber(Z);
fProperty->SetAtomicMass(A);
// Notic that the value of E may have been changed
fProperty->SetEnergy(E);
// The spin is not being used in the current implementation
fProperty->SetiSpin(0);
// the decaytable will be loaded later in G4RadioactiveDecay when it is needed
fProperty->SetDecayTable(0);
fIsotopeList.push_back(fProperty);
fname = GetIsotopeName(Z, A, E);
fIsotopeNameList.push_back(fname);
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetIsotope create: ";
G4cout <<fname <<G4endl;
}
#endif
return fProperty;
}
}
///////////////////////////////////////////////////////////////////////////////
//
G4String G4RIsotopeTable::GetIsotopeName(G4int Z, G4int A, G4double E)
{
G4String name;
char val[50];
std::ostrstream os(val,50);
os.setf(std::ios::fixed);
os <<"A"<< A << "Z" << Z <<'[' << std::setprecision(1) << E/keV << ']' << '\0';
name = val;
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cerr <<"G4RIsotopeTable::GetIsotope Name: ";
G4cerr <<name <<G4endl;
}
#endif
return name;
}
///////////////////////////////////////////////////////////////////////////////
//
G4double G4RIsotopeTable::GetMeanLifeTime (G4int Z, G4int A, G4double& aE)
{
G4double lifetime = -1.0;
// G4double levelTolerance = 1.0 * keV ;
G4String dirName = getenv("G4RADIOACTIVEDATA");
char val[100];
std::ostrstream os(val,100);
os <<dirName <<"/z" <<Z <<".a" <<A <<'\0';
G4String file(val);
std::ifstream DecaySchemeFile(file);
if (!DecaySchemeFile )
{
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetMeanLife() : "
<<"cannot find ion radioactive decay file: "
<<file <<G4endl;
G4cout <<"The nucleus is assumed to be stable " <<G4endl;
}
}
else
{
G4bool found(false);
char inputChars[80]={' '};
G4String inputLine;
G4String recordType("");
G4double a(0.0);
G4double b(0.0);
while (!found && -DecaySchemeFile.getline(inputChars, 80).eof() != EOF)
{
inputLine = inputChars;
//G4String::stripType stripend(1);
//G4String::stripType stripend =trailing;
inputLine = inputLine.strip(1);
if (inputChars[0] != '#' && inputLine.length() != 0)
{
std::istrstream tmpstream(inputLine);
// tmpstream = inputLine;
tmpstream >>recordType >>a >>b;
if (recordType == "P")
{
if (abs(a*keV-aE) < levelTolerance)
{
found = true;
lifetime = b/0.693147*s ;
// in the database was half-life!
aE = a*keV;
// pass back the correct energy
}
}
}
}
if (!found && aE )
{
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetMeanLife() : ";
G4cout <<"cannot find ion of required excitation E = " << aE << G4endl;
G4cout <<"state in radioactive data file " <<G4endl;
G4cout <<"The nucleus is assumed to be IT decayed with life = 1E-20 s" <<G4endl;
G4cout <<" -----------* THIS MAY CAUSE PROBLEM IN ITS DECAY-----------" <<G4endl;
lifetime = 1.0E-20*s;
}
}
if (!found && !aE )
{
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetMeanLife() : ";
G4cout <<"cannot find ion of required excitation E = " << aE << G4endl;
G4cout <<"state in radioactive data file " <<G4endl;
G4cout <<"The nucleus is assumed to be stable" <<G4endl;
lifetime = -1.0;
}
}
DecaySchemeFile.close();
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>0) {
G4cout <<"G4RIsotopeTable::GetMeanLifeTime: ";
G4cout <<lifetime <<G4endl; }
#endif
return lifetime;
}
///////////////////////////////////////////////////////////////////////////////
//
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,49 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4RadioactiveDecayMode.hh"
std::istream &operator >> (std::istream &s, G4RadioactiveDecayMode &q)
{
G4String a;
s >> a;
if (a == "IT")
{q = IT;}
else if (a == "BetaMinus")
{q = BetaMinus;}
else if (a == "BetaPlus")
{q = BetaPlus;}
else if (a == "KshellEC")
{q = KshellEC;}
else if (a == "LshellEC")
{q = LshellEC;}
else if (a == "MshellEC")
{q = MshellEC;}
else if (a == "Alpha")
{q = Alpha;}
else
{q = ERROR;}
return s;
}
////////////////////////////////////////////////////////////////////////////////
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// G4RadioactiveDecayRate.cc
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4DecayTable.hh"
#include "G4DecayProducts.hh"
#include "G4RadioactiveDecayRate.hh"
G4RadioactiveDecayRate::G4RadioactiveDecayRate()
{
;
//do nothing at the momment
}
G4RadioactiveDecayRate::G4RadioactiveDecayRate(const G4RadioactiveDecayRate &right)
{
Z = right.Z;
A = right.A;
E = right.E;
generation = right.generation;
decayRateC = right.decayRateC;
taos = right.taos;
// verboseLevel = right.verboseLevel;
}
G4RadioactiveDecayRate & G4RadioactiveDecayRate::operator=(const G4RadioactiveDecayRate &right)
{
if (this != &right) {
Z = right.Z;
A = right.A;
E = right.E;
generation = right.generation;
decayRateC = right.decayRateC;
taos = right.taos;
// verboseLevel = right.verboseLevel;
}
return *this;
}
G4RadioactiveDecayRate::~G4RadioactiveDecayRate()
{ ;}
void G4RadioactiveDecayRate::DumpInfo()
{
G4cout << " Z: " << Z << " A: " << A << " E: " << E <<G4endl;
G4cout << " Generation: " << generation << G4endl;
// G4cout << " Coefficiency: " << decayRateC << endl;
// G4cout << " Tao: " << tao << endl;
// need to overload << for decayRAteC and tao first!
G4cout << G4endl;
}
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
#include "G4RadioactiveDecayRateVector.hh"
G4RadioactiveDecayRateVector::G4RadioactiveDecayRateVector()
{
;
//do nothing at the momment
}
G4RadioactiveDecayRateVector::G4RadioactiveDecayRateVector(const G4RadioactiveDecayRateVector &right)
{
ionName = right.ionName;
itsRates = right.itsRates;
}
G4RadioactiveDecayRateVector & G4RadioactiveDecayRateVector::operator=(const G4RadioactiveDecayRateVector &right)
{
if (this != &right) {
ionName = right.ionName;
itsRates = right.itsRates;
}
return *this;
}
G4RadioactiveDecayRateVector::~G4RadioactiveDecayRateVector()
{ ;}
@@ -0,0 +1,219 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
#include "G4RadioactiveDecaymessenger.hh"
#include <iostream>
////////////////////////////////////////////////////////////////////////////////
//
G4RadioactiveDecaymessenger::G4RadioactiveDecaymessenger
(G4RadioactiveDecay* theRadioactiveDecayContainer1)
:theRadioactiveDecayContainer(theRadioactiveDecayContainer1)
{
//
//
// main directory for control of the RDM
//
//
grdmDirectory = new G4UIdirectory("/grdm/");
grdmDirectory->SetGuidance("Controls for the Radioactive Decay Module.");
//
//
// Command to define the limits on nucleus the RDM will treat.
//
nucleuslimitsCmd = new
G4UIcmdWithNucleusLimits("/grdm/nucleusLimits",this);
nucleuslimitsCmd->SetGuidance
("Set the amotic weight and number limits for the RDM.");
nucleuslimitsCmd->SetParameterName("aMin","aMax","zMin","zMax",true);
//
//
// The next command contols whether the decay will be treated analoguely or
// with variance reduction
//
analoguemcCmd = new G4UIcmdWithABool ("/grdm/analogueMC",this);
analoguemcCmd->SetGuidance("false: variance reduction method; true: analogue method");
analoguemcCmd->SetParameterName("AnalogueMC",true);
analoguemcCmd->SetDefaultValue(true);
//
// The next command contols whether beta decay will be treated faithfully or
// in fast mode
//
fbetaCmd = new G4UIcmdWithABool ("/grdm/fBeta",this);
fbetaCmd->SetGuidance("false: use 3-body decay, true: use histogram method");
fbetaCmd->SetParameterName("fBeta",true);
fbetaCmd->SetDefaultValue(false);
//
//
// Command to selete a logical volume for RDM.
//
avolumeCmd = new
G4UIcmdWithAString("/grdm/selectVolume",this);
avolumeCmd->SetGuidance
("Suppply a logical volumes name to add it to the RDM apply list");
avolumeCmd->SetParameterName("aVolume",false);
//
//
//
// Command to de-selete a logical volume for RDM.
//
deavolumeCmd = new
G4UIcmdWithAString("/grdm/deselectVolume",this);
deavolumeCmd->SetGuidance
("Suppply a logical volumes name to remove it from the RDM apply list");
deavolumeCmd->SetParameterName("aVolume",false);
//
//
// Command to selete all logical volumes for RDM.
//
allvolumesCmd = new
G4UIcmdWithoutParameter("/grdm/allVolumes",this);
allvolumesCmd->SetGuidance
(" apply RDM to all logical volumes. No parameter required.");
// allvolumeCmd->SetParameterName("AddAVolume",true);
//
// Command to de-selete a logical volume for RDM.
//
deallvolumesCmd = new
G4UIcmdWithoutParameter("/grdm/noVolumes",this);
deallvolumesCmd->SetGuidance
(" RDM is not applied to any logical volumes");
// deallvolumesCmd->SetParameterName("RemoveAVolume",true);
//
// The next command contols whether the branching ratio biasing will be applied or not
//
brbiasCmd = new G4UIcmdWithABool ("/grdm/BRbias",this);
brbiasCmd->SetGuidance("false: no biasing; true: all branches are treated as equal");
brbiasCmd->SetParameterName("BRBias",true);
brbiasCmd->SetDefaultValue(true);
//
// Command to define the incident particle source time profile.
//
sourcetimeprofileCmd = new
G4UIcmdWithAString("/grdm/sourceTimeProfile",this);
sourcetimeprofileCmd->SetGuidance
("Supply the name of the ascii file containing the source particle time profile");
sourcetimeprofileCmd->SetParameterName("STimeProfile",true);
sourcetimeprofileCmd->SetDefaultValue("source.data");
//
//
// Command to define the incident particle source time profile.
//
decaybiasprofileCmd = new
G4UIcmdWithAString("/grdm/decayBiasProfile",this);
decaybiasprofileCmd->SetGuidance
("Supply the name of the ascii file containing the decay bias time profile");
decaybiasprofileCmd->SetParameterName("DBiasProfile",true);
decaybiasprofileCmd->SetDefaultValue("bias.data");
//
//
// This command setup the nuclei spliting parameter
//
splitnucleiCmd = new G4UIcmdWithAnInteger("/grdm/splitNuclei",this);
splitnucleiCmd->SetGuidance("Set number of spliting for the isotopes.");
splitnucleiCmd->SetParameterName("NSplit",true);
splitnucleiCmd->SetDefaultValue(1);
splitnucleiCmd->SetRange("NSplit>=1");
//
// This command setup the verbose level of radioactive decay
//
verboseCmd = new G4UIcmdWithAnInteger("/grdm/verbose",this);
verboseCmd->SetGuidance("Set verbose level: 0, 1, 2 or 3");
verboseCmd->SetParameterName("VerboseLevel",true);
verboseCmd->SetDefaultValue(1);
verboseCmd->SetRange("VerboseLevel>=0");
}
////////////////////////////////////////////////////////////////////////////////
//
G4RadioactiveDecaymessenger::~G4RadioactiveDecaymessenger ()
{
delete grdmDirectory;
delete nucleuslimitsCmd;
delete sourcetimeprofileCmd;
delete decaybiasprofileCmd;
delete analoguemcCmd;
delete fbetaCmd;
delete brbiasCmd;
delete splitnucleiCmd;
delete verboseCmd;
delete avolumeCmd;
delete deavolumeCmd;
delete allvolumesCmd;
delete deallvolumesCmd;
}
////////////////////////////////////////////////////////////////////////////////
//
void G4RadioactiveDecaymessenger::SetNewValue (G4UIcommand *command, G4String newValues)
{
if (command==nucleuslimitsCmd) {theRadioactiveDecayContainer->
SetNucleusLimits(nucleuslimitsCmd->GetNewNucleusLimitsValue(newValues));}
else if (command==analoguemcCmd) {
G4int vl;
const char* t = newValues;
std::istrstream is((char*)t);
is >> vl;
theRadioactiveDecayContainer->SetAnalogueMonteCarlo(vl!=0);}
else if (command==fbetaCmd) {
G4int vl;
const char* t = newValues;
std::istrstream is((char*)t);
is >> vl;
theRadioactiveDecayContainer->SetFBeta(vl!=0);}
else if (command==avolumeCmd) {theRadioactiveDecayContainer->
SelectAVolume(newValues);}
else if (command==deavolumeCmd) {theRadioactiveDecayContainer->
DeselectAVolume(newValues);}
else if (command==allvolumesCmd) {theRadioactiveDecayContainer->
SelectAllVolumes();}
else if (command==deallvolumesCmd) {theRadioactiveDecayContainer->
DeselectAllVolumes();}
else if (command==brbiasCmd) {
G4int vl;
const char* t = newValues;
std::istrstream is((char*)t);
is >> vl;
theRadioactiveDecayContainer->SetBRBias(vl!=0);}
else if (command==sourcetimeprofileCmd) {theRadioactiveDecayContainer->
SetSourceTimeProfile(newValues);}
else if (command==decaybiasprofileCmd) {theRadioactiveDecayContainer->
SetDecayBias(newValues);}
else if (command==splitnucleiCmd) {theRadioactiveDecayContainer->
SetSplitNuclei(splitnucleiCmd->GetNewIntValue(newValues));}
else if (command==verboseCmd) {theRadioactiveDecayContainer->
SetVerboseLevel(verboseCmd->GetNewIntValue(newValues));}
}
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
#include "G4UIcmdWithNucleusLimits.hh"
#include <strstream>
////////////////////////////////////////////////////////////////////////////////
//
G4UIcmdWithNucleusLimits::G4UIcmdWithNucleusLimits
(const char * theCommandPath,G4UImessenger * theMessenger)
:G4UIcommand(theCommandPath,theMessenger)
{
G4UIparameter * intParamAMin = new G4UIparameter('i');
SetParameter(intParamAMin);
G4UIparameter * intParamAMax = new G4UIparameter('i');
SetParameter(intParamAMax);
G4UIparameter * intParamZMin = new G4UIparameter('i');
SetParameter(intParamZMin);
G4UIparameter * intParamZMax = new G4UIparameter('i');
SetParameter(intParamZMax);
}
////////////////////////////////////////////////////////////////////////////////
//
G4UIcmdWithNucleusLimits::~G4UIcmdWithNucleusLimits()
{
;
}
////////////////////////////////////////////////////////////////////////////////
//
G4NucleusLimits G4UIcmdWithNucleusLimits::
GetNewNucleusLimitsValue(G4String paramString)
{
G4int aMin;
G4int aMax;
G4int zMin;
G4int zMax;
const char* t = paramString;
std::istrstream is((char*)t);
is >> aMin >> aMax >> zMin >> zMax;
return G4NucleusLimits(aMin,aMax,zMin,zMax);
}
////////////////////////////////////////////////////////////////////////////////
//
G4String G4UIcmdWithNucleusLimits::ConvertToString
(G4NucleusLimits defLimits)
{
char st[100];
std::ostrstream os(st,100);
os << defLimits.GetAMin() << " " << defLimits.GetAMax()
<< defLimits.GetZMin() << " " << defLimits.GetZMax()<< '\0';
G4String vl = st;
return vl;
}
////////////////////////////////////////////////////////////////////////////////
//
void G4UIcmdWithNucleusLimits::SetParameterName
(const char * theNameAMin,const char * theNameAMax,const char * theNameZMin,
const char * theNameZMax,G4bool omittable,G4bool currentAsDefault)
{
G4UIparameter * theParamAMin = GetParameter(0);
theParamAMin->SetParameterName(theNameAMin);
theParamAMin->SetOmittable(omittable);
theParamAMin->SetCurrentAsDefault(currentAsDefault);
G4UIparameter * theParamAMax = GetParameter(1);
theParamAMax->SetParameterName(theNameAMax);
theParamAMax->SetOmittable(omittable);
theParamAMax->SetCurrentAsDefault(currentAsDefault);
G4UIparameter * theParamZMin = GetParameter(2);
theParamZMin->SetParameterName(theNameZMin);
theParamZMin->SetOmittable(omittable);
theParamZMin->SetCurrentAsDefault(currentAsDefault);
G4UIparameter * theParamZMax = GetParameter(3);
theParamZMax->SetParameterName(theNameZMax);
theParamZMax->SetOmittable(omittable);
theParamZMax->SetCurrentAsDefault(currentAsDefault);
}
////////////////////////////////////////////////////////////////////////////////
//
void G4UIcmdWithNucleusLimits::SetDefaultValue(G4NucleusLimits defLimits)
{
G4UIparameter * theParamAMin = GetParameter(0);
theParamAMin->SetDefaultValue(defLimits.GetAMin());
G4UIparameter * theParamAMax = GetParameter(1);
theParamAMax->SetDefaultValue(defLimits.GetAMax());
G4UIparameter * theParamZMin = GetParameter(2);
theParamZMin->SetDefaultValue(defLimits.GetZMin());
G4UIparameter * theParamZMax = GetParameter(3);
theParamZMax->SetDefaultValue(defLimits.GetZMax());
}