Dose deposition in a heterogeneous phantom using sensitive detector

I have a simulation made from 4 voxelized layers of different materials all of which I want to make “sensitive”. I similarly create 1 sensitive detector and I attach it to my logical volumes. finally, am doing something like this (the figure above) and instantiating my matrix in my detector class to calculate the dose using a matrix. some help please ?