Hi,
I have a very basic Geant4 question, given I have a rectangular box (G4SubtractionBox with 1 mm walls) I want to rotate and then place at a specific point that is defined by the edge of box rather than the center. My box has the dimensions (165,14,6)*mm and is supposed to be rotated by an angle of -25. and placed so that it ends at (-25,8.8,0)*mm. For this purpose I do:
G4ThreeVector zp = G4ThreeVector(0, 0, 1);
G4ThreeVector xp = G4ThreeVector(std::cos(phi),std::sin(phi),0);
G4ThreeVector yp = G4ThreeVector(-std::sin(phi), std::cos(phi),0);
G4RotationMatrix rotm1 = G4RotationMatrix(xp, yp, zp);
After which I try to come up with the offset to put the box at the right place. In this case,
G4ThreeVector offset=G4ThreeVector(std::cos(phi)*((-25-165/2)*mm),(8.8-sin(phi)*(165/2))*mm,0)
However this is not right as if I place a beam at the end of this hollowed out box by using 8.8-sin(phi)*(165))*mm, I see that my beam is off the desired point in y by >0.5mm. I am sure I am missing something very trivial here but I can’t seem to put my finger on it. Any help will be highly appreciated