CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/MagneticField/Engine/interface/MagneticFieldHelpers.h

Go to the documentation of this file.
00001 #ifndef MagneticFieldHelpers_h
00002 #define MagneticFieldHelpers_h
00003 
00004 // #include "CondFormats/RunInfo/interface/RunInfo.h"
00005 // #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "FWCore/Framework/interface/EventSetup.h"
00008 
00009 namespace magneticFieldHelpers  {
00010 
00012   int closerNominalField(float current) {
00013     int zeroFieldThreshold = 1000; //fixme
00014     float nominalCurrents[5] = {9558,14416,16819,18268,19262} ; //FIXME: replace with correct values...
00015     int nominalFields[5] = {20,30,35,38,40} ; //in kGauss
00016     if(current < zeroFieldThreshold) return 0;
00017     int i=0;
00018     for(;i<4;i++)
00019       {
00020         if(2*current < nominalCurrents[i]+nominalCurrents[i+1] )
00021           return nominalFields[i];
00022       }
00023     return nominalFields[i];
00024   }
00025 
00026 //   /// Return the closer nominal field value (kGauss) to the average current stored in the DB.
00027 //   int closerNominalField(const RunInfo & runInfo) {
00028 //     return closerNominalField(runInfo.m_avg_current);
00029 //   }
00030 
00031 //   /// Return the closer nominal field value (kGauss) to the average current stored in the DB.
00032 //   int closerNominalField(const edm::EventSetup& es)
00033 //   {
00034 //     edm::ESHandle<RunInfo> sum;
00035 //     es.get<RunInfoRcd>().get(sum);
00036 //     return closerNominalField( *sum.product() );
00037 //   }
00038 
00039 
00040 }
00041 
00042 #endif // MagneticFieldHelpers_h