Performing Dithering Corrections
This code uses data taken during beam modulation, or dithering. It uses 5 bpms diff_4aX, diff_4aY, diff_4eX, diff_4eY, and diff_12X as independent variables (IVs), and the 4 main detectors asym_usl, asym_usr, asym_dsl, and asym_dsr as dependent variables (DVs). It calculates the dithering slopes and uses either the slopes from a single run or the average slopes over a slug to correct the DVs.
Contents
Getting Started
First, you will need to find the slopes that you will use to perform the correction.
- Login to the apar account on aonl2:
ssh apar@aonl2
-
cd ~/PREX/prompt/beam-mod/scripts
-
source setup_japan.tcsh
- Choose a list of runs that you would like to analyze and put them in a file called "filename.list"
- To analyze a slug, choose the corresponding list in
~/PREX/prompt/collector/run_list/
- To analyze a slug, choose the corresponding list in
- Next, run
./dit_runlist.sh filename.list
-
NOTE: You can only run one( Bug fixed: Now you can do it, but you don't have to)./dit_runlist.sh
at a time - This creates or update a root file called "dit_slopes_slug#.root" in the
~/PREX/prompt/beam-mod/rootfiles
directory. - The TTree "dit" contains the following variables:
- run: The run number
- "DV"_"IV": the slope of the graph of "DV" vs "IV"
- Example: usr_4aY contains the slopes of asym_usr vs diff_bpm4aY
- There is one for each pair of dependent and independent variables
-
- Open the root file and see if there are any outlier runs
- If there is a slope that is very different from all of the others, we don't want to use it
- Add the outlier runs to the blacklist
-
~/PREX/prompt/beam-mod/black.list
- When taking slope averages, these runs will be skipped
-
Setting up for analysis
To get set up, you have to make sure you know the run number you would like to correct, and the run/slug number that contains the slopes you want to use for the correction.
Finding the slug number
In the ~/PREX/prompt/beam-mod/
directory, there is a macro called QuerySlugNumber.C
. Give this macro your run number, and it will search the RCDB to tell you what slug it belongs to.
Finding japan root files
You will also need to know the japan root file that contains the data you want to correct. The main japan output files are in ~/PREX/japan/japanOutput
, and have names that follow the convention prexPrompt_pass1/2_runNumber_segNumber.root
. Or, you can also use your own personal japan files (see Setting up japan and Running prompt).
Finding dithering slopes root files
These files are in the ~/PREX/prompt/beam-mod/rootfiles
directory. You can use the general slug root files if you know the slug number for the run whose slopes you want to use.
Running the analysis
There are two scripts in the ~/PREX/prompt/beam-mod/
directory that will use ditehring slopes to correct your data. They each have different options and outputs, so choose the one that is right for you.
CorrectTree.C
This macro will use the slug average to correct the detector asymmetries. Give it a run number as an argument, and it will load the corresponding main japan file, search the RCDB for the corresponding slug number, and correct the run based on the slug averaged slopes. It saves the uncorrected and corrected detector asymmetries to a root file in the DitOutputs
directory, with the naming convention "prexPrompt_dither_runNumber_segmentNumber.root".
Example: root -l 'CorrectTree.C (3422, 003)'
To run this many times, create a list of run numbers. Note that this will choose all segment numbers = 000. Then run ./correctTree_runlist.sh filename.list
DitAlias.C
This macro will use slopes from either a specific run number or the average from a slug, and uses them to correct the detector asymmetries. It draws plots of the detector asymmetry before and after the correction, and does not create an output root file.
- To correct data using the average slopes of the dithering root file, give the japan file whose data you would like to correct, and the file whose slopes you would like to use:
- Example:
root -l 'DitAlias.C ("~/PREX/japan/japanOutput/prexPrompt_pass1_3422.000.root", "rootfiles/dit_slopes_slug4.root")'
- Example:
- To correct data using the slopes from a particular run, give the japan file whose data you would like to correct, and the file whose slopes you would like to use, and the run number of the slopes you would like to use:
- Example:
root -l 'DitAlias.C ("~/PREX/japan/japanOutput/prexPrompt_pass1_3422.000.root", "rootfiles/dit_slopes_slug4.root", 3422)'
- Example:
- Note that you can correct a run using the slopes of any other run or slug that you'd like