# Source definition for mono energy with angular divergance

**URL:** <https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079>\
**Category:** Geometry, Fields and Transportation\
**Created:** [May 7, 2025, 3:01pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079 "2025-05-07T15:01:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![fateme262](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/fateme262/32/10155_2.png) [@fateme262](https://geant4-forum.web.cern.ch/u/fateme262)\
**Post date:** [May 7, 2025, 3:01pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/1 "2025-05-07T15:01:04Z")

</div>

Hello everyone,  
i defined this source in my simulation:  
/gps/particle proton  
/gps/energy 15 MeV

/gps/pos/type Point  
/gps/pos/centre 0 0 0 cm

`/gps/direction 0 0 1`

/gps/ang/type beam2d  
/gps/ang/sigma\_x 1 deg  
/gps/ang/sigma\_y 1 deg

But the direction of beam is -Z direction. i want to change the direction to +Z. so I changed 1 to -1, (/gps/direction 0 0 -1). but there is no change.  
Is there a way to change the direction to +Z without using the rotation commands (/gps/ang/rot1 1 0 0, /gps/ang/rot2 0 -1 0)?

---

<div class="post-metadata">

**Author:** ![drvijayraj](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/drvijayraj/32/5211_2.png) [@drvijayraj](https://geant4-forum.web.cern.ch/u/drvijayraj)\
**Post date:** [May 8, 2025, 2:27pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/2 "2025-05-08T14:27:51Z")

</div>

Hi @fateme262

For the direction other then what you mentioned. You can do one thing.  
Please give a try if it works,

```auto
/gps/particle proton
/gps/energy 15 MeV
/gps/pos/centre 0 0 0 cm

#Direction 
/gps/pos/type iso #isotropic and direction will be controlled by theta and phi
/gps/ang/mintheta 90 deg
/gps/ang/maxtheta 90 deg
/gps/ang/minphi 180 deg
/gps/ang/maxphi 180 deg

## I turn off the switch beam2D
/gps/ang/type beam2d
/gps/ang/sigma_x 1 deg
/gps/ang/sigma_y 1 deg

```

As you can see that Z is completely eliminated and direction is controlled by theta and phi.  
Please run some simulations, based on theta phi combinations. The above is one of the example.

Regards  
VRS

---

<div class="post-metadata">

**Author:** ![jrellin](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/j/58f4c7/32.png) [@jrellin](https://geant4-forum.web.cern.ch/u/jrellin)\
**Post date:** [May 9, 2025, 1:40am UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/3 "2025-05-09T01:40:49Z")

</div>

There is weird behavior when using Point in terms of orientation. I have avoided those headaches with just using a very small circle:

```auto
/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/radius 1 mm

```

---

<div class="post-metadata">

**Author:** ![fateme262](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/fateme262/32/10155_2.png) [@fateme262](https://geant4-forum.web.cern.ch/u/fateme262)\
**Post date:** [May 14, 2025, 7:43am UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/4 "2025-05-14T07:43:20Z")

</div>

Dear Dr.Sharma,

Thank you for your solution.  
the problem is here that i want to keep 1 deg angular divergence in X and Y direction. By defining the ```  
/gps/ang/type beam2d  
/gps/ang/sigma\_x 1 deg  
/gps/ang/sigma\_y 1 deg  
the direction of beam change to -Z?

---

<div class="post-metadata">

**Author:** ![fateme262](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/fateme262/32/10155_2.png) [@fateme262](https://geant4-forum.web.cern.ch/u/fateme262)\
**Post date:** [May 14, 2025, 7:45am UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/5 "2025-05-14T07:45:40Z")

</div>

Thank you for your suggestion.

the problem is here that i want to keep 1 deg angular divergence in X and Y direction. By defining the ```  
/gps/ang/type beam2d  
/gps/ang/sigma\_x 1 deg  
/gps/ang/sigma\_y 1 deg

The direction change to -Z?

---

<div class="post-metadata">

**Author:** ![maire1](https://geant4-forum.web.cern.ch/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@maire1](https://geant4-forum.web.cern.ch/u/maire1)\
**Post date:** [May 14, 2025, 10:31am UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/6 "2025-05-14T10:31:36Z")

</div>

If you have difficulties with GPS, you can do this kind of things with simple ParticleGun.  
see example extended/eventgenerator/particleGun/Readme : case 3

---

<div class="post-metadata">

**Author:** ![fateme262](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/fateme262/32/10155_2.png) [@fateme262](https://geant4-forum.web.cern.ch/u/fateme262)\
**Post date:** [May 14, 2025, 11:56am UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/7 "2025-05-14T11:56:02Z")

</div>

Thank you Michel for your response.

This example can be helpful. i will try it.

Best

---

<div class="post-metadata">

**Author:** ![drvijayraj](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/drvijayraj/32/5211_2.png) [@drvijayraj](https://geant4-forum.web.cern.ch/u/drvijayraj)\
**Post date:** [May 15, 2025, 3:57pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/8 "2025-05-15T15:57:22Z")

</div>

@fateme262

Let’s first understand,  
What is beam2d and when you say angular sigma\_x and sigma\_y 1deg, what does it mean ?  
beam2d means particle has directions via theta and phi. which further you define 1deg deviation.  
Remember: Theta is from 0 to 180 degree, whereas phi is from -180 to +180 , and is responsible for direction.

Right. Okay.

What is the bottom line we learn, choose wisely phi for direction add +/-0.5degree deviation, and do the same thing with theta.

Do not define again and again type. You need to eliminate

```auto
## Eliminate these lines or turn off
#/gps/ang/type beam2d
#/gps/ang/sigma_x 1 deg
#/gps/ang/sigma_y 1 deg

```

A better test case for your simulation is below,

TRY IT

```auto
#Your macro looks like this
/gps/particle proton
/gps/energy 15 MeV
/gps/pos/centre 0 0 0 cm

#Direction which is equal to beam2D
/gps/pos/type iso #isotropic and direction will be controlled by theta and phi
/gps/ang/mintheta 89.5 deg
/gps/ang/maxtheta 90.5 deg
/gps/ang/minphi 179.5 deg ###GIVES DIRECTION
/gps/ang/maxphi 180.5 deg ###GIVES DIRECTION

```

Regards

---

<div class="post-metadata">

**Author:** ![fateme262](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/fateme262/32/10155_2.png) [@fateme262](https://geant4-forum.web.cern.ch/u/fateme262)\
**Post date:** [May 21, 2025, 12:27pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/9 "2025-05-21T12:27:28Z")

</div>

Thank you for your explanation.  
Just i have a question: sigma\_x and sigma\_y 1deg is half of cone. it means full cone is 2 deg. So by considering this, theta will define with +/-0.5 deg deviation or +/- 1 degree?

Regards

---

<div class="post-metadata">

**Author:** ![drvijayraj](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/drvijayraj/32/5211_2.png) [@drvijayraj](https://geant4-forum.web.cern.ch/u/drvijayraj)\
**Post date:** [May 30, 2025, 3:19pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/10 "2025-05-30T15:19:40Z")

</div>

@fateme262

Yes theta will define with +/- 1 degree when you have cone of 2 degree in x and y direction (i.e. sigma\_x and sigma\_y).  
As an example,

```auto
/gps/ang/mintheta 89 deg
/gps/ang/maxtheta 91 deg

```

VRS

---

<div class="post-metadata">

**Author:** ![fateme262](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/fateme262/32/10155_2.png) [@fateme262](https://geant4-forum.web.cern.ch/u/fateme262)\
**Post date:** [June 11, 2025, 1:26pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/11 "2025-06-11T13:26:58Z")

</div>

Thank you Dr. Sharma. it works.

---

<div class="post-metadata">

**Author:** ![drvijayraj](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/drvijayraj/32/5211_2.png) [@drvijayraj](https://geant4-forum.web.cern.ch/u/drvijayraj)\
**Post date:** [June 11, 2025, 6:24pm UTC](https://geant4-forum.web.cern.ch/t/source-definition-for-mono-energy-with-angular-divergance/14079/12 "2025-06-11T18:24:45Z")

</div>

@fateme262

Great .. I am glad it worked.  
Regards  
VRS
