cnuphys.magfield
Class Torus

java.lang.Object
  extended by cnuphys.magfield.MagneticField
      extended by cnuphys.magfield.Torus
All Implemented Interfaces:
IField

public class Torus
extends MagneticField

The Class Torus.

Version:
1.0
Author:
David Heddle, Nicole Schumacher

Field Summary
 
Fields inherited from class cnuphys.magfield.MagneticField
MAGICNUMBER
 
Method Summary
 void field(float x, float y, float z, float[] result)
          Obtain the magnetic field at a given location expressed in Cartesian coordinates.
static Torus fromAsciiFile(java.io.File file)
          Obtain a torus object from an ascii file NOT YET IMPLEMENTED.
static Torus fromBinaryFile(java.io.File file)
          Obtain a torus object from a binary file, probably "clas12_torus_fieldmap_binary.dat"
 boolean isInvertField()
          Checks whether the polarity was flipped from what was in the field map--switching outbenders and inbenders.
 boolean isZeroField()
          Checks whether the field has been set to always return zero-- useful at times for debugging.
static void main(java.lang.String[] arg)
          main method used for testing.
 void setInvertField(boolean invertField)
          Sets whether the polarity is flipped from what was in the field map--switching outbenders and inbenders.
 void setZeroField(boolean zeroField)
          For debugging you can set the field to always return 0.
 
Methods inherited from class cnuphys.magfield.MagneticField
fieldMagnitude, getQ1Coordinate, getQ2Coordinate, getQ3Coordinate, maxFieldMagnitude, setCoordinateNames, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

fromBinaryFile

public static Torus fromBinaryFile(java.io.File file)
                            throws java.io.FileNotFoundException
Obtain a torus object from a binary file, probably "clas12_torus_fieldmap_binary.dat"

Parameters:
file - the file to read
Returns:
the torus object
Throws:
java.io.FileNotFoundException - the file not found exception

fromAsciiFile

public static Torus fromAsciiFile(java.io.File file)
Obtain a torus object from an ascii file NOT YET IMPLEMENTED.

Parameters:
file - the file to read
Returns:
the torus object

field

public void field(float x,
                  float y,
                  float z,
                  float[] result)
Obtain the magnetic field at a given location expressed in Cartesian coordinates. The field is returned as a Cartesian vector in kiloGauss. The coordinates are in the canonical CLAS system with the origin at the nominal target, x through the middle of sector 1 and z along the beam.

Parameters:
x - the x coordinate in cm
y - the y coordinate in cm
z - the z coordinate in cm
result - a array holding the retrieved (interpolated) field in kiloGauss. The 0,1 and 2 indices correspond to x, y, and z components.

isInvertField

public boolean isInvertField()
Checks whether the polarity was flipped from what was in the field map--switching outbenders and inbenders.

Returns:
true if the field was inverted.

setInvertField

public void setInvertField(boolean invertField)
Sets whether the polarity is flipped from what was in the field map--switching outbenders and inbenders.

Parameters:
invertField - if set to true the field will be inverted.

isZeroField

public boolean isZeroField()
Checks whether the field has been set to always return zero-- useful at times for debugging.

Returns:
true if the field is set to return zero.

setZeroField

public void setZeroField(boolean zeroField)
For debugging you can set the field to always return 0.

Parameters:
zeroField - if set to true the field will always return 0.

main

public static void main(java.lang.String[] arg)
main method used for testing.

Parameters:
arg - command line arguments