[Clas12_software] stand alone magfield interpolator
David Heddle
david.heddle at cnu.edu
Tue Oct 23 11:04:48 EDT 2012
Yo,
I checked in the first version of a Java stand-alone magnetic field
interpolator into "magfield" in the svn repository. It reads the same
binary file ced uses, clas12_torus_fieldmap_binary.dat, which is in the
data directory after checkout. It does not yet read the ascii file that
gemc uses (from which the binary file was derived) but it will. At the
moment there is just one class that you need to instantiate: Torus (see the
javadocs in the doc folder). The functionality is simple:
1) create a Torus by a static method in the Torus class that accepts a File
object corresponding to the binary file
2) you get get the field (in kiloGauss) at any x,y,z. See the documentation
for coordinate system discussion, units, etc.
3) you can globally invert the field to make inbenders into out benders,
and vice versa.
4) you can tell it to return zero for all requests, i.e. turn the magnet
off--useful (I found) for debugging.
See the main program in Torus for an example.
Its own jar file magfield.jar is in the lib folder. Alternatively, eclipse
uses can just make a dependency on the project
*What could go wrong?*
The field map is only for 30 degrees (in phi) of the field. i.e. half of
sector one. Obtaining values for the other half and other sectors requires
some inversions and rotations. I think I did it right but who knows?
Someone should double check. It agrees with red, and ced's swimming seems
to work properly.
*Notes:*
1) It uses float arithmetic, not double--purely to make the field map
smaller. I don't know if this is sufficient.
2) The interpolation is simple tri-linear
3) After some consideration I decided to be math library agnostic. It does
not use any 3rd party definitions of a 3-vector from any math library. It
uses arrays of three floats as generic 3-vectors, with x,y,z corresponding
to the 0,1 and 2 indices.
Cheers,
dph
--
David P. Heddle, Ph.D.
Associate Professor and Chair
Department of Mathematics
Christopher Newport University
1 University Place
Newport News, VA 23606
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jlab.org/pipermail/clas12_software/attachments/20121023/adf1553a/attachment-0002.html>
More information about the Clas12_software
mailing list