#!/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/production #SBATCH --open-mode=truncate if [ ! -z "$SLURM_SUBMIT_DIR" ]; then wdir=`pwd` else wdir=/lustre/nyx/cbm/users/csimon/simulation/production 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 "$cGeometry" ]; then if [ -z "$2" ]; then echo 'no geometry tag specified' exit 1 else cGeometry=$2 fi fi if [ -z "$bSpotResponse" ]; then if [ -z "$3" ]; then echo 'no response type specified' exit 1 else bSpotResponse=$3 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 for dir in * ; do if [ -d "$dir" ] && [[ ! $dir =~ [^[:digit:]] ]]; then fname=`ls -t ${dir}/data/*hist.reco.root | head -1` if [ -f "$fname" ]; then FileList=${FileList}${fname}" " fi ((iFile += 1)) if [ "${iFile}" == "${iNFiles}" ]; then break fi fi done 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_response_tb.C ${outdir}/ root -b -q './pl_response_tb.C++("result.root", '${iNFiles}', kTRUE, "'${cGeometry}'", '${bSpotResponse}')' 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