Message: Re: How to get translation vector of a physical volume w.r.t global origin Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: How to get translation vector of a physical volume w.r.t global origin 

Keywords: geometery
Forum: Geometry
Re: Question How to get translation vector of a physical volume w.r.t global origin (Jaison Lee)
Date: 14 Aug, 2006
From: Vladimir Grichine <Vladimir Grichine>

If one has a step point inside a physical volume, say

G4StepPoint* pPostStepPoint = aStep.GetPostStepPoint();

in the end of the current step, it is possible to find a transformation relative to the global (world volume) frame using touchable. Below is one example showing how to calculate the distance to outside of a volume fEnvelope ('position' and 'directionTR' are global position and direction from tracking):

const G4RotationMatrix* rotM = pPostStepPoint->GetTouchable()->
                               GetRotation();
G4ThreeVector transl = pPostStepPoint->GetTouchable()->GetTranslation();
G4AffineTransform transform = G4AffineTransform(rotM,transl);
transform.Invert();
G4ThreeVector localP = transform.TransformPoint(position);
G4ThreeVector localV = transform.TransformAxis(directionTR);
G4double distance = fEnvelope->GetSolid()->DistanceToOut(localP, localV);

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

 Add Message Add Message
to: "Re: How to get translation vector of a physical volume w.r.t global origin"

 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 ]