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:
Do you know how to solve this problem?
sincerely!
I guess i didnt set CRY
s 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:
i type ā./exampleB1 cmd2.fileā, an error again:
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:
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
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.
Hello Mr Carlos,
in order to learn more about CRY , I tried your files , but it gave me this error :
Do you even know how to fix this problem? thank you in advance.
The screenshot does not show an error but a warning. The warning is related to c++ code that must be discussed with CRY maintainers.
Cheers:
Carlos
Dear expert,
I have a question when I use CRY: How do you ensure that CRY outputs all the particles that can reach the detector you set up?Since CRY emits a lot of particles in its simulation of the real sky, Not all of these particles are what they want. How do you get all of CRYās particles to the detector?
So far, many of the particles in my simulation that donāt fit the criteria still occupy the output of Eventid in CRY. In this case, if I want to get a certain number of particles to reach the detector, I have to shoot a lot more than that number of particles in CRY to get the data I want from it, which is very troublesome because there is a finite number of particles that Geant4 can emit.