Template-based automation of treatment planning in advanced radiotherapy: a comprehensive dosimetric and clinical evaluation