Difference between revisions of "UITF Mott CODA Scripts"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 40: | Line 40: | ||
:: and are stored in | :: and are stored in | ||
/data/idaq/epics/ | /data/idaq/epics/ | ||
+ | |||
+ | An example file is found below: | ||
+ | |||
+ | <pre> | ||
+ | #!/bin/bash | ||
+ | # EPICS variables to be included in automatic logbook entries | ||
+ | # output is in | ||
+ | # /data/idaq/epics/$RUNTYPE_$RUNSTATE_$RUNNUMBER.epics | ||
+ | # | ||
+ | # Usage: | ||
+ | # MottEpicsStart RUNTYPE RUNSTATE RUNNUMBER | ||
+ | # | ||
+ | |||
+ | RUNTYPE=undefined | ||
+ | RUNSTATE=undefined | ||
+ | RUNNUMBER=0 | ||
+ | |||
+ | usage() { | ||
+ | echo "ERROR: Must use three arguments" | ||
+ | echo " $0 RUNTYPE RUNSTATE RUNNUMBER" | ||
+ | } | ||
+ | |||
+ | # Parse commandline arguments | ||
+ | if [ -n "$1" ]; then | ||
+ | RUNTYPE=$1 | ||
+ | else | ||
+ | usage | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | if [ -n "$2" ]; then | ||
+ | RUNSTATE=$2 | ||
+ | else | ||
+ | usage | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | if [ -n "$3" ]; then | ||
+ | RUNNUMBER=$3 | ||
+ | else | ||
+ | usage | ||
+ | exit 1 | ||
+ | fi | ||
+ | |||
+ | # Location of caget exe | ||
+ | CAGET=/usr/csite/pubtools/bin/caget | ||
+ | |||
+ | # Define the output filename if not already exported | ||
+ | if [ ! -n "$epicsfile" ]; then | ||
+ | RUNFILE_PATH=/data/idaq/epics | ||
+ | epicsfile=${RUNFILE_PATH}/${RUNTYPE}_${RUNSTATE}_${RUNNUMBER}.epics | ||
+ | fi | ||
+ | |||
+ | # Backup previous, if it's there | ||
+ | if [ -e $epicsfile ]; then | ||
+ | mv -bf ${epicsfile} ${epicsfile}~ | ||
+ | fi | ||
+ | |||
+ | # Set TESTPRINT=1 for debug output | ||
+ | TESTPRINT=0 | ||
+ | |||
+ | log() { # debug echo - send it to /dev/null when not needed | ||
+ | if [ "$TESTPRINT" == "1" ]; then | ||
+ | echo $* | tee -a $epicsfile | ||
+ | else | ||
+ | echo $* | tee -a $epicsfile >& /dev/null | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | log $epicsfile | ||
+ | log "Run Timestamp: `date`" | ||
+ | |||
+ | export EPICS_CA_ADDR_LIST="129.57.255.21" | ||
+ | log "EPICS_CA_ADDR_LIST:" $EPICS_CA_ADDR_LIST | ||
+ | |||
+ | log "" | ||
+ | log " -----" | ||
+ | log " -----" | ||
+ | log "" | ||
+ | log "CODA Config : " $RUNTYPE | ||
+ | log "Run Number : " $RUNNUMBER | ||
+ | log "Run State : " $RUNSTATE | ||
+ | log "" | ||
+ | log " Gun HV Readback (kV) : "`$CAGET -t IGLK100HVPSkVolts 2>&1` | ||
+ | log " Gun HV Current (mV) : "`$CAGET -t IGLK100HVPSmAmps 2>&1` | ||
+ | log " Gun Dipole BDL (G-cm) : "`$CAGET -t MDSK201.BDL 2>&1` | ||
+ | log " Gun Dipole Current (A) : "`$CAGET -t MDSK201.S 2>&1` | ||
+ | log " -----" | ||
+ | log " KeV Spectrometer Dump Beam Current (A) : "`$CAGET -t ISLK403K6485dataRead 2>&1` | ||
+ | log " Mott Target Ladder : "`$CAGET -t ITF:MOTT:AbsPosR 2>&1` | ||
+ | log " Mott Position : "`$CAGET -t ITF:MOTT:POSITION 2>&1` | ||
+ | log "" | ||
+ | log " -----" | ||
+ | log " -----" | ||
+ | log "" | ||
+ | # | ||
+ | log " Wafer X Stage : "`$CAGET -t ITFXLaserAbsPosR 2>&1` | ||
+ | log " Wafer Y Stage : "`$CAGET -t ITFYLaserAbsPosR 2>&1` | ||
+ | log " Laser Attenuator : "`$CAGET -t ITFAttenuatorAbsPosR 2>&1` | ||
+ | log " Half-wave plate Set(off=out) : " | ||
+ | log " Half-wave plate Read(off=out) : " | ||
+ | log " Pockels Cell POS HV : "`$CAGET -t IGLK100POCKPOS 2>&1` | ||
+ | log " Pockels Cell NEG HV : "`$CAGET -t IGLK100POCKNEG 2>&1` | ||
+ | log " -----" | ||
+ | # | ||
+ | log " UITF Helicity Clock Set : "`$CAGET -t ITFHELCLOCKs 2>&1` | ||
+ | log " Helicity Delay Set : "`$CAGET -t ITFHELDELAYs 2>&1` | ||
+ | log " Helicity Pattern Set : "`$CAGET -t ITFHELPATTERNs 2>&1` | ||
+ | log " Helicity Clock Read : "`$CAGET -t ITFHELCLOCKd 2>&1` | ||
+ | log " Helicity Settle Read : "`$CAGET -t ITFHELTSETTLEd 2>&1` | ||
+ | log " Helicity Stable Read : "`$CAGET -t ITFHELTSTABLEd 2>&1` | ||
+ | log " Helicity Delay Read : "`$CAGET -t ITFHELDELAYd 2>&1` | ||
+ | log " Helicity Pattern Read : "`$CAGET -t ITFHELPATTERNd 2>&1` | ||
+ | log " Helicity Frequency : "`$CAGET -t ITFHELFREQ 2>&1` | ||
+ | log " -----" | ||
+ | # | ||
+ | log " UITF Wien Angle :"`$CAGET -t PWFK203:spinCalc 2>&1` | ||
+ | log "" | ||
+ | log " UITF Wien Magnet BDL (G-cm) : "`$CAGET -t MWFK203.BDL 2>&1` | ||
+ | log " UITF Wien Magnet Current (A) : "`$CAGET -t MWFK203.S 2>&1` | ||
+ | log " UITF Wien Positive Voltage Supply: "`$CAGET -t PWFK203P:enabled 2>&1` | ||
+ | log " UITF Wien Positive Voltage Supply (V) : "`$CAGET -t PWFK203P:readVoltSet 2>&1` | ||
+ | log " UITF Wien Negative Voltage Supply: "`$CAGET -t PWFK203N:enabled 2>&1` | ||
+ | log " UITF Wien Negative Voltage Supply (V) : "`$CAGET -t PWFK203N:readVoltSet 2>&1` | ||
+ | log " UITF Wien Quad 1 BDL (G-cm) : "`$CAGET -t MQWK202.BDL 2>&1` | ||
+ | log " UITF Wien Quad 2 BDL (G-cm) : "`$CAGET -t MQWK203.BDL 2>&1` | ||
+ | log " -----" | ||
+ | # | ||
+ | log " keV Spectrometer Dipole BDL (G-cm) : "`$CAGET -t MDIK402.BDL 2>&1` | ||
+ | log " keV Spectrometer Dipole Current (A) : "`$CAGET -t MDIK402.S 2>&1` | ||
+ | log " keV Spectrometer Corrector 1 Horizontal BDL (G-cm): "`$CAGET -t MBHK501H.BDL 2>&1` | ||
+ | log " keV Spectrometer Corrector 1 Vertical BDL (G-cm) : "`$CAGET -t MBHK501V.BDL 2>&1` | ||
+ | log " keV Spectrometer Solenoid A BDL (G-cm): "`$CAGET -t MFQK501A.BDL 2>&1` | ||
+ | log " keV Spectrometer Solenoid B BDL (G-cm): "`$CAGET -t MFQK501B.BDL 2>&1` | ||
+ | log " keV Spectrometer Corrector 2 Horizontal BDL (G-cm): "`$CAGET -t MBHK501AH.BDL 2>&1` | ||
+ | log " keV Spectrometer Corrector 2 Vertical BDL (G-cm) : "`$CAGET -t MBHK501AV.BDL 2>&1` | ||
+ | log " -----" | ||
+ | # | ||
+ | # | ||
+ | # Example on reading from a list | ||
+ | epicslist1="ITFHELCLOCKs ITFHELDELAYs ITFHELPATTERNs" | ||
+ | |||
+ | for word in $epicslist1 ; do | ||
+ | log `$CAGET $word 2>&1 | ||
+ | done | ||
+ | |||
+ | </pre> | ||
/opt/idaq/coda/logentry_scripts/displayZenity.sh | /opt/idaq/coda/logentry_scripts/displayZenity.sh | ||
* displayZenity.sh RUNTYPE RUNNUMBER | * displayZenity.sh RUNTYPE RUNNUMBER | ||
:- GUI to ask user for Run Start Comment | :- GUI to ask user for Run Start Comment |
Latest revision as of 08:57, 12 July 2022
COOL database process entries
Process Name | Transition | Script | Purpose |
logentry_start | After Prestart | /opt/idaq/coda/logentry_scripts/MakeEntry.sh %(rt) START %(rn) %(session) | Start of Run Entry to UITFMOTTLOG, start of dalma |
logentry_end | After End | /opt/idaq/coda/logentry_scripts/MakeEntry.sh %(rt) END %(rn) %(session) | End of Run Entry to UITFMOTTLOG, end of dalma and attach log into entry if it exists |
logentry_reset | Before Reset | /opt/idaq/coda/logentry_scripts/MakeEntry.sh %(rt) RESET %(rn) %(session) | Reset of Run Entry to UITFMOTTLOG, end of dalma and attach log into entry if it exists |
Script descriptions
/opt/idaq/coda/logentry_scripts/MakeEntry.sh
- MakeEntry.sh RUNTYPE RUNSTATE RUNNUMBER
- - Main script called by the CODA platform.
- - Start/ends the dalma process
- - Executes MottEpicsStart
- - Executes displayZenity.sh
- - Makes a logbook entry with the script results.
/opt/idaq/coda/logentry_scripts/MottEpicsStart
- MottEpicsStart RUNTYPE RUNSTATE RUNNUMBER
- - script that stores the values of various EPICS variables to a file with format:
RUNTYPE_RUNSTATE_RUNNUMBER.epics
- and are stored in
/data/idaq/epics/
An example file is found below:
#!/bin/bash # EPICS variables to be included in automatic logbook entries # output is in # /data/idaq/epics/$RUNTYPE_$RUNSTATE_$RUNNUMBER.epics # # Usage: # MottEpicsStart RUNTYPE RUNSTATE RUNNUMBER # RUNTYPE=undefined RUNSTATE=undefined RUNNUMBER=0 usage() { echo "ERROR: Must use three arguments" echo " $0 RUNTYPE RUNSTATE RUNNUMBER" } # Parse commandline arguments if [ -n "$1" ]; then RUNTYPE=$1 else usage exit 1 fi if [ -n "$2" ]; then RUNSTATE=$2 else usage exit 1 fi if [ -n "$3" ]; then RUNNUMBER=$3 else usage exit 1 fi # Location of caget exe CAGET=/usr/csite/pubtools/bin/caget # Define the output filename if not already exported if [ ! -n "$epicsfile" ]; then RUNFILE_PATH=/data/idaq/epics epicsfile=${RUNFILE_PATH}/${RUNTYPE}_${RUNSTATE}_${RUNNUMBER}.epics fi # Backup previous, if it's there if [ -e $epicsfile ]; then mv -bf ${epicsfile} ${epicsfile}~ fi # Set TESTPRINT=1 for debug output TESTPRINT=0 log() { # debug echo - send it to /dev/null when not needed if [ "$TESTPRINT" == "1" ]; then echo $* | tee -a $epicsfile else echo $* | tee -a $epicsfile >& /dev/null fi } log $epicsfile log "Run Timestamp: `date`" export EPICS_CA_ADDR_LIST="129.57.255.21" log "EPICS_CA_ADDR_LIST:" $EPICS_CA_ADDR_LIST log "" log " -----" log " -----" log "" log "CODA Config : " $RUNTYPE log "Run Number : " $RUNNUMBER log "Run State : " $RUNSTATE log "" log " Gun HV Readback (kV) : "`$CAGET -t IGLK100HVPSkVolts 2>&1` log " Gun HV Current (mV) : "`$CAGET -t IGLK100HVPSmAmps 2>&1` log " Gun Dipole BDL (G-cm) : "`$CAGET -t MDSK201.BDL 2>&1` log " Gun Dipole Current (A) : "`$CAGET -t MDSK201.S 2>&1` log " -----" log " KeV Spectrometer Dump Beam Current (A) : "`$CAGET -t ISLK403K6485dataRead 2>&1` log " Mott Target Ladder : "`$CAGET -t ITF:MOTT:AbsPosR 2>&1` log " Mott Position : "`$CAGET -t ITF:MOTT:POSITION 2>&1` log "" log " -----" log " -----" log "" # log " Wafer X Stage : "`$CAGET -t ITFXLaserAbsPosR 2>&1` log " Wafer Y Stage : "`$CAGET -t ITFYLaserAbsPosR 2>&1` log " Laser Attenuator : "`$CAGET -t ITFAttenuatorAbsPosR 2>&1` log " Half-wave plate Set(off=out) : " log " Half-wave plate Read(off=out) : " log " Pockels Cell POS HV : "`$CAGET -t IGLK100POCKPOS 2>&1` log " Pockels Cell NEG HV : "`$CAGET -t IGLK100POCKNEG 2>&1` log " -----" # log " UITF Helicity Clock Set : "`$CAGET -t ITFHELCLOCKs 2>&1` log " Helicity Delay Set : "`$CAGET -t ITFHELDELAYs 2>&1` log " Helicity Pattern Set : "`$CAGET -t ITFHELPATTERNs 2>&1` log " Helicity Clock Read : "`$CAGET -t ITFHELCLOCKd 2>&1` log " Helicity Settle Read : "`$CAGET -t ITFHELTSETTLEd 2>&1` log " Helicity Stable Read : "`$CAGET -t ITFHELTSTABLEd 2>&1` log " Helicity Delay Read : "`$CAGET -t ITFHELDELAYd 2>&1` log " Helicity Pattern Read : "`$CAGET -t ITFHELPATTERNd 2>&1` log " Helicity Frequency : "`$CAGET -t ITFHELFREQ 2>&1` log " -----" # log " UITF Wien Angle :"`$CAGET -t PWFK203:spinCalc 2>&1` log "" log " UITF Wien Magnet BDL (G-cm) : "`$CAGET -t MWFK203.BDL 2>&1` log " UITF Wien Magnet Current (A) : "`$CAGET -t MWFK203.S 2>&1` log " UITF Wien Positive Voltage Supply: "`$CAGET -t PWFK203P:enabled 2>&1` log " UITF Wien Positive Voltage Supply (V) : "`$CAGET -t PWFK203P:readVoltSet 2>&1` log " UITF Wien Negative Voltage Supply: "`$CAGET -t PWFK203N:enabled 2>&1` log " UITF Wien Negative Voltage Supply (V) : "`$CAGET -t PWFK203N:readVoltSet 2>&1` log " UITF Wien Quad 1 BDL (G-cm) : "`$CAGET -t MQWK202.BDL 2>&1` log " UITF Wien Quad 2 BDL (G-cm) : "`$CAGET -t MQWK203.BDL 2>&1` log " -----" # log " keV Spectrometer Dipole BDL (G-cm) : "`$CAGET -t MDIK402.BDL 2>&1` log " keV Spectrometer Dipole Current (A) : "`$CAGET -t MDIK402.S 2>&1` log " keV Spectrometer Corrector 1 Horizontal BDL (G-cm): "`$CAGET -t MBHK501H.BDL 2>&1` log " keV Spectrometer Corrector 1 Vertical BDL (G-cm) : "`$CAGET -t MBHK501V.BDL 2>&1` log " keV Spectrometer Solenoid A BDL (G-cm): "`$CAGET -t MFQK501A.BDL 2>&1` log " keV Spectrometer Solenoid B BDL (G-cm): "`$CAGET -t MFQK501B.BDL 2>&1` log " keV Spectrometer Corrector 2 Horizontal BDL (G-cm): "`$CAGET -t MBHK501AH.BDL 2>&1` log " keV Spectrometer Corrector 2 Vertical BDL (G-cm) : "`$CAGET -t MBHK501AV.BDL 2>&1` log " -----" # # # Example on reading from a list epicslist1="ITFHELCLOCKs ITFHELDELAYs ITFHELPATTERNs" for word in $epicslist1 ; do log `$CAGET $word 2>&1 done
/opt/idaq/coda/logentry_scripts/displayZenity.sh
- displayZenity.sh RUNTYPE RUNNUMBER
- - GUI to ask user for Run Start Comment