run the simulation up to the certain dosage

Dear Geant4 team and users,

I am using the “dandamage1” example shipped with the Geat4-DNA. My intention is to run this example up to a certain dosage. Since I would require a huge number of simulations (creating a data set), it is important to cut the simulation at a specified threshold. Although a few topics address recording the total deposited energy (like this, and this topics), there are no clear instructions to follow in this regard.

With the “scoring” method that has been described in the above mentioned topics, just the amount of the dose (deposited energy) is calculated and a way to use the calculated dosage in stopping the simulation has not been introduced.

In advance, I appreciate your time and consideration.
Ali.