#include <MagneticField/Interpolation/src/RectangularCylindricalMFGrid.h>
Public Member Functions | |
virtual void | dump () const |
virtual LocalPoint | fromGridFrame (double a, double b, double c) const |
find grid coordinates for point. For debugging and validation only. | |
RectangularCylindricalMFGrid (binary_ifstream &istr, const GloballyPositioned< float > &vol) | |
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 | uncheckedValueInTesla (const LocalPoint &p) const |
Interpolated field value at given point; does not check for exceptions. |
Definition at line 8 of file RectangularCylindricalMFGrid.h.
RectangularCylindricalMFGrid::RectangularCylindricalMFGrid | ( | binary_ifstream & | istr, | |
const GloballyPositioned< float > & | vol | |||
) |
Definition at line 8 of file RectangularCylindricalMFGrid.cc.
References GenMuonPlsPt100GeV_cfg::cout, Vector3DBase< T, FrameTag >::dot(), lat::endl(), MFGrid::frame(), MFGrid3D::grid_, submitDQMOfflineCAF::nLines, PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::toLocal(), and PV3DBase< T, PVType, FrameType >::z().
00010 : MFGrid3D(vol) 00011 { 00012 // The parameters read from the data files are given in global coordinates. 00013 // In version 85l, local frame has the same orientation of global frame for the reference 00014 // volume, i.e. the r.f. transformation is only a translation. 00015 // There is therefore no need to convert the field values to local coordinates. 00016 // Check this assumption: 00017 GlobalVector localXDir(frame().toGlobal(LocalVector(1,0,0))); 00018 GlobalVector localYDir(frame().toGlobal(LocalVector(0,1,0))); 00019 00020 if (localXDir.dot(GlobalVector(1,0,0)) > 0.999999 && 00021 localYDir.dot(GlobalVector(0,1,0)) > 0.999999) { 00022 // "null" rotation - requires no conversion... 00023 } else { 00024 cout << "ERROR: RectangularCylindricalMFGrid: unexpected orientation: x: " 00025 << localXDir << " y: " << localYDir << endl; 00026 } 00027 00028 int n1, n2, n3; 00029 inFile >> n1 >> n2 >> n3; 00030 double xref, yref, zref; 00031 inFile >> xref >> yref >> zref; 00032 double stepx, stepy, stepz; 00033 inFile >> stepx >> stepy >> stepz; 00034 00035 vector<BVector> fieldValues; 00036 float Bx, By, Bz; 00037 int nLines = n1*n2*n3; 00038 for (int iLine=0; iLine<nLines; ++iLine){ 00039 inFile >> Bx >> By >> Bz; 00040 fieldValues.push_back(BVector(Bx,By,Bz)); 00041 } 00042 // check completeness 00043 string lastEntry; 00044 inFile >> lastEntry; 00045 if (lastEntry != "complete"){ 00046 cout << "ERROR during file reading: file is not complete" << endl; 00047 } 00048 00049 GlobalPoint grefp( GlobalPoint::Cylindrical( xref, yref, zref)); 00050 LocalPoint lrefp = frame().toLocal( grefp); 00051 00052 #ifdef DEBUG_GRID 00053 cout << "Grid reference point in grid system: " << xref << "," << yref << "," << zref << endl; 00054 cout << "Grid reference point in global x,y,z: " << grefp << endl; 00055 cout << "Grid reference point in local x,y,z: " << lrefp << endl; 00056 cout << "steps " << stepx << "," << stepy << "," << stepz << endl; 00057 #endif 00058 00059 Grid1D<double> gridX( lrefp.perp(), lrefp.perp() + stepx*(n1-1), n1); 00060 //Grid1D<double> gridY( lrefp.phi(), lrefp.phi() + stepy*(n2-1), n2); // wrong: gives zero 00061 Grid1D<double> gridY( yref, yref + stepy*(n2-1), n2); 00062 Grid1D<double> gridZ( lrefp.z(), lrefp.z() + stepz*(n3-1), n3); 00063 00064 grid_ = GridType( gridX, gridY, gridZ, fieldValues); 00065 00066 }
Reimplemented from MFGrid.
Definition at line 68 of file RectangularCylindricalMFGrid.cc.
References GenMuonPlsPt100GeV_cfg::cout, Grid3D< Value, T >::data(), lat::endl(), MFGrid3D::grid_, Grid3D< Value, T >::grida(), Grid3D< Value, T >::gridb(), and Grid3D< Value, T >::gridc().
00069 { 00070 cout << endl << "Dump of RectangularCylindricalMFGrid" << endl; 00071 cout << "Number of points from Grid1D " 00072 << grid_.grida().nodes() << " " << grid_.gridb().nodes() << " " << grid_.gridc().nodes() << endl; 00073 00074 cout << "Reference Point from Grid1D " 00075 << grid_.grida().lower() << " " << grid_.gridb().lower() << " " << grid_.gridc().lower() << endl; 00076 00077 cout << "Basic Distance from Grid1D " 00078 << grid_.grida().step() << " " << grid_.gridb().step() << " " << grid_.gridc().step() << endl; 00079 00080 00081 cout << "Dumping " << grid_.data().size() << " field values " << endl; 00082 // grid_.dump(); 00083 }
MFGrid::LocalPoint RectangularCylindricalMFGrid::fromGridFrame | ( | double | a, | |
double | b, | |||
double | c | |||
) | const [virtual] |
find grid coordinates for point. For debugging and validation only.
Implements MFGrid.
Definition at line 115 of file RectangularCylindricalMFGrid.cc.
00116 { 00117 00118 // FIXME: "OLD" convention of phi. 00119 // return LocalPoint( LocalPoint::Cylindrical(a, Geom::pi() - b, c)); 00120 return LocalPoint( LocalPoint::Cylindrical(a, b, c)); 00121 }
void RectangularCylindricalMFGrid::toGridFrame | ( | const LocalPoint & | p, | |
double & | a, | |||
double & | b, | |||
double & | c | |||
) | const [virtual] |
find grid coordinates for point. For debugging and validation only.
Implements MFGrid.
Definition at line 105 of file RectangularCylindricalMFGrid.cc.
References PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), and PV3DBase< T, PVType, FrameType >::z().
00107 { 00108 a = p.perp(); 00109 // FIXME: "OLD" convention of phi. 00110 // b = Geom::pi() - p.phi(); 00111 b = p.phi(); 00112 c = p.z(); 00113 }
MFGrid::LocalVector RectangularCylindricalMFGrid::uncheckedValueInTesla | ( | const LocalPoint & | p | ) | const [virtual] |
Interpolated field value at given point; does not check for exceptions.
Implements MFGrid3D.
Definition at line 85 of file RectangularCylindricalMFGrid.cc.
References e, MFGrid3D::grid_, Grid3D< Value, T >::grida(), Grid3D< Value, T >::gridc(), LinearGridInterpolator3D< Value, T >::interpolate(), k, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), dttmaxenums::R, HLT_VtxMuL3::result, value, and PV3DBase< T, PVType, FrameType >::z().
00086 { 00087 const float minimalSignificantR = 1e-6; // [cm], points below this radius are treated as zero radius 00088 float R = p.perp(); 00089 if (R < minimalSignificantR) { 00090 if (grid_.grida().lower() < minimalSignificantR) { 00091 int k = grid_.gridc().index(p.z()); 00092 double u = (p.z() - grid_.gridc().node(k)) / grid_.gridc().step(); 00093 LocalVector result((1-u)*grid_(0, 0, k) + u*grid_(0, 0, k+1)); 00094 return result; 00095 } 00096 } 00097 00098 LinearGridInterpolator3D<GridType::ValueType, GridType::Scalar> interpol( grid_); 00099 // FIXME: "OLD" convention of phi. 00100 // GridType::ValueType value = interpol( R, Geom::pi() - p.phi(), p.z()); 00101 GridType::ValueType value = interpol.interpolate( R, p.phi(), p.z()); 00102 return LocalVector(value); 00103 }