I created a code in which I count the total number of particles that deposit some energy > 0 in my detector in order to determine the total detection efficiency.
Now, I want to calculate the ‘full-energy-peak-efficiency’, and I think I need to introduce in my if condition, at the EndOfEventAction, the following: if( fEdep == energy of the photon at the beginning of event), but idk how to access that energy.
The question is, how can I access the energy with which my particle is created?
I just want to count the number of photons that deposit all of their energy per event, in my if condition (line 19). This if only counts the photons that deposit some energy > 0 for now, but i want to count the photons that deposit all their energy.
keep in mind that you then need to keep track of the total deposit per track (and not per event) if you want to use this approach. you could use a std::map<G4int, G4double> for the fEdep instead of G4double, and use the TrackID as key.
this would be my approach, maybe there is something more elegant?
The particle is generated with a GPS macro file, and I am adding its energy. I generate photons of 1 MeV, and I wanted to put in my if condition to count only if the energy deposited in detector is equal to the energy of my primary particle.