Files
sf-op/script/Tools/RfEnergyCalib.py
2020-02-07 11:43:37 +01:00

39 lines
1.5 KiB
Python

E1 = 3722.0 # old energy
E2 = 3789.0 # new energy
do_elog = True
#stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09")
#stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04")
stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04","S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13")
A1, A2 = {}, {}
P1, P2 = {}, {}
for station in stationlist:
A = caget(station + "-RSYS:SET-VSUM-AMPLT-SCALE") # MV/unit
P = caget(station + "-RSYS:SET-VOLT-POWER-SCALE") # MW/MV^2
A1[station] = A
A2[station] = A * E2 / E1
P1[station] = P
P2[station] = P * (E1 / E2)**2
# set RF on-delay
caput("SIN-TIMAST-TMA:Beam-RF-Delay-Sel",1)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
for station in stationlist:
caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", A2[station])
caput(station + "-RSYS:SET-VOLT-POWER-SCALE", P2[station])
caput(station + "-RSYS:CMD-LOAD-CALIB-BEAM", 1)
# set RF on-beam
caput("SIN-TIMAST-TMA:Beam-RF-Delay-Sel",0)
caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC",1)
#Elog entry
if do_elog:
title = "Energy calibration scaling"
log_msg = "Old energy: %0.2f" % E1 + " MeV/c\n"
log_msg = log_msg + "New energy: %0.2f" % E2 + " MeV/c\n\n"
log_msg = log_msg + " A1 A2 P1 P2 \n"
for station in stationlist:
log_msg = log_msg + station + "%10.2f%10.2f%10.6f%10.6f" % (A1[station],A2[station],P1[station],P2[station]) + " \n"
attachments = None
elog(title, log_msg)