-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathrun_edep_sim.sh
More file actions
executable file
·41 lines (32 loc) · 1.53 KB
/
run_edep_sim.sh
File metadata and controls
executable file
·41 lines (32 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
source ../util/reload_in_container.inc.sh
source ../util/init.inc.sh
if [ $(echo "$ARCUBE_BEAM_TYPE") = "particle_gun" ];
then nEvents=$(printf "%.0f" $(echo "$ARCUBE_EXPOSURE" | awk '{printf "%f", $1}')) # Convert exposure to integer
# Make a temporary macro file to replace the energy values and particle type
tempMacroFile=$(mktemp)
rm -f "macros/particle-gun-modified.mac"
sed -e "s/@ARCUBE_PARTICLE_TYPE@/$ARCUBE_PARTICLE_TYPE/g" \
-e "s/@ARCUBE_ENERGY_MINIMUM@/$ARCUBE_ENERGY_MINIMUM/g" \
-e "s/@ARCUBE_ENERGY_MAXIMUM@/$ARCUBE_ENERGY_MAXIMUM/g" \
$ARCUBE_EDEP_MAC > "$tempMacroFile"
export ARCUBE_EDEP_MAC="$tempMacroFile"
else
genieOutPrefix=${ARCUBE_OUTDIR_BASE}/run-genie/${ARCUBE_GENIE_NAME}/GTRAC/$subDir/${ARCUBE_GENIE_NAME}.$globalIdx
genieFile="$genieOutPrefix".GTRAC.root
rootCode='
auto t = (TTree*) _file0->Get("gRooTracker");
std::cout << t->GetEntries() << std::endl;'
nEvents=$(echo "$rootCode" | root -l -b "$genieFile" | tail -1)
edepCode="/generator/kinematics/rooTracker/input $genieFile
/edep/runId $runNo"
fi
edepRootFile=$tmpOutDir/${outName}.EDEPSIM.root
rm -f "$edepRootFile"
# The geometry file is given relative to the root of 2x2_sim
export ARCUBE_GEOM_EDEP=$baseDir/${ARCUBE_GEOM_EDEP:-$ARCUBE_GEOM}
run edep-sim -C -g "$ARCUBE_GEOM_EDEP" -o "$edepRootFile" -e "$nEvents" \
<(echo "$edepCode") "$ARCUBE_EDEP_MAC"
mkdir -p "$outDir/EDEPSIM/$subDir"
mv "$edepRootFile" "$outDir/EDEPSIM/$subDir"
rm -f "$tempMacroFile"