Newer
Older
#RUN_NUMBER="246"
RUN_NUMBER="$1"
num_cores=$(( $(nproc) - 4 ))
# Check if Snakefile exists
if [[ ! -f "Snakefile" ]]; then
echo "Error: Snakefile not found!"
exit 1
fi
# Replace all occurrences of run_<anything> with run_244
sed -i "s/run_[a-zA-Z0-9]\{3\}/run_${RUN_NUMBER}/g" Snakefile
echo "All occurrences of 'run_*' have been replaced with 'run_${RUN_NUMBER}' in Snakefile."
echo "- executing snakemake file for npanalysis..."
snakemake --cores ${num_cores} --forceall --keep-incomplete --keep-going --rerun-incomplete --restart-times 3
echo "- snakemake executed successfully!"
OName="\"Run${RUN_NUMBER}\""
OPATH="\"root/analysis\""
Path="\"../DataMacro/output/analysis/run_${RUN_NUMBER}/run_raw_${RUN_NUMBER}_\""
root -l -q "../DataMacro/Merger.C(30,${OPATH},${OName},${Path})"
wait
rm ../DataMacro/output/analysis/run_${RUN_NUMBER}/run_raw_*.root