|Message: Re: Trouble with G4SubtractionSolid -- bug? in CLHEP::HepRotation||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
I believe that I have found a bug in the handling of compound rotations about the coordinate axes in CLHEP::HepRotation (== G4RotationMatrix). The details are below, but my question is this. Does GEANT4 have an official channel to communicate bugs to the CLHEP developers, or should I report this on my own, with a small test example?
On Sat, 15 Jan 2011 05:31:01 GMT, Michael H. Kelsey wrote:
> I am having trouble constructing a specific G4SubtractionSolid: a flat > panel (scintillator veto) with a cylindrical hole drilled at an angle to > the surface.
The attachment http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2011/01/15/13.25-77267-pentagon-hole_wrong.eps shows the problem: The hole you see should be along the viewpoint (X) axis, but instead it is perpendicular to the angled yellow panel.
To create the panel with a hole, I used:
G4Box* panel = new G4Box("Panel", scintThick/2., sidePanelWidth/2., midPanelHeight/2.); G4Tubs* pipe = new G4Tubs("PipeHole", 0., radius, thick/2., 0, 360*deg);
G4double phi = panelTransform.getRotation().phiX();
G4RotationMatrix holerot; holerot.rotateY(90*deg).rotateZ(phi);
G4ThreeVector holepos(0., holeY, holeZ);
G4VSolid* panelWithHole = new G4SubtractionSolid("PanelWithHole", panel, pipe, &holerot, holepos);
The "holerot" construction should be clear: first rotateY(90*deg) is done, and second rotateZ(phi) is done). What I have discovered is that I get the correct result if I reverse those two rotations, that is,
G4RotationMatrix holerot; holerot.rotateZ(phi).rotateY(90*deg);
Which says do the Z rotation first followed by the rotation about Y; see http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2011/01/15/13.37-94283-pentagon-hole_right.eps . Now the hole doesn't have visible sides, and the adjacent panel now has a nice piece chipped out of it.
If I generate my full detector, including the pipe coming through the hole, neither grid_test nor cylinder_test report any errors. The picture looks right (no overlapping colors), http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2011/01/15/13.43-40324-pentagon-pipe.eps .
I believe this reflects a bug in CLHEP::HepRotation. Compound rotations should be applied by matrix left multiplication, that is R(1+2) = R2 * R1, for arbitrary rotation matrices 1 and 2. This is how the rotateX/Y/Z operations are documented in CLHEP/Vector/Rotation.h.
My result above suggests that HepRotation has actually implemented the compounding by right multiplication; that is rotateX(), rotateY(), and rotateZ() are implemented as R' = R * rotateX, etc., instead of as R' = rotateX * R. I just checked this by explicit multiplication: left multiply shows up wrong, right multiply shows up correct.
I know this isn't a GEANT4 issue. As I asked above, though, does GEANT4 have an "official" way to communicate such bugs back to CLHEP, or should I do so on my own?
-- Michael Kelsey
|Inline Depth:||Outline Depth:||Add message:|