Message: general particle source Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None general particle source 

Forum: Geometry
Date: 28 Jun, 2011
From: Jason Maldonis <Jason Maldonis>

--000e0ce0b6c6a45b8d04a6cd0045
Content-Type: text/plain; charset=ISO-8859-1

Hi, I am trying to use G4GeneralParticleGun.

I used the following code to create the source :
G4int n_particles = 10;
    particleGun = new G4GeneralParticleSource();

    G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
    G4ParticleDefinition* particle = particleTable->FindParticle("e-");

    particleGun->SetParticleDefinition(particle);
    particleGun->GetCurrentSource()->SetNumberOfParticles(n_particles);

    //*********************Mono-Energetic
    G4SPSEneDistribution* eneDist =
particleGun->GetCurrentSource()->GetEneDist();
    eneDist->SetEnergyDisType("Mono");
    eneDist->SetMonoEnergy(500.0*eV);

    //********************Set Position Distribution
    G4SPSPosDistribution* posDist =
particleGun->GetCurrentSource()->GetPosDist();
    posDist->SetPosDisType("Beam");
    posDist->SetPosDisShape("Circle");
    posDist->SetRadius(3.*m);
    posDist->SetCentreCoords(G4ThreeVector(0., 0., 12.*m));

    G4SPSAngDistribution* angDist =
particleGun->GetCurrentSource()->GetAngDist();
    angDist->SetParticleMomentumDirection(G4ThreeVector(0.0, 0., -1.0));

I'm trying to make points be created from different spots on a circle and go
in certain direction.
How can I make it work? If someone has an example, which illustrates it,
that would be great!!!
Also, how do I create a volume for the source and confine that source to the
volume -- or is there a way to visualize the source volume on the screen???

Victor

--000e0ce0b6c6a45b8d04a6cd0045
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<span class=3D"Apple-style-span" style=3D"font-family: arial, sans-serif; f=
ont-size: 13px; background-color: rgb(255, 255, 255); ">Hi, I am trying to =
use G4GeneralParticleGun.<br><br>I used the following code to create the so=
urce :=A0<br>

G4int n_particles =3D 10;<br>=A0=A0=A0 particleGun =3D new G4GeneralParticl=
eSource();<br>=A0=A0=A0=A0<br>=A0=A0=A0 G4ParticleTable* particleTable =3D =
G4ParticleTable::GetParticleTable();<br>=A0=A0=A0 G4ParticleDefinition* par=
ticle =3D particleTable-&gt;FindParticle(&quot;e-&quot;);<br>

=A0=A0=A0=A0<br>=A0=A0=A0 particleGun-&gt;SetParticleDefinition(particle);<=
br>=A0=A0=A0 particleGun-&gt;GetCurrentSource()-&gt;SetNumberOfParticles(n_=
particles);<br>=A0=A0=A0=A0<br>=A0=A0=A0 //*********************Mono-Energe=
tic<br>=A0=A0=A0 G4SPSEneDistribution* eneDist =3D particleGun-&gt;GetCurre=
ntSource()-&gt;GetEneDist();<br>

=A0=A0=A0 eneDist-&gt;SetEnergyDisType(&quot;Mono&quot;);<br>=A0=A0=A0 eneD=
ist-&gt;SetMonoEnergy(500.0*eV);<br>=A0=A0=A0=A0<br>=A0=A0=A0 //***********=
*********Set Position Distribution<br>=A0=A0=A0 G4SPSPosDistribution* posDi=
st =3D particleGun-&gt;GetCurrentSource()-&gt;GetPosDist();<br>

=A0=A0=A0 posDist-&gt;SetPosDisType(&quot;Beam&quot;);<br>=A0=A0=A0 posDist=
-&gt;SetPosDisShape(&quot;Circle&quot;);<br>=A0=A0=A0 posDist-&gt;SetRadius=
(3.*m);<br>=A0=A0=A0 posDist-&gt;SetCentreCoords(G4ThreeVector(0., 0., 12.*=
m));<br>=A0=A0=A0=A0<br>=A0=A0=A0 G4SPSAngDistribution* angDist =3D particl=
eGun-&gt;GetCurrentSource()-&gt;GetAngDist();<br>

=A0=A0=A0 angDist-&gt;SetParticleMomentumDirection(G4ThreeVector(0.0, 0., -=
1.0));<br><br>I&#39;m trying to make points be created from different spots=
 on a circle and go in certain direction.<br>How can I make it work? If som=
eone has an example, which illustrates it, that would be great!!!<br>

Also, how do I create a volume for the source and confine that source to th=
e volume -- or is there a way to visualize the source volume on the screen?=
??</span>
<div><font class=3D"Apple-style-span" face=3D"arial, sans-serif"><br></font=
></div><div><span class=3D"Apple-style-span" style=3D"font-family: arial, s=
ans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">Victor<=
/span></div>


--000e0ce0b6c6a45b8d04a6cd0045--

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

1 None: Re: general particle source   (Joel Long - 28 Jun, 2011)
2 None: Re: general particle source   (michel maire - 29 Jun, 2011)
 Add Message Add Message
to: "general particle source"

 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 ]