Best way to simulate rounded corners

Would anyone have any recommendations for the best way to simulate a cylindrical volume that would have a cross-section where the corners are rounded (a bulletized germanium detector)? I’m attempting to upload a picture that clarifies the volume I’m referring to. I’ve tried combining G4Tubs with G4Torus in a G4UnionSolid and subtracting the part of the torus that extrudes above the cylinder face, and at one point I tried something similar with a hemisphere, but nothing seems to work well.

image

Geant4 Version: 11.1.2
Operating System: Ubuntu 22.04.4
Compiler/Version: gcc 11.4.0
CMake Version: 3.22.1

Below is an example of how such a shape can be constructed
DetectorConstruction.cc (4.3 KB)

The detector has been constructed as a union of a polycone and a torus.
The hole has been defined as a cylinder and a hemisphere placed in the detector as daughter volumes.

2 Likes

Thank you! I feel profoundly silly for not thinking of using a polycone.

The solution that Evgueni provided is probably the quickest and most satisfocary response for your question. But I’d like to point out the existence of the GDML Workbench which allows FreeCAD CAD documents to be exported as GDML files, which can then be imported into geant:
https://github.com/KeithSloan/GDML

One facility that the GDML Workbenh provides is the ability to take a drawing in a 2D plane and to generate a 3D solid by revolving the drawing around some axis. The figures below show (1) a 2D sketch, (2) the sketch revolved around the z-axis and (3) the document exported and displayed by a geant application that reads gdml files.

(Note that revolved object is exported as a genericPolycone in the gdml file). I can send you the generated file if you wish.

As I said, for your relatively simple case, coding the detector in C++ as Evgueni did is perfectly acceptable. But if you have a much more complicated geometry with multiple elements, including perhaps arrays of solids, then you might want to consider the capabilities of the GDML Workbench.

Munther

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.