Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:31

0001 #include "GlobalGridWrapper.h"
0002 #include "MagneticFieldGrid.h"
0003 #include "MagneticField/VolumeGeometry/interface/MagExceptions.h"
0004 
0005 using namespace std;
0006 
0007 GlobalGridWrapper::GlobalGridWrapper(const GloballyPositioned<float>& vol, const string& fileName) : MFGrid(vol) {
0008   theRealOne = new MagneticFieldGrid;
0009   theRealOne->load(fileName);
0010 }
0011 
0012 MFGrid::LocalVector GlobalGridWrapper::valueInTesla(const LocalPoint& p) const {
0013   GlobalPoint gp = frame().toGlobal(p);
0014   float bx, by, bz;
0015 
0016   int gridType = theRealOne->gridType();
0017   if (gridType == 1 || gridType == 2) {
0018     // x,y,z grid
0019     theRealOne->interpolateAtPoint(gp.x(), gp.y(), gp.z(), bx, by, bz);
0020   } else {
0021     // r,phi,z grid
0022     //     cout << "calling interpolateAtPoint with args "
0023     //   << gp.perp() << " " << gp.phi() << " " << gp.z() << endl;
0024     theRealOne->interpolateAtPoint(gp.perp(), gp.phi(), gp.z(), bx, by, bz);
0025     //     cout << "interpolateAtPoint returned "
0026     //   << bx << " " << by << " " << bz << endl;
0027   }
0028   return LocalVector(bx, by, bz);
0029 }
0030 
0031 void GlobalGridWrapper::dump() const {}
0032 
0033 void GlobalGridWrapper::toGridFrame(const LocalPoint& p, double& a, double& b, double& c) const {
0034   throw MagLogicError("GlobalGridWrapper::toGridFrame not implemented yet");
0035 }
0036 
0037 MFGrid::LocalPoint GlobalGridWrapper::fromGridFrame(double a, double b, double c) const {
0038   throw MagLogicError("GlobalGridWrapper::fromGridFrame not implemented yet");
0039   return LocalPoint(0, 0, 0);
0040 }
0041 
0042 Dimensions GlobalGridWrapper::dimensions() const {
0043   throw MagLogicError("GlobalGridWrapper::dimensions not implemented yet");
0044   return Dimensions();
0045 }
0046 
0047 MFGrid::LocalPoint GlobalGridWrapper::nodePosition(int i, int j, int k) const {
0048   throw MagLogicError("GlobalGridWrapper::nodePosition not implemented yet");
0049   return LocalPoint(0, 0, 0);
0050 }
0051 
0052 MFGrid::LocalVector GlobalGridWrapper::nodeValue(int i, int j, int k) const {
0053   throw MagLogicError("GlobalGridWrapper::nodeValue not implemented yet");
0054   return LocalVector(0, 0, 0);
0055 }