Message: Re: Creating an Isotope and applying it to the particle gun Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Creating an Isotope and applying it to the particle gun 

Forum: Particles
Re: None Creating an Isotope and applying it to the particle gun (Matthew Gignac)
Date: 12 Nov, 2010
From: Michael H. Kelsey <Michael H. Kelsey>

On Thu, 11 Nov 2010 06:05:50 GMT, Matthew Gignac wrote:
>         G4int z, n;
>         G4double a;
>         G4Isotope*Calcium = new G4Isotope("Calcium", z=20 , n=40, a=40.08);
> 
> When I try to put this isotope into the particle gun, the simulation will not 
> run after it has successfully compiled. In the example, the following is what 
> I am using, which I know is wrong, but do not know how else to go about it, 
> 
> G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
> G4ParticleDefinition* particle = particleTable->FindParticle("Calcium");

This isn't correct. G4Isotope is not a particle, it's a material. What you really want to do is to ask the particle table directly for the G4Ions instance of Ca-40:

    G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
    G4ParticleDefinition *particle = pTable->GetIon(z, a, 0.);
    if (0 == particle) {
       G4cerr << " ERROR: Can't create nucleus with Z=" << z << " A=" << a
              << G4endl;
       ::exit(1);
    }

>   particleGun->SetParticleDefinition(particle);
>   particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
>   particleGun->SetParticleEnergy(1.5*GeV);

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

1 None: Re: Creating an Isotope and applying it to the particle gun   (Matthew Gignac - 13 Nov, 2010)
(_ None: Re: Creating an Isotope and applying it to the particle gun   (michel maire - 13 Nov, 2010)
(_ None: Re: Creating an Isotope and applying it to the particle gun   (Matthew Gignac - 13 Nov, 2010)
(_ None: Re: Creating an Isotope and applying it to the particle gun   (michel maire - 14 Nov, 2010)
(_ Idea: Re: Creating an Isotope and applying it to the particle gun   (Vladimir Ivanchenko - 14 Nov, 2010)
(_ None: Re: Creating an Isotope and applying it to the particle gun   (Matthew Gignac - 15 Nov, 2010)
(_ Ok: Re: Creating an Isotope and applying it to the particle gun   (Matthew Gignac - 15 Nov, 2010)
 Add Message Add Message
to: "Re: Creating an Isotope and applying it to the particle gun"

 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 ]