File indexing completed on 2024-04-06 12:14:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <Geometry/CSCGeometry/interface/OffsetRadialStripTopology.h>
0021 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0022
0023 #include <iostream>
0024 #include <cmath>
0025
0026 OffsetRadialStripTopology::OffsetRadialStripTopology(int numberOfStrips,
0027 float stripPhiPitch,
0028 float detectorHeight,
0029 float radialDistance,
0030 float stripOffset,
0031 float yCentre)
0032 : CSCRadialStripTopology(numberOfStrips, stripPhiPitch, detectorHeight, radialDistance, +1, yCentre),
0033 theStripOffset(stripOffset) {
0034 float rotate_by = stripOffset * angularWidth();
0035 theCosOff = cos(rotate_by);
0036 theSinOff = sin(rotate_by);
0037
0038 LogTrace("CSCStripTopology|CSC") << "fractional strip offset = " << stripOffset << "\n angle = " << rotate_by
0039 << " cos = " << theCosOff << " sin = " << theSinOff;
0040 }
0041
0042 LocalPoint OffsetRadialStripTopology::localPosition(const MeasurementPoint& mp) const {
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 float phi = phiOfOneEdge() + mp.x() * angularWidth();
0055
0056
0057
0058
0059
0060
0061
0062 float yprime = mp.y() * detHeight() + yCentreOfStripPlane();
0063 float xprime = (originToIntersection() + yprime) * tan(phi);
0064
0065 return toLocal(xprime, yprime);
0066 }
0067
0068 MeasurementPoint OffsetRadialStripTopology::measurementPosition(const LocalPoint& lp) const {
0069 LocalPoint lpp = this->toPrime(lp);
0070 return CSCRadialStripTopology::measurementPosition(lpp);
0071 }
0072
0073 float OffsetRadialStripTopology::strip(const LocalPoint& lp) const {
0074 LocalPoint pnt = toPrime(lp);
0075 float phi = atan2(pnt.x(), pnt.y() + originToIntersection());
0076 float fstrip = (phi - phiOfOneEdge()) / angularWidth();
0077 fstrip = (fstrip >= 0. ? fstrip : 0.);
0078 fstrip = (fstrip <= nstrips() ? fstrip : nstrips());
0079 return fstrip;
0080 }
0081
0082 float OffsetRadialStripTopology::stripAngle(float strip) const {
0083 return (phiOfOneEdge() + (strip + theStripOffset) * angularWidth());
0084 }
0085
0086 LocalPoint OffsetRadialStripTopology::toLocal(float xprime, float yprime) const {
0087 float x = theCosOff * xprime + theSinOff * yprime + originToIntersection() * theSinOff;
0088 float y = -theSinOff * xprime + theCosOff * yprime - originToIntersection() * (1. - theCosOff);
0089 return LocalPoint(x, y);
0090 }
0091
0092 LocalPoint OffsetRadialStripTopology::toPrime(const LocalPoint& lp) const {
0093 float xprime = theCosOff * lp.x() - theSinOff * lp.y() - originToIntersection() * theSinOff;
0094 float yprime = theSinOff * lp.x() + theCosOff * lp.y() - originToIntersection() * (1. - theCosOff);
0095 return LocalPoint(xprime, yprime);
0096 }
0097
0098 std::ostream& operator<<(std::ostream& os, const OffsetRadialStripTopology& orst) {
0099 os << "OffsetRadialStripTopology isa " << static_cast<const CSCRadialStripTopology&>(orst)
0100 << "fractional strip offset " << orst.stripOffset() << "\ncos(angular offset) " << orst.theCosOff
0101 << "\nsin(angular offset) " << orst.theSinOff << std::endl;
0102 return os;
0103 }