Message: Re: Local Electric Field: GetFieldValue() problem Not Logged In (login)

## Re: Local Electric Field: GetFieldValue() problem

Keywords: coordinate systems nonuniform electric field
Forum: Fields: Magnetic and Otherwise
Re: Local Electric Field: GetFieldValue() problem (Mario)
Date: 15 Feb, 2008
From: Gumplinger Peter <Gumplinger Peter>

 Hi Mario, My guess is that none of us will speculate what happens when you have overlapping volumes because it is a NO NO in Geant4, precisely because what the G4Navigator will do is unpredictable. You have to use special (G4) tools to test your geometry for overlaps. Please, see the documentation about that. ```> The main concern is point[4] which comes in at the GetFieldValue() > function. ``` point[3] is 'time' - ergo, you can have a time dependent field. ```> I have displayed point[0], point[1], point[2] and calculated the > magnitude of this vector and in some instances it is larger than my > entire world volume ``` You can also turn on step-wise debugging (/tracking/verbose 1) to follow where your tracks go and since you seem to have a debugging print statement in your SetFieldValue method you can find out when it's called - should only be called when in your 'logicalVolume' - and at what global coordinate points. If you print Point[0,1,2] you should be able to verify whether Point is local or global. I think it is global - but I am not 100% sure. So, if you want to return a value easier calculated from the local system, you need to use a GlobalToLocal transform: G4StepPoint* p = aStep->GetPreStepPoint(); G4ThreeVector globalPoint(Point[0],Point[1],Point[2]); const G4AffineTransform global2local = p->GetTouchable()->GetHistory()->GetTopTransform(); G4ThreeVector localPoint= global2local.TransformPoint(globalPoint); Except I am at a loss how you get a handle to G4Step aStep in your SetFieldValue method. One lengthy way might be: G4Step aStep = G4EventManager::GetEventManager()->GetTrackingManager()->GetSteppingManager()->GetStep(); ```> I guess I am curious about the coordinate system that point[4] is > using... does it use the logicalVolume in which the fieldManager of > the field belongs to as the coordinate system, or is it with respect > to the global volume?? ``` I am afraid it's the global coordinate system. ```> is there something special about a volume that is made of Vacuum and > holds a field manager?? ``` Not that I know off.

 Inline Depth: Outline Depth: Add message:

1 Re: Local Electric Field: GetFieldValue() problem   (Mario - 15 Feb, 2008)
Re: Local Electric Field: GetFieldValue() problem   (Peter Gumplinger - 18 Feb, 2008)
 to: "Re: Local Electric Field: GetFieldValue() problem"
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 ]