What is G4VNestedParameterisation::GetMaterial(int) supposed to do?

I cannot find documentation on what G4VNestedParameterisation::GetMaterial(int) is supposed to do, and for that matter G4VNestedParameterisation::GetNumberOfMaterials().

Looking at the code, it seems that the loop

for(int i=0;i<param.GetNumberOfMaterials();++i){
    param.GetMaterial(i);
}

should go through all the materials used by the G4VNestedParameterisation. Is this correct?

Anyone? I really think that this should be documented…

Hi,

GetMaterial(G4int i) returns the material of the volume with CopyID equal to i.

it seems to me the loop does what you say.

cheers

Thank you! Just to confirm: I need to implement my own GetMaterial (for my class deriving from G4VNestedParameterisation), so the definition of CopyID seems to be entirely up to me.

This is in contrast with G4VNestedParameterisation::ComputeMaterial, which is more intuitive to implement, because I know it should return (and set…) the material for the nested volume. But I am not sure where GetMaterial is called and what it is supposed to do…

The CopyID of the volume depends on how the parameterised geometry has been done (order of subdivisions along X, Y and Z).

The GetMaterial(i) method in G4VNestedParameterisation is virtual. How I use it in my simulation is to return the material of voxel i. But it seems to me that the use of this method is optional to the user.

My apologies, I missed your reply.

As far as I could tell, the method was called for all values of i from 0 to GetNumberOfMaterials()-1. If I did not go through one of the materials set in the volume, my program crashed. I do not think it is optional…