Hi all,
I work with Geant4 for more than 18 years and I have written codes very similar to the one described below.
But this time I have a very strange problem that I can not understand.
I don’t know if it is related to the Material, MaterialTable or to the Physics.
I have a very simple setup.
It is an empty World (3 x 3 x 3 m) at the beginning with a source of particles at the center (0,0,0).
I put one plate with dimensions of (x=100, y=100, z=5) mm at (0,0,z=5) cm to absorb the radiation.
I used gammas of 1 MeV for the tests, but with electrons there is the same problem.
This plate has some initial Material (for example G4_Al) for the first run.
It runs without problem (I have tried up to 10^7 events).
THE PROBLEM:
I have a method to change the material of this plate.
I tried to change to several materials of the NIST table using the FindOrBuild method.
The program RUNS WITHOUT PROBLEMS UNTIL I CHANGE IT BACK TO THE INITIAL MATERIAL.
I have tried to change a lot of materials in sequece, for example from G4_Al to
G4_WATER, G4_Fe, G4_Pb, G4_Ti, back to G4_WATER, back to G4_Fe, then G4_Cd, G4_Si, etc.
The problem appears only when I change back to the initial material G4_Al.
It gives me a segmentation fault.
I have tried to put other materials as the initial material, like G4_Cu.
Then I have changed to other materials as before, including G4_Al. It runs without problem, even with G4_Al.
When I put back to the initial material G4_Cu, segmentation fault again.
I am using Geat4.10.06.p02.
Physics list: the same as “Hadrontherapy_1” from Hadrontherapy example. Among other models it uses the electromagnetic model standard_opt4.
I have tried to use the EM Option3, but the same problem appears.
Each time that I change the material I use
G4RunManager::GetRunManager()->ReinitializeGeometry();
and my Construct() method deletes and rebuilds all the geometry again.
I think this is not the problem because it works fine until I put the initial material back.
The following lines show the output using /tracking/verbose 2 until the segmentation fault, after changing the Material back to the initial Material.
“placa1” is the volume that has the different materials.
“Falha de segmentação” is “Segmentation fault” in portuguese.
Run 13 starts.
- G4Track Information: Particle = gamma, Track ID = 1, Parent ID = 0
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -16.3 -9.66 0 1 0 0 0 mundo initStep
1 -16.3 -9.66 85 1 0 85 85 placa1 Transportation
2 -16.3 -9.66 92 0.814 2.03e-05 7.01 92 placa1 compt
:----- List of 2ndaries - #SpawnInStep= 2(Rest= 0,Along= 0,Post= 2), #SpawnTotal= 2 ---------------
: -16.3 -9.66 92 0.186 e-
: -16.3 -9.66 92 6.09e-05 e-
:----------------------------------------------------------------- EndOf2ndaries Info ---------------
3 -8.76 -20.1 115 0.814 0 26.3 118 mundo Transportation
4 447 -647 1.5e+03 0.814 0 1.59e+03 1.71e+03 OutOfWorld Transportation
- G4Track Information: Particle = e-, Track ID = 3, Parent ID = 1
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -16.3 -9.66 92 6.09e-05 0 0 0 placa1 initStep
Falha de segmentação
When the particle is an 1 MeV e-
Run 15 starts.
- G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 -6.68 -13.7 0 1 0 0 0 mundo initStep
1 -6.71 -13.4 97.2 0.984 0.0165 97.5 97.5 mundo msc
2 -6.72 -13.4 97.5 0.984 0 0.352 97.9 placa1 Transportation
Falha de segmentação
It would be nice if someone could help me.
Mauricio Moarlles