Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-29 08:37:26

0001 #!/bin/bash
0002 
0003 set -e  # exit if any command fails
0004 
0005 # ===== SETUP =====
0006 if [ -d "$1" ]; then
0007     setup_dir="$1"
0008     shift
0009 else
0010     echo "ERROR: setup directory '$1' does not exist." >&2
0011     exit 1
0012 fi
0013 cd "$setup_dir"
0014 source your_script_to_source_and_compile_epic
0015 cd - > /dev/null
0016 
0017 # ===== INPUT =====
0018 tag_in=$1
0019 nev=$2
0020 nskip=$3
0021 matmap=$4
0022 detector_xml="${DETECTOR_PATH}/epic_craterlake_tracking_only.xml" ## use tracking_only in dd4hep to save time
0023 detector_xml_full="${DETECTOR_PATH}/epic.xml" ## use full geometry in eicrecon to avoid exccesive amount of error msg from non-tracking detector algorithms.
0024 
0025 setup_base="$(basename "$setup_dir")"
0026 tag="${tag_in}${setup_base}_eta_${eta_min}_${eta_max}_mom_${mom}GeV_n${nev}"
0027 
0028 # ===== LOG FILE =====
0029 logfile="log/${tag}.log"
0030 
0031 # Also copy nohup output to our log file
0032 {
0033     echo "=== Starting run for $tag ==="
0034     date
0035     echo ""
0036 
0037     # ===== STEP 1: npsim =====
0038     echo "[`date`] Running npsim..."
0039     npsim --compactFile "$detector_xml" \
0040           --outputFile "sim_${tag}.root" \
0041           -N "${nev}" \
0042           --enableGun --gun.particle pi+ --gun.multiplicity 1 --gun.distribution uniform \
0043           --gun.etaMin "${eta_min}" --gun.etaMax "${eta_max}" \
0044           --gun.phiMin "0*degree" --gun.phiMax "360*degree" \
0045           --gun.momentumMin "${mom}*GeV" --gun.momentumMax "${mom}*GeV"
0046 
0047     echo "[`date`] npsim finished."
0048     echo ""
0049 
0050     # ===== STEP 2: eicrecon =====
0051     echo "[`date`] Running eicrecon..."
0052     eicrecon -Pjana:nevents="${nev}" \
0053              -Ppodio:output_file="rec_${tag}.root" \
0054              -Pdd4hep:xml_files="${detector_xml_full}" \
0055              ${matmap} \
0056              "sim_${tag}.root"
0057 
0058     echo "[`date`] eicrecon finished."
0059     echo ""
0060     date
0061     echo "=== Run completed for $tag ==="
0062 
0063 } > "$logfile" 2>&1