Commit 476e9e72 authored by Philipp Oleynik's avatar Philipp Oleynik
Browse files

Birks correction removed from the energy_to_64

parent 950a1add
......@@ -19,7 +19,7 @@ else:
sixs_lut = npzfile['arr_0']
side_threshold = 0.035 # TODO: It is a magic number.
core_threshold = 0.50 # in MeV TODO: Another magic number. Chosen as an initial value.
core_threshold = 0.600 # in MeV TODO: Another magic number. Chosen as an initial value.
radiation_area = 5 * 5 * 4 * const.pi # radius 5 cm sphere area in cm2
......@@ -63,10 +63,10 @@ def birks_correction(energy): # Birks coefficient and parameter estimates taken
return energy * (1 - scs.hyp2f1(1, 1 / 0.678, 1 + 1 / 0.678, -np.power(energy, 0.678) / (95 * kbirks)))
def core_energy_to_64(energy):
def core_energy_to_64(radiated_energy):
"""
Converts energy deposited in the core detector to a 6-bit value by the algorithms of SIXS.
:param energy: Input energy in MeV, float.
:param radiated_energy: Input energy in MeV, float.
:return: An output channel, 0..63 integer value.
"""
# core_cal_intercept = 178.8581 # old ones, should not be used
......@@ -75,11 +75,11 @@ def core_energy_to_64(energy):
core_instr_offset = 166
core_cal_slope = 47.121
core_cal_offset = 157 # TODO: It is a magic number. Fitted only, not verified.
radiated_energy = birks_correction(energy)
adc_11 = saturate2048(int(radiated_energy * core_cal_slope + core_cal_offset)) - core_instr_offset
adc_8 = logbit11to8(adc11=int(adc_11))
mute = 0 if radiated_energy < core_threshold else 1 # A correction for the threshold
x = 1 if radiated_energy > core_threshold else 0 # A correction for the algorithm in the SIXS firmware
return int(round(adc_8)) // 4 if adc_8 >= 4 else x
return mute*(int(round(adc_8)) // 4) if adc_8 >= 4 else x
def side_energy_to_64(energy, side): # MeV to 6 bit side
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment