Dipole only bends in x-y plane despite transform3d

Issue #78 resolved
William Shields created an issue

Dipoles after a transform3d component only appear to bend in the x-y plane. Screenshots below are for a psi=pi/4 rotation followed by a (angle=-1.047198, L=1.6449) dipole, for a 1168 MeV proton, reference distribution. There's no vertical bending regardless of transform3d angle.

Screen Shot 2015-09-09 at 13.54.54.png

Screen Shot 2015-09-09 at 14.02.58.png

Comments (3)

  1. Laurie Nevay

    So, having investigated this, it seems that the Sector bend magnetic field (BDSSbendMagField) inherits G4UniformMagField. This just has a constant field vector. This is created in local coordinates and never updated / transformed to global. We don't notice this as with a flat beam line, local y is degenerate with global y. As soon as you bend out of the plane with a dipole field, it'll be wrong as the field will always be in global y. This means that hkickers also never worked.

    I'm unsure if this was always the case or whether switching to the new beam line class and construction led to negating the "align component" function that applied the transform.

    This has been (temporarily) solved by introducing inheritance with BDSAuxiliaryNavigator to allow local to global transforms. This is inefficient as the field is constant and once placed so is the transform. However, the typical way of keeping a member boolean and initialising only once doesn't work as the GetField function must be const (from G4MagneticField - pure virtual). So it's done every time. Of course the better way is to transform the field once at construction and let Geant4 do its thing.

    What's more confusing is that our dipole stepper should've ignore the field. It ignores the supplied field value to the stepper /field/. Our BDSDipoleStepper has a SetBField method that stores a double (not a vector) that's the Y component of the magnetic field - pure dipole. This relies on the local coordinates of the geometry being not rotated ie the volume is created with Y in the same direction as the accelerator curvilinear Y (might not always be the case). This is confusing as it should completely ignore the field vector, so why does fixing the field vector fix the tracking through rotated dipoles?

    Anyway, for now it's fixed. In future, a general way to rotate fields at construction (once placed in the beamline) will be implemented and this revisted and therefore more efficient.

  2. Log in to comment