CMS 3D CMS Logo

CylinderFromSectorMFGrid.cc
Go to the documentation of this file.
3 #include <iostream>
4 
6  double phiMin, double phiMax,
7  MFGrid* sectorGrid) :
8  MFGrid(vol), thePhiMin(phiMin), thePhiMax(phiMax), theSectorGrid( sectorGrid)
9 
10 {
11  if (thePhiMax < thePhiMin) thePhiMax += 2.0*Geom::pi();
13 }
14 
16 {
17  delete theSectorGrid;
18 }
19 
21 {
22  double phi = p.phi();
23  if (phi < thePhiMax && phi > thePhiMin) return theSectorGrid->valueInTesla(p);
24  else {
25  double phiRot = floor((phi-thePhiMin)/theDelta) * theDelta;
26  double c = cos(phiRot);
27  double s = sin(phiRot);
28  double xrot = p.x()*c + p.y()*s;
29  double yrot = -p.x()*s + p.y()*c;
30 
31  // get field in interpolation sector
33 
34  // rotate field back to original sector
35  return MFGrid::LocalVector( tmp.x()*c - tmp.y()*s, tmp.x()*s + tmp.y()*c, tmp.z());
36  }
37 }
38 
39 void CylinderFromSectorMFGrid::throwUp( const char *message) const
40 {
41  std::cout << "Throwing exception " << message << std::endl;
42  throw MagGeometryError(message);
43 }
44 void CylinderFromSectorMFGrid::toGridFrame( const LocalPoint& p, double& a, double& b, double& c) const
45 {
46  throwUp("Not implemented yet");
47 }
48 
50 {
51  throwUp("Not implemented yet");
52  return LocalPoint();
53 }
54 
56 {return theSectorGrid->dimensions();}
57 
59 {
60  throwUp("Not implemented yet");
61  return LocalPoint();
62 }
63 
65 {
66  throwUp("Not implemented yet");
67  return LocalVector();
68 }
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
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
GloballyPositioned< float >::LocalPoint LocalPoint
Definition: MFGrid.h:34
void throwUp(const char *message) const
LocalPoint fromGridFrame(double a, double b, double c) const override
find grid coordinates for point. For debugging and validation only.
LocalVector valueInTesla(const LocalPoint &p) const override=0
Interpolated field value at given point.
LocalVector nodeValue(int i, int j, int k) const override
Field value at node.
CylinderFromSectorMFGrid(const GloballyPositioned< float > &vol, double phiMin, double phiMax, MFGrid *sectorGrid)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int k[5][pyjets_maxn]
double b
Definition: hdecay.h:120
Definition: MFGrid.h:29
GloballyPositioned< float >::LocalVector LocalVector
Definition: MFGrid.h:35
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
double a
Definition: hdecay.h:121
LocalVector valueInTesla(const LocalPoint &p) const override
Interpolated field value at given point.
constexpr double pi()
Definition: Pi.h:31
virtual Dimensions dimensions() const =0
LocalPoint nodePosition(int i, int j, int k) const override
Position of node in local frame.