#!/bin/bash ################################################################################ # Settings for MC simulation # ################################################################################ iMCTimeLimit=0-03:00:00 # expected MC job completion time (TIMEOUT if exceeded) cPartition=main # Kronos partitions (long, main, debug) cSetup=sps_nov15_sim # as defined in geometry/setup/setup_${cSetup}.C cGeometry=v15e # should match the string 'tofGeoTag' in the setup file cSystem=auau dBeamMomentum=30 cCentrality=mbias bNoTransportPhysics=0 # 1: disable all physics processes during MC transport # 0: perform a regular MC simulation dTargetInteraction=0.04 # range [0.,1.) here: 8% (equivalent to Pb on 4 mm Pb) # 4% (equivalent to Pb on 2 mm Pb) # (equivalent to Ar on 3 mm Pb) iNEvents=1000000 iNEventsPerFile=1000 iNParallelMCRuns=100 # WARNING: Make sure that this number divides without # rest the required numbers of MC events/files # per MC simulation run! ################################################################################ ################################################################################ #iMCTimeLimit=0-00:10:00 #cPartition=main #iNEvents=10000 macroDir=/lustre/nyx/cbm/users/csimon/cbmroot/development/csimon/src/macro/tof/digitizer #mcDir=/lustre/nyx/cbm/prod/gen/urqmd/${cSystem}/${dBeamMomentum}gev/${cCentrality} mcDir=/lustre/nyx/cbm/users/csimon/prod/gen/urqmd/${cSystem}/${dBeamMomentum}gev/${cCentrality} mcFileName=${mcDir}/urqmd.${cSystem}.${dBeamMomentum}gev.${cCentrality} wdir=/lustre/nyx/cbm/users/csimon/simulation/mc/${cSetup}/${cSystem}/${dBeamMomentum}gev/${cCentrality} if [ ! -d "${mcDir}" ]; then echo 'MC input directory does not exist' return 1 fi iNMCFiles=$(((iNEvents+iNEventsPerFile-1)/iNEventsPerFile)) iNFilesPerMCRun=$(((iNMCFiles+iNParallelMCRuns-1)/iNParallelMCRuns)) iNEventsPerMCRun=$(((iNEvents+iNParallelMCRuns-1)/iNParallelMCRuns)) iNAvailMCFiles=`find ${mcDir} -maxdepth 1 -name '*[0-9][0-9][0-9][0-9][0-9].root' | wc -l` if [ "${iNAvailMCFiles}" -lt "${iNMCFiles}" ]; then echo 'not enough MC input files available' return 1 fi # check if enough MC files are contiguously indexed MCFileList=( $(find ${mcDir} -maxdepth 1 -name '*[0-9][0-9][0-9][0-9][0-9].root' -printf '%f\n' | rev | cut -c6-10 | rev | sort -n) ) MCFileList=("${MCFileList[@]:0:iNMCFiles}") iNMissingMCFiles=`join -v1 <(seq -w ${MCFileList[-1]}) <(printf '%s\n' ${MCFileList[@]}) | wc -l` if [ "${iNMissingMCFiles}" != "0" ]; then echo 'MC input files are not contiguously indexed' echo "MC file indices missing: ${iNMissingMCFiles}" join -v1 <(seq -w ${MCFileList[-1]}) <(printf '%s\n' ${MCFileList[@]}) return 1 fi if [ "${bNoTransportPhysics}" == "1" ]; then wdir=${wdir}/nophys else wdir=${wdir}/real fi wdir=${wdir}/`date -u +"%Y-%m-%dT%H-%M-%SZ"` mkdir -p ${wdir} if [ ! -d "${wdir}" ]; then echo 'working directory does not exist and cannot be created' return 1 fi cDepMC=$(sbatch --time=${iMCTimeLimit} --partition=${cPartition} --workdir=${wdir} --array=1-${iNParallelMCRuns} ${macroDir}/run_mc.sh \ ${cSetup} ${bNoTransportPhysics} ${iNEventsPerMCRun} ${iNFilesPerMCRun} \ ${mcFileName} ${cGeometry} ${dTargetInteraction}) cDepMC=${cDepMC##* } sbatch --dependency=afterany:${cDepMC} --partition=${cPartition} --workdir=${wdir} ${macroDir}/combine_trees_mc.sh \ ${iNParallelMCRuns} ${iNEvents} ${dTargetInteraction} ${cSetup}