CMS 3D CMS Logo

MagneticFieldHelpers.h
Go to the documentation of this file.
1 #ifndef MagneticFieldHelpers_h
2 #define MagneticFieldHelpers_h
3 
4 // #include "CondFormats/RunInfo/interface/RunInfo.h"
5 // #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
8 
10 
12  int closerNominalField(float current) {
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  }
25 
26 // /// Return the closer nominal field value (kGauss) to the average current stored in the DB.
27 // int closerNominalField(const RunInfo & runInfo) {
28 // return closerNominalField(runInfo.m_avg_current);
29 // }
30 
31 // /// Return the closer nominal field value (kGauss) to the average current stored in the DB.
32 // int closerNominalField(const edm::EventSetup& es)
33 // {
34 // edm::ESHandle<RunInfo> sum;
35 // es.get<RunInfoRcd>().get(sum);
36 // return closerNominalField( *sum.product() );
37 // }
38 
39 
40 }
41 
42 #endif // MagneticFieldHelpers_h
int closerNominalField(float current)
Return the closer nominal field value (kGauss) to a given magnet current (A)
std::array< float, 7 > nominalFields
std::array< int, 7 > nominalCurrents