From 734c16c12df3bf59897588e7efda5998dbb5d9bd Mon Sep 17 00:00:00 2001 From: homolka Date: Mon, 25 Jan 2021 13:30:07 +0100 Subject: [PATCH] TOPAS: added error message for insufficient number of histories, where the code was stuck in a while loop. --- topas/MatRad_TopasConfig.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/topas/MatRad_TopasConfig.m b/topas/MatRad_TopasConfig.m index a643b8aa4..02d37175e 100644 --- a/topas/MatRad_TopasConfig.m +++ b/topas/MatRad_TopasConfig.m @@ -399,6 +399,10 @@ function writeStfFields(obj,ct,stf,baseData,w) historyCount(beamIx) = uint32(obj.fracHistories * nBeamParticlesTotal(beamIx) / obj.numOfRuns); + if historyCount < cutNumOfBixel || cutNumOfBixel == 0 + obj.matRad_cfg.dispError('Insufficient number of histories!') + end + while sum([dataTOPAS.current]) ~= historyCount(beamIx) % Randomly pick an index with the weigth given by the current idx = 1:length(dataTOPAS);