Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
Geant4 Version:11.3.2
Operating System:linux
Compiler/Version:gcc 12.2
CMake Version:3.25.1
Dear Geant4 developers,
I would like to ask whether Geant4 provides any quantity equivalent to the heating number available in MCNP cross-section data (i.e., the energy released per interaction that contributes to local energy deposition).
If such information is available within Geant4, could you kindly advise on how it can be accessed or calculated? For example, is there a built-in way to obtain it from the physics models or cross-section data, or would it need to be derived indirectly (e.g., from energy deposition or secondary particle production)?
Any guidance or recommended approaches would be greatly appreciated.
Thank you very much for your time and assistance.
Best regards
What kind of particle are you interested in. At a high level you get pretty close with
void MySteppingAction::UserSteppingAction(const G4Step* step) {
G4double edep = step->GetTotalEnergyDeposit();
if (edep > 0.) {
// Histogram, tally, etc.
// Also can get position of the step
}
}
The difference between this and the Heating Number I think is that GetTotalEnergyDeposit() does not include tracked secondaries (for charged particles with energies above their production cuts or uncharged particles in general). If you don’t care about charged particles you can set the production cuts very high for protons (ions), electrons, positrons, and gammas. This will “localize” the energy deposited to the step.
If you do care about charged particles and uncharged particles that will likely require more finesse. I imagine that this will be useful as you can grab all the secondaries anyway. And then process them as you please.
const std::vector<const G4Track*>* secondaries = step->GetSecondaryInCurrentStep();
Hi jrellin,
Thanks a lot for your detailed explanation — it really helps clarify the behavior of GetTotalEnergyDeposit() and the role of secondaries.
In my case, my supervisor is actually asking me to estimate neutron energy transfer in matter using a track-length estimator approach, rather than using a collision-based estimation.
My question is:
Does Geant4 natively support a track-length estimator (similar to what is used in deterministic transport or MCNP-style tallies), or would I need to implement this manually within SteppingAction (e.g., using step length + cross section queries)?
Also, if you’ve seen any recommended patterns or examples for this kind of estimator in Geant4, I’d really appreciate any pointers.
Thanks again for your help!
Hi,
Actually Geant4 uses natively a track-length estimator as Monte-Carlo theory means. You have access to the information of a particle along a step with a defined length. But as far I know you’ll have to do what you suggest using the SteppingAction in order to do what you want.
Alexandre