Hi
I want to see the deposited energy by secondary particle from the example: advanced/radioprotection**
I am using following line in SteppingActionClass.cc**
=========
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();
#ifdef ANALYSIS_USE
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/SteppingAction.cc: In member function ‘virtual void SteppingAction::UserSteppingAction(const G4Step*)’:
/home/kavita/Geant4_code/radioprotection/src/SteppingAction.cc:72:64: error: ‘class G4Track’ has no member named ‘GetTotalEnergyDeposit’; did you mean ‘GetTotalEnergy’?
G4double secondaryParticleEdep = (*fSecondary)[lp1] -> GetTotalEnergyDeposit(); // kinetic energy
^~~~~~~~~~~~~~~~~~~~~
GetTotalEnergy
CMakeFiles/radioprotection.dir/build.make:302: recipe for target ‘CMakeFiles/radioprotection.dir/src/SteppingAction.cc.o’ failed
make[2]: *** [CMakeFiles/radioprotection.dir/src/SteppingAction.cc.o] 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?
Hallo,
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.
Cheers
Susanna
Hi,
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!
Hello,
In radioprotection now named exp_microdosimetry, I see you fill the secondary particle information into the ntuples directly from stepping action.
I am wondering how you came to this decision? Why did you do it from there and not end of even action? Seeing that you collect the relevant information from there, why would one implement a hit class to do so instead?
How did you make these decisions?
Many thanks!
Hi, there are different ways to store the energy deposition as you point out. We chose this method because it is the most straightforward and the easiest to implement. This solution should support Geant4 beginners to start to use Geant4 for microdosimetry. In addition, in microdosimetry, often we have to retrieve information about the secondary radiation field (e.g. energy deposition due to nuclear recoils), therefore to use the SteppingAction can be convenient.
Cheers,
Susanna
It certaintly seems much more straight forward. Some of Makato’s presentations mention performance oveheads for allocation in hit classes. I am not sure what the situation is with dirrect write from stepping action but perhaps the ease of use is more important if the same information is ultimately recorded. Thank you for your reply.
In general, for microdosimetry, I would recommend the following if you are not interested to store information about the secondary radiation field:
- I would suggest to store the information at the level of the Event.
- If you know more or less the lineal energy spectra you expect, I would suggest to store the energy deposition in an histogram.
Then, other general reccommendations:
- I would recommend to use the CutsPerRegion to optimise the cut (smaller inside and close to the sensitive volumes).
- Depending on your simulation set-up, you may want to investigate biasing techniques.
Cheers,
Susanna
Thank you for the tips!
In this case I am interested in the secondary radiation field so your example as it is is pretty much exactly what I am interested in. I was just wondering about the practicalities of recording the data as tracks and steps may be accessed from pretty much anywhere in the body of the code and the examples seem to record the information from similarly random places in the code. Makato’s presentation at Jefferson Lab suggests recording at end of event action, so I was just wondering how these decisions get made. Finally I am interested in the location of a product of a reaction, therefore a secondary particle in order to plot generation as a function of depth. It seems the generation location is given to you by the vertex of the secondary. Is this indeed the case?
Many thanks