Simulating muons at sea level

Hello everyone,

I was wondering what are the steps to simulating muon particles at sea level.
My interest is to measure them underground.

What tools are there to simulate cos^2 distribution of muon particles on the ground? And what tools are there to randomize trajectories and energies above a threshold? Also needed is accurately simulate the number of muons per energy, per time, per solid angle, per area too.

If there are any prebuilt tools for such action I’d really love to know, as searching the web turned up nothing.

I am using GEANT4 version 10.7.3

Thanks in advance!

Hi, you can define the energy, position and angular distribution in the PrimaryGeneratorAction. You will need to sample distributions based on random numbers.

We did a similar study here: * Heredge, J., Archer, J. W., Duffy, A. R., Brown, J. M. C., Guatelli, S., Scutti, F., . . . Webster, C. (2021). Muon event localisation with AI. Nuclear Instruments and Methods in Physics Research, Section A: Accelerators, Spectrometers, Detectors and Associated Equipment, 1001. doi:10.1016/j.nima.2021.165237


Hello Susanna,

I had a look at your article, which is very interesting by the way, and I have a very small question regarding your implementation of SiPM to the square-based scintillator:

How did you manage to attach the SiPM to the scintillator while have a coating of 0.11 mm on it? I am trying to do something similar after applying a G4LogicalSkinSurface to my scintillator but naturally, when I place an SiPM on the edge of it, no optical photon ever reaches it.

Thanks for the help you can provide me with :slight_smile:


Hi Kevin,

It is true that a G4LogicalSkinSurface will apply to all sides of the scintillator, even where the SiPMs are.

You could instead place the scintillator inside of a volume representing the coating. Then, you could either implement a G4LogicalSkinSurface to the coating volume or instead implement a G4LogicalBorderSurface which gives the optical properties for an optical photon at the ordered boundary of two volumes. This way, the properties of the coating will only be applied when the optical photon traverses a scintillator-coating boundary as opposed to a scintillator-SiPM boundary.

Some more details of the function of these surfaces can be found here.


Hi Jay,

Thanks a lot for your message. It turns out that if I apply G4LogicalSkinSurface to my scintillator, and then, place a sensitive detector right at its surface, the detector will be able to record the hits. Not the behavior that I expected but I am happy it works this way. So my issue is essentially solved :slight_smile:
Of course, in reality, there should be small layer between both, but at this stage, this approximation works for my problem.
But again, thanks for your suggestion. It will be quite handy for more detailed simulations.


Hi Yardencarmel,
If you want to use the cosmic muon distribution inside Geant4, then there are various libraries available for that.
You can use CRY, which generates cosmic ray shower which you can integrate with your Geant4 application in your PrimaryGenerator.

There is another library name ECOMUG, that can also be used. They follow similar angular distribution of Cos^2(theta). I have tried using these two and got the expected results. But in my most of the application that deals with cosmic muon, I prefer to use CRY. The CRY library comes with the example to generate the cosmic ray shower as a standalone application if you wish. It also provides example to link it directly to the primary generator of you Geant4 code.

Just give them a try.


thank you

this is very useful to know.

Thank you for the suggestion @rasehgal

I did come across CRY. With that, had no success trying to work with it on GEANT 10.7.3. As I understand it will only work for earlier versions.

For now I use rejection sampling (Rejection sampling - Wikipedia) to create cos^2 distribution, but can only do so to perpendicular moving muons.

Also I’m having troubles registering hits on my scintillator. I worry it doesn’t scintillate. And the hits I do register, sadly I cannot seem to be able to save (get core dumps when trying to).

I would love to see an example for such program, but was unable to come across one.

@guatelli Interesting article. Could not understand your implementation w/o a proper look through your particle gun class.