CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/Geometry/CSCGeometry/src/CSCSlantedWireGeometry.cc

Go to the documentation of this file.
00001 #include <Geometry/CSCGeometry/src/CSCSlantedWireGeometry.h>
00002 #include <Geometry/CSCGeometry/interface/nint.h>
00003 
00004 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00005 
00006 #include <cmath>
00007 
00008 CSCSlantedWireGeometry::CSCSlantedWireGeometry( double wireSpacing,
00009              double yOfFirstWire, double narrow, double wide, double length, float wireAngle ) :
00010   CSCWireGeometry( wireSpacing, yOfFirstWire, narrow, wide, length ), theWireAngle( wireAngle ){
00011     cosWireAngle = cos( wireAngle );
00012     sinWireAngle = sin( wireAngle );
00013     theWireOffset = yOfFirstWire * cosWireAngle; 
00014     LogTrace("CSCWireGeometry|CSC") <<
00015       "CSCSlantedWireGeometry: constructed:\n" <<
00016       " wireSpacing = " << wireSpacing << 
00017       ", y1 = " << yOfFirstWire << 
00018       ", narrow_width = " << narrow << 
00019       ", wide_width = " << wide << 
00020       ", length = " << length << 
00021       ", wireAngle = " << wireAngle << 
00022       ", theWireOffset = " << theWireOffset;
00023 }
00024 
00025 int CSCSlantedWireGeometry::nearestWire(const LocalPoint& lp) const {
00026   // Return nearest wire number to input LocalPoint.
00027   // Beware this may not exist or be read out!
00028 
00029   // rotate point to an axis perp. to wires
00030   float yprime = lp.y() * cosWireAngle - lp.x() * sinWireAngle;
00031 
00032   // climb the ladder
00033   return 1 + nint( (yprime - theWireOffset) / wireSpacing() );
00034 } 
00035 
00036 
00037 float CSCSlantedWireGeometry::yOfWire(float wire, float x) const {
00038   // Return local y of given wire, at given x
00039 
00040   // y in rotated frame with y axis perpendicular to wires...
00041   float yprime = theWireOffset + (wire-1.) * wireSpacing();
00042   // then y in usual (unrotated!) local xy frame...
00043   return ( yprime + x*sinWireAngle )/cosWireAngle;
00044 }