I am a bleeding beginner, so it is completely possible for me to have missed something obvious. Please keep this in mind.
What I wanted to do is scatter a neutron beam, as coming from a reactor or spallation source from a particle beam going into the opposite direction (starting with protons, but I want to be able to change the nature of the oncoming particles).
To that end, I modified the B1 example, set all logical volumes to vacuum and introduced a second G4ParticleGun instance in B1 PrimaryGeneratorAction. This works and compiles very well.
Changed code sections are:
G4double vacLevel = 1e-7; //1 for normal pressure, 1e-3 for mbar …
density = vacLevel1.25kg/m3;
molWt = 14.0067g/mole;
G4Material vac = new G4Material(name=“vacuum”, density, ncomponents=1);
and setting all materials to vac.
and in B1PrimaryGeneratorAction.hh
// default particle kinematic for neutrons
What I noticed is, that obviously the events are worked through sequentially, i.e. one of the particle guns fires, the particle is tracked until it is out of world and then the other particle gun fires, meaning that the two beams that I want to meet head-on are never in the simulation at the same time.
Is there another way to do this, am I doing this completely wrong or is it something obvious that I missed?
Thanks for any help.