CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  int numberOfStrips, float stripPhiPitch,
28  float detectorHeight, float radialDistance,
29  float stripOffset, float yCentre ) :
30  CSCRadialStripTopology( numberOfStrips, stripPhiPitch, detectorHeight, radialDistance, +1, yCentre),
31  theStripOffset( stripOffset )
32 {
33  float rotate_by = stripOffset * angularWidth(); // now in angular units (radians, I hope)
34  theCosOff = cos(rotate_by);
35  theSinOff = sin(rotate_by);
36 
37  LogTrace("CSCStripTopology|CSC") << "fractional strip offset = " << stripOffset <<
38  "\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 
82 float OffsetRadialStripTopology::stripAngle(float strip) const {
83  return ( phiOfOneEdge() + (strip+theStripOffset)*angularWidth() );
84 }
85 
86 LocalPoint OffsetRadialStripTopology::toLocal(float xprime, float yprime) const {
87  float x = theCosOff * xprime + theSinOff * yprime
89  float y = -theSinOff * xprime + theCosOff * yprime
90  - originToIntersection() * (1. - theCosOff);
91  return LocalPoint(x, y);
92 }
93 
95  float xprime = theCosOff * lp.x() - theSinOff * lp.y()
97  float yprime = theSinOff * lp.x() + theCosOff * lp.y()
98  - originToIntersection() * (1. - theCosOff);
99  return LocalPoint(xprime, yprime);
100 }
101 
102 std::ostream & operator<<(std::ostream & os, const OffsetRadialStripTopology & orst)
103 {
104  os << "OffsetRadialStripTopology isa "
105  << static_cast<const CSCRadialStripTopology&>( orst )
106  << "fractional strip offset " << orst.stripOffset()
107  << "\ncos(angular offset) " << orst.theCosOff
108  << "\nsin(angular offset) " << orst.theSinOff << std::endl;
109  return os;
110 }
111 
LocalPoint toLocal(float xprime, float yprime) const
T y() const
Definition: PV2DBase.h:46
virtual int nstrips() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:63
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
virtual LocalPoint localPosition(float strip) const
LocalPoint toPrime(const LocalPoint &) const
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
OffsetRadialStripTopology(int numberOfStrips, float stripPhiPitch, float detectorHeight, float radialDistance, float stripOffset, float yCentre)
#define LogTrace(id)
virtual float stripOffset(void) const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
float stripAngle(float strip) const
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62
virtual float strip(const LocalPoint &) const