Fixed eloss bug
This commit is contained in:
parent
3a0c04b1c0
commit
99fe598ee4
|
|
@ -58,7 +58,7 @@ private:
|
||||||
const float radius = 88;
|
const float radius = 88;
|
||||||
const float width = 40;
|
const float width = 40;
|
||||||
const float length = 75; // 75
|
const float length = 75; // 75
|
||||||
const float gap = 46; // 46
|
const float gap = 0; // 46
|
||||||
|
|
||||||
short id; // -1 when no hit
|
short id; // -1 when no hit
|
||||||
short chUp;
|
short chUp;
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -163,6 +163,8 @@ def make_E_vs_x(
|
||||||
|
|
||||||
print(f"[INFO] saved: {outfile}")
|
print(f"[INFO] saved: {outfile}")
|
||||||
|
|
||||||
|
interp_cache.pop((label.lower(), medium.lower()), None)
|
||||||
|
|
||||||
return x, E
|
return x, E
|
||||||
|
|
||||||
#Generate energy loss tables from file
|
#Generate energy loss tables from file
|
||||||
|
|
@ -190,8 +192,10 @@ def load_table(filename):
|
||||||
|
|
||||||
def get_interpolators(particle, medium):
|
def get_interpolators(particle, medium):
|
||||||
|
|
||||||
if particle in interp_cache:
|
cache_key = (particle.lower(), medium.lower())
|
||||||
return interp_cache[particle]
|
|
||||||
|
if cache_key in interp_cache:
|
||||||
|
return interp_cache[cache_key]
|
||||||
|
|
||||||
filename = f"{medium}Loss/E_vs_x_{particle}.dat"
|
filename = f"{medium}Loss/E_vs_x_{particle}.dat"
|
||||||
|
|
||||||
|
|
@ -211,7 +215,7 @@ def get_interpolators(particle, medium):
|
||||||
fill_value="extrapolate"
|
fill_value="extrapolate"
|
||||||
)
|
)
|
||||||
|
|
||||||
interp_cache[particle] = (E_of_x, x_of_E)
|
interp_cache[cache_key] = (E_of_x, x_of_E)
|
||||||
|
|
||||||
return E_of_x, x_of_E
|
return E_of_x, x_of_E
|
||||||
|
|
||||||
|
|
@ -264,7 +268,7 @@ def resolve_particle(name):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
element = pt.elements.symbol(element_symbol)
|
element = pt.elements.symbol(element_symbol)
|
||||||
isotope = element[A] # <-- THIS is the correct way
|
isotope = element[A]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
isotope.number, # Z
|
isotope.number, # Z
|
||||||
|
|
@ -679,7 +683,7 @@ class MyInteractiveApp(cmd.Cmd):
|
||||||
Ei_offset = Ei * 1.1
|
Ei_offset = Ei * 1.1
|
||||||
table_specs = f"{particle} {Ei_offset}"
|
table_specs = f"{particle} {Ei_offset}"
|
||||||
try:
|
try:
|
||||||
self.do_make_table(table_specs)
|
#self.do_make_table(table_specs)
|
||||||
Ef = energy_loss(particle, medium, Ei, dl)
|
Ef = energy_loss(particle, medium, Ei, dl)
|
||||||
print(f"\nFinal energy: {Ef:.6f} MeV\n")
|
print(f"\nFinal energy: {Ef:.6f} MeV\n")
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in New Issue
Block a user