# File: fitcentroid.mac
# Brief: This uses the centroid method fitter.
#
# Date: 2014-05-29
# Contact: M Mottram, <m.mottram@qmul.ac.uk>
# Revisions:
#       2014-05-29 : P Jones, added header info.
#
# This macro runs the centroid method on simulated scintillator data.

/rat/db/set DETECTOR geo_file "geo/snoplus_simple.geo"

/rat/physics_list/OmitMuonicProcesses true
/rat/physics_list/OmitHadronicProcesses true

# Choose an Nhit threshold
/rat/db/set DAQ_RUN_LEVEL n100_hi_thresh 20.0
/rat/db/set DAQ_RUN_LEVEL n100_med_thresh 18.0
/rat/db/set DAQ_RUN_LEVEL n100_lo_thresh 16.0
/rat/db/set DAQ_RUN_LEVEL n20_thresh 20.0
/rat/db/set DAQ_RUN_LEVEL n20_lb_thresh 20.0
/rat/db/set DAQ_RUN_LEVEL eshi_thresh 160.0
/rat/db/set DAQ_RUN_LEVEL eslo_thresh 120.0

/run/initialize
/rat/proc frontend
/rat/proc trigger
/rat/proc eventbuilder
/rat/proc count
/rat/procset update 10
/rat/proc calibratePMT
/rat/proc fitter
/rat/procset method "centroid"
/rat/proc outroot
/rat/procset file "fitcentroid.root"

# Generate 3 classes of events:
#   monoenergetic center
#   monoenergetic distributed
#   energy range center
/generator/add combo gun:point
/generator/vtx/set e- 0 0 0 1.0
/generator/pos/set 0 0 0

/generator/add combo gun:fillshell
/generator/vtx/set e- 0 0 0 1.0
/generator/pos/set 0 0 0 0 0 0 1.0 6005.0

/generator/add combo gun2:point
/generator/vtx/set e- 0 0 0 0 1.0 3.5
/generator/pos/set 0 0 0

/rat/run/start 1000