# How to implement multiple sources via GPS in macro?

**URL:** <https://geant4-forum.web.cern.ch/t/how-to-implement-multiple-sources-via-gps-in-macro/6562>\
**Category:** Particles, Track, Event, Run and Biasing\
**Created:** [November 17, 2021, 7:43pm UTC](https://geant4-forum.web.cern.ch/t/how-to-implement-multiple-sources-via-gps-in-macro/6562 "2021-11-17T19:43:52Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![mksharma\_iitk](https://geant4-forum.web.cern.ch/user_avatar/geant4-forum.web.cern.ch/mksharma_iitk/32/2080_2.png) [@mksharma\_iitk](https://geant4-forum.web.cern.ch/u/mksharma_iitk)\
**Post date:** [November 18, 2021, 10:16pm UTC](https://geant4-forum.web.cern.ch/t/how-to-implement-multiple-sources-via-gps-in-macro/6562/4 "2021-11-18T22:16:00Z")

</div>

@Halait-Ge : Here is something that worked for me. The developers guide provides a list of other commands that may be useful.

**Sample macro file:**

```auto
# one neutron spectra and other monoenergetic Cs-137 gammas
# source-1
/gps/source/add 1.
/gps/particle neutron

# pos/shape info
/gps/pos/type Point
/gps/pos/centre 10 0 0 cm

# angular distribution
/gps/ang/type iso
/gps/ang/mintheta 90 deg
/gps/ang/maxtheta 125 deg
/gps/ang/minphi -90 deg
/gps/ang/maxphi 90 deg

# energy distribution
/gps/ene/type User
/gps/hist/type energy
/control/execute spec.dat

# source-2
/gps/source/add 1.
/gps/particle gamma

# pos/shape info
/gps/pos/type Point
/gps/pos/centre 20 0 0 cm

# angular distribution
/gps/ang/type iso
/gps/ang/mintheta 90 deg
/gps/ang/maxtheta 125 deg
/gps/ang/minphi -90 deg
/gps/ang/maxphi 90 deg

# energy distribution
/gps/ene/type Mono
/gps/ene/mono 0.6617 MeV

/gps/source/list
/control/verbose 2
/run/verbose 2
/event/verbose 0

/run/beamOn 10000

```

**Sample spec.dat:**

```auto
/gps/hist/point 0.01 0
/gps/hist/point 0.25 0
/gps/hist/point 0.35 0
/gps/hist/point 0.45 0
/gps/hist/point 0.49 0
/gps/hist/point 0.5 1

```

---

_[View the full topic](https://geant4-forum.web.cern.ch/t/how-to-implement-multiple-sources-via-gps-in-macro/6562)._
