modified: TrackRecon.C consolidated the ditehr sigma, the timing cuts and reset the beam xy to (0,0), beamenergy gets set to 0.001 instead of returning for values that are beyond calculated catima range.

Moved some diagnostic plots because they were out of range for the boleans to actually catch them, lifted the si time ditehring so that it gets applied everywhere for smootehr time plots.
	modified:   eloss_calculations/Eloss.py introduced a external scaling factr to allow eloss calculations to be paired with the run scripts to figure out the right dEdx scaling
	modified:   run_27Al.sh
This commit is contained in:
Vignesh Sitaraman 2026-08-18 15:14:18 -04:00
parent 9416638af6
commit c0c49be0c9
3 changed files with 306 additions and 203 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,9 @@
import pycatima as catima
import numpy as np
import os
DEDX_SCALE = float(os.environ.get("DEDX_SCALE", "1.0"))
print(f"Using dEdX scale factor: {DEDX_SCALE}")
# --- 1. Constants ---
P_TORR = 250
@ -32,7 +36,7 @@ fine_step_cm = 0.03 # row spacing near the Bragg peak
fine_zone_frac = 0.085 # fraction of the *total* range treated as "near the peak"
def generate_lookup(z, mass_u, e_start_mev, label):
filename = f"{label}_lookup_{e_start_mev}MeV_{P_TORR}torr_{P_CO2}pc.dat"
filename = f"/home/vsitaraman/ANASEN_analysis/eloss_calculations/{label}_lookup_{e_start_mev}MeV_{P_TORR}torr_{P_CO2}pc.dat"
header = f"Energy(MeV) \tmg/cm2 \tcm\nStarting Energy: {e_start_mev} MeV"
# Pass 1: integrate at full precision just to find the total range (needed
@ -78,7 +82,7 @@ def generate_lookup(z, mass_u, e_start_mev, label):
projectile.T(e_u)
# dedx returns MeV / (g/cm2)
if(mass_u >=10.0):
loss_mev = catima.dedx(projectile, gas_mix) * step_g_cm2 * 0.89
loss_mev = catima.dedx(projectile, gas_mix) * step_g_cm2 * DEDX_SCALE
else:
loss_mev = catima.dedx(projectile, gas_mix) * step_g_cm2

View File

@ -6,14 +6,15 @@ export OUT_DIR="Output_27Al"
export reactiondata=1
export CO2percent=3
export pressure_in_torr=250
export CATHODE_GAIN=4.0
export CATHODE_GAIN=3.0
export source_vertex=-200.0
export BEAM_AXIS_X=-15
export BEAM_AXIS_Y=-5
export DEDX_SCALE=0.90
# export BEAM_AXIS_X=-15
# export BEAM_AXIS_Y=-5
export CUTLIST=cuts_list.txt
# Clean up previous runs
rm -f Output_27Al/*.root
rm -f Output_27Al_$DEDX/*.root
echo "Pre-compiling TrackRecon.C safely on a single core..."
root -q -l -b -e '.L TrackRecon.C++O'
@ -22,9 +23,9 @@ process_run() {
local wrun=$(printf "%03d" "$1")
local prefix="${PREFIX:-Run_}"
local infile="../ANASEN_analysis/data/${DATASET}_Data/${prefix}${wrun}_mapped.root"
local out="Output_27Al/results_run${wrun}.root"
local out="Output_27Al_$DEDX_SCALE/results_run${wrun}.root"
mkdir -p Output_27Al
mkdir -p Output_27Al_$DEDX_SCALE
root -q -l -b -x "$infile" \
-e "tree->Process(\"TrackRecon.C+\", \"${out}\")" > /dev/null 2>&1
@ -38,9 +39,11 @@ process_run() {
export -f process_run
echo "Running Eloss.py with a scaling parameter of $DEDX_SCALE"
python3 eloss_calculations/Eloss.py
echo "Starting parallel processing..."
# time parallel --bar -j 8 process_run ::: {24..41}
time parallel --bar -j 8 process_run ::: {24..41}
time parallel --bar -j 3 process_run ::: 44 45 46
time parallel --bar -j 8 process_run ::: {50..59}
# time parallel --bar -j 4 process_run ::: 62 63 66 67 68
@ -49,7 +52,7 @@ time parallel --bar -j 8 process_run ::: {50..59}
# time parallel --bar -j 4 process_run ::: {78..89}
echo "Merging files..."
hadd -k -j 4 Output_27Al/output_27Al.root Output_27Al/results_run*.root
hadd -k -j 4 Output_27Al_$DEDX_SCALE/output_27Al.root Output_27Al_$DEDX_SCALE/results_run*.root
# rootbrowse Output_27Al/output_27Al.root
@ -68,4 +71,5 @@ unset A1C1_Z_OFF_SX3
unset BEAM_AXIS_X
unset BEAM_AXIS_Y
unset CUTLIST
unset DEDX_SCALE
echo "Script execution finished."