Hemispherical particle source

Hi|
I want to create an emispherical particle source. I am simulating a GCR flux on a Aluminum slab, placed in front of a silicon detector, and I would like for the particles to be shot only towards the alumimum slab.
Is there a way to create this type of source?
I tried using gps/pos/confine on the phisical target (aluminum slab) but it did not work.
(I recieved the following error: LoopCount = 100000
Either the source distribution >> confinement
or any confining volume may not overlap with
the source distribution or any confining volumes
may not exist)

Thank you in advance

I suggest you look at the radioprotection example to start with. There it is shown how to model a particle source from a hemisphere.
I do not get why you limit the primary particle generation in the aluminum slab if , as you say in the lines before, the particles are shot towards the aluminum slab. I think it makes sense you get this error as the al slab does not overlap with the source distribution

Thank you very much for the reply. So in the radioprotection example, when in the primary.mac a sphere is defined as the source, that is actually a hemispherical particle source? I know that G4Sphere is used to define a hemisphere and G4Orb is used to define a full sphere when defining a geometry, but I thought that in the gps macro file, sphere was intended as a full sphere.

Hi,

yes, the primary particle generation is on a sphere in the radioprotection example. I checked the GPS interactive commands and it seems there is no UI command to limit to a hemisphere. So one solution may be to define a “dummy” hemisphere S1 from a G4Sphere (inner radius, outer radius, etc), located where you want to generate the radiation field. Then you generate from a sphere with the GPS (similarly to the radioprotection) but then use the GPS command ConfineSourceToVolume NameOfTheVolume to limit the generation to S1. This works if you want to generate the radiation field from a surface.

I am not sure how you want to generate the radiation field. In general, you can define a spatial/energy/momentum distribution with the GPS and then confine to a specific volume.

1 Like

This problem occurs when the volume to be confined is overlapped with others.

The bug could be found here:
https://raw.githubusercontent.com/Liangxiuzuo/WORKSHOP/main/bug.png?token=AHUDARMK55BBBQWRIGCZELTAHCIHC
and when it is fixed:
https://raw.githubusercontent.com/Liangxiuzuo/WORKSHOP/main/good.png?token=AHUDARLVBCPSS4VMAMQIKEDAHCIJU