Visualising magnetic field in a beamline

I am building a beamline in Geant4 and have quadrupoles and bends with magnetic fields read from a 2d field map file. I have that implemented and would now like to visualize the fields in each element. I checked the blinetracer example and tried to implement it. I understand it doesn’t work for regions without fields so I tried visualizing each element separately but the process just gets killed when I try to run it. Can someone please help with that ? In the example the known limitations and issues were mentioned and it said it will be developed, has there been any update on that ? Any help is much appreciated. Thank you in advance,

Best Regards,

Have you tried the field visualisation commands? See Application Developers Guide, Visualisation, Controlling Visualization from Commands, Visualization of fields.

Hi thank you so much for the suggestion. I tried it but I get something like this (attached) showing the field but I was hoping to visualize smooth magnetic field lines. This is an example of a quadrupole. Is there a way to maybe increase the number of lines to make it look continuous? Please let me know. If this doesn’t look reasonable I should check my magnetic field definition then. Thank you again in advance,


Yes you can change the spacing etc. Consult the guidance:

help /vis/scene/add/magneticField

(Always consult guidance, because it’s more extensive than the normal documentation. In fact we rely on the online guidance in the visualisation group - it IS our documentation - see “Application Guide, Built-in commands”.)

Thanks a lot for the reply. Its better now. :slight_smile:

Have a great day ahead,