CMS 3D CMS Logo

Functions

magneticFieldHelpers Namespace Reference

Functions

int closerNominalField (float current)
 Return the closer nominal field value (kGauss) to a given magnet current (A)

Function Documentation

int magneticFieldHelpers::closerNominalField ( float  current)

Return the closer nominal field value (kGauss) to a given magnet current (A)

Definition at line 12 of file MagneticFieldHelpers.h.

References i.

                                        {
    int zeroFieldThreshold = 1000; //fixme
    float nominalCurrents[5] = {9558,14416,16819,18268,19262} ; //FIXME: replace with correct values...
    int nominalFields[5] = {20,30,35,38,40} ; //in kGauss
    if(current < zeroFieldThreshold) return 0;
    int i=0;
    for(;i<4;i++)
      {
        if(2*current < nominalCurrents[i]+nominalCurrents[i+1] )
          return nominalFields[i];
      }
    return nominalFields[i];
  }