Can i run two primary.mac files at same time?

Hi Experts,
i want to incident two different particle at same time on my object using GPS but i am not able to do this.
Can anyone please help me with this ?
Thanks
Priyanshu

you may generate more particles in one event. Please, look here. This doc refers to 10.5 but its concepts can be applied also to the current version of Geant4: https://indico.cern.ch/event/776050/contributions/3240644/attachments/1788889/2913530/PrimaryParticle.pdf

means if i have two different GCR spectra of different-different particles for example proton and alpha then in one macro file first i can give for proton and its spectra using /gps/hist/point then second particle alpha and then its spectra same as /gps/hist/point commands.
please see below:-

GCR spectra from CREME96

##########################
#define incident particle
/gps/particle proton
##########################

type and distribution of beam

/gps/pos/type Surface
/gps/pos/shape Sphere
##########################

Set angular distribution

/gps/ang/type cos
/gps/ang/mintheta 0. deg
/gps/ang/maxtheta 0.003 deg
/gps/ang/minphi 0. deg
/gps/ang/maxphi 360. deg
##########################

Setting position

/gps/pos/centre 0. 0. 0. mm
/gps/pos/radius 2.0 m
##########################
/gps/ene/type Arb
/gps/ene/diffspec 1
/gps/hist/type arb
##########################
/gps/hist/point 1.0023 202.26
/gps/hist/point 1.0162 207.42
/gps/hist/point 1.0304 212.75
/gps/hist/point 1.0447 218.26
/gps/hist/point 1.0592 223.95
/gps/hist/point 1.0739 229.83
/gps/hist/point 1.0888 235.92
/gps/hist/point 1.104 232.96
/gps/hist/point 1.1193 224.59
/gps/hist/point 1.1349 216.5
/gps/hist/point 1.1506 208.66
/gps/hist/point 1.1666 201.06
/gps/hist/point 1.1828 193.7
/gps/hist/point 1.1993 186.58
/gps/hist/point 1.2159 179.69
/gps/hist/point 1.2328 173.02
/gps/hist/point 1.25 166.57
/gps/hist/point 1.2674 160.33
/gps/source/add 10.

GCR spectra from CREME96

##########################
#define incident particle
/gps/particle alpha
##########################

type and distribution of beam

/gps/pos/type Surface
/gps/pos/shape Sphere
##########################

Set angular distribution

/gps/ang/type cos
/gps/ang/mintheta 0. deg
/gps/ang/maxtheta 0.003 deg
/gps/ang/minphi 0. deg
/gps/ang/maxphi 360. deg
##########################

Setting position

/gps/pos/centre 0. 0. 0. mm
/gps/pos/radius 2.0 m
##########################
/gps/ene/type Arb
/gps/ene/diffspec 1
/gps/hist/type arb

/gps/hist/point 1.0023 11.167
/gps/hist/point 1.0162 11.364
/gps/hist/point 1.0304 11.565
/gps/hist/point 1.0447 11.771
/gps/hist/point 1.0592 11.982
/gps/hist/point 1.0739 12.198
/gps/hist/point 1.0888 12.419
/gps/hist/point 1.104 12.289

in this way, can i work with two different GCR spectra ? will it work ?
because i want to throw different particles with different spectra at the same time.
so can you please suggest me, am i doing wrong or it can be done ?
Thanks
priyanshu

I suggest you run one simulation at the time for protons and alpha particles, separated. This will help you to understand more in depth the results.

Okay, thank you so much.
i asked this just to confirm that can i do this, if i want to work in this way? i will run these two separately for the study but in last if i want to add both the spectra to create the environment same as the space then i want to run both or may be for more particles at the same time, that’s why i am asking.
Thanks a lot!

you can define multiple sources with Geant4 GPS.

Cheers

1 Like

Okay thank you so much !

Hi,

In geant4, each particle is independent. So, you can define two or more sources but can’t hit (or simulate) “exactly” same time. However you can work around via particle time functions in stepping action.

I understand that its a space application and possibly you need to calculate total dose or linear energy transfer. If it is, you can also divide simulation in to two run and print results only after second run from end of run action function.

Tevfik

Thank you for correcting me…actually i was thinking to incident (simulate) more than 2 particles at the same time as i wrote in this thread earlier.
can you please tell me why it is so ?
yes, you said right. in this space application, i will calculate total dose but i didn’t understand meaning of ““you can also divide simulation in to two run and print results only after second run from end of run action function””.
and then in that case should i define the GCR spectra in two different-different mac files or in one i can define as i wrote in this thread earlier ?
Thanks in advance!
Priyanshu

also can you please tell how can i calculate maximum angle theta in defining of GPS.
since i am taking help of the example/advanced/radio-protection , in that maximum angle theta is 0.003 degree why not it is 0.001 or 0.007 or other, i am not getting how it is calculated exact this value (0.003)?
as i can see it (theta values) is also affecting the incident of particles on my object just same as the radius of GPS.
Can you also help me with this, it will be very helpful.
Thanks in advance!
priyanshu

Dear Priyanshu,

Due to internal mechanism of geant4, a simulation is consist of run, event, track and step actions. Geant4 is not designed for simulating “relations” between particles this is why you can’t simulate exactly same time two particles. Run start after BeginOfRunAction function, end with EndOfRunAction. If you’re accounting total dose somewhere in stepping action, you can count the run number at EndOfRunAction and print results when the run number is two.

After adding required source code, you can write a macro something like this
/control/execute source1.mac
/run/beamOn xxx
/control/execute source2.mac
/run/beamOn yyy

For total dose, actually, there is no need such a configuration. First calculate total dose for source-1 and after source-2. Maximum theta is depend on the simulation scenario. I recommend to look at Spenvis platform for detailed information.

Okayyy, thank you so much.
can you please share any material or document has information of this theta maximum for the GPS ?
i didn’t get it. actually i am very confused with this theta angle so i can understand about biasing or angles used here.
in my simulation scenario, i am having a GDML file of object. and i am throwing GPS (same primary.mac file used in radio-protection example). but i am getting radiation like that it is concentrating at a point inside my object, is it due to the angle and radius i am using is very small according to my object ?
or any other reson that’s why i want to know more about effect of this theta maximum and radius on the object. what values should i kept for my object ?
please find my GDML file and primary.mac file if you can suggest some solution.
primary.txt (25.7 KB)
air_gold.txt (2.0 MB)

The following article and Spenvis Help system contain information about particle generation for space applications. The theta is an approximation for your source, you can check also CREME96 model documentation to understand what is going on. Unfortunately I can’t check the GDML but you can use third party software to be sure for your geometry file, your GDML can be invalid, be sure about geometry materials and size. (There are some topics on the forum for this purpose)

Geometric factor and directional response of single and multi-element particle telescopes - ScienceDirect

Help: Geant4 source particles (oma.be)

I’m sure that you can find enough information at Spenvis and even simulate.

Hi,
I am a new beginner of Geant 4 simulation and I want to use GEANT4 to simulate dose-rate proton irradiation. As we know, in the Geant4 toolkit, particles are tracked separately. Is there a solution that can simulate dose-rate with Giant 4?

Dear Priyanshu-gif would you please give a clue how to generate the energy /gps/hist/type arb or /gps/hist/point that include in your primary.txt? for example if I need to use iodine as source how i can get it?

Please do no resurrect ancient threads, especially ones marked as solved. Posting your questions in a new thread is much cleaner and clearer, and you can always cross-reference back to the old thread.