Message: Re: Rotation convention using GDML? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Rotation convention using GDML? 

Forum: Geometry
Re: Question Rotation convention using GDML? (Klas Marcks)
Re: None Re: Rotation convention using GDML? (John Allison)
Re: None 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:

<rotation name="V" unit="degree" x="10" y="20" z="30" />

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:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: Rotation convention using GDML?   (Klas Marcks - 08 Apr, 2015)
 Add Message Add Message
to: "Re: Rotation convention using GDML?"

 Subscribe Subscribe

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 ]