Hello Geant4 experts:
I am trying to simulate proton beam inject water with and without lateral scattering, and I would like to control the multiple Coulomb scattering (MCS) and nuclear scattering (NS) process. I use the G4EmStandardPhysics_option4 as the EM physics, but I want to remove the “msc” process assigned on G4Proton. Any idea how to implement this?
Thanks in advance.
Two ways :
1- after initialization : /process/inactivate msc
2- copy G4EmStandardPhysics_option4 in your application → MyEmStandardPhysics
and do not register Multiple Scattering
Attached, a macro for TestEm1, to be run interactively.
saluta.mac.txt (323 Bytes)
Thank you maire, it works. But still a little problem.
In my “init.mac” I have:
#### init.mac ######
# the initialization commands
# set number of threads
# Initialize kernel
# Load General Particle Source Set
# Load Setting of visualization
# set scoring
Then I do the running work in “run.in”:
#### run.in ###################
/gps/ene/mono 150 MeV
/process/inactivate msc proton
/process/inactivate hadElastic proton # MCS off, NS off
/score/dumpQuantityToFile doseBoxMesh primEdep waterPrimEdep150MeV_MCSOFF_NSOFF.csv
/process/activate msc proton
/process/inactivate hadElastic proton # MCS on, NS off
/score/dumpQuantityToFile doseBoxMesh primEdep waterPrimEdep150MeV_MCSON_NSOFF.csv
/process/activate msc proton
/process/activate hadElastic proton # MCS on, NS on
/score/dumpQuantityToFile doseBoxMesh primEdep waterPrimEdep150MeV_MCSON_NSON.csv
If I directly execute the init.mac and run.in, then the program just crashed with “Segmentation fault (core dumped)”, I guess this is a memory error when referring to an empty or illegal pointer.
If I start the program with init.mac, and I do a run/beamOn manually on the terminal, then I execute the run.in, IT WORKS FINE!!
I don’t understand. Do you have any idea?
My guess would be that
doseBoxMesh (or something else entirely) is never ‘hit’ accident with "a run/beamOn’ and therefore you never notice a problem.
Maybe you are initializing something ‘correctly’ in your
EndOfRunAction that should be moved to
Also, it is almost impossible to debug something with just the statement “just crashed”. Please try to run your application with a debugger to get more insight into the issue.
I use gdb to run the program, find that if I load score.mac and use /process/inactivate msc, then the program crashed with:
Thread 1 "G4Water" received signal SIGSEGV, Segmentation fault.
0x00007ffff0981a79 in G4ProcessManager::CreateGPILvectors() ()
The content of score.mac is following:
# define scoring mesh
/score/mesh/boxSize 10. 10. 15. cm
/score/mesh/nBin 1 1 3000
/score/mesh/translate/xyz 0. 0. 0. cm
### define scorer and filter ###
# total Ddep
/score/quantity/doseDeposit totalDdep Gy
if I execute a ‘run/beamOn’ after execution of score.mac and before ‘/process/inactivate xxx’, then the crash does not happened.
Are there any inconsistent between Scoring method and process control?
** In my RunAction there is a filter definition in the constructor and the begin and end of RunAction are empty.
I’m swamped with teaching. Since you got a workaround I place this down in my priority list. I’ll come back to it if this is still bothering you next week.
Have your problem solved? Recently I encountered the same problem when using ‘/process/inactivate …’ and boxMesh Scoring at the same time. Also, I found it is OK for Geant4.10.07.p02, but it appeared when the same application transfered to Geant126.96.36.199.
Hope to hear from you, thank you in advance.