[Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?

David Leibold D.Leibold at tudelft.nl
Fri Sep 2 09:07:03 CEST 2022


Dear Mas,

You mention that you got a one-dimensional profile, and you show a screenshot of the root output. However, please note that you select only the x-coordinates of the root output, that means, you select the x-coordinate of all particles intersecting your detector plane. Since you select only one variable, you will obtain a one-dimensional output.

The phase space actor does not have a built-in function that separates scatter and primaries; you have to do this yourself.

What you have to do is the following (and I hope that also answers your questions 2-3 as well): You have to extract the (x,y) coordinates for all events, and then filter the events based on their distance to the centre of the detector. (I assume that the centre of the detector is the point at which the pencil beam is directed.) To be honest, I have never really used the root object browser, so others might share more light on this. For my data analysis I use Python. There is a Python library called “uproot<https://uproot.readthedocs.io/en/latest/>”, which enables you to read the root files.

Here's some example code to read the root file that is output by the phase space actor; in this example the file is called “phaseSpace.root”.

import numpy as np
import uproot
import matplotlib.pyplot as plt

# Load the root file:
with uproot.open("phaseSpace.root") as rootfile:
    data = rootfile['PhaseSpace'].arrays(filter_name="*", library='np’)

    # root files have a tree structure, like a trunk with many branches.
    # The “trunk” of a root file that is output by a phase space actor
    # is called ‘PhaseSpace’. With the function ‘arrays’ we can
    # access all the branches that we want. You can specify the
    # desired branches with the argument ‘filter_name’. If you use the
    # wildcard ‘*’, then all branches are loaded. If you just want the
    # x and y coordinate, you can do
    #     filter_name = [‘X’, ‘Y’]
    # . The argument ‘library’ specifies whether you want to use numpy
    # or pandas. The former is better in terms of performance, the
    # latter is nicer for visualisation.

# Create a 2D histogram:
xbins = np.arange(-240, 241, 1)
ybins = np.arange(-240, 241, 1)

histData, histXbins, histYbins = np.histogram2d(data['X'], data['Y'], bins=[xbins, ybins])

# Plot the result:
fig, ax = plt.subplots()

ax.imshow(histData, vmin=0, vmax=2)
    # Please note that the origin of the plot does not coincide with the
    # data origin, you would have to shift that manually


[cid:image001.png at 01D8BEAB.5D291C50]
(That little dot in the centre of the figure is not dust on your screen, it’s actually a very faint signal…)

Based the 2D histogram, you can now say that all events that are outside, for example, a 0.1 mm region around the origin, are scatter.

I hope that helps! If you need more help, let me know.


Best regards,
David


PS: Sorry for writing your name incorrectly in my last mail!





From: mas <fight1_fight2 at yahoo.co.jp>
Sent: Friday, 2 September 2022 8:27 AM
To: David Leibold <D.Leibold at tudelft.nl>
Cc: gate-users at lists.opengatecollaboration.org
Subject: Re: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?


Dear David,



Thanks to your reply, I understood that I should use the phase space actor.

After reading the documentation, I tried using phase space actor.



I got a one-dimensional profile.

It was certainly like a point spread function.

However, some questions remained.



1)The output is a one-dimensional profile, but how do I know which location on the detector is profiled?



2)Which function of the phase space actor is used to separate scattered and direct lines?

[/gate/actor/MyActor/storeOutgoingParticles true] is used?



3)How do I output the actual values from the root file, e.g. a txt file? I am sorry that this is not the original question.



Thank you.

mas




----- Original Message -----

From: "David Leibold" <D.Leibold at tudelft.nl<mailto:D.Leibold at tudelft.nl>>
To: "mas" <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>>
Cc: "gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>" <gate-users at lists.opengatecollaboration.org<mailto:gate-users at lists.opengatecollaboration.org>>
Date: 2022/09/02 金 00:35
Subject: Re: [Gate-users] How to measure the X-rays scattered by the phantom when they enter the detector?


Dear Masa,

May I summarise your requirements:

1) You mention that you want to simulate a CsI detector, but with 100 % detection efficiency and no interaction within the detector.

2) You would like to distinguish between scattered and primary rays.

3) A monochromatic pencil beam enters a phantom.


My suggestion:

I would suggest using a phase space actor (see the documentation here<https://urldefense.com/v3/__https:/opengate.readthedocs.io/en/latest/tools_to_interact_with_the_simulation_actors.html*phase-space-actor__;Iw!!PAKc-5URQlI!_P9nlwtwj9dIeV2hHQtSbBZiOOlf2u0klOOSbhmmNrMhNxMxAJN4SgVVz_zaiEj0SQYvfHgXq2pNEPKPSyXWmZGQZIKttg$>), which registers each particle's energy, position, velocity etc. crossing its surface. Since you do not want to simulate interaction in your CsI detector material, there is no need to use it in the first place.

Since you are using a pencil beam, all primary photons will go straight through your phantom, intersecting your detector at, for example, point (0,0). All scattered radiation will intersect your detector away from point (0,0). Hence, you can filter out the scatter and primary rays purely based on where they end up on your detector.

To set up your detector, use e.g. a box volume with the desired size, fill it with vacuum, and attach a phase space actor to it.

If you need more help, please let us know.

Best regards,
David



On 30 Aug2022, at 00:46, mas <fight1_fight2 at yahoo.co.jp<mailto:fight1_fight2 at yahoo.co.jp>> wrote:


Hi GATE users.

I am masa at japan and new to Gate.



I am currently working on a simple simulation.

I am trying to find the point spread function of the scattered rays detected by a CsI detector by injecting a pencil beam of monochromatic X-rays into an acrylic phantom.



Assuming a detector detection efficiency of 100%, I want to output the spread of scattered radiation when it enters the detector.

No interaction occurs with the detector. I also want to output scattered rays and primary rays separately.

How should I set up the detector in such a case?



Should I use Fluence Actor for detection?

Or should I use a sensitive detector?



I would appreciate it if you could help me.



Thank you.

_______________________________________________
Gate-users mailing list
Gate-users at lists.opengatecollaboration.org<mailto:Gate-users at lists.opengatecollaboration.org>
https://urldefense.com/v3/__http://lists.opengatecollaboration.org/mailman/listinfo/gate-users__;!!PAKc-5URQlI!5R6DdcwuD-nXX0bmvN3RckxZ2HEAgen9ExhbGuDcz_52hS9V1Rohx8vBP7HBR0msh9Bx0lNmj5dJ866ftlukHHjC8jk0_A$<https://urldefense.com/v3/__http:/lists.opengatecollaboration.org/mailman/listinfo/gate-users__;!!PAKc-5URQlI!5R6DdcwuD-nXX0bmvN3RckxZ2HEAgen9ExhbGuDcz_52hS9V1Rohx8vBP7HBR0msh9Bx0lNmj5dJ866ftlukHHjC8jk0_A$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220902/725ef8c4/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 142043 bytes
Desc: image001.png
URL: <http://lists.opengatecollaboration.org/pipermail/gate-users/attachments/20220902/725ef8c4/attachment-0001.png>


More information about the Gate-users mailing list