CMS 3D CMS Logo

OffsetRadialStripTopology.cc
Go to the documentation of this file.
1 // This is OffsetRadialStripTopology.cc
2 
3 // Implementation and use of base class RST depends crucially on stripAngle() being defined
4 // to include the angular strip offset relative to the local coordinate frame, while
5 // phiOfOneEdge() remains unchanged from its RST interpretation (i.e. phiOfOneEdge remains
6 // measured relative to the symmetry axis of the strip plane even in the OffsetRST case.)
7 // To help understand the implementation below I use the notation 'prime' for the local
8 // coordinate system rotated from the true local coordinate system by the angular offset
9 // of the offset RST. Thus the 'prime' system is aligned with the symmetry axes of the
10 // strip plane of the ORST.
11 // The following functions in the base class RST work fine for the ORST too since
12 // they're implemented in terms of stripAngle() and this is overridden for the ORST
13 // so that the angular offset is included:
14 // xOfStrip(.)
15 // localPitch(.)
16 // localError(.,.)
17 // localError(.,.)
18 // measurementError(.,.)
19 
22 
23 #include <iostream>
24 #include <cmath>
25 
27  float stripPhiPitch,
28  float detectorHeight,
29  float radialDistance,
30  float stripOffset,
31  float yCentre)
32  : CSCRadialStripTopology(numberOfStrips, stripPhiPitch, detectorHeight, radialDistance, +1, yCentre),
33  theStripOffset(stripOffset) {
34  float rotate_by = stripOffset * angularWidth(); // now in angular units (radians, I hope)
35  theCosOff = cos(rotate_by);
36  theSinOff = sin(rotate_by);
37 
38  LogTrace("CSCStripTopology|CSC") << "fractional strip offset = " << stripOffset << "\n angle = " << rotate_by
39  << " cos = " << theCosOff << " sin = " << theSinOff;
40 }
41 
43  // Local coordinates are (x,y). Coordinates along symmetry axes of strip
44  // plane are (x',y'). These are rotated w.r.t. (x,y)
45 
46  // You might first think you could implement this as follows (cf. measurementPosition below):
47  // LocalPoint lpp = RST::localPosition(MP);
48  // return this->toLocal(lpp);
49  // But this does not work because RST::localPosition makes use of stripAngle() - virtual - and thus
50  // this is not the appropriate angle - it has the offset added, which is unwanted in this case!
51  // So have to implement it directly...
52 
53  // 1st component of MP measures angular position within strip plane
54  float phi = phiOfOneEdge() + mp.x() * angularWidth();
55  // 2nd component of MP is fractional position along strip, with range +/-0.5,
56  // so distance along strip, measured from mid-point of length of strip, is
57  // mp.y() * (length of strip).
58  // Distance in direction of coordinate y' is
59  // mp.y() * (length of strip) * cos(phi)
60  // where phi is angle between strip and y' axis.
61  // But (length of strip) = detHeight/cos(phi), so
62  float yprime = mp.y() * detHeight() + yCentreOfStripPlane();
63  float xprime = (originToIntersection() + yprime) * tan(phi);
64  // Rotate to (x,y)
65  return toLocal(xprime, yprime);
66 }
67 
69  LocalPoint lpp = this->toPrime(lp); // in prime system, aligned with strip plane sym axes
70  return CSCRadialStripTopology::measurementPosition(lpp); // now can use the base class method
71 }
72 
74  LocalPoint pnt = toPrime(lp);
75  float phi = atan2(pnt.x(), pnt.y() + originToIntersection());
76  float fstrip = (phi - phiOfOneEdge()) / angularWidth();
77  fstrip = (fstrip >= 0. ? fstrip : 0.);
78  fstrip = (fstrip <= nstrips() ? fstrip : nstrips());
79  return fstrip;
80 }
81 
83  return (phiOfOneEdge() + (strip + theStripOffset) * angularWidth());
84 }
85 
86 LocalPoint OffsetRadialStripTopology::toLocal(float xprime, float yprime) const {
87  float x = theCosOff * xprime + theSinOff * yprime + originToIntersection() * theSinOff;
88  float y = -theSinOff * xprime + theCosOff * yprime - originToIntersection() * (1. - theCosOff);
89  return LocalPoint(x, y);
90 }
91 
93  float xprime = theCosOff * lp.x() - theSinOff * lp.y() - originToIntersection() * theSinOff;
94  float yprime = theSinOff * lp.x() + theCosOff * lp.y() - originToIntersection() * (1. - theCosOff);
95  return LocalPoint(xprime, yprime);
96 }
97 
98 std::ostream& operator<<(std::ostream& os, const OffsetRadialStripTopology& orst) {
99  os << "OffsetRadialStripTopology isa " << static_cast<const CSCRadialStripTopology&>(orst)
100  << "fractional strip offset " << orst.stripOffset() << "\ncos(angular offset) " << orst.theCosOff
101  << "\nsin(angular offset) " << orst.theSinOff << std::endl;
102  return os;
103 }
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
float phiOfOneEdge() const override
T x() const
Definition: PV2DBase.h:43
float strip(const LocalPoint &) const override
LocalPoint toPrime(const LocalPoint &) const
#define LogTrace(id)
T y() const
Definition: PV2DBase.h:44
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
float detHeight() const override
std::ostream & operator<<(std::ostream &os, const OffsetRadialStripTopology &orst)
virtual float stripOffset(void) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
float angularWidth() const override
MeasurementPoint measurementPosition(const LocalPoint &) const override
OffsetRadialStripTopology(int numberOfStrips, float stripPhiPitch, float detectorHeight, float radialDistance, float stripOffset, float yCentre)
MeasurementPoint measurementPosition(const LocalPoint &) const override
LocalPoint localPosition(float strip) const override
float originToIntersection() const override
float yCentreOfStripPlane() const override
LocalPoint toLocal(float xprime, float yprime) const
int nstrips() const override
float stripAngle(float strip) const override
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648