# global energy scaling for a group of station (normally one full linac) # dE1 and dE2 are the old and new energy gains (from bends) dE1 = 291.72 # old energy gain dE2 = 292.90 # new energy gain do_elog = True stationlist = ("SINSB01","SINSB02","SINSB03","SINSB04","SINXB01") #stationlist = ("S10CB01","S10CB02","S10CB03","S10CB04","S10CB05","S10CB06","S10CB07","S10CB08","S10CB09") #stationlist = ("S20CB01","S20CB02","S20CB03","S20CB04") #stationlist = ("S30CB01","S30CB02","S30CB03","S30CB04","S30CB05","S30CB06","S30CB07","S30CB08","S30CB09","S30CB10","S30CB11","S30CB12","S30CB13") do_VRF = False #VRFGAIN = "S10:SET-E-GAIN-OP" #VRFGAIN = "S20:SET-E-GAIN-OP" #VRFGAIN = "S30:SET-E-GAIN-OP" # set RF on-delay caput("SIN-TIMAST-TMA:Beam-RF-OnDelay-Sel", 1) caput("SIN-TIMAST-TMA:Beam-Apply-Cmd.PROC", 1) time.sleep(1.0) # energy calibration A1, P1, VSA1, PWR1, ACC1 = {}, {}, {}, {}, {} A2, P2, VSA2, PWR2, ACC2 = {}, {}, {}, {}, {} 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 VSA = caget(station + "-RSYS:GET-VSUM-AMPLT") # unit PWR = caget(station + "-RSYS:GET-KLY-POWER-GATED") # MW ACC = caget(station + "-RSYS:SET-ACC-VOLT") # MV A1[station] = A P1[station] = P VSA1[station] = VSA PWR1[station] = PWR ACC1[station] = ACC A2[station] = A * dE2 / dE1 P2[station] = P * (dE1 / dE2)**2 ACC2[station] = ACC * dE2 / dE1 caput(station + "-RSYS:SET-VSUM-AMPLT-SCALE", A2[station]) caput(station + "-RSYS:SET-VOLT-POWER-SCALE", P2[station]) caput(station + "-RSYS:SET-ACC-VOLT", ACC2[station]) if do_VRF: caput(VRFGAIN, dE2) time.sleep(10.0) for station in stationlist: VSA = caget(station + "-RSYS:GET-VSUM-AMPLT") # unit PWR = caget(station + "-RSYS:GET-KLY-POWER-GATED") # MW VSA2[station] = VSA PWR2[station] = PWR #Elog entry if do_elog: title = "Energy calibration scaling" log_msg = "Old energy gain: %0.2f" % dE1 + " MeV/c\n" log_msg = log_msg + "New energy gain: %0.2f" % dE2 + " MeV/c\n\n" log_msg = log_msg + " AmpScale1 AmpScale2 PwrScale1 PwrScale2 Acc-Volt1 Acc-Volt2 VSA1 VSA2 Power1 Power2\n" for station in stationlist: log_msg = log_msg + station + "%12.2f%12.2f%12.6f%12.6f%12.2f%12.2f%12.4f%12.4f%12.2f%12.2f" % (A1[station],A2[station],P1[station],P2[station],ACC1[station],ACC2[station],VSA1[station],VSA2[station],PWR1[station],PWR2[station]) + "\n" attachments = None elog(title, log_msg)