Skip to content
Snippets Groups Projects
Commit e17a9b39 authored by Chao Peng's avatar Chao Peng
Browse files

add photons and pions

parent 72fa2a2a
Branches
Tags
1 merge request!74add benchmark for sampling calorimeter
#!/bin/bash
if [[ ! -n "${JUGGLER_DETECTOR}" ]] ; then
export JUGGLER_DETECTOR="topside"
fi
export CB_EMCAL_COMPACT_PATH=${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml
if [[ ! -n "${CB_EMCAL_NUMEV}" ]] ; then
export CB_EMCAL_NUMEV=1000
fi
if [[ ! -n "${CB_EMCAL_ENERGY}" ]] ; then
export CB_EMCAL_ENERGY=5.0
fi
if [[ ! -n "${CB_EMCAL_SAMP_FRAC}" ]] ; then
export CB_EMCAL_SAMP_FRAC=0.014
fi
export CB_EMCAL_NAME_TAG="emcal_barrel_uniform_photons"
export CB_EMCAL_GEN_FILE="${CB_EMCAL_NAME_TAG}.hepmc"
export CB_EMCAL_SIM_FILE="sim_${CB_EMCAL_NAME_TAG}.root"
export CB_EMCAL_REC_FILE="rec_${CB_EMCAL_NAME_TAG}.root"
echo "CB_EMCAL_NUMEV = ${CB_EMCAL_NUMEV}"
echo "CB_EMCAL_COMPACT_PATH = ${CB_EMCAL_COMPACT_PATH}"
# Generate the input events
python benchmarks/sampling_ecal/scripts/gen_particles.py ${CB_EMCAL_GEN_FILE} \
--angmin 90 --angmax 90 --parray ${CB_EMCAL_ENERGY} --particles="22"
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running script: generating input events"
exit 1
fi
ls -lh ${CB_EMCAL_GEN_FILE}
# Run geant4 simulations
npsim --runType batch \
-v WARNING \
--part.minimalKineticEnergy 0.5*GeV \
--numberOfEvents ${CB_EMCAL_NUMEV} \
--compactFile ${CB_EMCAL_COMPACT_PATH} \
--inputFiles ${CB_EMCAL_GEN_FILE} \
--outputFile ${CB_EMCAL_SIM_FILE}
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running npdet"
exit 1
fi
rootls -t "${CB_EMCAL_SIM_FILE}"
# Directory for plots
mkdir -p results
# CB_EMCAL_OPTION_DIR=${JUGGLER_INSTALL_PREFIX}/Examples/options
# CB_EMCAL_SCRIPT_DIR=${JUGGLER_INSTALL_PREFIX}/Examples/scripts/sampling_calorimeter
CB_EMCAL_OPTION_DIR=benchmarks/sampling_ecal/options
CB_EMCAL_SCRIPT_DIR=benchmarks/sampling_ecal/scripts
# Run Juggler
# xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv gaudirun.py ${CB_EMCAL_OPTION_DIR}/sampling_cluster3d.py
gaudirun.py ${CB_EMCAL_OPTION_DIR}/sampling_cluster3d.py
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running juggler"
exit 1
fi
# check required python modules
python -m pip install -r benchmarks/sampling_ecal/requirements.txt
# Run analysis script
python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \
${CB_EMCAL_REC_FILE} -e 0 --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/photons
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running analysis script: draw_cluster_layers"
exit 1
fi
python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \
${CB_EMCAL_REC_FILE} -e 0 --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/photons
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running analysis script: draw_cluster"
exit 1
fi
python ${CB_EMCAL_SCRIPT_DIR}/energy_profile.py \
${CB_EMCAL_REC_FILE} --type=EM --energy=${CB_EMCAL_ENERGY} -o results/photons \
--save=results/profile.csv --color=royalblue
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running analysis script: energy_profile"
exit 1
fi
root_filesize=$(stat --format=%s "${CB_EMCAL_REC_FILE}")
if [[ "${CB_EMCAL_NUMEV}" -lt "500" ]] ; then
# file must be less than 10 MB to upload
if [[ "${root_filesize}" -lt "10000000" ]] ; then
cp ${CB_EMCAL_REC_FILE} results/.
fi
fi
#!/bin/bash
if [[ ! -n "${JUGGLER_DETECTOR}" ]] ; then
export JUGGLER_DETECTOR="topside"
fi
export CB_EMCAL_COMPACT_PATH=${DETECTOR_PATH}/${JUGGLER_DETECTOR}.xml
if [[ ! -n "${CB_EMCAL_NUMEV}" ]] ; then
export CB_EMCAL_NUMEV=1000
fi
if [[ ! -n "${CB_EMCAL_ENERGY}" ]] ; then
export CB_EMCAL_ENERGY=5.0
fi
if [[ ! -n "${CB_EMCAL_SAMP_FRAC}" ]] ; then
export CB_EMCAL_SAMP_FRAC=0.014
fi
export CB_EMCAL_NAME_TAG="emcal_barrel_uniform_pions"
export CB_EMCAL_GEN_FILE="${CB_EMCAL_NAME_TAG}.hepmc"
export CB_EMCAL_SIM_FILE="sim_${CB_EMCAL_NAME_TAG}.root"
export CB_EMCAL_REC_FILE="rec_${CB_EMCAL_NAME_TAG}.root"
echo "CB_EMCAL_NUMEV = ${CB_EMCAL_NUMEV}"
echo "CB_EMCAL_COMPACT_PATH = ${CB_EMCAL_COMPACT_PATH}"
# Generate the input events
python benchmarks/sampling_ecal/scripts/gen_particles.py ${CB_EMCAL_GEN_FILE} \
--angmin 90 --angmax 90 --parray ${CB_EMCAL_ENERGY} --particles="-211"
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running script: generating input events"
exit 1
fi
ls -lh ${CB_EMCAL_GEN_FILE}
# Run geant4 simulations
npsim --runType batch \
-v WARNING \
--part.minimalKineticEnergy 0.5*GeV \
--numberOfEvents ${CB_EMCAL_NUMEV} \
--compactFile ${CB_EMCAL_COMPACT_PATH} \
--inputFiles ${CB_EMCAL_GEN_FILE} \
--outputFile ${CB_EMCAL_SIM_FILE}
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running npdet"
exit 1
fi
rootls -t "${CB_EMCAL_SIM_FILE}"
# Directory for plots
mkdir -p results
# CB_EMCAL_OPTION_DIR=${JUGGLER_INSTALL_PREFIX}/Examples/options
# CB_EMCAL_SCRIPT_DIR=${JUGGLER_INSTALL_PREFIX}/Examples/scripts/sampling_calorimeter
CB_EMCAL_OPTION_DIR=benchmarks/sampling_ecal/options
CB_EMCAL_SCRIPT_DIR=benchmarks/sampling_ecal/scripts
# Run Juggler
# xenv -x ${JUGGLER_INSTALL_PREFIX}/Juggler.xenv gaudirun.py ${CB_EMCAL_OPTION_DIR}/sampling_cluster3d.py
gaudirun.py ${CB_EMCAL_OPTION_DIR}/sampling_cluster3d.py
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running juggler"
exit 1
fi
# check required python modules
python -m pip install -r benchmarks/sampling_ecal/requirements.txt
# Run analysis script
python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster_layers.py \
${CB_EMCAL_REC_FILE} -e 0 --topo-size=1.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/pions
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running analysis script: draw_cluster_layers"
exit 1
fi
python ${CB_EMCAL_SCRIPT_DIR}/draw_cluster.py \
${CB_EMCAL_REC_FILE} -e 0 --topo-size=2.0 --compact=${CB_EMCAL_COMPACT_PATH} -o results/pions
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running analysis script: draw_cluster"
exit 1
fi
python ${CB_EMCAL_SCRIPT_DIR}/energy_profile.py \
${CB_EMCAL_REC_FILE} --type=EM --energy=${CB_EMCAL_ENERGY} -o results/pions \
--save=results/profile.csv --color=royalblue
if [[ "$?" -ne "0" ]] ; then
echo "ERROR running analysis script: energy_profile"
exit 1
fi
root_filesize=$(stat --format=%s "${CB_EMCAL_REC_FILE}")
if [[ "${CB_EMCAL_NUMEV}" -lt "500" ]] ; then
# file must be less than 10 MB to upload
if [[ "${root_filesize}" -lt "10000000" ]] ; then
cp ${CB_EMCAL_REC_FILE} results/.
fi
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment