#/**
#*       Example Macro for simulating neutrons with the PMT BucketSource
#*
#*       run_neutrons_bucketsource.mac
#*       Date:           22/09/2008
#*       contact:        J. Wilson, Oxford
#*/

/rat/physics_list/OmitMuonicProcesses true

# Select the required detector geometry
/rat/db/set DETECTOR geo_file "geo/sno_h2o.geo"

# and add the Bucket and neutron source geometry
/rat/db/load geo/calib/BucketSource.geo

# Adjust bucket source position
/rat/db/set GEO[source] z 100.0
# Put the neutron source near the bucket (enable this geometry which is just a cylinder of acrylic)
/rat/db/set GEO[neutronSource] enable 1
# Put the source to the side of the bucket
/rat/db/set GEO[neutronSource] position [75.0, 0.0, 100.0]
/run/initialize

# BEGIN EVENT LOOP
/rat/proc frontend
/rat/proc trigger
/rat/proc eventbuilder
/rat/proc count
/rat/procset update 100
/rat/proclast outroot
/rat/procset file "neutrons_bucketsource_Z100_10000.root"
# END EVENTLOOP

/generator/add combo gun:point
# Use 1keV neutrons
/generator/vtx/set neutron 0 0 0 0.001
# Generate neutrons from the center of the acrylic source
/generator/pos/set 75.0 0.0 100.0
/generator/rate/set 1

# have to generate lots of events as only a fraction go into the bucket.
/rat/run/start 50
exit