#!/bin/bash #SBATCH --time=1-00:00:00 #SBATCH --mem-per-cpu=4096 #SBATCH --cpus-per-task=1 #SBATCH --partition=long #SBATCH --array=0 #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 echo 'script needs to be invoked by sbatch' exit 1 fi source /lustre/nyx/cbm/users/csimon/cbmroot/development/csimon/bld/v1805_may18_new/config.sh if [ -z "$VMCWORKDIR" ]; then echo 'no ROOT environment available' exit 1 fi if [ -z "$cSetup" ]; then if [ -z "$1" ]; then echo 'no setup specified' exit 1 else cSetup=$1 fi fi if [ -z "$iNSerialSpills" ]; then if [ -z "$2" ]; then echo 'number of serial spills not specified' exit 1 else iNSerialSpills=$2 fi fi if [ -z "$dSpillLength" ]; then if [ -z "$3" ]; then echo 'no spill length specified' exit 1 else dSpillLength=$3 fi fi if [ -z "$dSpillBreakLength" ]; then if [ -z "$4" ]; then echo 'no spill break length specified' exit 1 else dSpillBreakLength=$4 fi fi if [ -z "$dBeamIntensity" ]; then if [ -z "$5" ]; then echo 'no beam intensity specified' exit 1 else dBeamIntensity=$5 fi fi if [ -z "$bAverageSerialSpills" ]; then if [ -z "$6" ]; then echo 'no averaging method specified' exit 1 else bAverageSerialSpills=$6 fi fi if [ -z "$bSingleTimeSlice" ]; then if [ -z "$7" ]; then echo 'no time slice type specified' exit 1 else bSingleTimeSlice=$7 fi fi if [ -z "$bCalibrateDigis" ]; then if [ -z "$8" ]; then echo 'no digi calibration specified' exit 1 else bCalibrateDigis=$8 fi fi if [ -z "$iNEvents" ]; then if [ -z "$9" ]; then echo 'no number of events specified' exit 1 else iNEvents=$9 fi fi if [ -z "$iNParallelMCRuns" ]; then if [ -z "${10}" ]; then echo 'no number of parallel MC runs specified' exit 1 else iNParallelMCRuns=${10} fi fi if [ -z "$cGeometry" ]; then if [ -z "${11}" ]; then echo 'no geometry tag specified' exit 1 else cGeometry=${11} fi fi if [ -z "$dTargetInteraction" ]; then if [ -z "${12}" ]; then echo 'no target interaction specified' exit 1 else dTargetInteraction=${12} fi fi if [ -z "$bTwoSidedReadout" ]; then if [ -z "${13}" ]; then echo 'no two-sided readout specified' exit 1 else bTwoSidedReadout=${13} fi fi if [ -z "$bRunWithMemory" ]; then if [ -z "${14}" ]; then echo 'no point memory specified' exit 1 else bRunWithMemory=${14} fi fi if [ -z "$bGenerateDarkRate" ]; then if [ -z "${15}" ]; then echo 'no dark-rate generation specified' exit 1 else bGenerateDarkRate=${15} fi fi if [ -z "$bIgnoreInterference" ]; then if [ -z "${16}" ]; then echo 'no interference flag specified' exit 1 else bIgnoreInterference=${16} fi fi if [ -z "$bIgnoreDeadTime" ]; then if [ -z "${17}" ]; then echo 'no dead time flag specified' exit 1 else bIgnoreDeadTime=${17} fi fi if [ -z "$bStorePointsInTS" ]; then if [ -z "${18}" ]; then echo 'no point storage flag specified' exit 1 else bStorePointsInTS=${18} fi fi if [ -z "$bRunQA" ]; then if [ -z "${19}" ]; then echo 'no run QA flag specified' exit 1 else bRunQA=${19} fi fi if [ -z "$bRunReco" ]; then if [ -z "${20}" ]; then echo 'no run reco flag specified' exit 1 else bRunReco=${20} fi fi if [ -z "$bHitCompatibility" ]; then if [ -z "${21}" ]; then echo 'no hit compatibility flag specified' exit 1 else bHitCompatibility=${21} fi fi if [ -z "$bAlternativeBranchNames" ]; then if [ -z "${22}" ]; then echo 'no branch name flag specified' exit 1 else bAlternativeBranchNames=${22} fi fi if [ -z "$bBuildCbmEvents" ]; then if [ -z "${23}" ]; then echo 'no CbmEvent flag specified' exit 1 else bBuildCbmEvents=${23} fi fi if [ -z "$bBuildHits" ]; then if [ -z "${24}" ]; then echo 'no hit building flag specified' exit 1 else bBuildHits=${24} fi fi iNChildThreads=`echo "${SLURM_CPUS_PER_TASK}*2 - 1" | bc` outdir=${wdir}/`printf "%03d" ${SLURM_ARRAY_TASK_ID}` InputFilePath=${outdir}/data/mc/00001 if [ ! -d "${InputFilePath}" ]; then echo 'MC directories do not exist' exit 1 else cd ${outdir} # copy parameter output file from MC simulation to digi/reco output directory cp -v ${InputFilePath}/data/*params.root ${outdir}/data/ cp -v ${VMCWORKDIR}/macro/tof/digitizer/.rootrc ${outdir}/ cp -v ${VMCWORKDIR}/macro/tof/digitizer/rootlogon.C ${outdir}/ # document the steering macros and the parameter files used in this digi/reco run if [ "${SLURM_ARRAY_TASK_ID}" == "1" ]; then cp -v ${VMCWORKDIR}/macro/tof/digitizer/run_hic.sh ${wdir}/ cp -v ${VMCWORKDIR}/macro/tof/digitizer/run_digi_tb_hic.C ${wdir}/ cp -v ${VMCWORKDIR}/macro/tof/digitizer/run_reco_tb_digi_hic.C ${wdir}/ cp -v ${VMCWORKDIR}/parameters/tof/tof_${cGeometry}.digitb.par ${wdir}/ cp -v ${VMCWORKDIR}/parameters/tof/tof_${cGeometry}.digitb.root ${wdir}/ fi root -b -q ''${VMCWORKDIR}'/macro/tof/digitizer/run_digi_tb_hic.C('${iNEvents}',"'${cSetup}'",'${SLURM_ARRAY_TASK_ID}','${dBeamIntensity}','${dTargetInteraction}','${iNChildThreads}',\ '${dSpillLength}','${dSpillBreakLength}','${bAverageSerialSpills}','${iNSerialSpills}','${bSingleTimeSlice}',\ '${bCalibrateDigis}',"'${InputFilePath}'",'${iNParallelMCRuns}','${bRunWithMemory}','${bTwoSidedReadout}',\ '${bGenerateDarkRate}','${bIgnoreInterference}','${bIgnoreDeadTime}','${bStorePointsInTS}',\ '${bAlternativeBranchNames}')' if [ "${bRunReco}" == "1" ]; then rm -rf ${outdir}/data/${cSetup}_hist.reco.root root -b -q ''${VMCWORKDIR}'/macro/tof/digitizer/run_reco_tb_digi_hic.C('${iNEvents}',"'${cSetup}'",'${SLURM_ARRAY_TASK_ID}','${dSpillLength}','${dSpillBreakLength}',\ '${bAverageSerialSpills}','${iNSerialSpills}','${bRunQA}','${bHitCompatibility}',\ '${bAlternativeBranchNames}','${iNParallelMCRuns}','${bBuildCbmEvents}','${bBuildHits}')' # TODO: If 'CbmTofRecoMCQa::fbFillLocalHistos' is set to true, starting the reconstruction run twice will result in even more extreme computation times root -b -q ''${VMCWORKDIR}'/macro/tof/digitizer/run_reco_tb_digi_hic.C('${iNEvents}',"'${cSetup}'",'${SLURM_ARRAY_TASK_ID}','${dSpillLength}','${dSpillBreakLength}',\ '${bAverageSerialSpills}','${iNSerialSpills}','${bRunQA}','${bHitCompatibility}',\ '${bAlternativeBranchNames}','${iNParallelMCRuns}','${bBuildCbmEvents}','${bBuildHits}')' fi echo "" echo "Array job ran on ${SLURM_JOB_CPUS_PER_NODE} CPUs of node ${SLURM_JOB_NODELIST} in partition ${SLURM_JOB_PARTITION}." echo "" mv -v ${wdir}/slurm-${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}.out ${outdir}/ fi