Message: Problem with setting particle gun as an ion Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Problem with setting particle gun as an ion 

Forum: Particles
Date: 12 Feb, 2014
From: <breanainneire>

Hello,

I am relatively new to Geant, and am just fooling around with a really basic build. So far, I can set the particle of the particle gun to gammas, neutrons, protons, etc, but today I decided to see if I can do other ions as well.

I put the code in my primary action generator as this:

PrimaryGeneratorAction::PrimaryGeneratorAction()
{
  G4int NumberOfParticles = 1;
  particleGun = new G4ParticleGun(NumberOfParticles);

  G4IonTable* ionTable = G4IonTable::GetIonTable();
  G4int Z = 6, A = 12;
  G4double excitEnergy = 0.*keV;
  G4ParticleDefinition* particle = ionTable->GetIon(Z,A,excitEnergy);
  particleGun->SetParticleDefinition(particle);
  particleGun->SetParticleEnergy(1.0*MeV);
}

Everything compiles fine, but when I run the program, I get these errors,

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : PART105
      issued by : G4IonTable::CreateIon()
Can not create ions because GenericIon is not ready
*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : Event0101
      issued by : G4ParticleGun::SetParticleDefinition()
Null pointer is given.
*** Fatal Exception *** core dump ***
-------- EEEE -------- G4Exception-END --------- EEEE -------

I'm pretty new at this, and I've search for what these mean, but I'm at a loss. If anyone can shed some light on this, it would be greatly appreciated!

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

1 Feedback: Re: Problem with setting particle gun as an ion   (Gumplinger Peter - 12 Feb, 2014)
2 None: Re: Problem with setting particle gun as an ion   (michel maire - 13 Feb, 2014)
3 None: Re: Problem with setting particle gun as an ion   (breanainneire - 14 Feb, 2014)
 Add Message Add Message
to: "Problem with setting particle gun as an ion"

 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 ]