Created attachment 387 [details] plot of dose deposit, with and without skipping voxel boundaries. With regular navigation, choosing the option to skip voxel boundaries when they are the same material gives incorrect dose deposit. The attached figure shows dose for a 3 MeV e- beam into a water phantom, with and without skipping voxel boundaries. I modified the DICOM example to have a simple water phantom (will attach). Also the DICOM example documentation says the option to skip voxel boundaries is on by default. It's not.
Created attachment 388 [details] tarball of code to reproduce Modified DICOM example to use a water phantom.
Your problem is due probably to the fact that you are not properly distributing the dose among voxels. By default the dose is given at the end of step, so if the step traverses several volumes, it is not distributed in them, as it should be. Try using G4EnergySplitter class and tell me if the problem persists.
Thanks Pedro. G4EnergySplitter class is already activated. With make option -DVERBOSE_ENERSPLIT, I get lots of output like: G4WT0 > G4EnergySplitter::SplitEnergyInVolumes1 RN: iter1 energy lost 0.036839 energy at interaction 2.95072 = stepLength 0.216082 * dEdx 0.170486
Created attachment 390 [details] tarball to reproduce (updated DICOM.cc) The code attached previously doesn't run because DicomHandler is looking for the file Data.dat, which I didn't include. This DICOM.cc doesn't instantiate DicomHandler.
The problem is not in the regular navigation, but in the fact that you are giving too big steps for the precision you want: with the physics you have defined the first step is usually around 4.7 mm: this means that the energy loss is calculated with an initial energy of 3 MeV. In this step the e- has lost about 0.7 MeV, so the energy loss is not precise (dE/dx changes a lot along the step). This is why you see the change of slope around 4.7 mm. The solution is to make smaller steps. Set a user limit, or try a more precise physics, I checked that changing the multiple scattering step limit type from fUseSafety to fUseDistanceToBoundary helps. Pedro