I would like to store the deposited/absorbed dose inside a detector. Until now, I’m only using the deposited energy ( G4double partEdep = aStep->GetTotalEnergyDeposit(); )
in principle the dose is simply D = dE/dM but how do I get the mass of the detector? Is it also just a simple calculation or is there already something built inside Geant4 for the dose?
In your code, you can use G4VPhysicalVolume::GetLogicalVolume()->GetMass(). Look at G4LogicalVolume.hh to see what the optional arguments to GetMass() are.
Note that you should sum up all of the Edeps in your volume to get a total DeltaE/M value.
indeed, this is working… in a different world it’s probably making sense but however, I’m always struggling how to solve issues like this.
How exactly are you using intellisense that it provided the solution?
However, when I print mass I receive mass: 2.32505e+20 as value. Which unit is it, but anyway, it seems to be quite a lot?
edit: I saw About the molar mass and absorbed dose - #4 by mkelsey and used G4cout << "mass: " << mass/kg << " kg" << G4endl; which gives mass: 3.72514e-05 kg which equals to 37 µg. Tbh, I have to check. The value is not far off but could be a bit little nevertheless. But it could be a valid value, I will check…
but is this correct, what I am doing?
And when I wanna’ know the dose I won’t convert it into other units, right?
it does make sense when you think of the “physical representation” of the volume, so kind of the actual placement of it → hence also the term “touchable”.
to be honest it did not suggest the whole solution, just that “GetMass()” is available for the “GetLogicalVolume”. Using visual studio code, the auto-complete suggestions appear when I start typing the arrow ->
seemingly
yes. just don’t use any units until you store/display results, then you divide by the (combined) final unit that you prefer, e.g., (keV/kg) or CLHEP::joule/CLHEP::kilogram, or …