general newbie question.
Say I want to cut out for example a cylindrical shape so that my resulting shape resembles a bucket. And the cut out region should then be air. Do I have to subtract the volumes or would it be enough to put the smaller cylinder as a daughter volume into the larger cylinder and declare its material as air?
I would do the second solution: smaller cylinder of air inside the other cylinder (mother volume). You can also have an annulus (fix appropriately the inner and outer radius of the G4Tubs) on top of a cylindrical basis… there are many ways to implement the same geometry!
As you want to have a bucket shaped volume, it seems that one side of the volume is closed while the other is open. In that case both of the options that you mentioned would work.
I would prefer the second solution: placement of a smaller cylinder (current or daughter volume) of air inside other cylinder (mother volume) with help of G4PVPlacement [http://geant4-userdoc.web.cern.ch/geant4-userdoc/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomPhysical.html]. You just need to take a proper translation vector (which represents the translation of the current/daughter volume in the reference frame of its mother volume).
Hope it would help you.
Allright, thank you!
To follow up on @guatelli’s great response: placing a daughter volume will be more efficient in some aspects of tracking: when code needs to find the nearest surface to a point, or a surface normal, that’s more easily done with a “simple” shape than with a boolean subtraction.
On the other hand, if you have other geometry components that are going to be placed “in the bucket”, it may be more convenient in your code for those to be siblings of the bucket (i.e., all daughters of the same mother volume), rather than granddaughters (daughters of the air volume which is a daughter of the cylinder). In that case, making the bucket as a boolean subtraction may be more convenient.