CMS 3D CMS Logo

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 
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
LocalPoint nodePosition(int i, int j, int k) const override
Position of node in local frame.
GloballyPositioned< float >::LocalPoint LocalPoint
Definition: MFGrid.h:34
int gridType()
returns value of GridType (and eventually prints the type + short description)
void toGridFrame(const LocalPoint &p, double &a, double &b, double &c) const override
find grid coordinates for point. For debugging and validation only.
Dimensions dimensions() const override
LocalVector nodeValue(int i, int j, int k) const override
Field value at node.
MagneticFieldGrid * theRealOne
int k[5][pyjets_maxn]
GlobalPoint toGlobal(const LocalPoint &lp) const
GloballyPositioned< float >::GlobalPoint GlobalPoint
Definition: MFGrid.h:32
void dump() const override
double b
Definition: hdecay.h:120
Definition: MFGrid.h:29
LocalPoint fromGridFrame(double a, double b, double c) const override
find grid coordinates for point. For debugging and validation only.
GloballyPositioned< float >::LocalVector LocalVector
Definition: MFGrid.h:35
LocalVector valueInTesla(const LocalPoint &p) const override
Interpolated field value at given point.
double a
Definition: hdecay.h:121
const GloballyPositioned< float > & frame() const
Local reference frame.
Definition: MFGrid.h:63
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 ...