# File: pcaproctw.mac
# Brief: This simulates a laserball
#
# Date: 2014-05-29
# Contact: F Descamps, <fbdescamps@lbl.gov>
# Revisions:
#       2014-05-29 : P Jones, added header info.
#       2014-12-16 : J. Maneira, update to new LB generator
#
# The pca properties are tested against the data

/rat/physics_list/OmitMuonicProcesses true
/rat/physics_list/OmitHadronicProcesses true

#The laserball position is in the middle of the detector for PCA data
# position of laserball in mm
/rat/db/set LASERBALL_SIMULATION position [7500.0, 0.0, 0.0]

# Generate photons at a single energy value
/rat/db/set LASERBALL_SIMULATION intensity 1000
/rat/db/set LASERBALL_SIMULATION wl_mode "MONO"
/rat/db/set LASERBALL_SIMULATION wl_mono 505.0


/rat/db/set NOISE_MC noise_flag 0
# Set the pulse-type to realistic
/rat/db/set DAQ pulse_type 1
/rat/db/set DAQ pulse_width 0.22
/rat/db/set DAQ uncal_type 11
/rat/db/set DAQ extasync_time 180.0

#The following enables and masks only the external trigger
/rat/db/set DAQ_RUN_LEVEL trigger_mask 32768
/rat/db/set DAQ_RUN_LEVEL trigger_enable 32768

/run/initialize
# BEGIN EVENT LOOP
/rat/proc frontend
/rat/proc trigger
/rat/proc eventbuilder
/rat/proc calibratePMT

/rat/proc count
/rat/procset update 100
/rat/proc prune
/rat/procset prune "mc"
/rat/proc outroot
/rat/procset file "pcaproctw.root"
# END EVENTLOOP

# Choose the laserball generator from fixed point (standard in poslaserball now), uniform in time
/generator/add combo vertexlaserball:poslaserball:uniform

/generator/rate/set 1

/rat/run/start 2000

exit