CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCSlantedWireGeometry.cc
Go to the documentation of this file.
3 
5 
6 #include <cmath>
7 
9  double wireSpacing, double yOfFirstWire, double narrow, double wide, double length, float wireAngle)
10  : CSCWireGeometry(wireSpacing, yOfFirstWire, narrow, wide, length), theWireAngle(wireAngle) {
11  cosWireAngle = cos(wireAngle);
12  sinWireAngle = sin(wireAngle);
13  theWireOffset = yOfFirstWire * cosWireAngle;
14  LogTrace("CSCWireGeometry|CSC") << "CSCSlantedWireGeometry: constructed:\n"
15  << " wireSpacing = " << wireSpacing << ", y1 = " << yOfFirstWire
16  << ", narrow_width = " << narrow << ", wide_width = " << wide
17  << ", length = " << length << ", wireAngle = " << wireAngle
18  << ", theWireOffset = " << theWireOffset;
19 }
20 
22  // Return nearest wire number to input LocalPoint.
23  // Beware this may not exist or be read out!
24 
25  // rotate point to an axis perp. to wires
26  float yprime = lp.y() * cosWireAngle - lp.x() * sinWireAngle;
27 
28  // climb the ladder
29  return 1 + nint((yprime - theWireOffset) / wireSpacing());
30 }
31 
32 float CSCSlantedWireGeometry::yOfWire(float wire, float x) const {
33  // Return local y of given wire, at given x
34 
35  // y in rotated frame with y axis perpendicular to wires...
36  float yprime = theWireOffset + (wire - 1.) * wireSpacing();
37  // then y in usual (unrotated!) local xy frame...
38  return (yprime + x * sinWireAngle) / cosWireAngle;
39 }
int nearestWire(const LocalPoint &lp) const override
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T y() const
Definition: PV3DBase.h:60
#define LogTrace(id)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double wireSpacing() const
int nint(float a)
Return the nearest integer - analogous to the FORTRAN intrinsic NINT.
Definition: nint.h:8
float yOfWire(float wire, float x=0.) const override
float x
T x() const
Definition: PV3DBase.h:59
CSCSlantedWireGeometry(double wireSpacing, double yOfFirstWire, double narrow, double wide, double length, float wireAngle)