# Re: [fluka-discuss]: Geometry Rotations with a Magnetic Field

From: Luigi Salvatore Esposito <luigi.salvatore.esposito_at_cern.ch>
Date: Sun, 31 May 2015 08:41:01 +0000

Dirk,
I pointed you to those slides because in your initial email your question was about how to use a transformation in the magfld routine.
Of course, you donâ€™t need to use lattices.

Typically, a magnetic map is given in the reference of the magnet. But the magnet is then placed somewhere in the whole geometry.
And I guess this is also your case as you want to apply a transformation.

Therefore, a convenient way could be to build your magnet in its reference frame and then place it in its final position by means of
a transformation (defined by one or more ROT-DEFIs).
More explicitly, and adapting the example from the course to this recipe

* . yoke
RPP quadyoke -10.0 10.0 -10.0 10.0 -8.5 8.5
* . pipe
ZEC quad_bp 0.0 0.0 3.0 1.5
\$end_transform

Then use the QUAD___1 transformation in the magfld routine with the same logic to jump forth and back from the whole geometry reference frame to
the magnet one (with the interpolation done in the last reference frame).
In this way, both the positioning of the magnet in its final position and the computation of the magnetic field are done by using the same transformation,
making everything straightforward if any changes in the positioning of the magnet are necessary.

Certainly, one can avoid to use the start_tranform directive. At that point, the user should take care to correctly map the magnetic field map onto the magnetic region.
Hope this could help.
Cheers, Luigi

On 30 May 2015, at 10:52, Bartkoski,Dirk Alan <DABartkoski_at_mdanderson.org<mailto:DABartkoski_at_mdanderson.org>> wrote:

Thank you very much that is helpful. After looking at the slides and example, I have one question. I understand in the example why the use of lattices are included since there are multiple copies of the same component. However, if I only have one magnetic field region, do I still need to use a lattice card to transform my position coordinates to my magnetic map frame? Since the magfld routine only outputs the field at a given point could I not use the transformation matrix on the x,y,z coordinates inside my magfld routine to interpolate the field from my magnetic map and then do the inverse rotation to put the field in the geometry reference frame? I guess I am confused as to why a lattice is needed when it seems like it is only being used to access the rotation matrix as in the slides.

On May 29, 2015, at 6:47 AM, Luigi Salvatore Esposito <luigi.salvatore.esposito_at_cern.ch<mailto:luigi.salvatore.esposito_at_cern.ch>> wrote:

Dear Dirk,
you can give a look at the slides<https://indico.cern.ch/event/334606/contribution/18/material/slides/0.pdf> presented at the last advanced FLUKA course about the tracking in magnetic field.
As a practical example, you can refer to the exercise proposed at the same school<https://indico.cern.ch/event/334606/contribution/19>.
In this example, we associated a constant field to several quadrupoles defined as lattices, by means of ROT-DEFI transformations.
All the best, Luigi

On 28 May 2015, at 22:35, Bartkoski,Dirk Alan <DABartkoski_at_mdanderson.org<mailto:DABartkoski_at_mdanderson.org>> wrote:

I am having no success and was wondering if anyone has any suggestions. I have generated a 3 dimensional magnetic map consisting of x,y,z coordinates and magnetic field vector components at each location. In Flair I turn on the magnetic field in a region of the same size. I then track particles in that region subject to the magnetic field represented by my magnetic map. I have used the magfld user routine to accomplish this for the case where my map coordinates coincide with my Fluka geometry. My problem is that I am trying to rotate my Fluka geometry about a point using a Rot-Def and apply a corresponding transformation in my magfld routine that would rotate my field map with my geometry. The goal is to sum the contributions from multiple beams at the origin where each beam is subject to a magnetic field that has been rotated along with the beam.

________________________________
Dirk A. Bartkoski, Ph.D.
<image001.png>
Mays Clinic (ACBP1.2972.1)
1515 Holcombe Blvd., Unit 1202
Houston, TX 77030
(713) 745-8124 Office | (865) 310-7349 Mobile
dabartkoski_at_mdanderson.org<mailto:dabartkoski_at_mdanderson.org>

__________________________________________________________________________
You can manage unsubscription from this mailing list at https://www.fluka.org/fluka.php?id=acc_info
Received on Sun May 31 2015 - 12:05:39 CEST

This archive was generated by hypermail 2.3.0 : Sun May 31 2015 - 12:05:48 CEST