Question about rotation of geometry

Geant4 Version:
Operating System:
Compiler/Version:
CMake Version:
Hi, I write the following code:

G4double phi = 45* deg;
 G4ThreeVector u = G4ThreeVector(1, 0, 0);
G4ThreeVector v=G4ThreeVector(0, 1, 0).rotateX(phi);
 G4ThreeVector w=G4ThreeVector(0, 0, 1).rotateX(phi);
  G4RotationMatrix *rotm1 = new G4RotationMatrix(u, v, w);///////old     
 G4ThreeVector position1 = 50 * w;
G4Box* det_box
   = new G4Box("det_box",det_xx/2.,det_yy/2.,0.001*mm);
 G4LogicalVolume* det_log= new G4LogicalVolume(det_box,
                                               Vaccum,"det_log",0,0,0);
new G4PVPlacement(rotm1, position1,
                    det_log,  // logical volume                                                                                                             
                    "det_phys",  // name                                                                                                                    
                    experimentalHall_log,  // mother volume                                                                                                 
                    false,  // no boolean operation                                                                                                         
                     0);  // copy number   

I hope to rotate the plan detector 45deg around the X-axis,and the plan detector is still Parallel to the X-axis. The simulation results is wrong! The detector have been placed incorrect location! However when I rotate the plan detector 90deg, 180deg, 270deg, with this method,the simulation results are all good!
Why? How can I fix it? Thanks!

It is hard to say if you operate “right” and “wrong” adjectives. Could you run a GUI session to see what happens to the box?

I would recommend you to use G4PVPlacement with G4Transform3D, instead of G4Rotation and G4ThreeVector. An object of the G4Transform3D class can be constructed as a sequence of simple transformations. The resulting transformation can be found as a right-to-left product of these simple transformations.

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