InitMPSfield
.
ProcessMpsHallProbe
for each event.
field_isOn
.
field_ffield
from C, or fieldb
from Fortran.
To use these functions the program include tracking.h
and fieldmodel.h
and and should be linked with libUtil.a
.
int runNo; // run number ret = InitMPSfield(runNo,0);
itape_header_t *event; // the event pointer ProcessMpsHallProbe(event);
The routines described in this section assume the coordinates in the MPS coordinate system and return the value of the magnetic field in kGausses.
The MPS coordinate system is defined to have (0,0,0) at the MPS pivot point with Y in the middle of the magnet, the z-axis points downstream, y-axis points up and the x-axis points towards the control room (i.e. towards the open side of the magnet).
REAL X,Y,Z - space point REAL B(3) - returned field value CALL FIELDB(X,Y,Z,B)
#include <ntypes.h> #include <fieldmodel.h> vector3_t space; - space point vector3_t b; - field value field_ffield(&space,&b); dvector3_t dspace; - same, but double instead of float dvector3_t db; field_dfield(&dspace,&db);
int ret; ret = field_isOn(); if (ret) { /* field is on */ } else { /* field is off */ }
To select any particular field map the following call can be used- #include <fieldmodel.h> field_setSwitch(<name>); where <name> is the name of the field map- "NONE" - no field, "FIELDB" - full field "FIELDB-3/4" - 3/4 field "HALF" - half field "FIELD93" - the 1993 ziptrack field map "UNIFORM" - the uniform 10 kGauss field map The older Fortran routine 'initfield(flag)' can still be used with 'flag' equal to 0 for the "FIELDB" map and 1 for the "HALF" field map.
To find out the setting (on or off) of the MPS magnet for any run, one has to load the run database and get the value of the 'run.field' resource: int runNo; // run number char*field; // field setting param_loadDatabase("run.field",runNo); field = param_getString("run.field","unknown"); if (strcmp(field,"FULL") == 0) ... /* full field */ else if (strcmp(field,"3/4") == 0) ... /* 3/4 field */ else if (strcmp(field,"HALF") == 0) ... /* half field */ else if (strcmp(field,"OFF") == 0) ... /* field off */
To turn the field on or off one can use the 'field_toggle' call: #include <fieldmodel.h> field_toggle(1); /* turn field on */ field_toggle(0); /* turn field off */ To find out the current setting of the field, call: #include <fieldmodel.h> int isOn; isOn = field_isOn(); if (isOn) /* field is on */ else /* field is off */ The Fortran routines 'bon, boff, fieldon and fieldoff' can also be used to turn the field on and off.
Any field map can be scaled by setting the field scaling factor. The nominal value (i.e. 10 kGauss for FIELDB and FIELD93 maps) corresponds to scaling equal to 1.0 #include <fieldmodel.h> double newScaling = 1.0; double oldScaling; oldScaling = field_setBfactor(newScaling); /* set a new scaling */ or oldScaling = field_getBfactor(); /* get the old scaling factor */ The Fortran routine 'call setbfac(scaling)' can also be used.
The MPS Hall probe has to be initialized once per run by calling: #include <tracking.h> InitMpsHallProbe(); To set the new field scaling using the MPS Hall probe data on an event per event basis, call: #include <tracking.h> <eventPointer> event; ProcessMpsHallProbe(event); This call extracts the DVM data, applies necessary calibrations and calls the 'field_setBfactor' routine.
~e852/include/fieldmodel.h ~e852/include/tracking.h -lUtil.a
Any field map defines the field only inside a subvolume, which might be different for each field map. Caution should be used when calculating fields far upstream, far downstream or outside the MPS magnet aperture. The MPS field software has many internal routines. Some of them are/were used by some older code. Such code has to be converted to use the calls described in this document. Only the routines described in the document are supported. Report bugs to Dennis Weygand (weygand@b1.phy.bnl.gov) or Const Olchanski (olchansk@b1.phy.bnl.gov)
CO 11 July 1994 revised and htmlified: CO 1995-03-16 revised (added 3/4 field) and more htmlified: CO 1995-05-04 //end file