A Spherical Parameterisation for the Community

Hi folks,

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:

Best,

Joseph

3 Likes

Hello @JDecunha!

I am currently working with spherical parametrisation and your solution is very useful for me! Thank you for your work!
However I think I’ve found some mistakes or miscalculations.

In “SphericalParameterisation.cc” line 103 one needs to change

sphere.SetStartThetaAngle(thetaNum*_phiSegmentDegrees+_startPhi);

to

sphere.SetStartThetaAngle(thetaNum*_thetaSegmentDegrees+_startTheta);

because the theta angle is discussed.

And in line 91

G4int phiNum = copyNo - (copyNo/(_thetaIncrements*_phiIncrements))*_thetaIncrements *_phiIncrements;

the formula doesn’t work for most angles.

I can suggest that

G4int phiNum = copyNo - (copyNo/(_thetaIncrements*_phiIncrements))*_thetaIncrements *_phiIncrements;

will be better. Atleast, this works well for me.

I hope this will be helpful for some people. Also I assume I can be mistaken and my “corrections” are wrong.

Andrey