Energy Deposited from Secondary Particle in RadioProtection Class

I want to see the deposited energy by secondary particle from the example: advanced/radioprotection**
I am using following line in**


G4double secondaryParticleEdep = (*fSecondary)[lp1] -> GetTotalEnergyDeposit(); // depositted energy


My code looks like:

G4SteppingManager* steppingManager = fpSteppingManager;
G4Track* theTrack = aStep -> GetTrack();
// check if it is alive
if(theTrack-> GetTrackStatus() == fAlive) { return; }
// Retrieve the secondary particles
fSecondary = steppingManager -> GetfSecondary();
for(size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
// Retrieve the info about the generation of secondary particles
G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName(); // volume where secondary was generated
G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName(); // name of the secondary
G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy(); // kinetic energy
// G4String process = (*fSecondary)[lp1]-> GetCreatorProcess()-> GetProcessName(); // process creating it
G4double charge = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();
G4int AA = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber();
G4double secondaryParticleEdep = (*fSecondary)[lp1] -> GetTotalEnergyDeposit(); // depositted energy

analysis -> FillSecondaries(AA, charge, secondaryParticleKineticEnergy/MeV, secondaryParticleEdep/MeV);


When I compile program by make - j 8, it gives me following error


/home/kavita/Geant4_code/radioprotection/src/ In member function ‘virtual void SteppingAction::UserSteppingAction(const G4Step*)’:
/home/kavita/Geant4_code/radioprotection/src/ error: ‘class G4Track’ has no member named ‘GetTotalEnergyDeposit’; did you mean ‘GetTotalEnergy’?
G4double secondaryParticleEdep = (*fSecondary)[lp1] -> GetTotalEnergyDeposit(); // kinetic energy
CMakeFiles/radioprotection.dir/build.make:302: recipe for target ‘CMakeFiles/radioprotection.dir/src/’ failed
make[2]: *** [CMakeFiles/radioprotection.dir/src/] Error 1
CMakeFiles/Makefile2:67: recipe for target ‘CMakeFiles/radioprotection.dir/all’ failed
make[1]: *** [CMakeFiles/radioprotection.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2


My query is how to get energy deposited from secondary particles?


the energy deposition is retrieved from the step of a particle: edep = aStep->GetTotalEnergyDeposit(); not from (*fSecondary)[lp1] where, instead, information about secondary particles is retrieved (e.g. particle type, kinetic energy, etc.).

I hope this helps you.


can you please tell me that from where aStep is getting the information of Total energy deposited ?
means how this information of total energy deposit (energy loss) is stored in G4Step* > aStep.
Can you please elaborate this ? is it somewhere connected to primary generation action class in that GPS is used in this radio-protection example ?
means how stepping action class is knowing the information that particle is coming of this energy on the object and all that.
Thanks in advance!