Need suggestions for C++ implementation of customized phantom

Hello everyone,

I am working on a custom voxelized phantom designed specifically for photons below 1 MeV. Unlike traditional implementations where each voxel is assigned a single material, my goal is for each voxel to store the average linear attenuation coefficient derived from multiple materials.

What would be the most efficient and consistent way to integrate this approach into Geant4?

Here’s the idea: I could define a voxelized phantom where the proportion (ranging from 0 to 1) of each material is stored in two separate *.mhd files. Then, I would like Geant4 to compute the effective linear attenuation coefficient dynamically based on these proportions for each given energy window. This information should be accessible during particle tracking.

How would you approach this in the following two cases?

  1. Before the simulation: the information would not be computed for each photon individually but preprocessed for energy windows. (One possible approach could be to calculate the attenuation coefficients every 0.1 keV and then average them over 10 keV windows.)
  2. During the simulation: the information would be computed dynamically for each photon as it traverses the phantom.

I understand that my questions are quite specific and technical, but I am trying to gain a deep understanding of the code and its applications. I am progressively getting more familiar with Geant4 and starting to grasp the key concepts necessary for this implementation.

For information, I am using Geant4 v11.2.2 on Linux and Windows.

Thank you very much for your insights and help!