Difference between revisions of "BPM Calibration"
From PREX Wiki
Jump to navigationJump to searchCatherinef (talk | contribs) |
Catherinef (talk | contribs) |
||
Line 36: | Line 36: | ||
== How to Analyze the Pedestal Run == | == How to Analyze the Pedestal Run == | ||
− | # Make sure you are in the [[BPM Calibration#GettingStarted#Where can I find the files I need?|correct directory for macros]] | + | # Make sure you are in the [[BPM Calibration#GettingStarted#Where can I find the files I need?|correct directory for macros]] |
− | # [[Spot++| Run spot++]] on the [[Bullseye scans#BPM pedestal run|pedestal runs]] that you took for the LHRS and RHRS | + | # [[Spot++| Run spot++]] on the [[Bullseye scans#BPM pedestal run|pedestal runs]] that you took for the LHRS and RHRS |
# Run <font face="Courier">pedestals.C</font> | # Run <font face="Courier">pedestals.C</font> | ||
#* Changes to make | #* Changes to make | ||
− | #*# Change the name and location of the root | + | #*# Change the name and location of the root files for the LHRS and RHRS pedestal runs |
+ | #*#* <font face="Courier"> TFile *fileLPed = new TFile("/chafs1/work1/spot/Lrun#.root"); </font> | ||
+ | #*#* <font face="Courier"> TFile *fileRPed = new TFile("/chafs1/work1/spot/Rrun#.root"); </font> | ||
# Save the resulting plots | # Save the resulting plots | ||
# The pedestals are the means of the gaussian fits to the data. | # The pedestals are the means of the gaussian fits to the data. | ||
#* Write down the pedestals or save them to a file - Right now it doesn’t output to a file or anything | #* Write down the pedestals or save them to a file - Right now it doesn’t output to a file or anything | ||
− | # Update database files in the [[BPM Calibration#GettingStarted#Where can I find the files I need?|database directory]] | + | # Update database files in the [[BPM Calibration#GettingStarted#Where can I find the files I need?|database directory]] with the new pedestals |
− | #* '''Make sure to put today’s date with the timestamp 00:00:00!''' The analyzer will use the pedestals from the most recent date | + | #* '''Make sure to put today’s date with the timestamp 00:00:00!''' The analyzer will use the pedestals from the most recent date |
#* Change the pedestals in these files: | #* Change the pedestals in these files: | ||
#*# <font face="Courier"> db_Lrb.BPMA.db </font> | #*# <font face="Courier"> db_Lrb.BPMA.db </font> | ||
Line 65: | Line 67: | ||
#*#* First come the timestamps for harp A, and then for harp B | #*#* First come the timestamps for harp A, and then for harp B | ||
#*# Change the name of the text file that will store the results | #*# Change the name of the text file that will store the results | ||
− | #*#* <font face="Courier"> sprintf(Hresults, '' | + | #*#* <font face="Courier"> sprintf(Hresults, ''filename'') </font> |
#*#* put L or R in the filename so you know the difference between the LHRS and RHRS files | #*#* put L or R in the filename so you know the difference between the LHRS and RHRS files | ||
#*# Change the directory of where the harp files are stored | #*# Change the directory of where the harp files are stored | ||
− | #*#* <font face="Courier"> sprintf(file_name, '' | + | #*#* <font face="Courier"> sprintf(file_name, ''dirname'') </font> |
# Save the pdf files | # Save the pdf files | ||
#* 5 each for Harp A and B | #* 5 each for Harp A and B | ||
# When you are done, you should see two new .txt files, one for harp scan results for the LHRS, and one for the RHRS. | # When you are done, you should see two new .txt files, one for harp scan results for the LHRS, and one for the RHRS. | ||
+ | # File contents have the form | ||
+ | #* LHRS/RHRS Run #, Harp Run #, HarpA_X, HarpA_X sigma, HarpA_Y, HarpA_Y sigma, HarpB_X, HarpB_X sigma, HarpB_Y, HarpB_Y sigma | ||
+ | |||
== How to Calibrate the BPMs == | == How to Calibrate the BPMs == | ||
+ | # Open the output_rastersize.def file in the <font face="Courier"> rastersize/LeftHRS </font> and <font face="Courier"> rastersize/RightHRS </font> directories | ||
+ | ## Edit the files to include EPICS variables that we will use later | ||
+ | <pre> begin epics | ||
+ | hac_bcm_average | ||
+ | end epics </pre> | ||
+ | # [[Spot++| Run spot++]] on the [[Bullseye scans#How to perform a bullseye scan:#Bullseye Scan 06/22/2019|bullseye scan CODA runs]] that you took for the LHRS and RHRS. | ||
+ | #* This will analyze the data with the old calibration parameters | ||
# Make sure you are in the [[BPM Calibration#GettingStarted#Where can I find the files I need?|correct directory for macros]]. | # Make sure you are in the [[BPM Calibration#GettingStarted#Where can I find the files I need?|correct directory for macros]]. | ||
− | # [[Spot++| | + | # Run <font face="Courier"> plot_harp_results.c </font> |
− | #* This will analyze the data with the | + | #* Changes to make |
− | # | + | #*# Change <font face="Courier"> int run_numberL[5] </font> and <font face="Courier"> int run_numberR[5] </font> to the run numbers for the LHRS and RHRS, respectively |
+ | #*# (If needed) Change <font face="Courier"> t_file </font> to the location where the spot++ root files are stored | ||
+ | #*#* You do NOT need to this for PREX, but to repurpose this script, you'll have to change it | ||
+ | #*# Change <font face="Courier"> Double_t harpLA_X[5], harpLA_Y, harpLB_X, harpLB_Y, harpRA_X, harpRA_Y, harpRB_X, harpRB_Y </font> to [[BPM Calibration#How to Analyze the Harp Scan Data|the results of the harp fit]]. | ||
+ | # Save the plot as the "before" calibration plot | ||
+ | # Run <font face="Courier"> BPM_calibration.c </font> | ||
+ | #* <span style="color:red"> '''Run TWICE''' </span> - once for LHRS and once for RHRS | ||
+ | #* Changes to make | ||
+ | #*# Change <font face="Courier"> root_dir </font> to the directory where the root files are stored | ||
+ | #*# Choose to run for the LHRS or RHRS: <font face="Courier"> side = ‘L’ or ‘R’ </font> | ||
+ | #*# Change <font face="Courier"> pedestal[9] </font> and <font face="Courier"> pedestalL[9] </font> to the new pedestals for the LHRS and RHRS | ||
+ | #*#* The first number is always 0, then put in order the pedestals for the 4 antennas of BPMA, then BPMB | ||
+ | #*# Change <font face="Courier"> double BCMcuts[5][2] </font> if necessary | ||
+ | #*# Change <font face="Courier"> double cur[5] </font> to the minimum current value you want to look at | ||
+ | #*#* All data taken below this value of <font face="Courier"> hac_bcm_average </font> will NOT be analyzed - '''so be careful!''' | ||
+ | #*# Change <font face="Courier"> char date[256] </font> to the date the harp scans were taken | ||
+ | #*# Change <font face="Courier"> Hresults </font> to read the file the <font face="Courier"> get_harp_pos() </font> produced for the LHRS or RHRS | ||
+ | #*#* <font face="Courier"> sprintf(Hresults,''filename.txt''); </font> | ||
+ | #*# Change <font face="Courier"> filein </font> to read the root file for the LHRS or RHRS | ||
+ | # Copy the output to a file | ||
+ | #* The current file is called <font face="Courier"> calibration_Const.txt </font> | ||
+ | #* Output is in the format: 4 rotmatrix entries, 2 offsets | ||
+ | # Update database files in the [[BPM Calibration#GettingStarted#Where can I find the files I need?|database directory]] with the new rotation matrix and offsets | ||
+ | #* '''Make sure to put today’s date with the timestamp 00:00:00!''' The analyzer will use the rotation matrix and offsets from the most recent date. | ||
+ | #* Change the pedestals in these files: | ||
+ | #*# <font face="Courier"> db_Lrb.BPMA.db </font> | ||
+ | #*# <font face="Courier"> db_Lrb.BPMB.db </font> | ||
+ | #*# <font face="Courier"> db_Rrb.BPMA.db </font> | ||
+ | #*# <font face="Courier"> db_Rrb.BPMB.db </font> | ||
+ | # [[Spot++| Re-run spot++]] on the [[Bullseye scans#How to perform a bullseye scan:#Bullseye Scan 06/22/2019|bullseye scan CODA runs]] that you took for the LHRS and RHRS. | ||
+ | #* This will analyze the data with the new calibration parameters | ||
+ | # Re-run <font face="Courier"> plot_harp_results.c </font> | ||
+ | #* You don't have to change anything this time, hooray! | ||
+ | # Save the plot as the "after" calibration plot |
Revision as of 14:50, 24 June 2019
In the process of editing and updating this page. Please contact Juliette Mammei crowder@jlab.org with questions or suggestions.
PREX Main<< Information for Shift Takers << Shift Leader << HOW TOs << Expert Tools
Getting Started
Where can I find the files I need?
You need to be logged on to the a-onl account: ssh –X aonl@aonl2
- Analysis macros are located in
/adaqfs/home/a-onl/rastersize/bpmCalibration
- Database files are located in
/adaqfs/home/a-onl/rastersize/DB
- Output files are located in
/chafs1/work1/spot
- Root output files have the format Lrun#.root or Rrun#.root for the LHRS and RHRS, respectively
- Plot output files have the format FADC_prex_run#.pdf
- Harp scan file location is described below
Getting the harp scan files
You will need to have an ops account to do this.
- Check the HALOG for the HarpFitter entries corresponding to the harp scans you took
- Write down the Entry Log # and Timestamp
- An example can be found [here]
- Log into your ops account
ssh ''username''@opsl01
- Harp scan files can be found in
/cs/data/harpData/IHA1H04A and /cs/data/harpData/IHA1H04B
- Create a new directory in the /adaqfs/home/a-onl/rastersize/bpmCalibration directory for your harp scans
- Some example directories are already there
- scp the harp scan files for your harp scans into the new directory
How to Analyze the Pedestal Run
- Make sure you are in the correct directory for macros
- Run spot++ on the pedestal runs that you took for the LHRS and RHRS
- Run pedestals.C
- Changes to make
- Change the name and location of the root files for the LHRS and RHRS pedestal runs
- TFile *fileLPed = new TFile("/chafs1/work1/spot/Lrun#.root");
- TFile *fileRPed = new TFile("/chafs1/work1/spot/Rrun#.root");
- Change the name and location of the root files for the LHRS and RHRS pedestal runs
- Changes to make
- Save the resulting plots
- The pedestals are the means of the gaussian fits to the data.
- Write down the pedestals or save them to a file - Right now it doesn’t output to a file or anything
- Update database files in the database directory with the new pedestals
- Make sure to put today’s date with the timestamp 00:00:00! The analyzer will use the pedestals from the most recent date
- Change the pedestals in these files:
- db_Lrb.BPMA.db
- db_Lrb.BPMB.db
- db_Rrb.BPMA.db
- db_Rrb.BPMB.db
How to Analyze the Harp Scan Data
- Make sure you are in the correct directory for macros.
- Run get_harp_pos.C
- Run TWICE - once for LHRS and once for RHRS
- Changes to make
- Change char date[256] to the date the harp scans were taken
- Change run_number[5] to the run numbers for the LHRS or RHRS
- Change logbook_num[5] to the corresponding harp run numbers
- Change timestamp[] to the corresponding harp timestamps
- First come the timestamps for harp A, and then for harp B
- Change the name of the text file that will store the results
- sprintf(Hresults, filename)
- put L or R in the filename so you know the difference between the LHRS and RHRS files
- Change the directory of where the harp files are stored
- sprintf(file_name, dirname)
- Save the pdf files
- 5 each for Harp A and B
- When you are done, you should see two new .txt files, one for harp scan results for the LHRS, and one for the RHRS.
- File contents have the form
- LHRS/RHRS Run #, Harp Run #, HarpA_X, HarpA_X sigma, HarpA_Y, HarpA_Y sigma, HarpB_X, HarpB_X sigma, HarpB_Y, HarpB_Y sigma
How to Calibrate the BPMs
- Open the output_rastersize.def file in the rastersize/LeftHRS and rastersize/RightHRS directories
- Edit the files to include EPICS variables that we will use later
begin epics hac_bcm_average end epics
- Run spot++ on the bullseye scan CODA runs that you took for the LHRS and RHRS.
- This will analyze the data with the old calibration parameters
- Make sure you are in the correct directory for macros.
- Run plot_harp_results.c
- Changes to make
- Change int run_numberL[5] and int run_numberR[5] to the run numbers for the LHRS and RHRS, respectively
- (If needed) Change t_file to the location where the spot++ root files are stored
- You do NOT need to this for PREX, but to repurpose this script, you'll have to change it
- Change Double_t harpLA_X[5], harpLA_Y, harpLB_X, harpLB_Y, harpRA_X, harpRA_Y, harpRB_X, harpRB_Y to the results of the harp fit.
- Changes to make
- Save the plot as the "before" calibration plot
- Run BPM_calibration.c
- Run TWICE - once for LHRS and once for RHRS
- Changes to make
- Change root_dir to the directory where the root files are stored
- Choose to run for the LHRS or RHRS: side = ‘L’ or ‘R’
- Change pedestal[9] and pedestalL[9] to the new pedestals for the LHRS and RHRS
- The first number is always 0, then put in order the pedestals for the 4 antennas of BPMA, then BPMB
- Change double BCMcuts[5][2] if necessary
- Change double cur[5] to the minimum current value you want to look at
- All data taken below this value of hac_bcm_average will NOT be analyzed - so be careful!
- Change char date[256] to the date the harp scans were taken
- Change Hresults to read the file the get_harp_pos() produced for the LHRS or RHRS
- sprintf(Hresults,filename.txt);
- Change filein to read the root file for the LHRS or RHRS
- Copy the output to a file
- The current file is called calibration_Const.txt
- Output is in the format: 4 rotmatrix entries, 2 offsets
- Update database files in the database directory with the new rotation matrix and offsets
- Make sure to put today’s date with the timestamp 00:00:00! The analyzer will use the rotation matrix and offsets from the most recent date.
- Change the pedestals in these files:
- db_Lrb.BPMA.db
- db_Lrb.BPMB.db
- db_Rrb.BPMA.db
- db_Rrb.BPMB.db
- Re-run spot++ on the bullseye scan CODA runs that you took for the LHRS and RHRS.
- This will analyze the data with the new calibration parameters
- Re-run plot_harp_results.c
- You don't have to change anything this time, hooray!
- Save the plot as the "after" calibration plot