CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Trapezoid2RectangleMappingX Class Reference

#include <Trapezoid2RectangleMappingX.h>

Public Member Functions

void rectangle (double xtrap, double ytrap, double &xrec, double &yrec) const
 
void trapezoid (double xrec, double yrec, double &xtrap, double &ytrap) const
 
 Trapezoid2RectangleMappingX ()
 
 Trapezoid2RectangleMappingX (double x0, double y0, double bovera, double h)
 normal trapezoid case, a != b More...
 
 Trapezoid2RectangleMappingX (double x0, double y0, double k)
 special parallelogram case, a == b. The meaning of k changes. More...
 

Private Attributes

double k_
 
bool parallel_
 
double x0_
 
double y0_
 

Detailed Description

Maps a trapezoidal coordinate system into a cartesian one. It is assumed that x is the coordinate along the trapezoid bases while y is along the trapezoid height.

Author
T. Todorov

Definition at line 21 of file Trapezoid2RectangleMappingX.h.

Constructor & Destructor Documentation

◆ Trapezoid2RectangleMappingX() [1/3]

Trapezoid2RectangleMappingX::Trapezoid2RectangleMappingX ( )
inline

Definition at line 23 of file Trapezoid2RectangleMappingX.h.

23 {}

◆ Trapezoid2RectangleMappingX() [2/3]

Trapezoid2RectangleMappingX::Trapezoid2RectangleMappingX ( double  x0,
double  y0,
double  bovera,
double  h 
)
inline

normal trapezoid case, a != b

Definition at line 26 of file Trapezoid2RectangleMappingX.h.

26  : x0_(x0), y0_(y0), parallel_(false) {
27  k_ = 2 / h * (bovera - 1.) / (bovera + 1.);
28 
29 #ifdef DEBUG_GRID_TRM
30  std::cout << "Trapezoid2RectangleMappingX constructed with x0,y0 " << x0 << " " << y0 << " b/a= " << bovera
31  << " h= " << h << std::endl;
32 #endif
33  }

References gather_cfg::cout.

◆ Trapezoid2RectangleMappingX() [3/3]

Trapezoid2RectangleMappingX::Trapezoid2RectangleMappingX ( double  x0,
double  y0,
double  k 
)
inline

special parallelogram case, a == b. The meaning of k changes.

Definition at line 36 of file Trapezoid2RectangleMappingX.h.

36  : x0_(x0), y0_(y0), k_(k), parallel_(true) {
37 #ifdef DEBUG_GRID_TRM
38  std::cout << "Trapezoid2RectangleMappingX constructed with x0,y0 " << x0 << " " << y0 << " k= " << k << std::endl;
39 #endif
40  }

References gather_cfg::cout, and dqmdumpme::k.

Member Function Documentation

◆ rectangle()

void Trapezoid2RectangleMappingX::rectangle ( double  xtrap,
double  ytrap,
double &  xrec,
double &  yrec 
) const
inline

Definition at line 42 of file Trapezoid2RectangleMappingX.h.

42  {
43  yrec = ytrap - y0_;
44  if (!parallel_)
45  xrec = (xtrap - x0_) / (1. + yrec * k_);
46  else
47  xrec = xtrap - x0_ + k_ * yrec;
48 
49 #ifdef DEBUG_GRID
50  std::cout << xtrap << " " << ytrap << " transformed to rectangle " << xrec << " " << yrec << std::endl;
51 #endif
52  }

References gather_cfg::cout.

Referenced by TrapezoidalCylindricalMFGrid::toGridFrame(), TrapezoidalCartesianMFGrid::toGridFrame(), TrapezoidalCartesianMFGrid::TrapezoidalCartesianMFGrid(), TrapezoidalCylindricalMFGrid::TrapezoidalCylindricalMFGrid(), and TrapezoidalCartesianMFGrid::uncheckedValueInTesla().

◆ trapezoid()

void Trapezoid2RectangleMappingX::trapezoid ( double  xrec,
double  yrec,
double &  xtrap,
double &  ytrap 
) const
inline

Definition at line 54 of file Trapezoid2RectangleMappingX.h.

54  {
55  if (!parallel_)
56  xtrap = x0_ + xrec * (1. + yrec * k_);
57  else
58  xtrap = x0_ + xrec - k_ * yrec;
59  ytrap = y0_ + yrec;
60 
61 #ifdef DEBUG_GRID
62  std::cout << xrec << " " << yrec << " transformed to trapezoid " << xtrap << " " << ytrap << std::endl;
63 #endif
64  }

References gather_cfg::cout.

Referenced by TrapezoidalCylindricalMFGrid::fromGridFrame(), and TrapezoidalCartesianMFGrid::fromGridFrame().

Member Data Documentation

◆ k_

double Trapezoid2RectangleMappingX::k_
private

Definition at line 69 of file Trapezoid2RectangleMappingX.h.

◆ parallel_

bool Trapezoid2RectangleMappingX::parallel_
private

Definition at line 70 of file Trapezoid2RectangleMappingX.h.

◆ x0_

double Trapezoid2RectangleMappingX::x0_
private

Definition at line 67 of file Trapezoid2RectangleMappingX.h.

◆ y0_

double Trapezoid2RectangleMappingX::y0_
private

Definition at line 68 of file Trapezoid2RectangleMappingX.h.

gather_cfg.cout
cout
Definition: gather_cfg.py:144
h
dqmdumpme.k
k
Definition: dqmdumpme.py:60
Trapezoid2RectangleMappingX::parallel_
bool parallel_
Definition: Trapezoid2RectangleMappingX.h:70
Trapezoid2RectangleMappingX::k_
double k_
Definition: Trapezoid2RectangleMappingX.h:69
Trapezoid2RectangleMappingX::x0_
double x0_
Definition: Trapezoid2RectangleMappingX.h:67
Trapezoid2RectangleMappingX::y0_
double y0_
Definition: Trapezoid2RectangleMappingX.h:68