Merging Data from Multiple Run

I simulated a radiotherapy using medical linac which require me to simulate 4e9 particles, I used primitive scorer using UI scoring to create box mesh inside a water phantom, then I accumulated dose for each box and write the output in csv format.
I knew that we only able to simulate 2^31 (2147483648) particles at once (I basically got the same problem with this, after trying to run it simultaneously). Let’s say if I split the simulation into two parts, which I run 2e9 for each part, can I add the accumulated dose directly for each box to get the total dose of 4e9 particles inside the water phantom?

to be honest I’m still very new to c++ programming especially using geant4, any help would be appreciated, thanks!

yes you can do that and it is the correct way! :slight_smile:

1 Like

Don’t forget to start each run with a different random number seed (otherwise the runs will be identical and adding will not reduce the statistical fluctuations). In the case of the medical linac example, it looks like the designer has programmed for a seed to be supplied as the second argument on the command line - as it says in the README:

The example needs as input data the macro file (like “ml2.mac”) and a seed number.

Look at ml2.cc, where there is if (arc == 3) ... and the following few lines. It looks like the default is 1, so any other number should give a different random number sequence. I always choose an odd number for good luck.

John

2 Likes

thanks for the reply!
but can I ask about how to start each run with different random number seed using UI command? Since I also use UI command to run my events, through this code :

/vis/disable
/score/create/boxMesh boxMesh_1
/score/mesh/boxSize 20. 20. 20. cm
/score/mesh/translate/xyz 0 0 100.135 cm
/score/mesh/nBin 200 200 200
/score/quantity/doseDeposit eDep
#/score/drawProjection boxMesh_1 eDep
/score/close
/score/list
/run/printProgress 4000000
/run/beamOn 2000000000
/score/dumpAllQuantitiesToFile boxMesh_1 doseDep

/random/setSeeds

Look at the guidance - help /random/setSeeds. In general it’s good to browse through available commands. Use ls or help or look at Built-in Commands — Book For Application Developers 11.0 documentation. If you use the Qt QUI there is a help tab.

`

1 Like

thanks Allison, you’ve been very helpful !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.