CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalGridWrapper.cc
Go to the documentation of this file.
1 #include "GlobalGridWrapper.h"
2 #include "MagneticFieldGrid.h"
4 
5 using namespace std;
6 
8  const string& fileName)
9  : MFGrid(vol)
10 {
12  theRealOne->load(fileName);
13 }
14 
16 {
17 
18  GlobalPoint gp = frame().toGlobal(p);
19  float bx, by, bz;
20 
21  int gridType = theRealOne->gridType();
22  if ( gridType == 1 || gridType == 2) {
23  // x,y,z grid
24  theRealOne->interpolateAtPoint( gp.x(), gp.y(), gp.z(), bx, by, bz);
25  }
26  else {
27  // r,phi,z grid
28 // cout << "calling interpolateAtPoint with args "
29 // << gp.perp() << " " << gp.phi() << " " << gp.z() << endl;
30  theRealOne->interpolateAtPoint( gp.perp(), gp.phi(), gp.z(), bx, by, bz);
31 // cout << "interpolateAtPoint returned "
32 // << bx << " " << by << " " << bz << endl;
33  }
34  return LocalVector( bx, by, bz);
35 }
36 
37 void GlobalGridWrapper::dump() const {}
38 
40  double& a, double& b, double& c) const
41 {
42  throw MagLogicError ("GlobalGridWrapper::toGridFrame not implemented yet");
43 }
44 
46 {
47  throw MagLogicError ("GlobalGridWrapper::fromGridFrame not implemented yet");
48  return LocalPoint( 0, 0, 0);
49 }
50 
52 {
53  throw MagLogicError ("GlobalGridWrapper::dimensions not implemented yet");
54  return Dimensions();
55 }
56 
58 {
59  throw MagLogicError ("GlobalGridWrapper::nodePosition not implemented yet");
60  return LocalPoint( 0, 0, 0);
61 }
62 
64 {
65  throw MagLogicError ("GlobalGridWrapper::nodeValue not implemented yet");
66  return LocalVector( 0, 0, 0);
67 }
68 
GlobalGridWrapper(const GloballyPositioned< float > &vol, const std::string &fileName)
void load(const std::string &name)
load grid binary file
int i
Definition: DBlmapReader.cc:9
virtual LocalVector nodeValue(int i, int j, int k) const
Field value at node.
virtual LocalPoint nodePosition(int i, int j, int k) const
Position of node in local frame.
virtual Dimensions dimensions() const
GloballyPositioned< float >::LocalPoint LocalPoint
Definition: MFGrid.h:34
int gridType()
returns value of GridType (and eventually prints the type + short description)
virtual LocalPoint fromGridFrame(double a, double b, double c) const
find grid coordinates for point. For debugging and validation only.
int j
Definition: DBlmapReader.cc:9
MagneticFieldGrid * theRealOne
GlobalPoint toGlobal(const LocalPoint &lp) const
GloballyPositioned< float >::GlobalPoint GlobalPoint
Definition: MFGrid.h:32
double b
Definition: hdecay.h:120
Definition: MFGrid.h:29
GloballyPositioned< float >::LocalVector LocalVector
Definition: MFGrid.h:35
double a
Definition: hdecay.h:121
const GloballyPositioned< float > & frame() const
Local reference frame.
Definition: MFGrid.h:63
virtual void toGridFrame(const LocalPoint &p, double &a, double &b, double &c) const
find grid coordinates for point. For debugging and validation only.
virtual LocalVector valueInTesla(const LocalPoint &p) const
Interpolated field value at given point.
void interpolateAtPoint(double X1, double X2, double X3, float &Bx, float &By, float &Bz)
interpolates the magnetic field at input coordinate point and returns field values ...