Hi geant4 community,
How to sum the energy deposits of all hit event by event?
For example, in examples/extended/field/field02
, the F02CalorHit.hh
file has a function void AddAbs(G4double de, G4double dl) {fEdepAbs += de; fTrackLengthAbs += dl;};
. It seems this function add the deposited energy of each hit. And this file also defined a function G4double GetEdepAbs() { return fEdepAbs; };
. But how to obtain the summed energy (fEdepAbs
) in the end of event. what do I need to do in the void F02CalorimeterSD::EndOfEvent(G4HCofThisEvent* hce){....}
part of fileF02CalorimeterSD.cc
to obtain the sum of energy deposits?