Non z-directional tubs & double rotation

Hi, I’m trying to make some geometry.
I need some half hole(like a D shape) through the disk plate along the X axis
I know how to make those structure technically, by using UnionSolid or SubtractionSolid.

But I need some help.

  1. Can I make a tube which is not extract along z-axis?
    I mean can I make a pipe along a x,y, or other custom axis?

  2. Can I rotate a structure 2 times?
    Is there a way to rotate structure by X axis and then Y axis?
    here is my code

G4VSolid* Disk = new Tubs(“Disk”,0.*cm,10.*cm,4.*cm,0.*deg,360.deg);
G4VSolid
Pipe = new Tubs(“Pipe”,0.*cm,2.*cm,5.*cm,0.*deg,360.deg);
G4RotationMatrix
rotM = new G4RotationMatrix;
rotM->rotateY(90.*deg); // << want to add rotateX(90.deg) again to the rotM.
G4VSolid
A = new SubtractionSolid(“A”,Disk,Pipe,rotM,G4ThreeVector());

  1. No. All Geant4 solids are created in their local system coordinate. In case of G4Tubs the solid always is oriented along Z axis. However, then it can be placed in any position in the mother volume and rotated as required, see the documentation on Physical Volumes, namely G4PVPlacement.

  2. Yes. A rotation can be created as a sequence of rotations:

    rot = rotY * rotX;

1 Like

Oh, thank you for your generosity. Have a good day ::slight_smile: