# File: conditional.mac
# Brief: Macro showing how to use conditional processors in a RAT macro.
#
# Date: 2014-09-07
# Contact: P G Jones,
# Revisions:
#
# This macro demonstrates how to use conditional processors in a RAT macro.
/run/initialize
# BEGIN EVENT LOOP
/rat/proc frontend
/rat/proc trigger
/rat/proc eventbuilder
/rat/proc calibratePMT
/rat/proc count
/rat/procset id "Outer"
/rat/procset update 1
# Conditionally run the count proc if the nhitCut proc returns true.
# Otherwise write the event to file.
/rat/proc/if nhitCut # IF
/rat/procset nhit 500
/rat/proc count
/rat/procset id "NhitCut if"
/rat/procset update 1
/rat/proc/else # ELSE
/rat/proc/if nhitCut # Inner IF
/rat/procset nhit 450
/rat/proc count
/rat/procset id "Inner NhitCut if"
/rat/procset update 1
/rat/proc/endif # Inner ENDIF
/rat/proc count
/rat/procset id "NhitCut else"
/rat/procset update 1
/rat/proc/endif # END IF
# END EVENTLOOP
/generator/add combo gun:fill:poisson
/generator/vtx/set e- 0 0 0 1.0
/generator/pos/set 0.0 0.0 0.0
/generator/rate/set 1
/rat/run/start 10
exit