History-by-history method in command-based scoring

Hello everyone!

I hope everyone had a nice Holiday and my best wishes for this 2024. I want to ask you guys something. I am trying to use the command-based scoring method, but the output file only contains the quantity of interest per voxel. Does anyone know if the history-by-history method can be used with command-based scoring or has anyone implemented it using this method? How do you deal with the uncertainties for each voxel?

Thank you in advance!

Dear Victor,

Sorry for late response… I think the example extended/runAndEvent/RE03 may help to do this job. Here, the event maps store variables of type G4StatDouble, and by means of class G4VScoreWriter, you may print out the sum_wx and sum_wx2 of the additive quantity per event, which is what you need to calculate uncertainties with the history-by-history method.

Please check this out, I hope this helps. Regards,


1 Like

Hello Miguel,

Thank you for your reply! Yes I was able to obtian my uncertainites using the history-by-history method. But not the way you told me using the G4VScorerWriter. I noticed that the command-based scoring output is different between Geant4 versions. For example, I am working with 2 Geant4 versions, 10.02 and 10.07.

When I score Dose in a voxelized volume using 10.02 I obtain an output file with 4 columns: xi, yi, zi, Dosei. But when I use the 10.07 the output file has 6 columns: xi, yi, zi, Dosei, Dose^2i, entries.

The 10.07 version is very useful since I can have the sum_wx2 that you mentioned and use it to calculate my uncertainties.

I would like to do the same with the 10.02 version using the G4VScorerWriter, but I am not even able to obtain an output file just by un-commenting out the lines on the R03.cc.

Could you please share with me how did you manage to make the RE03UserScoreWriter.cc to work? And if possible how did you obtain the sum_wx, and sum_wx2 in that class? I would appreciate it so much!

THank you and have a great day!