CMS 3D CMS Logo

GEMStripTopology.cc
Go to the documentation of this file.
1 
7 #include <iostream>
8 #include <cmath>
9 #include <algorithm>
10 
11 GEMStripTopology::GEMStripTopology(int ns, float aw, float dh, float r0)
12  : numberOfStrips_(ns), angularWidth_(aw), detHeight_(dh), centreToIntersection_(r0) {
13  assert(angularWidth_ != 0);
14  assert(detHeight_ != 0);
17  yCentre_ = 0;
18  LogTrace("GEMStripTopology") << "Constructing GEMStripTopology with"
19  << " nstrips = " << ns << " angular width = " << aw << " det. height = " << dh
20  << " r0 = " << r0 << "\n";
21 }
22 
23 GEMStripTopology::GEMStripTopology(int ns, float aw, float dh, float r0, float yAx)
24  : numberOfStrips_(ns), angularWidth_(aw), detHeight_(dh), centreToIntersection_(r0), yAxisOrientation_(yAx) {
25  assert(angularWidth_ != 0);
26  assert(detHeight_ != 0);
28  yCentre_ = 0;
29  LogTrace("GEMStripTopology") << "Constructing GEMStripTopology with"
30  << " nstrips = " << ns << " angular width = " << aw << " det. height = " << dh
31  << " r0 = " << r0 << " yAxOrientation = " << yAx << "\n";
32 }
33 
36 }
37 
39  const float // y = (L/cos(phi))*mp.y()*cos(phi)
40  y(mp.y() * detHeight() + yCentreOfStripPlane()),
42  return LocalPoint(x, y);
43 }
44 
45 LocalError GEMStripTopology::localError(float strip, float stripErr2) const {
46  const double phi(stripAngle(strip)), t1(std::tan(phi)), t2(t1 * t1),
47  tt(stripErr2 * std::pow(centreToIntersection() * angularWidth(), 2)), // tangential sigma^2 *c2
48  rr(std::pow(detHeight(), 2) * (1.f / 12.f)), // radial sigma^2( uniform prob density along strip) *c2
49 
50  xx(tt + t2 * rr), yy(t2 * tt + rr), xy(t1 * (rr - tt));
51 
52  return LocalError(xx, xy, yy);
53 }
54 
56  const double phi(stripAngle(mp.x())), s1(std::sin(phi)), c1(std::cos(phi));
57  assert(c1 != 0);
58  const double cs(s1 * c1), s2(s1 * s1),
59  c2(1 - s2), // rotation matrix
60 
62  c1), // tangential measurement unit (local pitch)
63  R(detHeight() / c1), // radial measurement unit (strip length)
64  tt(me.uu() * T * T), // tangential sigma^2
65  rr(me.vv() * R * R), // radial sigma^2
66  tr(me.uv() * T * R),
67 
68  xx(c2 * tt + 2 * cs * tr + s2 * rr), yy(s2 * tt - 2 * cs * tr + c2 * rr), xy(cs * (rr - tt) + tr * (c2 - s2));
69 
70  return LocalError(xx, xy, yy);
71 }
72 
73 float GEMStripTopology::strip(const LocalPoint& lp) const {
74  const float // phi is measured from y axis --> sign of angle is sign of x * yAxisOrientation --> use atan2(x,y), not atan2(y,x)
75  phi(std::atan2(lp.x(), yDistanceToIntersection(lp.y()))),
76  aStrip((phi - yAxisOrientation() * phiOfOneEdge()) / angularWidth());
77  return std::max(float(0), std::min((float)nstrips(), aStrip));
78 }
79 
81  return std::min(nstrips(), static_cast<int>(std::max(float(0), strip(lp))) + 1);
82 }
83 
85  const float // phi is [pi/2 - conventional local phi], use atan2(x,y) rather than atan2(y,x)
86  phi(yAxisOrientation() * std::atan2(lp.x(), yDistanceToIntersection(lp.y())));
88  (lp.y() - yCentreOfStripPlane()) / detHeight());
89 }
90 
92  const double yHitToInter(yDistanceToIntersection(p.y()));
93  assert(yHitToInter != 0);
94  const double t(yAxisOrientation() * p.x() / yHitToInter), // tan(strip angle)
95  cs(t / (1 + t * t)), s2(t * cs), c2(1 - s2), // rotation matrix
96 
97  T2(1. / (std::pow(angularWidth(), 2) *
98  (std::pow(p.x(), 2) + std::pow(yHitToInter, 2)))), // 1./tangential measurement unit (local pitch) ^2
99  R2(c2 / std::pow(detHeight(), 2)), // 1./ radial measurement unit (strip length) ^2
100 
101  uu((c2 * e.xx() - 2 * cs * e.xy() + s2 * e.yy()) * T2), vv((s2 * e.xx() + 2 * cs * e.xy() + c2 * e.yy()) * R2),
102  uv((cs * (e.xx() - e.yy()) + e.xy() * (c2 - s2)) * std::sqrt(T2 * R2));
103 
104  return MeasurementError(uu, uv, vv);
105 }
106 
107 int GEMStripTopology::channel(const LocalPoint& lp) const { return std::min(int(strip(lp)), numberOfStrips_ - 1); }
108 
109 float GEMStripTopology::pitch() const { return localPitch(LocalPoint(0, 0)); }
110 
111 float GEMStripTopology::localPitch(const LocalPoint& lp) const {
112  const int istrip = std::min(nstrips(), static_cast<int>(strip(lp)) + 1); // which strip number
113  const float fangle = stripAngle(static_cast<float>(istrip) - 0.5); // angle of strip centre
114  assert(std::cos(fangle - 0.5f * angularWidth()) != 0);
115  return yDistanceToIntersection(lp.y()) * std::sin(angularWidth()) /
116  std::pow(std::cos(fangle - 0.5f * angularWidth()), 2);
117 }
118 
120  return phiOfOneEdge() + yAxisOrientation() * strip * angularWidth();
121 }
122 
124  assert(yDistanceToIntersection(lp.y()) != 0);
125  return detHeight() * std::sqrt(1.f + std::pow(lp.x() / yDistanceToIntersection(lp.y()), 2));
126 }
127 
129  return yAxisOrientation() * y + originToIntersection();
130 }
131 
132 float GEMStripTopology::xOfStrip(int strip, float y) const {
133  return yAxisOrientation() * yDistanceToIntersection(y) * std::tan(stripAngle(static_cast<float>(strip) - 0.5));
134 }
float centreToIntersection() const
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
float strip(const LocalPoint &) const override
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
int nstrips() const override
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float yDistanceToIntersection(float y) const
int channel(const LocalPoint &) const override
T x() const
Definition: PV2DBase.h:43
assert(be >=bs)
#define LogTrace(id)
T y() const
Definition: PV2DBase.h:44
int nearestStrip(const LocalPoint &) const
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
float angularWidth() const
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float localPitch(const LocalPoint &) const override
float phiOfOneEdge() const
double f[11][100]
GEMStripTopology(int ns, float aw, float dh, float r0)
float stripAngle(float strip) const override
float yAxisOrientation() const
float localStripLength(const LocalPoint &) const override
float yCentreOfStripPlane() const
MeasurementPoint measurementPosition(const LocalPoint &) const override
float xOfStrip(int strip, float y) const
LocalPoint localPosition(float strip) const override
LocalError localError(float strip, float stripErr2) const override
float detHeight() const
dh
Definition: cuy.py:354
long double T
float originToIntersection() const
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
float pitch() const override