# File: conditional_Ecut.mac
# Brief: Macro showing how to use energy cut conditional processor in a RAT macro.
#
# Date: 2015-11-13
# Contact: J R Wilson <j.r.wilson@qmul.ac.uk>
# Revisions:
#
# This macro demonstrates how to use energy cut conditional processor 
# in a RAT macro to scan through existing rootfile and output a smaller one
# syntax: rat -i input_file.root -o output_file.root conditional_Ecut.mac

/rat/inroot/load_default
/run/initialize

# BEGIN EVENT LOOP

# Conditionally output the event to file only if FitEnergyCut is true

/rat/proc/if fitEnergyCut         # IF
    /rat/procset Elow 2.485	  # Cut on BisMSD Dec2013 ROI (-0.5sigma -> +1.5sigma)
    /rat/procset Ehigh 2.733
    /rat/procset fitName "scintFitter"
    /rat/proclast outroot              # output the events to file
/rat/proc/endif                   # END IF

# END EVENTLOOP

/rat/inroot/read      # Read the events in from file

exit