# File: multiPathFitter.mac
# Brief: Short macro showing how to run the MultiPath (Alberta) fitter method
#
# Date: 6 Feb 2018
# Author:  Jeff Tseng, <jeff.tseng@physics.ox.ac.uk> (contact)
#          David Auty, <auty@ualberta.ca>
#          Kalpana Singh, <kalpana.singh@ualberta.ca>
#          Jie Hu, <jhu9@ualberta.ca>
#
# This is a macro which shows how to run the MultiPath Water (MPW) fitter.
# The MPW fits for postion, time and direction of events in SNO+ water phase.
# This macro should be run on the processed data after cuts or
# Monte Carlo simulations.

/rat/inroot/load output.root
/run/initialize
# BEGIN EVENT LOOP
#/rat/proc count
#/rat/procset update 10
#/rat/procset stop 10

#/rat/proc/if taggedSource

#/rat/proc/if nhitCut
#/rat/procset nhit 10
#/rat/procset clean 1
#  /rat/proc/if numberProcessed
#  /rat/procset number 10
    /rat/proc fitter
    /rat/procset method "multipath-waterposition"
    /rat/procset selector "modeCut"
    /rat/procset selector.lowLimit -50.5
    /rat/procset selector.highLimit 100.5
    /rat/procset selector.low_domain_limit -9000
    /rat/procset selector.high_domain_limit 9000
    /rat/procset name "multipath"

    /rat/proc fitter
    /rat/procset method "multipath-waterdirection"
    /rat/procset selector "straightTimeResidualCut"
    /rat/procset selector.lowLimit -10.0
    /rat/procset selector.highLimit 120.0
    /rat/procset seed "multipath"
    /rat/procset name "multipathdirection"

    /rat/proc count
    /rat/procset update 100

    /rat/proclast outroot
    /rat/procset file "FitMP_output.root"
#  /rat/proc/endif
#/rat/proc/endif

#/rat/proc/endif

# END EVENTLOOP
/rat/inroot/read
exit