AGS CNI Quick Start Recipe
Jeff Wood,
last updated by Haixin on Jan. 9, 2017

This recipe describes how to perform two essential functions with the AGS CNI Polarimeter:
     Target Position Scans and Polarization Measurements.
It can be started from the StartUp menu choose start ... -> AgsApplications ... -> Polar Conbtrol(AGS)

   Inhibit beam when switch target. Always take emittance measurement before each fixed target polarization measurement.

   Target switch can be done through the application. Sometimes, it requires to click twice to switch target. Please do not use the target pet page if you are not an expert. To send target to home, select vertical target3(as an example, as long as target3 is not the in use target). In the popup, select reset, it will send target to home. You may see many warning popups, just read them and click OK. After it is done, press "close" button. Then select vertical target3 again. The popup window will appear. Click button "Proceed" and wait till it's done. Then click "close" button again. At every mode switch, the target will be pulled out to home and reset the counts consequently. A good judgment on target movement during measurement is to check if the rate is constant from shot to shot.
To monitor the rate:
Open a x-terminal.
Type ssh cnipol3 -l mcr
Type cd ado/log
Type ls *.log
Find the largest run number: *****.log
Type tail -f *****.log
To start monitor for a new run, Type cntl-C and repeat tail -f *****.log with the new run number.

To change a number on any page, the area will turn yellow. Remember to hit return to let it change to white.
Target Position Scan
   1. Choose the Target Scans tab from the top of the PAT.
   2. Select the target:  Choose the Vertical tab, and Select Target*
       Target1 is our default target for now. If you are using a different target from the previous measurement,
       then a popup window will appear with a message about changing the target position.
       Click Proceed to move the target to ready position.
   Example settings for a popup window.
   3. In the Center Position field, type an estimate for the optimal target position.
   4. Click the Start button at the top of the page to start the scan.
       A popup window will review your settings and ask "Do you wish to proceed?" Click OK.

   The scan results will be updated at the bottom of the page. When the scan is finished, the peak position is calculated and showed in the Peak Count Position. This position result is also automatically sent to the Peak Position on the Target Measurements tab.
   Example settings for a target scan.
Taking a Polarization Measurement
   1. Choose the Target Measurements tab from the top of the PAT. Currently, that is the only one to use.
   2. Check that the Target, the Orientation, and the Peak Position are all set to the desired values.
       Target selection has to be done in target scan page.
   Currently, this is Vertical target1. The peak position should be around 103000(encoder position, the command position has to change since we still have the drift problem as in the past). Don't change the insertion and extraction time from the polarimeter pet page, unless you understand what you are doing.
3. Enter the Num Events (# of events to measure) and/or the Time To Run (in seconds).
       Typically, there are 40M events for a measurement.
4. Click the Run button to start the polarization measurement.
       A popup window will review your settings and ask "Do you wish to proceed?" Click OK.

   The measurement automatically stops when Num Events or Time To Run is reached, whichever occurs first. Before that time, the measurement can be stopped by clicking the Stop button. The polarization result is displayed at the bottom of the page. It will pull out target automatically (it is good to check on the pet page) and start the analysis. The results are also displayed on the Summary tab. The usual wait of several minutes still apply. The final polarization value will replace the old value. The indication of the change is the time stamp on the page.
   Example settings for a polarization measurement.
To View the PostScript File
   Click the CNI Analysis button on the Target Measurement page. Type in the run number in the popup window and click colorplot button. A postecript file will pop up.