# Kinematic Reconstruction Package Introduction

The kinematic reconstruction package here currently is designed for the gsfma230 experiment using GammaSphere and the Microball detector. The most early version for dealing with an α-31Si binary system, and then I extend the program to deal with a two-proton-34Si and one-proton-33P cases. The kinematic reconstruction consists of multiple steps, and the physics discussion for the kinematic reconstruction is here.

(1) Re-sorting the data. ( source.ev2 -> modified_source.ev2). We have to require that there are two γ rays and one particle entries in an event since we are going to make particle-γ-γ matrices.

(2) Calculated the recoil velocities and directions. And then applying Doppler correction to the γ-ray energies. We also re-define and re-bin the γ-ray angle. The polar angle is defined by the one between the recoil and the γ ray, not the detector angle anymore. In another word, the z-axis follows the direction of the recoil, and it is dynamically changing. (modified_source.ev2 -> new_source.ev2)

(3) sort the data into various kind of matrices, such as all-vs-all or 30deg-vs-90deg, etc (multiple new_source.ev2 files to a matrix.sqr )

# Before running the code

You should check the 'parameter.txt', and set up the spices of the target and projectile, and the binary system after the reaction. Note: Currently this program is only limited in a binary system.

```--------------------before reaction-----------------------------------
25		The energy of projectile in the lab frame (MeV).
18		The atomic number of the projectile
16766.0384	The mass of the projectile in MeV/c^2 (if 0, mass = A*938)
18		The atomic number of the target
16766.0384	The mass of the target in MeV/c^2 (if 0, mass = A*938)
--------------------after reaction------------------------------------
1		The atomic number of the light daughter nuclei
938		its mass in MeV/c^2	(if 0, mass = A*938)
34		The atomic number of the heavy daughter nuclei
31638.6	its mass in MeV/c^2	(if 0, mass = A*938)
```

# Run the script

The packages have been installed in the nucgam server. I use two bash scripts to run these jobs, and one does not need to memorize how to run the programs. The scripts provide very friendly control methods over the parameters. For example, the matrix type, dop-dop, nod-dop, or nod-nod, as well as the initial velocity modifying factor. The essential part of the script presents as the following. Basically, you only need to change the 'IMPORTANT VARIABLE'. Note: if your ev2 run number is not continuous (in this case run105 to run246), you may need to modified the script or to run it piecewise.

```#!/bin/bash
# !!! for proton !!!
#---------IMPORTANT VARIABLE---------
FACTOR=0.9  # set it zero when Nod-Nod
Dop_Dop=false
Dop_Nod=true
#-------------------------------------

PREFIX=run
SUFIX=.ev2
INDEX=105

# to clean the previous record of statistics.
if [ -e "stat.dat" ]; then rm stat.dat; fi
while [ \$INDEX -le 246 ];
do

# STEP1___To modify the original .ev2
\${modify_ev2} run\${INDEX}.ev2

if \$Dop_Dop; then
./KM_correction modified_run\${INDEX}.ev2 \$FACTOR dop #(dop-dop version)
fi
if \$Dop_Nod; then
./KM_correction modified_run\${INDEX}.ev2 \$FACTOR     #(nod-dop version)
fi

# STEP3___remove the intermidate .ev2 file,
rm modified_run\${INDEX}.ev2

# STEP4____to move .ev2 file to sort_ev2 directory
# and rmove the original .ev2 files in project_KM directory
mv new_run\${INDEX}.ev2 ./sort_ev2/run\${INDEX}.ev2

# remove the files copied from servers.
rm run\${INDEX}.ev2
INDEX=\$((INDEX+1))
echo "--------------------------------------"

done

```

# Sort into matrices

The sort.ev2 program can sort the ev2 files, of course, you can use gnuscope to sort as well. But the sort.ev2 can prevent the issue of 'gating itself, but see itself' for a Dop-Nod matrix. For example, if you gate on 1000-1200 keV, but you still see a peak at 1000-1200 keV.

For the ev2 data, the Dop part will have similar energies as the Nod part. For example, Nod = [1, 1000], Dop=[101, 995]. However, gnuscope cannot recognize ADC1 and ADC101 as the same detector. The program 'gnuscope2' has fixed this issue, but its process of sorting takes longer time than my 'sort.ev2' program. I will write a specialized introduction for sort.ev2 and sort.ev2_ex (with external gating) later.

At this point, you should have a series of ev2 files in the sort_ev2 file folder. And the ev2_filename.txt file contains the runs you would like to sort into a matrix. You should check it before running the program. The run number does not need to be continuous. For example,   run001.ev2   run02.ev2   run5.ev2 ....

For All-vs-All matrix: .sort.ev2
For Ring matrix: .sort.ev2 xyz ( xyz axis file, you don't need .axis suffix)

the axis file has the following format:

```-----------(put the ADC you want in x axis )--------------
43 44 45 46 47
-end-
-----------(put the ADC you want in y axis)--------------
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
-end-

```
If you have bunches of ring matrices to make. You can try the following script.
```#!/bin/bash
dir='.'
cmd='./sort.ev2'
# (15 ring matrices)
for axis in 1-12 13-17 18-22 23-27 28-32 33-37 38-42 43-47 48-52 53-57 58-62 63-67 68-72 73-77 78-90
do

\$cmd dop_\${axis}
mv dop_\${axis}.sqr \${dir}

done
```