test
CMS 3D CMS Logo

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