I am currently trying to use the loop function in GDML to read position and orb radius properties from a matrix.
For instance, a matrix with 100 rows and 4 columns would contain the x y z position and r radius of 100 orbs.
The radius of said orbs would be stated in the solids part of the gdml file. Their position would be stated in the physvol part.
According to the GDML manual version 2.7:
When you use linked loop triples (loop triple= 3 loop tags, as we did in our example; linked in the sense that we looped over a solid, then we looped over a logical volume that referred to that solid, and finally we looped over a physical volume that referred to that logical volume) you always have to be sure that the number of steps is the same for every loop tag of that particular triple. In our example that number was 5: from 1 to 5 in the first loop, from 0 to 4 in the second loop, and from 0 to 8 (but with a step of 2) in the third loop.
This implies that, so long as you used has the same number of steps for the loop over the solid, the loop over the logical volume and the loop over the physical volume, these loops will be “linked”.
I would think that for my matrix with 100 rows, 100 solids are created with the loop each with their corresponding radius from the matrix. 100 logical volumes are created linking to those 100 solids. and then 100 physical volumes are created with their corresponding xyz from the matrix, linking to those logical volumes. So, the nth orb would have the xyz and radius from the nth row of the matrix.
However, even when I try the exact piece of code given in the GDML manual, all the solids have the same properties. They do get their correct position data from the matrix, but they get their properties (in this case, the radius), from row 1 of the matrix.
GDML does not to my knowledge allow a variable in the naming of solids/volumes, so I cannot force 100 different volume names. But according to the manual it should work without forcing a variable name.
Do any of you know how to properly create such a “linked loop triple”?