Sum results when running run loop

Dear all,

  • I want to simulate 1E10 events, so I created a run.mac file that contains run loop
/control/verbose 2
/run/verbose 2
/Physics/addPhysics  LowE_Livermore	# em physics
/run/setCut 1 mm 

# Change the default number of workers (in multi-threading mode) 
/run/numberOfThreads 40
# Initialize kernel
/calorimeter/helmetSize 18
/control/loop sim.mac runID 0 4
  • My sim.mac create a mesh to score 2E9 histories
/score/create/boxMesh Tumor_{runID}
/score/mesh/boxSize 2.025 2.025 2.025 cm
/score/mesh/translate/xyz 0. 0. 0. cm
/score/mesh/rotate/rotateX 0 deg          # Note: Hack to enable rotations
/score/mesh/nBin 81 81 81
/score/quantity/energyDeposit eDep

#/control/execute vis.mac
/run/printProgress 1
/run/beamOn 2000000000
/score/dumpQuantityToFile Tumor_{runID} eDep eDep_{runID}.txt
  • After simulation, I have 5 files with the name Tumor_0.txt - Tumor_4.txt. I have used Python, to sum all results.

Python code

dose0 = read_dose(r"eDep_0.txt")
dose1 = read_dose(r"eDep_1.txt")
dose2 = read_dose(r"eDep_2.txt")
dose3 = read_dose(r"eDep_3.txt")

dose = dose0 + dose1 + dose2 + dose3

dose = 100 * dose/dose[40,40,40]


the blue line - Only Tumor_0.txt result (2E9 events)
the orange line - Tumor_0.txt + Tumor_1.txt (4E9 events)
the green line - Tumor_0.txt + Tumor_1.txt + Tumor_2.txt (6E9 events)
the red line - Tumor_0.txt + Tumor_1.txt + Tumor_2.txt + Tumor_3.txt (8E9 events)

Can anyone check the results for me to see if this is correct and the results shown in the Figure are biased?
I also used the random engine in the main() function:

  // Choose the Random engine and reset the seed (before the RunManager)
    CLHEP::MixMaxRng* randomEngine = new CLHEP::MixMaxRng();
  // Construct the default run manager
  auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);

Dear HungBuiTien,
Your work seems very helpful for my work, would you please elaborate to me the questions here under?

  1. To calculate the dose you scored the energy, why you did`t score the dose directly?
  2. I try to score the dose in number of bins the result show almost no scoring but in a single bin it scores, I don’t the reason if you have idea why it is happening.
    Thank you

Dear Halait-Ge,

  1. Because I want to calculate the dose profile. So I just recorded the deposited energy instead of the absorbed dose (the absorbed dose = deposited energy/volume).
  2. Actually, that is difficult to diagnose the errors. If you can, please show the way you used to record the dose in the number of bins. Maybe I have an idea to help you.

Best regards,
Hung Bui Tien

Dear HungBuiTien,
Thank you very much dear for eagerly soon reply.
Here are the result of the scored mesh in the nbins with the macro command I used
boxMesh_1.txt (365.4 KB)
boxMesh_2.txt (2.0 KB)
com.mac.txt (1.8 KB)

Thank you,
With regards,

Dear Halait-Ge,
Please attach the run1.mac file

Best regards,
Hung Bui Tien

Dear HungBuiTien,
Dear it is here.
run1.txt (673 Bytes)

Dear Halait-Ge,
I want to know the 1000 events that you simulated whether significant or not? You can check it by using only one scoring mesh with 1000 events. If your mesh scores a lot of particles then maybe because of the definition. Otherwise, I’m thinking the number of particles you simulate is not enough. If the number of events is not enough, please simulate more events.
One more thing I think you shouldn’t have the same “dose” variable for after all “/score/quantity/doseDeposit” commands.

Best regards,
Hung Bui Tien

Dear HungBuiTien,
I have simulated even for a single mesh with nbins, yet the result is the same. The only diffent result I got is with a single bin. For example

iZ, iPHI, iR, total(value) [Gy], total(val^2), entry

for more information I set to your email
Thank you,
With regards,

Dear Halait-Ge,
If you can, please send the source to my email I will check in a more specific way.

Best regards,
Hung Bui Tien