CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/MagneticField/Interpolation/src/GlobalGridWrapper.cc

Go to the documentation of this file.
00001 #include "GlobalGridWrapper.h"
00002 #include "MagneticFieldGrid.h"
00003 #include "MagneticField/VolumeGeometry/interface/MagExceptions.h"
00004 
00005 using namespace std;
00006 
00007 GlobalGridWrapper::GlobalGridWrapper( const GloballyPositioned<float>& vol,
00008                                       const string& fileName)
00009   : MFGrid(vol)
00010 {
00011   theRealOne = new MagneticFieldGrid;
00012   theRealOne->load(fileName);
00013 }
00014 
00015 MFGrid::LocalVector GlobalGridWrapper::valueInTesla( const LocalPoint& p) const
00016 {
00017 
00018   GlobalPoint gp = frame().toGlobal(p);
00019   float bx, by, bz;
00020 
00021   int gridType = theRealOne->gridType();
00022   if ( gridType == 1 || gridType == 2) {
00023     // x,y,z grid
00024     theRealOne->interpolateAtPoint( gp.x(), gp.y(), gp.z(), bx, by, bz);      
00025   }
00026   else {
00027     // r,phi,z grid
00028 //     cout << "calling interpolateAtPoint with args " 
00029 //       << gp.perp() << " " << gp.phi() << " " << gp.z() << endl;
00030     theRealOne->interpolateAtPoint( gp.perp(), gp.phi(), gp.z(), bx, by, bz);      
00031 //     cout << "interpolateAtPoint returned " 
00032 //       << bx << " " << by << " " << bz << endl;
00033   }
00034   return LocalVector( bx, by, bz);
00035 }
00036 
00037 void GlobalGridWrapper::dump() const {}
00038 
00039 void GlobalGridWrapper::toGridFrame( const LocalPoint& p, 
00040                                               double& a, double& b, double& c) const
00041 {
00042   throw MagLogicError ("GlobalGridWrapper::toGridFrame not implemented yet");
00043 }
00044  
00045 MFGrid::LocalPoint GlobalGridWrapper::fromGridFrame( double a, double b, double c) const
00046 {
00047   throw MagLogicError ("GlobalGridWrapper::fromGridFrame not implemented yet");
00048   return LocalPoint( 0, 0, 0);
00049 }
00050 
00051 Dimensions GlobalGridWrapper::dimensions() const
00052 {
00053   throw MagLogicError ("GlobalGridWrapper::dimensions not implemented yet");
00054   return Dimensions();
00055 }
00056 
00057 MFGrid::LocalPoint GlobalGridWrapper::nodePosition( int i, int j, int k) const
00058 {
00059   throw MagLogicError ("GlobalGridWrapper::nodePosition not implemented yet");
00060   return LocalPoint( 0, 0, 0);
00061 }
00062 
00063 MFGrid::LocalVector GlobalGridWrapper::nodeValue( int i, int j, int k) const
00064 {
00065   throw MagLogicError ("GlobalGridWrapper::nodeValue not implemented yet");
00066   return LocalVector( 0, 0, 0);
00067 }
00068