# File: positionTimeFit.mac
# Brief: Short macro showing how to run the position likelihood fitter
#
# Date: 19-05-2014
# Contact: I Coulter, <icoulter@hep.upenn.edu>
# Revisions:
#       19-05-2014 I. Coulter <icoulter@hep.upenn.edu> Initial commit.
#
# This is a macro which shows how to run a position likelihood fitter.
# This uses the positionTimeLikelihood method, the et1d PDF, which uses
# the time-residuals of the PMT hits along with an effective speed within
# the scintillator, and the null PMTselector which uses all PMTs.
#

/run/initialize

# BEGIN EVENT LOOP
/rat/proc frontend
/rat/proc trigger
/rat/proc eventbuilder
/rat/proc count
/rat/procset update 10
/rat/proc calibratePMT

# Requires a position seed
/rat/proc fitter
/rat/procset method "quad"

# Run the position likelihood fitter
/rat/proc fitter
/rat/procset method "positionTimeLikelihood"
/rat/procset optimiser "powell"
/rat/procset pdf "et1d"
/rat/procset seed "quad"
/rat/procset selector "null"

/rat/proclast outroot
/rat/procset file "positionTimeFit.root"
# END EVENTLOOP

/generator/add combo gun:fill
/generator/vtx/set e- 0 0 0 1.0
/generator/pos/set 0 0 0
/generator/rate/set 1

/rat/run/start 10
exit