Polyhedron warning when creating parameterised spherical shell

Hi all, I am trying to create a voxelised spherical shell in which copy numbers correspond to specific theta and phi.

I used the G4PVParameterised class and assigned each voxel the same inner and outer radius, but different start/end theta and phi.

SphereParameterisation::SphereParameterisation(
G4double startTheta, G4double endTheta, G4double startPhi, G4double endPhi, G4double innerR, G4double outerR, G4int PhiNo, G4int ThetaNo)
: G4VPVParameterisation()
{
G4double finnerR = innerR;
G4double fouterR = outerR;
G4int fnPhi = PhiNo;
G4int fnTheta = ThetaNo;
G4double fstepPhi = (endPhi - startPhi) / PhiNo;
G4double fstepTheta = (endTheta - startTheta) / ThetaNo;
}
SphereParameterisation::~SphereParameterisation()
{ }

void SphereParameterisation::ComputeTransformation
(const G4int copyNo, G4VPhysicalVolume* physVol) const
{
G4ThreeVector origin(0,0,0);
physVol->SetTranslation(origin);
physVol->SetRotation(0);
}

void SphereParameterisation::ComputeDimensions
(G4Sphere& sphere, const G4int copyNo, const G4VPhysicalVolume*) const
{
sphere.SetInnerRadius(finnerR);
sphere.SetOuterRadius(fouterR);
sphere.SetStartPhiAngle(copyNo % fnPhi * fstepPhi);
sphere.SetDeltaPhiAngle(fstepPhi);
sphere.SetStartThetaAngle(int(copyNo / fnPhi) * fstepTheta);
sphere.SetDeltaThetaAngle(fstepTheta);
}

Then I implemented it in my detector construction.

G4Sphere* solidVoxel = new G4Sphere(“voxel”, 0.*cm, Rmax, 0.*deg, 360.*deg, 0.deg, 180.deg);
G4LogicalVolume
logicVoxel = new G4LogicalVolume(solidVoxel, water, “voxel”);
G4VPVParameterisation
param =
new SphereParameterisation(Thetamin, Thetamax, Phimin, Phimax, Rmin, Rmax, nPhi, nTheta);
new G4PVParameterised(“voxel”,logicVoxel,logicMotherSphere,kXAxis,nTotal,param,checkOverlaps);

The code was successfully compiled, but when I ran the visualisation, this comes up for every voxel and I can only see the mother volume but none of the voxels.

What does this warning imply? I guess it’s from an error in my parameterisation but I don’t know where to look at.

Thank you in advance for your help!

Hi Chloe

I have not tried to understand you parameterisation in detail, but I question if this is the right way to go. G4PVParameterised is designed to save space at the expense of CPU time. You have relatively few volumes. Why don’t you simply place them (G4PVPlacement) in a loop over copy number with different transformations depending on copy number? Geant4 copes well with multiple placements (what it calls “voxelisation of 3D space” - not the same as your voxels). It will save CPU time at the expense of (a very small amount of) memory.

Just my thoughts.

John

Hi John

Thank you for your reply! I doubted whether this is the best way to approach it too. I’m actually studying the angular distribution of scattered electrons and I want to create a detector like this.

I thought about placing the volumes individually. Depending on the resolution, I might use hundreds of volumes. And their shapes will be different too, so a new solid needs to be created every time, which I think means that I need to assign a new sensitive detector or multifunctional detector to each volume, instead of using one detector and accessing the volumes through copy number? Does this require a big amount of memory?

Hi Chloe

Have you made any progress with this? Sorry not to get back to you before.

Creating something like your drawing with hundreds of volumes is no problem for Geant4. For those volumes whose shapes are the same you can place them multiple times (without creating a new solid).

I think (operative word is think - I’m not totally sure) you could assign the same sensitive detector to all the volumes and in your sensitive detector code test for solid and placement copy number. (You would have to make the solid (pointers) available to the sensitive detector either in global space or when constructing your sensitive detector.)

But I don’t know how this impacts a multifunctional detector - sorry. I hope someone with more experience will answer that.

John