The thing is, I simulated a layer of ZnS scintillator behind the stainless steel. When the electron is incident on the stainless steel, I want to know what process the scintillation photon is caused by the interaction between the electron and the stainless steel.
I tried to call the function of eventaction in the steppingaction to add ProcessName to the vector, as in B1, but the program crashed.
Here is the code in steppingaction:
Are you asking about what process created the photon? In that case, look at G4Track::GetCreatorProcess(). Make sure you test for a null pointer before dereferencing it to get the name.
Thanks for replying.
In ZnS scintillator,the optical photon is created by “some” particle in scintillation process.
I want to know how the “some” particle is created in stainless steel,i.e.,the process to creat the “some”
partilce in stainless steel.
What is your radiation source? Gammas? Unless they are very high energy, the photons will be created from electrons. If you are using hadrons, you can look at what the target isotope was using
auto postStep = step->GetPostStepPoint();
auto stepProcess = (G4VProcess*)postStep->GetProcessDefinedStep();
G4HadronInelasticProcess* had = dynamic_cast<G4HadronInelasticProcess*>(stepProcess);
const G4Isotope* isotope = (had ? had->GetTargetIsotope() : 0);
The ZnS scintillator is attached to the back of the stainless steel, and the “reactions” of the high energy electron incident on the stainless steel makes the scintillator scintillate.
I just want to know what the “reactions” are.
The method G4Track::GetCreatorProcess() seems to only get “Scintillation” or “Cerenkov”.But what
i want to know is,the parent process of “Scintillation” and “Cerenkov”.
Are you trying to find the process that created the electron/gamma/etc, that underwent the scintillation process to create an opticalphoton? You’ll want to do that in the user action for the primary (the electron/gamma/etc).
In OpNovice2, here: https://geant4.kek.jp/lxr/source/examples/extended/optical/OpNovice2/src/SteppingAction.cc#L405
there’s already been a check that the particle isn’t an opticalphoton. If there are secondaries created, loop over them to see if any are opticalphotons produced by scintillation. If so, call track->GetCreatorProcess() . This will give what created the electron, e.g. eIoni.
I tried to answer before, but guess I wasn’t clear.
It’s not trivial to get what you want. As you find, the opticalphoton keeps a record of the process that created it. But, there’s no record of anything before that.
To keep this information, there are two main steps:
When the electron is stepping, if there is an opticalphoton created, get the process that created the electron
Record that information in a UserTrackInformation attached to the opticalphoton.