Project

General

Profile

BPMs » History » Version 1

Ole Hansen, 04/05/2018 11:38 AM

1 1 Ole Hansen
h1. Analyzing BPMs
2
3
h2. List of files
4
5
Source code:
6
7
<pre>
8
THaRaster.h
9
THaBPM.h
10
THaUnRasteredBeam.h
11
HallA_LinkDef.h
12
THaBeamDet.h
13
THaRasteredBeam.h
14
15
THaRaster.C
16
THaUnRasteredBeam.C
17
THaBPM.C
18
THaRasteredBeam.C
19
THaBeamDet.C
20
</pre>
21
22
Examples (can be found in @$ANALYZER/examples/BPM@):
23
24
<pre>
25
beam_db.dat             database for B.Reitz's beam apparatus/detectors
26
                        (one has to create appropriate soft links to this file)
27
28
check_bpm_calib.C       to verify the BPM calibration constants are okay (bulls eye scan needed)
29
get_bpm_calib.C         to extract BPM calibration constants (bulls eye scan needed)
30
get_bpm_pedestals.C     to extract BPM pedestals (special CODA run needed)
31
get_rast_const.C        to extract transformation coefficients between raster currents and position 
32
33
harp_results.txt        results of the harp scan analysis (needed to run 
34
                        bpm_calib scripts)
35
</pre>
36
37
h2. Details about the database file
38
39
The database elements for all beam line detectors can be stored in principle in one file, however the analyzer expects different database files for the different detectors. One way to cope with this feature is to put everything in a single file (@beam_db.dat@) and create soft links for all detectors, like in the following example: 
40
<pre>
41
ln -s beam_db.dat db_rb.Raster.dat 
42
ln -s beam_db.dat db_urb.BPMA.dat 
43
ln -s beam_db.dat db_urb.BPMB.dat 
44
</pre>
45
Of course you can also have three files, which only need to have the necessary blocks.
46
47
The database file is an ASCII file, which is read in line-by-line. There are several blocks containing relevant information in a fixed format. Between the blocks one can add comments as wanted, but not in the blocks itself.
48
49
A block starts with a line containing a keyword in square brackets (no leading spaces or other leading characters are allowed).
50
51
The following blocks are known and needed:
52
53
<pre>
54
I.)
55
56
[xy_detmap]
57
               1      2          1            23          0 3       1881
58
              -1       0         0            0           0 0       0
59
</pre>
60
Where xy is the name of the beam line detector as defined in the beam apparatus (currently I am using Raster, BPMA and BPMB, caution it is case sensitive). Next line(s) are the detector map lines in ESPACE style:
61
* first detector channel
62
* ROC number
63
* Crate number
64
* Slot number
65
* first channel on digitizing module
66
* last channel on digitizing module
67
* type of digitizing module
68
Ask Bob Michaels or the experimenters to get these numbers. They are also hidden in the detector map which is inserted in the CODA file.
69
70
Lines are read in, until the first detector channel is negative. 
71
<pre>
72
II.)
73
74
[Raster]
75
-23.0 18.3 18.3   0 0 1633   1643
76
-7.345
77
-2.214
78
0.0
79
0. 0. 1. 1. 0. 0.
80
0. 0. 1. 1. 0. 0.
81
0. 0. 1. 1. 0. 0.
82
</pre>
83
First line gives: 
84
<pre>
85
z-position of the raster magnets in meters (not used) [Arun Saha, Surveys]
86
x-frequency of the raster magnets in kHz (currently not used) 
87
y-frequency of the raster magnets in kHz (currently not used)
88
            [Bob Michaels, Bill Gunning should know what was used. 
89
             18.3/18.3 is typical for circular raster,
90
             22.4/18.3 or 18.3/22.4 is typical for a traditional square raster] 
91
2* pedestals for magnet current in x (y) (currently not used, since accounted for below)
92
2* pedestals for derivative of magnet current in x (y)   (currently not used, to 
93
            get those, one has to plot  histograms of raster.rawslope1(2), the pedestal
94
            is defined as the point right in the middle of the two peaks)
