Message: Re: Rotation convention using GDML? Not Logged In (login)

## Re: Rotation convention using GDML?

Forum: Geometry
Re: Rotation convention using GDML? (Klas Marcks)
Re: Re: Rotation convention using GDML? (John Allison)
Re: Re: Rotation convention using GDML? (Klas Marcks)
Date: 08 Apr, 2015
From: Witek Pokorski <Witek Pokorski>

 Hi Klas, when GDML Geant4 reader parses the following line: it does: ` G4ThreeVector rotation(0.,0.,0.);` ``` rotation.setX(10*deg); rotation.setY(20*deg); rotation.setZ(30*deg);``` The 'rotation' object is then available for the 'future use' when parsing the geometry. In particular, for the physical volumes it is used in the following way (I am extracting only the relevant lines from Geant4 code): - first, in G4GDMLReadStructure we construct G4Transform3D out of it: ` G4Transform3D transform(GetRotationMatrix(rotation).inverse(),position);` and then, ignoring scaling and/or reflection, we go to new G4PVPlacement(transform, LV, name, ...) which calls the Physical Volume constructor: ```G4VPhysicalVolume(NewPtrRotMatrix(transform.getRotation().inverse()), transform.getTranslation(),pName,....)``` So, you end up with the original rotation (it is inversed twice). If you look at the PhysicalVolume constructor you see the comment below: ``` G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother); // Initialise volume, positioned in a frame which is rotated by *pRot, // relative to the coordinate system of the mother volume pMother. // The center of the object is then placed at tlate in the new // coordinates.``` I hope this helps. Cheers, Witek

 Inline Depth: Outline Depth: Add message:

1 Re: Rotation convention using GDML?   (Klas Marcks - 08 Apr, 2015)
 to: "Re: Rotation convention using GDML?"
This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]