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

From: <hdaghan_at_etu.edu.tr>
Date: Sun, 31 May 2015 12:25:10 +0300

Please do not sent e-mail anymore you an idiot

Sent from myMail for iOS

31 Mayıs 2015 Pazar 11:41 +0300 kimden: luigi.salvatore.esposito_at_cern.ch <luigi.salvatore.esposito_at_cern.ch>:
>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 > 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 > wrote:
>>
>>>Dear Dirk,
>>>you can give a look at the  slides  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 .
>>>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 > 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.