95
</pre>
96
2nd - 4th line: z position of 1st and 2nd beam line detector and the target. (Those are the planes at which the x and y position of the beam is calculated at) One should use the surveyed position of the two BPMs and 0. as nominal interaction point. Although the provided tools do not correct for the fact, that BPMs and harps are not exactly at the same z-position. Therefore don't be surprised if you see the position of the two harps instead, it doesn't make a difference within the resolution of these devices.
97
98
5th - 7th line: linear transformation from raster currents (in ADC channels) to the x/y position in the three previously defined planes (in meters).
99
100
A line like 
101
<pre>
102
B1 B2 A11 A22 A12 A21
103
</pre>
104
means 
105
<pre>
106
x_HCS = B1 + A11 * x_raster + A12 * y_raster
107
y_HCS = B2 + A21 * x_raster + A22 * y_raster
108
</pre>
109
There is a script: @get_raster_coeff.C@ as an example to extract this transformation. This transformation changes at least from run to run, or even more frequently if the beam was tuned during a run. Currently I do not support the latter case with the analyzer. This will be added, as soon as the general database support is a little more stable. (Espace already supports time dependent trafos even within a run)
110
111
<pre>
112
III.)
113
114
[BPMA]
115
-7.345 0.01887  1.1 1.1
116
0 0 0 0
117
-1.0269  1.0300  1.0846 0.95947  -4.09371E-04  3.91314E-04
118
119
(Of course there is a similar block for BPMB)
120
First line: z-position of the device (in meters)
121
            calibration constant (historically set to 0.01887 to produce reasonable 
122
            big numbers in the rotated coordinate system. One can change this number, but has 
123
            to repeat the calibration of the other numbers afterwards)
124
            phase difference between x(y) position determined by device and real position
125
            (currently not used)
126
Second line: pedestals for the four antennas. Don't bother to much if you don't know them.
127
            The bulls eye scan can mostly compensate wrong values here. If you change them,
128
            you have to repeat the calibration of the numbers in the last line.
129
	    You need a special bpm_pedestal run to measure them (see comments in 
130
            get_bpm_pedestals.C e.g., this script would also analyze such a run )
131
Third line: Linear transformation from BPM coordinates to HCS coordinates, in the above 
132
            example:
133
134
            x_HCS [meter] = -1.0269 rot1 + 1.0300  rot2 - 4.09371E-04
135
            y_HCS [meter] =  1.0846 rot1 + 0.95947 rot2 + 3.91314E-04
