Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:53

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   // Return nearest wire number to input LocalPoint.
0023   // Beware this may not exist or be read out!
0024 
0025   // rotate point to an axis perp. to wires
0026   float yprime = lp.y() * cosWireAngle - lp.x() * sinWireAngle;
0027 
0028   // climb the ladder
0029   return 1 + nint((yprime - theWireOffset) / wireSpacing());
0030 }
0031 
0032 float CSCSlantedWireGeometry::yOfWire(float wire, float x) const {
0033   // Return local y of given wire, at given x
0034 
0035   // y in rotated frame with y axis perpendicular to wires...
0036   float yprime = theWireOffset + (wire - 1.) * wireSpacing();
0037   // then y in usual (unrotated!) local xy frame...
0038   return (yprime + x * sinWireAngle) / cosWireAngle;
0039 }