File indexing completed on 2024-04-06 12:14:24
0001 #include <Geometry/CSCGeometry/src/CSCSlantedWireGeometry.h>
0002 #include <Geometry/CSCGeometry/interface/nint.h>
0003
0004 #include <FWCore/MessageLogger/interface/MessageLogger.h>
0005
0006 #include <cmath>
0007
0008 CSCSlantedWireGeometry::CSCSlantedWireGeometry(
0009 double wireSpacing, double yOfFirstWire, double narrow, double wide, double length, float wireAngle)
0010 : CSCWireGeometry(wireSpacing, yOfFirstWire, narrow, wide, length), theWireAngle(wireAngle) {
0011 cosWireAngle = cos(wireAngle);
0012 sinWireAngle = sin(wireAngle);
0013 theWireOffset = yOfFirstWire * cosWireAngle;
0014 LogTrace("CSCWireGeometry|CSC") << "CSCSlantedWireGeometry: constructed:\n"
0015 << " wireSpacing = " << wireSpacing << ", y1 = " << yOfFirstWire
0016 << ", narrow_width = " << narrow << ", wide_width = " << wide
0017 << ", length = " << length << ", wireAngle = " << wireAngle
0018 << ", theWireOffset = " << theWireOffset;
0019 }
0020
0021 int CSCSlantedWireGeometry::nearestWire(const LocalPoint& lp) const {
0022
0023
0024
0025
0026 float yprime = lp.y() * cosWireAngle - lp.x() * sinWireAngle;
0027
0028
0029 return 1 + nint((yprime - theWireOffset) / wireSpacing());
0030 }
0031
0032 float CSCSlantedWireGeometry::yOfWire(float wire, float x) const {
0033
0034
0035
0036 float yprime = theWireOffset + (wire - 1.) * wireSpacing();
0037
0038 return (yprime + x * sinWireAngle) / cosWireAngle;
0039 }