Message: RE: Generic Ion Problems Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None RE: Generic Ion Problems 

Forum: Particles
Re: Question Generic Ion Problems (Laura)
Date: 01 Nov, 2007
From: Makoto Asai <Makoto Asai>

Hi, 

 Ions cannot be made before physics processes are
constructed. Since you put GetIon() method in your
constructor, and instantiate your primary generator
action before you invoke initialize() of run manager,
this error happened.
 
There can be two solutions.

1) Move the instantiation of your primary generator
action after you invoke G4RunManager::Initialize().

2) Alternatively, move GetIon() method to 
GeneratePrimaries() method like this

void ISMPrimaryGeneratorAction::
            GeneratePrimaries(G4Event* evt)
{
  static G4ParticleDefinition* part = 0;
  if(!part)
  {
    part = particleTable->GetIon(26,56,0.);
    particleGun->SetParticleDefinition(part);
  }
  .....
}
  

Makoto

> -----Original Message-----
> From: Laura [mailto:lapaulucci@gmail.com] 
> Sent: Thursday, November 01, 2007 4:40 AM
> To: publichypernews
> Subject: Generic Ion Problems
> 
> *** Discussion title: Particles
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/particles/367"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hello!
> 
> I am sorry for this may sound like a very basic question but 
> I am trying to implement an iron beam and for that I did:
> 
> In the Physics List:
> 
> void ISMPhysicsList::ConstructIons()
> { 
>     G4IonConstructor iConstructor;
>     iConstructor.ConstructParticle();
> }
> 
> In the Primary Generator Action:
> 
> ISMPrimaryGeneratorAction::ISMPrimaryGeneratorAction()
> {
>   particleGun = new G4ParticleGun(1);
> 
>   G4ParticleTable* particleTable = 
> G4ParticleTable::GetParticleTable();
>   G4ParticleDefinition* particleName = 
> particleTable->GetIon(26,56,0.);
>   particleGun->SetParticleDefinition(particleName);
> (...)
> }  
> 
> And I am getting the following error message:
> 
> *** G4Exception : Illegal operation
>       issued by : G4IonTable::CreateIon()
> Can not create ions in PreInit state
> *** This is just a warning message.
> 
> *** G4Exception : Event00003
>       issued by : G4ParticleGun::SetParticleDefinition()
> Null pointer is given.
> *** Fatal Exception *** core dump ***
> 
> *** G4Exception: Aborting execution ***
> Abort
> 
> I have tried to look the advanced examples but I did not 
> find what seems to be the problem...
> Does anybody know what am I doing wrong?
> Thank you.
> 
> 

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

1 Agree: RE: Generic Ion Problems   (Laura - 01 Nov, 2007)
 Add Message Add Message
to: "RE: Generic Ion Problems"

 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 ]