<div dir="ltr">Hi, <div><br></div><div>very detailed and clear report, interesting ! </div><div><br></div><div>About photonID : I am not familiar too with it, it seems related to the trackID somehow, see: <a href="https://github.com/OpenGATE/Gate/blob/86083caae3a4f41903b3d1e3c3d5571e807e041e/source/digits_hits/src/GateTrajectoryNavigator.cc#L256" target="_blank">around this line</a>. </div><div>Regarding Compton scattering, info may <a href="https://github.com/OpenGATE/Gate/blob/86083caae3a4f41903b3d1e3c3d5571e807e041e/source/digits_hits/src/GateAnalysis.cc#L379">be found here</a>. </div><div><br></div><div>I never investigate such flagged scattered photons, sorry I cannot really help. Maybe Olga, Ane or Seb (in cc), may have a better view ?</div><div><br></div><div>As a side note, this is exactly for this kind of issue that we decided to rework on the whole digitizer chain. </div><div>Code grew up with the time, people come and go, and now it is not easy to understand what happened ;)</div><div><br></div><div>Cheers, </div><div>David</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jun 14, 2022 at 10:59 AM David Leibold <<a href="mailto:D.Leibold@tudelft.nl" target="_blank">D.Leibold@tudelft.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
Dear David, dear Gaters,
<div><br>
</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div>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
<font face="Consolas"><span style="font-style:normal">nPhantomCompton, nPhantomRayleigh</span></font> and the
<font face="Consolas"><span style="font-style:normal">parentID</span></font> parameters in the hit file.</div>
<div><br>
</div>
<div><img id="gmail-m_-6533013864163380843gmail-m_209666414268757257149C2D6CC-8DB8-47CB-B94E-DBAF3E657D92" src="cid:18165d2db6c5ccf4f381"></div>
<div><br>
</div>
<div><b>1. Difference in number as observed by crystalSD and phase space actor</b></div>
<div>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.
<i>That means that this problem is solved!</i></div>
<div><br>
</div>
<div><br>
</div>
<div><b>2. Number of photons incident on the detector changes with production cut</b></div>
<div>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. </div>
<div><br>
</div>
<div><img id="gmail-m_-6533013864163380843gmail-m_20966641426875725710E9D0A73-4763-4F1A-A424-B393F74ADCAA" src="cid:18165d2db6c339ba68d2"></div>
<div><br>
</div>
<div><br>
</div>
<div>The mean value of the number of events for a production cut of 10 mm is:</div>
<div><span style="white-space:pre-wrap"></span><font face="Consolas"><span style="font-style:normal">13,623 +- 118</span></font></div>
<div>The mean value of the number of events for a production cut of 0.001 mm is:</div>
<div><span style="white-space:pre-wrap"></span><font face="Consolas"><span style="font-style:normal">13,568 +- 101 </span></font></div>
<div><br>
</div>
<div><i>While the mean does indeed drop, it is not statistically significant (within 1 sigma).
</i>More simulations would be needed to see whether the number of events is indeed dependent on the production cut.</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><b>3. The number of events flagged as scatter drops considerably with production cut</b></div>
<div><br>
</div>
<div>As for now, this problem still persists. The following figure shows the number of events flagged by Gate as scatter/secondary using the <font face="Consolas">nPhantomCompton, nPhantomRayleigh</font> and the <font face="Consolas">parentID</font> 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):</div>
<div><img id="gmail-m_-6533013864163380843gmail-m_20966641426875725717EA38FF2-19E6-4C65-A262-3F1A782060F9" src="cid:18165d2db6c1fa6aade3"></div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div><br>
</div>
<div><b>photonID:</b></div>
<div><br>
</div>
<div>For a production cut of 10 mm (everything works as expected), <b>
all</b> events registered in the Hit file have a value of “1” for the <font face="Consolas">
<span style="font-style:normal">photonID</span></font> parameters.</div>
<div><br>
</div>
<div>For a production cut of 0.01 mm (number of events flagged by Gate is wrong),
<b>some</b> events registered in the Hit file have a value of “0” for the <font face="Consolas">photonID</font> parameters, the others have value “1”.
<b>All</b> events that are <b>correctly</b> flagged as a scatter event have a <span style="font-family:Consolas">photonID</span> value of “1”, the ones that are flagged
<b>incorrectly</b> <b>all </b>have a <span style="font-family:Consolas">photonID</span> value of “0”. </div>
<div><br>
</div>
<div>I am unfamiliar what the <span style="font-family:Consolas">photonID</span> parameter specifies, though. </div>
<div><br>
</div>
<div><br>
</div>
<div><b>energy spectra:</b></div>
<div><br>
</div>
<div>The following figure compares the energy spectra of photons that are flagged correctly / incorrectly:</div>
<div><br>
</div>
<div><img id="gmail-m_-6533013864163380843gmail-m_20966641426875725715B7C9441-10C6-40D6-BBB8-14EB72875DE7" width="675" height="238" src="cid:18165d2db6c5b2e86774"></div>
<div><br>
</div>
<div><br>
</div>
<div>Barring different noise due to the different number of events, the shape of the spectra seems to match.</div>
<div><br>
</div>
<div><br>
</div>
<div>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:</div>
<div><img id="gmail-m_-6533013864163380843gmail-m_20966641426875725715B089AAA-872C-46F4-B918-05FA9A4E7798" width="675" height="241" src="cid:18165d2db6c5b206ef65"></div>
<div><br>
</div>
<div><br>
</div>
<div>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). </div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>If anyone can shed any insight into this matter, I would most appreciate it.</div>
<div><br>
</div>
<div>Kind regards,</div>
<div>David Leibold</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>
<blockquote type="cite">
<div>On 18 May2022, at 13:57, David Leibold <<a href="mailto:D.Leibold@tudelft.nl" target="_blank">D.Leibold@tudelft.nl</a>> wrote:</div>
<br>
<div>
<div>
Dear David,
<div><br>
</div>
<div>thanks a lot for your answer!</div>
<div><br>
</div>
<div>Indeed, I was referring to “production cuts”, sorry for the wrong terminology.</div>
<div><br>
</div>
<div>Thanks a lot for your suggestions, I will apply them and let you know about the results. </div>
<div><br>
</div>
<div>Kind regards,</div>
<div>David<br>
<div><br>
<blockquote type="cite">
<div>On 18 May2022, at 13:28, David Sarrut <<a href="mailto:david.sarrut@creatis.insa-lyon.fr" target="_blank">david.sarrut@creatis.insa-lyon.fr</a>> wrote:</div>
<br>
<div>
<div dir="ltr">Hi David,
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div>You mentioned "range cut", but did you really used "ranged cut" (<a href="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=" target="_blank">https://opengate.readthedocs.io/en/latest/cut_and_variance_reduction_technics.html#special-cuts</a>)
or the default "production cut" (<a href="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=" target="_blank">https://opengate.readthedocs.io/en/latest/cut_and_variance_reduction_technics.html#id2</a>)
? <br>
</div>
<div><br>
</div>
<div>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 <a href="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=" target="_blank">
https://github.com/OpenGATE/Gate/blob/develop/source/digits_hits/src/GatePhaseSpaceActorMessenger.cc</a>) 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). </div>
<div><br>
</div>
<div>Sincerely, </div>
<div>David</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, May 17, 2022 at 11:34 PM David Leibold <<a href="mailto:D.Leibold@tudelft.nl" target="_blank">D.Leibold@tudelft.nl</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div>Dear Gaters,
<div><br>
</div>
<div>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
<font face="Consolas"><span style="font-style:normal">nPhantomCompton</span></font>,
<font face="Consolas"><span style="font-style:normal">nPhantomRayleigh</span></font> and
<font face="Consolas"><span style="font-style:normal">parentID</span></font> 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.</div>
<div>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 <font face="Consolas">nPhantomCompton </font>or <font face="Consolas">nPhantomRayleigh</font> 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. </div>
<div><br>
</div>
<div>In the following figure you will see on the left the simulation setup:</div>
<div>
<ul>
<li>A monoenergetic source emitting a pencil beam of 120 keV photons,</li><li>A water cube serving as a phantom,</li><li>A phase space actor in front of a realistic (two-dimensional) detector,</li><li>And a CTdetector of a realistic material (CsI), to which a crystalSD detector is attached.</li></ul>
</div>
<div><br>
</div>
<div>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. (*)</div>
<div>Additionally, the crystalSD detector outputs the <font face="Consolas">nPhantomCompton</font>, <font face="Consolas">nPhantomRayleigh</font> and <font face="Consolas">parentID</font> parameters, which I used initially
to separate primaries from scatter. </div>
<div><br>
</div>
<div></div>
</div>
<div><span id="gmail-m_-6533013864163380843gmail-m_2096664142687572571cid:180d6e0f1d95ccf4f381"><setup.png></span> </div>
<div>
<div></div>
<div>(*) 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.</div>
<div><br>
</div>
<div><br>
</div>
<div>In the following the range cut<b> inside the detector</b> is now varied. I then evaluated:</div>
<div>
<ul>
<li>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”),</li><li>How many photons are flagged by Gate as scatter or as secondary particle, based on the <font face="Consolas">nPhantomCompton</font>, <font face="Consolas">nPhantomRayleigh</font> and <font face="Consolas">parentID</font> parameters
(label “Gate: scatter&secondaries”),</li><li>How many photons are outside the centre axis, based on the their intersection with the phase space actor (label “off-centre in phase-space”), </li><li>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").</li></ul>
<div>The following plot shows the results:</div>
</div>
<div></div>
</div>
<div><span id="gmail-m_-6533013864163380843gmail-m_2096664142687572571cid:180d6e0f1d979344b8f2"><stp_d.png></span> </div>
<div>
<div></div>
<div><br>
</div>
<div>As one can see, below a certain range cut the number of events flagged by Gate as scatter or secondaries (via the <font face="Consolas">nPhantomCompton</font>, <font face="Consolas">nPhantomRayleigh</font> and <font face="Consolas">parentID</font> 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.</div>
<div><br>
</div>
<div>Now let’s zoom into the the number of incident photons: </div>
<div><br>
</div>
<div></div>
</div>
<div><span id="gmail-m_-6533013864163380843gmail-m_2096664142687572571cid:180d6e0f1d9c8edcfc13"><stp_d_ni.png></span> </div>
<div>
<div></div>
<div>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.</div>
<div><br>
</div>
<div>Here is a zoom into the number of off-axis photons:</div>
<div></div>
</div>
<div><span id="gmail-m_-6533013864163380843gmail-m_2096664142687572571cid:180d6e0f1daca31ec584"><stp_d_oa.png></span> </div>
<div>
<div></div>
<div>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.</div>
<div><br>
</div>
<div><br>
</div>
<div>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:</div>
<div></div>
</div>
<div><span id="gmail-m_-6533013864163380843gmail-m_2096664142687572571cid:180d6e0f1da79dd659b5"><stp_p.png></span> </div>
<div>
<div></div>
<div>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.</div>
<div><br>
</div>
<div><br>
</div>
<div>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.</div>
<div>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.</div>
<div><br>
</div>
<div>Thanks a lot for your time in advance!</div>
<div><br>
</div>
<div>Kind regards,</div>
<div>David Leibold</div>
<div><br>
</div>
<div><br>
</div>
<div></div>
</div>
<div>
<div></div>
<div><br>
</div>
</div>
</div>
_______________________________________________<br>
Gate-users mailing list<br>
<a href="mailto:Gate-users@lists.opengatecollaboration.org" target="_blank">Gate-users@lists.opengatecollaboration.org</a><br>
<a href="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=" rel="noreferrer" target="_blank">http://lists.opengatecollaboration.org/mailman/listinfo/gate-users</a></blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr">
<div dir="ltr">
<div><span>David Sarrut, Phd</span><br>
</div>
<div><font>Directeur de recherche CNRS</font></div>
<div><font>CREATIS, UMR CNRS 5220, Inserm U1294</font></div>
<div><font>Centre de lutte contre le cancer Léon Bérard</font></div>
<div><font>28 rue Laënnec, 69373 Lyon cedex 08</font></div>
<div><font>Tel : 04 78 78 51 51 / 06 74 72 05 42</font></div>
<div><font><a href="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=" target="_blank">http://dsarrut.github.io</a></font></div>
<div><font>_________________________________</font></div>
<div><font> "2 + 2 = 5, for extremely large values of 2"</font></div>
<div><font>_________________________________</font></div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
_______________________________________________<br>
Gate-users mailing list<br>
<a href="mailto:Gate-users@lists.opengatecollaboration.org" target="_blank">Gate-users@lists.opengatecollaboration.org</a><br>
<a href="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=" target="_blank">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=</a>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><span style="color:rgb(0,0,0)">David Sarrut, Phd</span><br></div><div><font color="#000000">Directeur de recherche CNRS</font></div><div><font color="#000000">CREATIS, UMR CNRS 5220, Inserm U1294</font></div><div><font color="#000000">Centre de lutte contre le cancer Léon Bérard</font></div><div><font color="#000000">28 rue Laënnec, 69373 Lyon cedex 08</font></div><div><font color="#000000">Tel : 04 78 78 51 51 / 06 74 72 05 42</font></div><div><font color="#000000"><a href="http://dsarrut.github.io" target="_blank">http://dsarrut.github.io</a></font></div><div><font color="#000000">_________________________________</font></div><div><font color="#000000"> "2 + 2 = 5, for extremely large values of 2"</font></div><div><font color="#000000">_________________________________</font></div></div></div>