There exist an example of Geant4 that shows you how to compute dose (B1). The reference is here: http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/ExampleB1.html
If you look into the detector response section, you'll see that they accumulate the total energy deposited (edep) into a scoring variable and then divide by the mass (which they call dose). Now that is the standard definition of dose.
To accumulate the energy, you can use the simple function, aStep->GetTotalEnergyDeposit() in your stepping action. The mass is defined by your density you assigned for the material and the volume.
There exist an example of Geant4 that shows you how to compute dose (B1). The reference is here: http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/ExampleB1.html
If you look into the detector response section, you'll see that they accumulate the total energy deposited (edep) into a scoring variable and then divide by the mass (which they call dose). Now that is the standard definition of dose.
To accumulate the energy, you can use the simple function, aStep->GetTotalEnergyDeposit() in your stepping action. The mass is defined by your density you assigned for the material and the volume.
In your Geant4 files systems, you have the files name's G4PSDoseDeposit.cc
In this file, you can find the answer of dose calculation. see exampleB3 in your home directory. At the top of the file B3DetectorConstruction.cc, note the red elements included.