Is "volume-local" EM field automatically passed local coordinates?

[ The following is with Geant4 10.06.p03 ]

In our experiment we have multiple active detectors at various positions in space. We have used COMSOL to calculate a 3D mesh electric field (voltage map) for each type of detector we have, and have written an electric field class that reads in the mesh and does the appropriate tetrahedral interpolation.

We have attached an instance of the mesh field to each individual detector (using LV->SetFieldManger()), and I wrote a wrapper for the field to take care of mapping (what I thought were) the global coordinates passed from G4Transportation the the local coordinates of the volume.

I’ve been struggling with some weird geometry dependent errors in the code, and instrumented my field wrapper with lots of G4cout. It appears that the electric field is actually being passed the local coordinates, and my wrapper class is misbehaving by applying the global-to-local coordinate transformation on top of that.

Is this true? If G4LogicalVolume::SetFieldManager() is used, with the attached electric field automatically be given coordinates in the volume’s local frame? If so, should the outgoing electric and magnetic field vectors (returned by GetFieldValue(const G4double Point[4], G4double *BEfield)) also be returned in the volume-local frame?

Hi Mike,

As with the magnetic field, the field propagation module in Geant4 expects the electric field (or any other) to accept the position in global coordinates, and return the electric field in global coordinates.

If you are experiencing some unexpected values, it is likely due to something else.

I note/recall that it is possible for G4 to request the value of the field in regions outside the volume for which a field is (actually) defined, because the integration first creates one or more chords, before intersecting them with the volume boundaries.

Could it be that your transformation does not cope with such cases ?

Cheers, John

Thanks, John. That helps; I guess that G4Transportation (or whomever) just happened to choose sampling points that looked like my true event point in local coordinates :slight_smile:

It seems like I’ve got several weird things going on. I get the transform from G4Touchable for the track (via my implementation of fieldManager::ConfigureForTrack(). Within that function, I print out the transform, and apply it to a test point to confirm that it does what it’s supposed to do. But I’m seeing the transform misbehave when GetFieldValue() is called.

In any event, this is back to being my problem, not Geant’s :-/

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.