# Tool to align the laser on the cathode. # S. Bettoni, A. Gobbo, D. Voulot # 16/06/2016 # Procedure: # switch off all the magnets between the gun solenoid and the screen or BPM used for the measurement # change the phase of the gun RF # look at the centroid position (BPM or screen) downstream of the gun. if get_context().source == CommandSource.ui: phi1 = 20.0 phi2 = 30.0 dphi = 1.0 settling_time = 0.1 print phi1 print phi2 print dphi print settling_time abort() cam_x = Channel("SINEG01-DSCR190:profile.X_stats.com", alias = "cam_x") cam_y = Channel("SINEG01-DSCR190:profile.Y_stats.com", alias = "cam_y") bpm_x = Channel("SINEG01-DBPM340:X1", alias = "bpm_x") bpm_y = Channel("SINEG01-DBPM340:Y1", alias = "bpm_y") def ccr(mag): n = 1 while n > 0: sleep(0.5) n = caget(mag + ":I-COMP") def laser_on(): caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 0) def laser_off(): caput("SIN-TIMAST-TMA:Beam-Las-Delay-Sel", 1) # Switch off magnets mag = [ "SINEG01-MCRX120","SINEG01-MCRY120", "SINEG01-MQUA140", "SINEG01-MQUA150", "SINEG01-MCRX160","SINEG01-MCRY160", "SINEG01-MCRX180","SINEG01-MCRY180", "SINEG01-MCRX200","SINEG01-MCRY200", "SINEG01-MCRX220","SINEG01-MCRY220", "SINEG01-MQUA310", "SINEG01-MQUA320" ] for m in mag: caput(m + ":I-SET", 0.0) for m in mag: ccr(m) def br(): pass def ar(): pass laser_on() try: r = lscan(gun_phase, [bpm_x, bpm_y], phi1, phi2, dphi, settling_time, before_read = br, after_read = ar) finally: laser_off() # take the result of the scan and do the plots plot(r.getReadable(1), xdata=r.getReadable(0), title = "Centroid excursion") #add_convex_hull_plot ("Centroid excursion", r.getReadable(0),r.getReadable(1), "Name") # save the entry in the logbook msg = str(r) msg = msg + "\nFile: " + get_context().path msg = msg + "\n\n" + r.print() elog("Gun laser alignment", msg , get_plot_snapshots())