Message: Radioactive decay Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Radioactive decay 

Keywords: Radioactive decay
Forum: Physics List
Date: 02 Mar, 2008
From: Suhaili Zakaria <Suhaili Zakaria>

Hi.

I want to construct a radioactive source of Y90. My PhysicsList is as follows:

#include "exrdmPhysicsList.hh"
#include "globals.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleDefinition.hh"

#include "G4MesonConstructor.hh"

exrdmPhysicsList::exrdmPhysicsList():  G4VUserPhysicsList()
{
  defaultCutValue = 0.05*um;
  SetVerboseLevel(1);
}

exrdmPhysicsList::~exrdmPhysicsList() {;}

void exrdmPhysicsList::ConstructParticle()
{
  ConstructBosons();
  ConstructLeptons();
  ConstructBaryons();
  ConstructIons();

  G4MesonConstructor mConstructor;
  mConstructor.ConstructParticle();
}

void exrdmPhysicsList::ConstructBosons()
{
  G4Geantino::GeantinoDefinition();
  G4ChargedGeantino::ChargedGeantinoDefinition();
  G4Gamma::GammaDefinition();
}

void exrdmPhysicsList::ConstructLeptons()
{
  G4Electron::ElectronDefinition();
  G4Positron::PositronDefinition();
  G4MuonPlus::MuonPlusDefinition();
  G4MuonMinus::MuonMinusDefinition();
  G4AntiNeutrinoE::AntiNeutrinoEDefinition();
  G4NeutrinoE::NeutrinoEDefinition();
  G4NeutrinoMu::NeutrinoMuDefinition();
  G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}

void exrdmPhysicsList::ConstructBaryons()
{
  G4Proton::ProtonDefinition();
  G4AntiProton::AntiProtonDefinition();
  G4Neutron::NeutronDefinition();
  G4AntiNeutron::AntiNeutronDefinition();
}

void exrdmPhysicsList::ConstructIons()
{
  G4GenericIon::GenericIonDefinition();
}

void exrdmPhysicsList::ConstructProcess()
{
  AddTransportation();
  ConstructEM();
  ConstructGeneral();
}

#include "G4Decay.hh"
#include "G4RadioactiveDecay.hh"

#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"

#include "G4MultipleScattering.hh"

#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"

#include "G4hIonisation.hh"
#include "G4ionIonisation.hh"

//low energy

#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyRayleigh.hh"

#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"

void exrdmPhysicsList::ConstructEM()
{
  theParticleIterator->reset();
  while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();
    G4String particleName = particle->GetParticleName();

 if (particleName == "gamma") {
      pmanager->AddDiscreteProcess(new G4LowEnergyPhotoElectric);
      pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
      pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh());
      pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion());

 } else if (particleName == "e-") {
      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
      pmanager->AddProcess(new G4LowEnergyIonisation,       -1, 2,2);
      pmanager->AddProcess(new G4LowEnergyBremsstrahlung,   -1, -1,3);

 } else if (particleName == "e+") {
      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
      pmanager->AddProcess(new G4eIonisation,       -1, 2,2);
      pmanager->AddProcess(new G4eBremsstrahlung,   -1, 3,3);
      pmanager->AddProcess(new G4eplusAnnihilation,   -1, -1,4);

 }  else if (particleName == "GenericIon"){
     pmanager->AddProcess(new G4MultipleScattering, -1,1,1);
     pmanager->AddProcess(new G4hIonisation, -1, 2,2);
     pmanager->AddProcess(new G4RadioactiveDecay, -1, 3, 3);
     pmanager->AddProcess(new G4Decay, -1, 4, 4);

 } else if (particleName == "mu+"|| particleName == "mu-"){
   pmanager->AddProcess(new G4MultipleScattering, -1, 1, 1);
   pmanager->AddProcess(new G4MuIonisation, -1, 2, 2);
   pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 3);
   pmanager->AddProcess(new G4MuPairProduction, -1, 4, 4);

 } else if ((!particle->IsShortLived()) &&
            (particle->GetPDGCharge() != 0.0) &&
	    (particle->GetParticleName() != "chargedgeantino")) {
      //all others charged particles except geantino
      pmanager->AddProcess(new G4MultipleScattering,-1, 1,1);
      pmanager->AddProcess(new G4hIonisation,       -1, 2,2);
      }
}
}

#include "G4Decay.hh"
#include "G4RadioactiveDecay.hh"

void exrdmPhysicsList::ConstructGeneral()
{
 G4Decay* theDecayProcess = new G4Decay();
   theParticleIterator->reset();
   while( (*theParticleIterator)() ){
    G4ParticleDefinition* particle = theParticleIterator->value();
    G4ProcessManager* pmanager = particle->GetProcessManager();

      if (theDecayProcess->IsApplicable(*particle)) {
      pmanager ->AddProcess(theDecayProcess);
      pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
      pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
    }
  } 

const G4IonTable* theIonTable = G4ParticleTable::GetParticleTable()->GetIonTable();
G4GenericIon* ion = G4GenericIon::GenericIon();
  G4RadioactiveDecay* theRadioactiveDecay = new G4RadioactiveDecay();
  ion->GetProcessManager()->AddProcess(theRadioactiveDecay, 0, -1, 3);

   for (G4int i=0; i<theIonTable->Entries(); i++)
    {
      G4String particleName = theIonTable->GetParticle(i)->GetParticleName();
      if (particleName == "GenericIon")
	{
	G4ProcessManager* pmanager = theIonTable ->GetParticle(i)->GetProcessManager();
	//pmanager->SetVerbose(0);
	pmanager->AddProcess(theRadioactiveDecay);
	pmanager->SetProcessOrdering (theRadioactiveDecay, idxPostStep);
	pmanager->SetProcessOrdering (theRadioactiveDecay, idxAtRest);
	}
}
}

void exrdmPhysicsList::SetCuts()
{
  SetCutsWithDefault();
  if (verboseLevel>0) DumpCutValuesTable();
}

This compiles fine,and I run it, and try the following gps command, (after initialization) /gps/particle ion /gps/ion 39 90 0 0 /gps/energy 0 keV /run/beamOn 1

But, I get this segmentation fault.

*** G4Exception : 200
      issued by : G4ParticleChange::CheckIt
momentum, energy, and/or time was illegal
*** Event Must Be Aborted
Segmentation fault

What is wrong with my code? Your comment and help is highly appreciated

Many thanks, S

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Radioactive decay   (Luciano - 18 Apr, 2008)
 Add Message Add Message
to: "Radioactive decay"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]