|Message: Re: Spectrum of Optical photons generated in scintillator||Not Logged In (login)|
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
> I want to see energy spectrum of optical photons generated by gamma ray > in a scintillator. For that I have introduced following lines in > ClassifyNewTrack() of StackingAction
Note, your code is in ClassifyNewTrack of StackingAction. This code is called before G4SteppingManager::SetInitialStep. It is in SetInitialStep that the G4Track gets its fVtxKineticEnergy class member filled:
The G4Track of a secondary is only filled in as much as is done in the constructor:
> OpRun is pointing RunAction where I am plotting Energy spectrum but I am > not getting any spectrum in histogramme and all energy values printed in > beam_Energy.txt is zero.
> But when I used > > G4double E = (aTrack->GetKineticEnergy())/MeV; > > then I am getting some spectrum non zero energy values in the text file. > > I want to know whether it is the actual spectrum to what I am looking > for. Because I don't know whether GetKineticenergy is giving energy at > the starting point or end point of a optical photon track or it is at > some different point.
Well, your StackingAction is called during the tracking of the particle that generates scintillation photons. Those photons have not yet been tracked.
is the initial optical photon's energy you want in StackingAction!
I agree it is a bit strange that the 'vertex energy' is not also filled in the constructor. I don't know why? It may be an oversight.
|Inline Depth:||Outline Depth:||Add message:|