136
</pre>
137
To obtain this transformation you need an analyzed bulls eye scan. The script @get_bpm_calib.C@ will then extract those numbers for both BPMs.
138
139
140
h2. How to use all this stuff
141
142
# get a template for the beamline database file
143
# make sure that the detector map entries are correct
144
# make sure that the z-positions of the BPMs/target are up to date in the database
145
# during the experiment: perform a bpm_pedestal run: 
146
<pre>
147
//   1.   MCC has to follow the following procedure
148
//   1.1    Open BPM window "BPM Diagnostics - SEE"
149
//   1.2    From there pull down the "Expert Screens" and open "Gain Control"
150
//   1.3    For IOCSE10, use the pull down window and change from "auto gain"
151
//          to "forced gain". Then change the Forced Gain values x and y to zero.
152
//   2.   CODA has to run in pedestal mode
153
</pre>
154
# run @get_bpm_pedestals.C@ in the analyzer (you might have to modify some details) it should print out the new pedestals at the end. Load the database into an editor and change them (2nd line of the @[BPMx]@ blocks) 
155
# Next step is a so called bulls eye scan. Therefore you need unrastered beam. 
156
#* Ask MCC to steer the beam to the nominal center of the target (caution you should not do this with a target requiring rastered beam, use carbon, BeO, optics, or in the worst case empty instead). Wait until beam is stable and perform a harp scan and a CODA run right next to each other. Ask MCC then to steer the beam to positions around the nominal center, covering at least the area the raster will cover, and repeat harp and CODA runs.
157
#* Analyze the harp scans, making sure you use the latest survey results to get the corrected beam position. (To analyze harp runs follow the instructions on the web. They are not in the scope of the analyzer.)
158
Put those results into a table, together with the run number of the corresponding CODA run. This will look like: 
159
<pre>
160
$ more harp_results.txt 
161
1154 62  -1747.0  131.0  1665.00  339.9   517.00  101.0  1012.00  315.5 1493.90   730.23  -.44  -.13
162
1155 64  -1614.0  124.0  2829.00  343.6   693.00   96.0  2908.00  329.9 1688.46  2942.09  -.45   .02
163
1156 65  -3256.0  124.0  2889.00  346.5 -1422.00   98.0  2993.00  331.2 -630.64  3037.88  -.36   .02
164
....
165
</pre>
166
where the columns are: CODA RunID, Harp RunID, positions (and sigmas) at 1H04a (~BPMA), 1H04b (~BPMB) and the extrapolated position and angle at the pivot point (z=0) in [um]
167
#* The script @get_bpm_calib.C@ can now be used. It reads in this table, analyzes the CODA runs and finally prints out the coefficients, which one has to copy into the database (3rd line of the @[BPMx]@ section.) 
168
# You can check if this worked out by running @check_bpm_calib.C@. It again analyzes the runs of the bulls-eye scan and plots the reconstructed positions versus the results of the harp analysis.
169
# If your experiment takes data with unrastered beam you are done now. Simply use this database and the @THaUnRasteredBeam@ Apparatus to obtain the beam position and direction. It will give those two parameters for each event, and will automatically take care of drifts and or (slow) changes of them. !!! This will not work with rastered beam, even worse by doing so you would use a beam position which is off, and the offset might even depend on other kinematical variables, or is at least not randomly. 
170
# If your experiment takes data with rastered beam:
171
#* The BPMs are unfortunately too slow to measure the position of the beam at the time when the electron actually hits the target, they have a shift in the order of micro-seconds. The Raster magnets have a much smaller phase difference and can be used directly, however the relation between the current in the raster and actual beam deflection and beam position depends on beam energy and on beam tuning. Therefore this calibration has to be redone for all data individually. In principle it can change even within one CODA run if MCC had to do retuning while the experiment did not stop data taking. This latter case is currently not supported, but will be added in a later version of the root analyzer. However it is recommended to get a new beam_db.dat file for each run, where the @[Raster]@ block is adjusted accordingly. This already implies, that one has to go through the data in a two step analysis. 
172
#* Use a generic @beam_db.dat@ file and run a script similar to @get_rast_consts.C@. It uses the @THaUnRasteredBeam@ apparatus to get the centroid and the size of the raster using the BPMs, and the @THaRasteredBeam@ apparatus to get the centroid and width of the current in the raster for one CODA run. Out of those values it calculates the diagonal matrix elements and offsets for the raster to position transformation, which are printed and need to be put into the database file for that run. (If someone automates this procedure, let me know ;) This procedure has a sign ambiguity for both the horizontal and the vertical width. This sign depends on cabling and ADCs used, and can therefore change between experiments. Only checking the data can reveal if things are done properly. E.g. looking at the correlation between @rb.x@ and @L/R.gold.y@ will show if the sign for the horizontal calibration is correct. The vertical sign can be checked by looking at a sharp peak in an energy spectrum (emiss, omega), before and after applying extended target corrections. If the sign is correct, the width of the peak should get smaller after the corrections. 
173
#* Now you can replay the CODA run again, this time using the @THaRasteredBeam@ Apparatus (with the individual database file) to get the phase correct event-by-event beam position and using all Apparatus (like HRS ...) and physics packages needed for a complete analysis. 
174
#* For online analysis the procedure seems rather complicated. Probably the best way is to use the @THaIdealBeam@ apparatus instead, which always puts the beam position to its nominal value, and use the more sophisticated analysis for offline purposes later on. 
175
176
Bodo Reitz
177
Last modified Jul 28, 2004