CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCRadialStripTopology.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <algorithm>
6 
7 CSCRadialStripTopology::CSCRadialStripTopology(int ns, float aw, float dh, float r, float yAx, float yMid)
8  : theNumberOfStrips(ns),
9  theAngularWidth(aw),
10  theDetHeight(dh),
11  theCentreToIntersection(r),
12  theYAxisOrientation(yAx),
13  yCentre(yMid) {
14  // Angular offset of extreme edge of detector, so that angle is
15  // zero for a strip lying along local y axis = long symmetry axis of plane of strips
17 
18  LogTrace("CSCRadialStripTopology") << "CSCRadialStripTopology: constructed with"
19  << " strips = " << ns << " width = " << aw << " rad "
20  << " det_height = " << dh << " ctoi = " << r << " phi_edge = " << thePhiOfOneEdge
21  << " rad "
22  << " y_ax_ori = " << theYAxisOrientation << " y_det_centre = " << yCentre << "\n";
23 }
24 
26  return std::min(int(strip(lp)), theNumberOfStrips - 1);
27 }
28 
30  return std::min(nstrips(), static_cast<int>(std::max(float(0), strip(lp))) + 1);
31 }
32 
34  return phiOfOneEdge() + yAxisOrientation() * strip * angularWidth();
35 }
36 
38  return yAxisOrientation() * y + originToIntersection();
39 }
40 
42  return detHeight() * std::sqrt(1.f + std::pow(lp.x() / yDistanceToIntersection(lp.y()), 2.f));
43 }
44 
45 float CSCRadialStripTopology::xOfStrip(int strip, float y) const {
46  return yAxisOrientation() * yDistanceToIntersection(y) * std::tan(stripAngle(static_cast<float>(strip) - 0.5));
47 }
48 
49 float CSCRadialStripTopology::strip(const LocalPoint& lp) const {
50  const float // phi is measured from y axis --> sign of angle is sign of x * yAxisOrientation --> use atan2(x,y), not atan2(y,x)
51  phi(std::atan2(lp.x(), yDistanceToIntersection(lp.y()))),
52  aStrip((phi - yAxisOrientation() * phiOfOneEdge()) / angularWidth());
53  return std::max(float(0), std::min((float)nstrips(), aStrip));
54 }
55 
58 }
59 
61  const float // y = (L/cos(phi))*mp.y()*cos(phi)
62  y(mp.y() * detHeight() + yCentreOfStripPlane()),
64  return LocalPoint(x, y);
65 }
66 
68  const float // phi is [pi/2 - conventional local phi], use atan2(x,y) rather than atan2(y,x)
69  phi(yAxisOrientation() * std::atan2(lp.x(), yDistanceToIntersection(lp.y())));
71  (lp.y() - yCentreOfStripPlane()) / detHeight());
72 }
73 
74 LocalError CSCRadialStripTopology::localError(float strip, float stripErr2) const {
75  const double phi(stripAngle(strip)), t1(std::tan(phi)), t2(t1 * t1),
76  // s1(std::sin(phi)), c1(std::cos(phi)),
77  // cs(s1*c1), s2(s1*s1), c2(1-s2), // rotation matrix
78 
79  tt(stripErr2 * std::pow(centreToIntersection() * angularWidth(), 2.f)), // tangential sigma^2 *c2
80  rr(std::pow(detHeight(), 2.f) * (1.f / 12.f)), // radial sigma^2( uniform prob density along strip) *c2
81 
82  xx(tt + t2 * rr), yy(t2 * tt + rr), xy(t1 * (rr - tt));
83 
84  return LocalError(xx, xy, yy);
85 }
86 
88  const double phi(stripAngle(mp.x())), s1(std::sin(phi)), c1(std::cos(phi)), cs(s1 * c1), s2(s1 * s1),
89  c2(1 - s2), // rotation matrix
90 
92  c1), // tangential measurement unit (local pitch)
93  R(detHeight() / c1), // radial measurement unit (strip length)
94  tt(me.uu() * T * T), // tangential sigma^2
95  rr(me.vv() * R * R), // radial sigma^2
96  tr(me.uv() * T * R),
97 
98  xx(c2 * tt + 2 * cs * tr + s2 * rr), yy(s2 * tt - 2 * cs * tr + c2 * rr), xy(cs * (rr - tt) + tr * (c2 - s2));
99 
100  return LocalError(xx, xy, yy);
101 }
102 
104  const double yHitToInter(yDistanceToIntersection(p.y())),
105  t(yAxisOrientation() * p.x() / yHitToInter), // tan(strip angle)
106  cs(t / (1 + t * t)), s2(t * cs), c2(1 - s2), // rotation matrix
107 
108  T2(1. / (std::pow(angularWidth(), 2.f) *
109  (std::pow(p.x(), 2.f) + std::pow(yHitToInter, 2)))), // 1./tangential measurement unit (local pitch) ^2
110  R2(c2 / std::pow(detHeight(), 2.f)), // 1./ radial measurement unit (strip length) ^2
111 
112  uu((c2 * e.xx() - 2 * cs * e.xy() + s2 * e.yy()) * T2), vv((s2 * e.xx() + 2 * cs * e.xy() + c2 * e.yy()) * R2),
113  uv((cs * (e.xx() - e.yy()) + e.xy() * (c2 - s2)) * std::sqrt(T2 * R2));
114 
115  return MeasurementError(uu, uv, vv);
116 }
117 
119  // The local pitch is the local x width of the strip at the local (x,y)
120  const int istrip = std::min(nstrips(), static_cast<int>(strip(lp)) + 1); // which strip number
121  const float fangle = stripAngle(static_cast<float>(istrip) - 0.5); // angle of strip centre
122  return yDistanceToIntersection(lp.y()) * std::sin(angularWidth()) /
123  std::pow(std::cos(fangle - 0.5f * angularWidth()), 2.f);
124 }
float centreToIntersection() const override
float xx() const
Definition: LocalError.h:22
int nearestStrip(const LocalPoint &) const override
float vv() const
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
T y() const
Definition: PV2DBase.h:44
unique_ptr< ClusterSequence > cs
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float phiOfOneEdge() const override
float strip(const LocalPoint &) const override
T y() const
Definition: PV3DBase.h:60
LocalPoint localPosition(float strip) const override
#define LogTrace(id)
float yAxisOrientation() const override
float xy() const
Definition: LocalError.h:23
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
float detHeight() const override
CSCRadialStripTopology(int ns, float aw, float dh, float r, float yAx=1.f, float yMid=0.)
float yy() const
Definition: LocalError.h:24
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float uu() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float angularWidth() const override
MeasurementPoint measurementPosition(const LocalPoint &) const override
float stripAngle(float strip) const override
int channel(const LocalPoint &) const override
float originToIntersection() const override
Basic2DVector< T > xy() const
float yCentreOfStripPlane() const override
float xOfStrip(int strip, float y) const override
LocalError localError(float strip, float stripErr2) const override
float yDistanceToIntersection(float y) const override
T x() const
Definition: PV2DBase.h:43
long double T
T x() const
Definition: PV3DBase.h:59
int nstrips() const override
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
tuple dh
Definition: cuy.py:354
float localPitch(const LocalPoint &) const override
float uv() const
float localStripLength(const LocalPoint &) const override