Can't observe change in beam profile

Hello! I am having issues with observing a change in beam profile…

What I want to do: Plot the proton beam profile in a water phantom.
What I did:

  1. Create a 25 x 25 x 25 cm^3 water phantom (world material is air) centred at (0,0,0).
  2. Shoot 150 MeV protons using GPS in the x-direction (SSD 20 cm), with varying beam sizes.
  3. Score dose in 128 bins along the z-direction of the phantom. The bins’ dimensions are 25 x 25 x 0.2 cm^3.

The issue: The width of the beam profile doesn’t change between a beam size of 6 cm and 20 cm:

The plot still looks roughly similar to these when the beam sizes were changed to anything in between 0.5 cm and 20 cm. I don’t know why. GPS should be working properly, since if I changed the beam’s position, direction, particle, etc. the plots change accordingly.

I tried scoring dose in 2 ways as well: one using /score/mesh, and the other using a sensitive detector in DetectorConstruction that moves along the z-axis. They both give this same result.

Does anyone have an idea as to why this is? Please let me know. I greatly appreciate it!

Geant4 Version: 11.1
Operating System: MacOS, M1
Compiler/Version: g++ (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
CMake Version: 3.20.1

If you visualize, do you see a change in the beam profile?

Ah yes… another issue is that I can’t visualize it since I’m working on a cluster and it involves complicated permission changes… I tried to do it locally too, but was running into expat library issues that’s taking a long time to solve. I wanted to ask here in case there’s something I missed…

What is the unit on your plot, cm?

Is it possible that the binned size is relative to the beam location? A simple check to see if the beam is widening is to print the position each particle to see if they are going from a range of -3, 3 to -10, 10

Ah my bad, the x-axis on the plot is just the bin number. There are 128 bins and each bin is ~0.2 cm, so that should span about 25 cm.

And that was so helpful about printing the particle’s positions, thank you! I printed them out and it turns out the range was correct in the y-direction, but for some reason it’s always 0 in the z-direction. I looked up another thread where someone else encountered the same problem (apparently setting the source as “Square” doesn’t work for /gps/pos/halfz). I’ll reorient it around then.

This was great. Thank you so much again for the help!

could you try: /gps/pos/type Beam
rather than: /gps/pos/type Plane

Yes, I tried /gps/pos/type Beam instead of Plane, but unfortunately it gave the same issue as before (the beam size doesn’t change). I was able to fix it in the end – by changing the direction of the scoring volumes instead of changing gps. Thanks for the suggestion though!