# Data taking and tracking script for Mrk 421 starting up...
.! echo
.! echo `date -u`  "----------------------------------------------------" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u`  "Data taking and tracking script for Mrk 421 starting up... " >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u`  "----------------------------------------------------" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log

# changing tracking to "Mrk 421" Wobble 1
.! echo `date -u`  "moving telescope to wobble position 1" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u`  "...waiting for drivectrl to be ready to move" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.s DRIVE_CONTROL 5
.w 2000
DRIVE_CONTROL/TRACK_SOURCE 0.6 90 "Mrk 421"
.! echo `date -u`  "...sent tracking command" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log

# Wait for drivectrl to reply that its tracking the given source
.s DRIVE_CONTROL 6
.! echo `date -u`  "...moving" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.s DRIVE_CONTROL 7
.! echo `date -u`  "...tracking above written wobble position" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u`  "...waiting 30 sec for drive to calm down" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo

.w 30000

# starting data taking of "Mrk 421" Wobble 1
.! echo
.x ScriptsForDimCtrl/DataTaking1

# Stop tracking
.w 2000
DRIVE_CONTROL/STOP
.s DRIVE_CONTROL 5
.! echo
.! echo `date -u` "...stopped tracking of above wobble position" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u` "----------------------------------------------------" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log

# changing tracking to "Mrk 421" Wobble 2
.! echo
.! echo `date -u`  "moving telescope to wobble position 2" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u`  "...waiting for drivectrl to be ready to move" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.s DRIVE_CONTROL 5
.w 2000
DRIVE_CONTROL/TRACK_SOURCE 0.6 -90 "Mrk 421"
.! echo `date -u`  "...sent tracking command" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log

# Wait for drivectrl to reply that its tracking the given source
.s DRIVE_CONTROL 6
.! echo `date -u`  "...moving" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.s DRIVE_CONTROL 7
.! echo `date -u`  "...tracking above written wobble position" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u`  "...waiting 30 sec for drive to calm down" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo
.w 30000

# data taking to "Mrk 421" Wobble 2
.! echo
.x ScriptsForDimCtrl/DataTaking2

# Stop tracking
.w 2000
DRIVE_CONTROL/STOP
.s DRIVE_CONTROL 5
.! echo
.! echo `date -u` "...stopped tracking of Mrk421 at above wobble position" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo `date -u` "----------------------------------------------------" >> ~/FACT++/ScriptsForDimCtrl/DataTaking.log
.! echo
# ...stopped tracking of Mrk421 at above wobble position
# ----------------------------------------------------
