CMS 3D CMS Logo

RectangularMTDTopology.cc
Go to the documentation of this file.
2 
3 //--------------------------------------------------------------------
4 // PixelTopology interface.
5 // Transform LocalPoint in cm to measurement in pitch units.
6 std::pair<float, float> RectangularMTDTopology::pixel(const LocalPoint& p) const {
7  // check limits
8  float py = p.y();
9  float px = p.x();
10 
11  // In Y
12  float newybin = (py - m_yoffset) / m_pitchy;
13  // In X
14  float newxbin = (px - m_xoffset) / m_pitchx;
15 
16  return std::pair<float, float>(newxbin, newybin);
17 }
18 
19 //The following lines check whether the point is actually out of the active pixel area.
21  bool isInside = true;
22  const auto& thepixel = pixel(p);
23  const int ixbin = static_cast<int>(thepixel.first);
24  const int iybin = static_cast<int>(thepixel.second);
25  const float fractionX = thepixel.first - ixbin;
26  const float fractionY = thepixel.second - iybin;
27  if ((fractionX > 1.0 - m_GAPxInterpadFrac || fractionX < m_GAPxInterpadFrac) ||
28  (ixbin == 0 && fractionX < m_GAPxBorderFrac) || (ixbin == m_nrows - 1 && fractionX > 1.0 - m_GAPxBorderFrac)) {
29  isInside = false;
30  }
31  if ((fractionY > 1.0 - m_GAPyInterpadFrac || fractionY < m_GAPyInterpadFrac) ||
32  (iybin == 0 && fractionY < m_GAPyBorderFrac) || (iybin == m_ncols - 1 && fractionY > 1.0 - m_GAPyBorderFrac)) {
33  isInside = false;
34  }
35  return isInside;
36 }
37 
38 //----------------------------------------------------------------------
39 // Topology interface, go from Measurement to Local corrdinates
40 // pixel coordinates (mp) -> cm (LocalPoint)
42  float mpy = mp.y(); // measurements
43  float mpx = mp.x();
44 
45  float lpY = localY(mpy);
46  float lpX = localX(mpx);
47 
48  // Return it as a LocalPoint
49  return LocalPoint(lpX, lpY);
50 }
51 
52 //--------------------------------------------------------------------
53 //
54 // measuremet to local transformation for X coordinate
55 float RectangularMTDTopology::localX(const float mpx) const {
56  // The final position in local coordinates
57  float lpX = mpx * m_pitchx + m_xoffset;
58 
59  return lpX;
60 }
61 
62 float RectangularMTDTopology::localY(const float mpy) const {
63  // The final position in local coordinates
64  float lpY = mpy * m_pitchy + m_yoffset;
65 
66  return lpY;
67 }
68 
70 // Get hit errors in LocalPoint coordinates (cm)
72  return LocalError(me.uu() * float(m_pitchx * m_pitchx), 0, me.vv() * float(m_pitchy * m_pitchy));
73 }
74 
76 // Get errors in pixel pitch units.
78  return MeasurementError(le.xx() / float(m_pitchx * m_pitchx), 0, le.yy() / float(m_pitchy * m_pitchy));
79 }
bool isInPixel(const LocalPoint &p) const
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
T x() const
Definition: PV2DBase.h:43
T y() const
Definition: PV2DBase.h:44
float yy() const
Definition: LocalError.h:24
std::pair< float, float > pixel(const LocalPoint &p) const override
float localX(const float mpX) const override
float localY(const float mpY) const override
LocalPoint localPosition(const MeasurementPoint &mp) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
float xx() const
Definition: LocalError.h:22