[Gate-users] Scatter dependent on range cut – bug?
David Sarrut
david.sarrut at creatis.insa-lyon.fr
Wed Jun 15 08:14:56 CEST 2022
Hi,
very detailed and clear report, interesting !
About photonID : I am not familiar too with it, it seems related to the
trackID somehow, see: around this line
<https://github.com/OpenGATE/Gate/blob/86083caae3a4f41903b3d1e3c3d5571e807e041e/source/digits_hits/src/GateTrajectoryNavigator.cc#L256>
.
Regarding Compton scattering, info may be found here
<https://github.com/OpenGATE/Gate/blob/86083caae3a4f41903b3d1e3c3d5571e807e041e/source/digits_hits/src/GateAnalysis.cc#L379>
.
I never investigate such flagged scattered photons, sorry I cannot
really help. Maybe Olga, Ane or Seb (in cc), may have a better view ?
As a side note, this is exactly for this kind of issue that we decided to
rework on the whole digitizer chain.
Code grew up with the time, people come and go, and now it is not easy to
understand what happened ;)
Cheers,
David
On Tue, Jun 14, 2022 at 10:59 AM David Leibold <D.Leibold at tudelft.nl> wrote:
> Dear David, dear Gaters,
>
>
> I continued looking into the strange behaviour I reported earlier, where
> the number of photons produced in the simulation and the number of photons
> flagged as scatter events both depend on the selected production cuts.
>
> As a recap, the simulation setup is as follows: A monoenergetic pencil
> beam is shot through a water phantom, behind which is a realistic detector
> made up of CsI, to which a crystalSD is attached. A phase space actor was
> previously also placed in front of the detector plane as a reference.
> I then evaluate which photons are detected outside the origin of the
> detector plane; these are the photons that must have been scattered or
> which are secondaries. I compare this with the nPhantomCompton,
> nPhantomRayleigh and the parentID parameters in the hit file.
>
>
> *1. Difference in number as observed by crystalSD and phase space actor*
> Previously I saw a difference in the number of photons detected by the
> phase space actor in slightly in front of the detector and the detector
> itself; it turned out that this was simply due to the divergent nature of
> scatter events. I followed your suggestion, David, and attached the phase
> space actor to the detector volume, after which the number of detected
> photons was in agreement. *That means that this problem is solved!*
>
>
> *2. Number of photons incident on the detector changes with production cut*
> Previously, I observed that the number of events registered by the
> detector drops with a decreasing production cut. However, I was always
> using the same seed for my simulation, so the statistical nature did not
> become obvious. The figure below shows the use of 20 different seeds and
> the number of events over the production cut.
>
>
>
> The mean value of the number of events for a production cut of 10 mm is:
> 13,623 +- 118
> The mean value of the number of events for a production cut of 0.001 mm is:
> 13,568 +- 101
>
> *While the mean does indeed drop, it is not statistically significant
> (within 1 sigma). *More simulations would be needed to see whether
> the number of events is indeed dependent on the production cut.
>
>
>
> *3. The number of events flagged as scatter drops considerably with
> production cut*
>
> As for now, this problem still persists. The following figure shows the
> number of events flagged by Gate as scatter/secondary using the nPhantomCompton,
> nPhantomRayleigh and the parentID parameters in the hit file over the
> production cut (label “Flags scatter & secondaries” in the figure). This is
> compared to the number of photons that interact with the detector outside a
> small region around its origin; these photons must have been either
> scattered or are secondaries (label “Hits: off-centre” in the figure):
>
> As you can see, as soon as the production cut is lowered below 1 mm, the
> number of events flagged by Gate as scatter drops considerably.
>
> Following your suggestions, David, I investigated the data to see whether
> I could see any pattern between the events that are flagged correctly as
> scatter and those that are not.
>
>
> *photonID:*
>
> For a production cut of 10 mm (everything works as expected), * all* events
> registered in the Hit file have a value of “1” for the photonID
> parameters.
>
> For a production cut of 0.01 mm (number of events flagged by Gate is
> wrong), *some* events registered in the Hit file have a value of “0” for
> the photonID parameters, the others have value “1”. *All* events that are
> *correctly* flagged as a scatter event have a photonID value of “1”, the
> ones that are flagged *incorrectly* *all *have a photonID value of “0”.
>
> I am unfamiliar what the photonID parameter specifies, though.
>
>
> *energy spectra:*
>
> The following figure compares the energy spectra of photons that are
> flagged correctly / incorrectly:
>
>
>
> Barring different noise due to the different number of events, the shape
> of the spectra seems to match.
>
>
> However, there is one interesting finding: If one plots the energy spectra
> of only the first interaction of a photon with the detector (and a
> production cut of 0.001 mm), then one can indeed see a clear difference:
>
>
> The two sets of events differ by the maximum energy deposited and by their
> shape as well. The spectrum of deposited energy by correctly flagged events
> in their first interaction exhibits two peaks, which are in the region of
> the K-edges of iodine and cesium (33 keV and 36 keV, respectively).
>
>
>
> If anyone can shed any insight into this matter, I would most appreciate
> it.
>
> Kind regards,
> David Leibold
>
>
>
>
> On 18 May2022, at 13:57, David Leibold <D.Leibold at tudelft.nl> wrote:
>
> Dear David,
>
> thanks a lot for your answer!
>
> Indeed, I was referring to “production cuts”, sorry for the wrong
> terminology.
>
> Thanks a lot for your suggestions, I will apply them and let you know
> about the results.
>
> Kind regards,
> David
>
> On 18 May2022, at 13:28, David Sarrut <david.sarrut at creatis.insa-lyon.fr>
> wrote:
>
> Hi David,
>
> interesting indeed ... I would suggest, maybe, to use a second phase-space
> actor attached to the crystal and see if you can observe similar behavior.
>
> You mentioned "range cut", but did you really used "ranged cut" (
> https://opengate.readthedocs.io/en/latest/cut_and_variance_reduction_technics.html#special-cuts
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__opengate.readthedocs.io_en_latest_cut-5Fand-5Fvariance-5Freduction-5Ftechnics.html-23special-2Dcuts&d=DwMFaQ&c=XYzUhXBD2cD-CornpT4QE19xOJBbRy-TBPLK0X9U2o8&r=lfXR69GFfS7NT-Wp5HZqbtBDrbYoilDdmNEG7fKW7aM&m=msOSt_Cuqems-MdSlI7cb4iBwEjcICzcr6zqGiZQABx3xcgK95id4rGs_Lw6U5S8&s=uI_BMLv0lolDo9Z4d_F-Mye06FQyaBWVEAfv-yR4n6Q&e=>)
> or the default "production cut" (
> https://opengate.readthedocs.io/en/latest/cut_and_variance_reduction_technics.html#id2
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__opengate.readthedocs.io_en_latest_cut-5Fand-5Fvariance-5Freduction-5Ftechnics.html-23id2&d=DwMFaQ&c=XYzUhXBD2cD-CornpT4QE19xOJBbRy-TBPLK0X9U2o8&r=lfXR69GFfS7NT-Wp5HZqbtBDrbYoilDdmNEG7fKW7aM&m=msOSt_Cuqems-MdSlI7cb4iBwEjcICzcr6zqGiZQABx3xcgK95id4rGs_Lw6U5S8&s=EEzETSAa8hoGEyDVMmi0GQFd4XsLCF9wA7f0NgtvjaU&e=>)
> ?
>
> I don't really get why the # of incident gammas is lower with lower cut ;
> maybe try to look at the energy spectra ? Also, there are differences
> between crystalHits and phase-space. For example: crystalHits do not store
> hits when edep=0 while phasespace does. Phase space actor has many options
> (storeAllStep for example, see
> https://github.com/OpenGATE/Gate/blob/develop/source/digits_hits/src/GatePhaseSpaceActorMessenger.cc
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_OpenGATE_Gate_blob_develop_source_digits-5Fhits_src_GatePhaseSpaceActorMessenger.cc&d=DwMFaQ&c=XYzUhXBD2cD-CornpT4QE19xOJBbRy-TBPLK0X9U2o8&r=lfXR69GFfS7NT-Wp5HZqbtBDrbYoilDdmNEG7fKW7aM&m=msOSt_Cuqems-MdSlI7cb4iBwEjcICzcr6zqGiZQABx3xcgK95id4rGs_Lw6U5S8&s=a8Jxr4qTjZv3ZQujRwpgNz-Fo5Pb-ZCnpz3u0ZG5hO8&e=>)
> you can play with to try understand what happens. Be sure to define (in
> particular): storeSecondaries (should be false), storeOutgoingParticles
> (should be false) and storeAllStep (should be false).
>
> Sincerely,
> David
>
> On Tue, May 17, 2022 at 11:34 PM David Leibold <D.Leibold at tudelft.nl>
> wrote:
>
>> Dear Gaters,
>>
>> I am simulating a cone beam CT setup where I output the Hits / Singles
>> registered in the detector, which I then split into primary and scatter
>> contribution based on the nPhantomCompton, nPhantomRayleigh and parentID
>> parameters. These indicate the number of Compton or Rayleigh scatter events
>> in the phantom and whether a particle was created by the source or via
>> creation of secondary particles.
>> We noticed that the scatter-to-primary ratio in our simulation was far
>> below the values reported in literature (more than a factor 10). I was able
>> to show that for certain range cuts not every scattered photon exhibited a
>> nPhantomCompton or nPhantomRayleigh value that would have indicated that
>> it was indeed scattered. In the following I will try to explain what I mean
>> by that and which behaviour of the simulation I can’t explain.
>>
>> In the following figure you will see on the left the simulation setup:
>>
>> - A monoenergetic source emitting a pencil beam of 120 keV photons,
>> - A water cube serving as a phantom,
>> - A phase space actor in front of a realistic (two-dimensional)
>> detector,
>> - And a CTdetector of a realistic material (CsI), to which a
>> crystalSD detector is attached.
>>
>>
>> With the output of the crystalSD detector (Hits/Singles) and the phase
>> space actor, one can simply plot the coordinates of the intersection point
>> of the incident photons with the detector plane. Any photon that does not
>> go through the centre axis must then either have been scattered in the
>> water phantom or be a secondary. (*)
>> Additionally, the crystalSD detector outputs the nPhantomCompton,
>> nPhantomRayleigh and parentID parameters, which I used initially to
>> separate primaries from scatter.
>>
>> <setup.png>
>> (*) Note: In the Hits dataset, I only evaluate the first entry for a
>> given eventID, so scatter inside the detector does not influence this
>> evaluation (I guess?). In the data of the phase space actor, only photons
>> flying in the direction of the detector are evaluated.
>>
>>
>> In the following the range cut* inside the detector* is now varied. I
>> then evaluated:
>>
>> - How many photons end up in the detector, which is evaluated by
>> counting the number of unique eventIDs in the Hits dataset (label “incident
>> photons”),
>> - How many photons are flagged by Gate as scatter or as secondary
>> particle, based on the nPhantomCompton, nPhantomRayleigh and parentID parameters
>> (label “Gate: scatter&secondaries”),
>> - How many photons are outside the centre axis, based on the their
>> intersection with the phase space actor (label “off-centre in
>> phase-space”),
>> - and how many photons are outside the centre axis, based on their
>> intersection with the realistic detector (i.e., using their coordinates as
>> registered in the Hits output, label “hits off-centre").
>>
>> The following plot shows the results:
>> <stp_d.png>
>>
>> As one can see, below a certain range cut the number of events flagged by
>> Gate as scatter or secondaries (via the nPhantomCompton,
>> nPhantomRayleigh and parentID parameters) drops considerably and
>> deviates from the evaluation based on the number of photons that are
>> off-centre. I have no explanation for this phenomenon.
>>
>> Now let’s zoom into the the number of incident photons:
>>
>> <stp_d_ni.png>
>> Interestingly, the number of photons incident on the detector varies with
>> the range cut, which to me is unexpected. Sure, the number of interactions
>> inside the detector increases with decreasing range cut, but this should
>> have no effect on the number of incident photons.
>>
>> Here is a zoom into the number of off-axis photons:
>> <stp_d_oa.png>
>> I don’t have an explanation why the phase space actor and the crystalSD
>> have a slightly different number of off-axis photons, but this is at the
>> moment not my main concern. Again, one can see that their number changes
>> with decreasing range cut.
>>
>>
>> Last but not least, I kept the range cut in the detector at the default
>> value and instead changed the range cut inside the phantom. Here is the
>> result:
>> <stp_p.png>
>> In this case, the three different ways to extract the number of scatter
>> and primaries agree more or less. Again, one can clearly see a change in
>> the number of total incident photons with smaller range cuts.
>>
>>
>> So far, I am unable to explain the behaviour shown above, and I am not
>> sure whether I did something wrong in my Gate simulation or whether this is
>> a bug. Please find attached the Gate macros that I used to create this
>> minimum example, and also the Python script I used to evaluate the
>> resulting data. FYI, I use Gate version 9.1, and I also observe this
>> behaviour with Gate version 9.0.
>> Any help or suggestions would be greatly appreciated. If you think that
>> this is a bug, then I am happy to submit a bug report on GitHub.
>>
>> Thanks a lot for your time in advance!
>>
>> Kind regards,
>> David Leibold
>>
>>
>>
>> _______________________________________________
>> Gate-users mailing list
>> Gate-users at lists.opengatecollaboration.org
>> http://lists.opengatecollaboration.org/mailman/listinfo/gate-users
>> <https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.opengatecollaboration.org_mailman_listinfo_gate-2Dusers&d=DwMFaQ&c=XYzUhXBD2cD-CornpT4QE19xOJBbRy-TBPLK0X9U2o8&r=lfXR69GFfS7NT-Wp5HZqbtBDrbYoilDdmNEG7fKW7aM&m=msOSt_Cuqems-MdSlI7cb4iBwEjcICzcr6zqGiZQABx3xcgK95id4rGs_Lw6U5S8&s=24G5ksXo-j0j8MyPkQpQR7sKfzueEkD2M30FW-qL8Ew&e=>
>
>
>
> --
> David Sarrut, Phd
> Directeur de recherche CNRS
> CREATIS, UMR CNRS 5220, Inserm U1294
> Centre de lutte contre le cancer Léon Bérard
> 28 rue Laënnec, 69373 Lyon cedex 08
> Tel : 04 78 78 51 51 / 06 74 72 05 42
> http://dsarrut.github.io
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__dsarrut.github.io&d=DwMFaQ&c=XYzUhXBD2cD-CornpT4QE19xOJBbRy-TBPLK0X9U2o8&r=lfXR69GFfS7NT-Wp5HZqbtBDrbYoilDdmNEG7fKW7aM&m=msOSt_Cuqems-MdSlI7cb4iBwEjcICzcr6zqGiZQABx3xcgK95id4rGs_Lw6U5S8&s=toXdBHQvMOzlbOarpsrIqssE0tMO8HZUltPxasIqnwk&e=>
> _________________________________
> "2 + 2 = 5, for extremely large values of 2"
> _________________________________
>
>
> _______________________________________________
> Gate-users mailing list
> Gate-users at lists.opengatecollaboration.org
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.opengatecollaboration.org_mailman_listinfo_gate-2Dusers&d=DwIGaQ&c=XYzUhXBD2cD-CornpT4QE19xOJBbRy-TBPLK0X9U2o8&r=lfXR69GFfS7NT-Wp5HZqbtBDrbYoilDdmNEG7fKW7aM&m=SAz54Wv_9FAJhlvOzC7b1f-I5Bf2KH39OMooYh3DEJjxK5qw9CQUjV_cUg7N3Ktj&s=tmgIiFVp22IUSea7Ru7TBRVz4ZIB-mnVVfW086CHYI0&e=
>
>
>
--
David Sarrut, Phd
Directeur de recherche CNRS
CREATIS, UMR CNRS 5220, Inserm U1294
Centre de lutte contre le cancer Léon Bérard
28 rue Laënnec, 69373 Lyon cedex 08
Tel : 04 78 78 51 51 / 06 74 72 05 42
http://dsarrut.github.io
_________________________________
"2 + 2 = 5, for extremely large values of 2"
_________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220615/c5f6789b/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: setup.png
Type: image/png
Size: 88393 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220615/c5f6789b/attachment-0005.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attachment copy.png
Type: image/png
Size: 38058 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220615/c5f6789b/attachment-0006.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attachment.png
Type: image/png
Size: 22365 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220615/c5f6789b/attachment-0007.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.png
Type: image/png
Size: 129877 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220615/c5f6789b/attachment-0008.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.png
Type: image/png
Size: 122237 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220615/c5f6789b/attachment-0009.png>
More information about the Gate-users
mailing list