On a couple of occasions previously (here, and here) I have noticed Geant4 users with questions regarding how to create a spherical shell detector (i.e. a sphere with radial, phi, and theta slices) such that users can detect and score quantities in a spherical coordinate system.
To help them with that I decided to put together a G4VPVParameterisation class, which should accomplish the behavior they are looking for. I hope you’ll find the class user-friendly because:
1.) How to use the parameterisation is explained, both in the readme and attached example program.
2.) The parameterisation performs error checking. It automatically determines the number of copies for the parameterisation and verifies that not too many copies have been placed. It also verifies that the given radial, phi, and theta segments tile the sphere evenly without any voxels being cut off.
3.) The parameterisation includes an attached function which will iterate through all of the copyNumbers and tell you explicitly the geometric properties of each slice for validation and debugging.
You can find the parameterisation here: