Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:02:39

0001 #!/bin/bash
0002 
0003 PARTICLE="neutron"
0004 
0005 function print_the_help {
0006   echo "USAGE: ${0} [--particle=$PARTICLE] "
0007   echo "  OPTIONS: "
0008   echo "            --particle   particle to generate and simulate"
0009   exit 
0010 }
0011 
0012 POSITIONAL=()
0013 while [[ $# -gt 0 ]]
0014 do
0015   key="$1"
0016   case $key in
0017     -h|--help)
0018       shift # past argument
0019       print_the_help
0020       ;;
0021     --particle)
0022       PARTICLE="$2"
0023       shift # past argument
0024       shift # past value
0025       ;;
0026     *)    # unknown option
0027       #POSITIONAL+=("$1") # save it in an array for later
0028       echo "unknown option $1"
0029       print_the_help
0030       shift # past argument
0031       ;;
0032   esac
0033 done
0034 set -- "${POSITIONAL[@]}" # restore positional parameters
0035 
0036 if [[ ! -n  "${DETECTOR}" ]] ; then 
0037   export DETECTOR="topside"
0038 fi
0039 
0040 if [[ ! -n  "${JUGGLER_N_EVENTS}" ]] ; then 
0041   export JUGGLER_N_EVENTS=5000
0042 fi
0043 
0044 #a place where I can run my events when I want to. - AMJ
0045 #export JUGGLER_N_EVENTS=1000
0046 
0047 if [[ ! -n  "${E_start}" ]] ; then
0048   export E_start=125.0
0049 fi
0050 
0051 if [[ ! -n  "${E_end}" ]] ; then
0052   export E_end=145.0
0053 fi
0054 
0055 export JUGGLER_FILE_NAME_TAG="zdc_${PARTICLE}"
0056 export JUGGLER_GEN_FILE="${JUGGLER_FILE_NAME_TAG}.hepmc"
0057 
0058 export JUGGLER_SIM_FILE="sim_output/sim_${JUGGLER_FILE_NAME_TAG}.edm4hep.root"
0059 export JUGGLER_REC_FILE="rec_${JUGGLER_FILE_NAME_TAG}.root"
0060 
0061 export RESULTS_PATH="results/far_forward/zdc/"
0062 mkdir -p "${RESULTS_PATH}"
0063 
0064 echo "JUGGLER_N_EVENTS = ${JUGGLER_N_EVENTS}"
0065 echo "DETECTOR = ${DETECTOR}"
0066 
0067 # Generate the input events
0068 root -b -q "benchmarks/zdc/scripts/gen_zdc_particles.cxx+(${JUGGLER_N_EVENTS}, \"${PARTICLE}\", ${E_start}, ${E_end}, \"${JUGGLER_FILE_NAME_TAG}.hepmc\")"
0069 if [[ "$?" -ne "0" ]] ; then
0070   echo "ERROR running script: generating input events"
0071   exit 1
0072 fi
0073 
0074 # Run geant4 simulations
0075 ddsim --runType batch \
0076       -v WARNING \
0077       --part.minimalKineticEnergy 0.5*GeV  \
0078       --filter.tracker edep0 \
0079       --numberOfEvents ${JUGGLER_N_EVENTS} \
0080       --compactFile ${DETECTOR_PATH}/${DETECTOR_CONFIG}.xml \
0081       --inputFiles ${JUGGLER_FILE_NAME_TAG}.hepmc \
0082       --outputFile ${JUGGLER_SIM_FILE}
0083 if [[ "$?" -ne "0" ]] ; then
0084   echo "ERROR running npdet"
0085   exit 1
0086 fi
0087 
0088 echo "Running analysis root scripts"
0089 root -b -q "benchmarks/zdc/scripts/analysis_zdc_particles.cxx+(\"${JUGGLER_SIM_FILE}\", \"${RESULTS_PATH}\")"
0090 if [[ "$?" -ne "0" ]] ; then
0091   echo "ERROR running root analysis script"
0092   exit 1
0093 fi
0094