Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:22

0001 #ifndef MFGrid_h
0002 #define MFGrid_h
0003 
0004 /** \class MFGrid
0005  *
0006  *  Virtual interface for a field provider that is based on interpolation
0007  *  on a regular grid.
0008  *
0009  *  \author T. Todorov
0010  */
0011 
0012 #include "DataFormats/GeometrySurface/interface/GloballyPositioned.h"
0013 #include "MagneticField/Interpolation/interface/MagProviderInterpol.h"
0014 
0015 struct Dimensions {
0016   int w;
0017   int h;
0018   int d;
0019 };
0020 
0021 struct Indexes {
0022   int i;
0023   int j;
0024   int k;
0025 };
0026 
0027 class MFGrid : public MagProviderInterpol {
0028 public:
0029   typedef GloballyPositioned<float>::GlobalPoint GlobalPoint;
0030   typedef GloballyPositioned<float>::GlobalVector GlobalVector;
0031   typedef GloballyPositioned<float>::LocalPoint LocalPoint;
0032   typedef GloballyPositioned<float>::LocalVector LocalVector;
0033 
0034   explicit MFGrid(const GloballyPositioned<float>& vol) : frame_(vol) {}
0035 
0036   ~MFGrid() override {}
0037 
0038   /// Interpolated field value at given point.
0039   LocalVector valueInTesla(const LocalPoint& p) const override = 0;
0040 
0041   virtual void dump() const {}
0042 
0043   /// find grid coordinates for point. For debugging and validation only.
0044   virtual void toGridFrame(const LocalPoint& p, double& a, double& b, double& c) const = 0;
0045 
0046   /// find grid coordinates for point. For debugging and validation only.
0047   virtual LocalPoint fromGridFrame(double a, double b, double c) const = 0;
0048 
0049   virtual Dimensions dimensions() const = 0;
0050 
0051   /// Position of node in local frame
0052   virtual LocalPoint nodePosition(int i, int j, int k) const = 0;
0053 
0054   /// Field value at node
0055   virtual LocalVector nodeValue(int i, int j, int k) const = 0;
0056 
0057   virtual Indexes index(const LocalPoint& p) const { return Indexes(); }
0058 
0059   /// Local reference frame
0060   const GloballyPositioned<float>& frame() const { return frame_; }
0061 
0062 private:
0063   GloballyPositioned<float> frame_;
0064 };
0065 
0066 #endif