Magnetic Field inside a new detector in O2

Hi all,

I am currently trying to have a new detector for ALICE 3, the Forward Conversion Tracker (FCT), implemented in a local version of O2 for test purposes.
It was decided that the FCT will get its own di-pole magnet and have a magnetic field in the vertical (y-direction). The concept for the magnets is nowhere near final, so a simulation of the magnet to create a map is not an option yet, but for local testing purposes a uniform magnetic field with a user defined strength would suffice. The strength of the B-field is not final either, because his needs to be decided by running simulations.

Is it possible to construct a user-defined magnetic field inside a detector in O2? One that overrides the present solenoid field (for run 3) in a user-defined volume.

Or perhaps is it possible to adapt the maps and thus construct a magnetic field that way? If yes, could you please provide details on how to do this (some documentation or a starting point would be highly appreciated).

Kind regards,


The field can be set via --field option of o2-sim. A uniform field can be enforced via adding U to the option. However, it appears that only predefined values are allowed in terms of kGaus.
I assume a generalization to custom global uniform field can be done easily. However, having something only valid locally will be quite a bit harder.

Pinging also @shahoian (author of MagField classes).

1 Like

Hello @Cas

The field is calculated here: AliceO2/MagneticField.cxx at 6ee7b90bc79673f563d45c10020e396a24ab4ac3 · AliceO2Group/AliceO2 · GitHub, by default from the MagneticWrapperChebyshev object, which contains hundreds of cylindrical slices each providing a field (in cylindrical frame) in the corresponding subvolume, parameterized using Chebyshev polynomials. Optionally (in reconstruction only and only for the solenoid region) it is taken from the faster and less precise MagFieldFast object, which is using fixed order polynomials in more coarse cylindrical slices.

The cleanest solution would be to create another version of “uniform” field parameterization: currently, it is represented by a single volume:

Segmentation for Solenoid (-700.00<Z<+700.00 cm | R<560.00 cm)
SOL   0 BSol_const: Chebyshev parameterization for 3D->3D function. Precision: 1.000000e-06
Region of validity: [+0.00000e+00:+5.60000e+02] [-3.14159e+00:+3.14159e+00] [-7.00000e+02:+7.00000e+02]
                                   R                        phi                   z

What would need to do is to split this cylinder to 3 pieces ([zmin_solenoid : zmin_dipole], [zmin_dipole : zmax_dipole], [zmax_dipole : zmax_solenoid]), redefine the Rmin of the piece containing the dipole and insert another piece parameterizing dipole field in cyl. frame.
This will require also adding an extra enum, e.g. k5kGUniformAlice3, in AliceO2/MagFieldParam.h at 6ee7b90bc79673f563d45c10020e396a24ab4ac3 · AliceO2Group/AliceO2 · GitHub
If you decide to go this way, I can provide more technical details.

Alternatively, for quick and dirty tests , you can hack the Field and GetBz calls above to return the field you want, but I would be against adding extra if/else in these methods to dev branch.


Dear Ruben,

Thank you for the detailed description. I will have a look and see what is needed for the approach of creating another uniform field parametrization. Once I think I have understood most of it, I will get back to you for the “technical details”.