Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #!/bin/bash
0002 
0003 DIR=$(cd -- $(dirname -- "${BASH_SOURCE[0]}") &> /dev/null  && pwd)
0004 export LD_LIBRARY_PATH="${DIR}/install/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
0005 
0006 echo "In directory $PWD!"
0007 
0008 # Set ePIC software version
0009 source /opt/detector/epic-main/bin/thisepic.sh
0010 
0011 # Read HTCondor ProcID
0012 procid="$1"
0013 
0014 # Set Number of events
0015 NEVENTS=1000
0016 
0017 # Create Theta/Eta and Momentum arrays
0018 theta_max=(
0019   3.08121623
0020   3.04210067
0021   2.9777899
0022   2.43656581
0023   0.70502684
0024   0.16380276
0025   0.09949199
0026 )
0027 
0028 theta_min=(
0029   3.04210067
0030   2.9777899
0031   2.43656581
0032   0.70502684
0033   0.16380276
0034   0.09949199
0035   0.06037642
0036 )
0037 
0038 eta_low=(
0039   -3.5
0040   -3.0
0041   -2.5
0042   -1.0
0043   1.0
0044   2.5
0045   3.0
0046 )
0047 
0048 eta_hi=(
0049   -3.0
0050   -2.5
0051   -1.0
0052   1.0
0053   2.5
0054   3.0
0055   3.5
0056 )
0057 
0058 momentum=(0.5 1 2 5 10 15)
0059 
0060 # Compute indices
0061 Nmom=${#momentum[@]}
0062 Ntheta=${#theta_max[@]}
0063 
0064 theta_idx=$(( procid / Nmom ))
0065 mom_idx=$(( procid % Nmom ))
0066 
0067 if (( theta_idx < 0 || theta_idx >= Ntheta )); then
0068   echo "ERROR: ProcID $procid out of range"
0069   echo "Max ProcID allowed: $(( Ntheta * Nmom - 1 ))"
0070   exit 1
0071 fi
0072 
0073 # Set values for this run
0074 theta_max_val=${theta_max[$theta_idx]}
0075 theta_min_val=${theta_min[$theta_idx]}
0076 eta_low_val=${eta_low[$theta_idx]}
0077 eta_hi_val=${eta_hi[$theta_idx]}
0078 mom_val=${momentum[$mom_idx]}
0079 
0080 echo "================================="
0081 echo "ProcID      : $procid"
0082 echo "theta index : $theta_idx"
0083 echo "mom index   : $mom_idx"
0084 echo "theta-max value : $theta_max_val"
0085 echo "theta-min value : $theta_min_val"
0086 echo "eta-low value : $eta_low_val"
0087 echo "eta-hi value : $eta_hi_val"
0088 echo "mom value   : $mom_val"
0089 echo "num events  : $NEVENTS"
0090 echo "================================="
0091 
0092 # Run simulation
0093 npsim --compactFile $DETECTOR_PATH/epic_craterlake.xml --enableGun --gun.distribution 'eta' \
0094       --gun.thetaMax $theta_max_val --gun.thetaMin $theta_min_val \
0095       --gun.momentumMin "${mom_val}*GeV" --gun.momentumMax "${mom_val}*GeV" \
0096       --gun.particle pi- --numberOfEvents ${NEVENTS} --outputFile output.edm4hep.root
0097 
0098 eicrecon -Ppodio:output_file=eicrecon_out.root \
0099          -Pjana:nevents=${NEVENTS} \
0100          -Pdd4hep:xml_files=epic_craterlake.xml output.edm4hep.root
0101 
0102 # Clean up
0103 mv output.edm4hep.root sim_default_eta_${eta_low_val}_${eta_hi_val}_${mom_val}GeV_${NEVENTS}.edm4hep.root
0104 mv eicrecon_out.root rec_default_eta_${eta_low_val}_${eta_hi_val}_${mom_val}GeV_${NEVENTS}.root
0105 
0106 echo "Listing files after running:"
0107 ls
0108 echo ""
0109 
0110 echo "Done!"
0111