Cosmic ray library

Hello everyone!
I installed geant4 on Windows and I need to simulate a beam of cosmic rays . Does someone know if there exists any library ( to be downloaded on Windows platform) that will do this ?
Thank you so much in advance

Few months ago i have used CRY (https://nuclear.llnl.gov/simulation/main.html) but it must be compiled from source. I do not know how to do it in windows.

Thank you so much . I found this library too, I will try to compile it in windows , but i think I will have to modify makefiles .

Just to be sure, do you want the energy distribution of the cosmic rays for example? If that’s the case, you can get the spectrum of each of the ions (from H to U) present in the cosmic rays from SPENVIS (https://www.spenvis.oma.be/intro.php). There you’ll get the LET spectrum as well (for all the cosmic ray species).

The cool thing about SPENVIS is that it will output a text file directly readable by Geant4, but for each ion species separately. Then you can use GPS (General Particle Source) to gather the files and do an integrated run.

Let me know if this helps.

/Leonardo.

I would like to simulate galactic cosmic rays , all the components (from H to U) together (with their respectives spectrums). I’ll try this suggestion , thank you .

Hello! I have the same problem as you. I also need to simulate a beam of cosmic rays. Do you know how to integrate CRY with geant4? I have modified the CMakeLists.txt, after running, the error is still reported as follows:
7
Do you know how to solve this problem?
sincerely!

I guess i didnt set CRYs environment variable, i don`t know how to set the environment variable of CRY, do you know the method?Thankyou!

Hi. Here there is my .bashrc lines to setup cry (i am using linux, for other systems i do not know):

##needed to use CRY
export G4INSTALL=/usr/local/geant4.10.03.p02
export G4SYSTEM=Linux-g++
export G4WORKDIR=$HOME/geant4_workdir
source /usr/local/cry_v1.7/setup

Also you have to change CMakeLists.txt file, see CMakeLists.txt (2.9 KB) (“TheExample” is the project name)

I also think that you have to create a file named setup.file (see below) in your main directory and then copy it to your build directory (see in CMakeLists.txt how to do it)

setup.file example:
returnNeutrons 0
returnProtons 1
returnGammas 1
date 7-1-2012
latitude 90.0
altitude 0
subboxLength 1

Hope it helps.
Regards:
Carlos

Thank you very much for your timely reply!

new users can only put one image in a post. so I’ll split my content into three parts and upload it.

Your explanation is very detailed(i am using linux,too). I modified CMakeLists.txt and .bashrc according to the file you uploaded, but there was still an error.

I don’t know if I’m emitting particles in the right way, here’s what I’m doing, i type “./exampleB1 cmd.file”, there reported an error:
111

i type “./exampleB1 cmd2.file”, an error again:
7

my cmd.file、cmd2.file、setup.file below:

cmd.file example:

/event/verbose 0
/tracking/verbose 0

/run/initialize

/CRY/input returnMuons 1
/CRY/input returnNeutrons 1
/CRY/input returnProtons 0
/CRY/input returnGammas 0
/CRY/input returnPions 0
/CRY/input returnKaons 0
/CRY/input returnElectrons 0

/CRY/input data 7-1-2012
/CRY/input latitude 90.0
/CRY/input altitude 0
/CRY/input subboxlength 100
/CRY/update

/run/beamOn 1

cmd2.file example:

/CRY/file setup.file
/run/initialize
/tracking/verbose 1
/run/beamOn 1

setup.file example:

returnNeutrons 0
returnProtons 1
returnGammas 1
date 7-1-2012
latitude 90.0
altitude 0
subboxLength 1

Above I compiled directly in the command line without visualization.

If I type ./exampleB1 and the visual image appears, then copy the contents of the cmd.file to the visual window, the error will appear again as follows:
333

I don’t know how to solve my problem. Am I using CRY emission particles in the right way?

Maybe besides CMakeLists.txt and .bashrc these two files, are there any other files that need to be modified?

If you know any details, I would be very grateful!

Hi. It has a time ago that i have used CRY, so i am not in a very good memory. I am not shore if you are using CRY in the right way. Did you have set your PrimaryGeneratorAction to use CRY? Please check my files that have used to generate the particles. I forgot to send them on my last reply. Besides that was just the .bashrc and CMakeList.txt adjustments. PrimaryGeneratorAction.cc (6.7 KB) PrimaryGeneratorAction.hh (1.7 KB)

You also have compiled cry in your machine, right?
Please let me know if it helps:
Carlos

Also new users can just upload 2 inks to here it goes the PrimaryGeneratorMessenger files.

PrimaryGeneratorMessenger.cc (3.6 KB) PrimaryGeneratorMessenger.hh (2.6 KB)

If you do not succeed please make a minimal example and upload it and i will try to run it in my computer in order to check if the problem is in cry setup.
Carlos

1 Like

Hello sorry I didn’t read your reply, I’m so sorry. You can modify environment variables right-clicking on ‘my computer’, then choosing properties, then clicking on ‘advanced tab’ and finally clicking on ‘environment variables’. But I have no idea on how to modify them . Thank you for your reply.

Thank you all for your replies , I’ll try ur suggestions . Thank you so much.

Thank you very much for all your replies. I am really sorry that I didn’t check your message in time. Then I will debug and compile again according to the files you uploaded. If I do not succeed, I will make an example and upload it to you. Thanks again for your help!

Thank you for your reply. I am using linux, I have already modified the environment variable, and I will make other modifications and debugging next. Thanks again for your reply.