#!/bin/bash #SBATCH --time=0-01:00:00 #SBATCH --mem-per-cpu=3072 #SBATCH --cpus-per-task=1 #SBATCH --partition=long #SBATCH --job-name="tof_digi" #SBATCH --comment="CBM TOF" #SBATCH --workdir=/lustre/nyx/cbm/users/csimon/simulation/mc #SBATCH --open-mode=truncate if [ ! -z "$SLURM_SUBMIT_DIR" ]; then wdir=`pwd` else wdir=/lustre/nyx/cbm/users/csimon/simulation/mc origdir=`pwd` fi if [ ! -z "$SLURM_SUBMIT_DIR" ]; then source /lustre/nyx/cbm/users/csimon/cbmroot/development/csimon/bld/v1805_may18_new/config.sh fi if [ -z "$VMCWORKDIR" ]; then echo 'no ROOT environment available' exit 1 fi if [ -z "$iNFiles" ]; then if [ -z "$1" ]; then echo 'number of files not specified' exit 1 else iNFiles=$1 fi fi if [ -z "$iNEvents" ]; then if [ -z "$2" ]; then echo 'no number of events specified' exit 1 else iNEvents=$2 fi fi if [ -z "$dTargetInteraction" ]; then if [ -z "$3" ]; then echo 'no target interaction specified' exit 1 else dTargetInteraction=$3 fi fi if [ -z "$cSetup" ]; then if [ -z "$4" ]; then echo 'no setup specified' exit 1 else cSetup=$4 fi fi outdir=${wdir}/result mkdir ${outdir} if [ ! -d "${outdir}" ]; then echo 'output directory does not exist and cannot be created' exit 1 else rm ${outdir}/result.root cd ${outdir}/../ iFile=0 unset FileList for dir in * ; do if [ -d "$dir" ] && [[ ! $dir =~ [^[:digit:]] ]]; then fname=`ls -t ${dir}/data/${cSetup}_test.mc.root | head -1` if [ -f "$fname" ]; then FileList=${FileList}${fname}" " fi if [ "${iFile}" == "0" ]; then cp -v ${dir}/data/${cSetup}_geofile_full.root ${outdir}/geofile.root fi ((iFile += 1)) if [ "${iFile}" == "${iNFiles}" ]; then break fi fi done LD_PRELOAD=${VMCWORKDIR}/macro/tof/digitizer/startup_C.so hadd result/result.root ${FileList} cd ${outdir} cp -v ${VMCWORKDIR}/macro/tof/digitizer/.rootrc ${outdir}/ cp -v ${VMCWORKDIR}/macro/tof/digitizer/rootlogon.C ${outdir}/ cp -v ${VMCWORKDIR}/macro/tof/digitizer/pl_mc_inspection.C ${outdir}/ root -b -q './pl_mc_inspection.C++("'${outdir}'/result.root", '${iNEvents}', '${dTargetInteraction}', kTRUE, "'${outdir}'/geofile.root")' echo "" echo "Job ran on ${SLURM_JOB_CPUS_PER_NODE} CPUs of node ${SLURM_JOB_NODELIST} in partition ${SLURM_JOB_PARTITION}." echo "" if [ ! -z "$SLURM_SUBMIT_DIR" ]; then mv -v ${wdir}/slurm-${SLURM_JOB_ID}.out ${outdir}/ else cd ${origdir} fi fi