Hi,
it is hard to inspect this event to try to understand the Compton scattering produced by Geant4. This is due to the fact that hits inside (I suppose) the vessel are not stored.
The electrons with trackID 14 and 15 are clearly the result of Compton and photoelectric interaction of hits 1 and 2 inside the gamma track with id 11.I output here track 11 for quick access.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SubEvent ID : 0 Global timestamp : 0 seconds
Track ID : 11 Parent ID : 0 Particle : gamma Time track length : 0.0021 us
Ekin : 7.6e+02 keV
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hit 0 process : TRansportation volume : 0 X : -717.01 Y : 354.82 Z : -252.43 mm Edep : 0 keV
Hit 1 process : compt volume : 0 X : -660.66 Y : 399.09 Z : -222.54 mm Edep : 0.01361 keV
Hit 2 process : phot volume : 0 X : -668.53 Y : 404.11 Z : -240.5 mm Edep : 0.9266 keV
Then, I would expect that I could apply your formula with the following information.
Output electron = 74keV (It is trackID=15 because the first hit position corresponds with the Hit 1 in trackID=11).
I calculate the angle with Hit 0, Hit 1 and Hit 2 from Track 11. After doing the scalar product of the resulting vectors I get cos(Theta)=0.482. Which gives an angle of 61.16 degrees.
But the problem is that I cannot be completely sure of the energy of the incident gamma to write in the Compton formula. This is because I don’t know what happens to the hits inside the vessel. Hits seem not to be stored in the vessel. If the gamma goes inside the vessel, and losses some energy (probably between Hit0 and Hit1 of Track11?) Then, the Compton incident gamma in Hit 1 is modified.
Therefore, probably my previous angle calculation is biased … because the trajectory of the gamma was probably deviated in the vessel.
I would say, perhaps, to do the calculation of your formula at Hit1 you may need to remove the energy of the “hidden” electron process inside the vessel. E=563keV. Then, the incident gamma energy of the Compton formula will be 761keV-563keV. The angle 61.16 degrees. And that gives you already something closer to the resulting output gamma = 74keV.
But, in order to try to understand better this kind of processes I suggest you add the vessel to the activeVolumes so that hits and processes inside the vessel are stored.
Inside TRestG4Metadata, storage section …
<storage sensitiveVolume="gas">
<parameter name="energyRange" value="(0,5)" units="MeV" />
<activeVolume name="gas" chance="1" />
<activeVolume name="vessel" chance="1" />
</storage>
Check also documentation of storage section at TRestG4Metadata. https://sultan.unizar.es/rest/classTRestG4Metadata.html
I guess this problem would not be so puzzling if we would store the kinetic energy of the gamma (or particle) at each interaction. We will consider to include this information in the future. Thanks for this remark.