# File: alphaBeta.mac
# Brief: Short macro showing how to run the AlphaBeta Classifier
#
# Date: 19-05-2014
# Contact: E Marzec, <marzece@sas.upenn.edu>
# Revisions:
#       17-01-2018 T. Kroupa <tereza.kroupova@physics.ox.ac.uk> Replace colon with a hyphen in the classifier initialisation.
#       19-05-2014 I. Coulter <icoulter@hep.upenn.edu> Initial commit.
#
# This is a macro which shows how to run the AlphaBeta Classifier.
# Calculates a log-liklihood that an event is either a BiPo event
# or a two beta event and returns the ratio of those likelihoods.
# Uses PDFs contained within CLASSIFIER_ALPHA_BETA_LIKELIHOOD.ratdb.
# The classifier can be called with an initialisation, the format of
# which goes as the pulse shape description, then a hyphen followed by
# the desired scintillator. The default, if no initialisation is given,
# is 212_wPSD and te_0p3_labppo_scintillator_Oct2012.
# The pulse shape can be given with no specified scintillator but
# you can't give a scintillator without a pulse shape description.
#

/run/initialize

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

# Use quad to get a position seed
/rat/proc fitter
/rat/procset method "quad"

# AlphaBeta classifier requires an optimiser and can use a seed.
# Typically used with grid search optimiser, in steps of 100.
/rat/proc classifier
/rat/procset classifier "AlphaBetaClassifier-212_wPSD-te_0p3_labppo_scintillator_Oct2012"
/rat/procset optimiser "grid-100"
/rat/procset seed "quad"

/rat/proclast outroot
/rat/procset file "AlphaBeta.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