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) More...
 

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 mps_fire::i, RunInfoPI::nominalCurrents, and RunInfoPI::nominalFields.

12  {
13  int zeroFieldThreshold = 1000; //fixme
14  float nominalCurrents[5] = {9558,14416,16819,18268,19262} ; //FIXME: replace with correct values...
15  int nominalFields[5] = {20,30,35,38,40} ; //in kGauss
16  if(current < zeroFieldThreshold) return 0;
17  int i=0;
18  for(;i<4;i++)
19  {
20  if(2*current < nominalCurrents[i]+nominalCurrents[i+1] )
21  return nominalFields[i];
22  }
23  return nominalFields[i];
24  }
std::array< float, 7 > nominalFields
std::array< int, 7 > nominalCurrents