CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCRadialStripTopology.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 #include <algorithm>
6 
7 CSCRadialStripTopology::CSCRadialStripTopology(int ns, float aw, float dh, float r, float yAx, float yMid) :
8  theNumberOfStrips(ns), theAngularWidth(aw),
9  theDetHeight(dh), theCentreToIntersection(r),
10  theYAxisOrientation(yAx), yCentre( yMid) {
11  // Angular offset of extreme edge of detector, so that angle is
12  // zero for a strip lying along local y axis = long symmetry axis of plane of strips
14 
15  LogTrace("CSCRadialStripTopology") << "CSCRadialStripTopology: constructed with"
16  << " strips = " << ns
17  << " width = " << aw << " rad "
18  << " det_height = " << dh
19  << " ctoi = " << r
20  << " phi_edge = " << thePhiOfOneEdge << " rad "
21  << " y_ax_ori = " << theYAxisOrientation
22  << " y_det_centre = " << yCentre
23  << "\n";
24 }
25 
26 int CSCRadialStripTopology::channel(const LocalPoint& lp) const { return std::min( int( strip(lp) ), theNumberOfStrips-1 ) ;}
27 
28 int CSCRadialStripTopology::nearestStrip(const LocalPoint & lp) const { return std::min( nstrips(), static_cast<int>( std::max(float(0), strip(lp)) ) + 1);}
29 
30 float CSCRadialStripTopology::stripAngle(float strip) const { return phiOfOneEdge() + yAxisOrientation() * strip * angularWidth() ;}
31 
33 
35  return detHeight() * std::sqrt(1.f + std::pow( lp.x()/yDistanceToIntersection(lp.y()), 2.f) );
36 }
37 
38 float CSCRadialStripTopology::xOfStrip(int strip, float y) const {
39  return
40  yAxisOrientation() * yDistanceToIntersection( y ) * std::tan( stripAngle(static_cast<float>(strip) - 0.5 ) );
41 }
42 
43 float CSCRadialStripTopology::strip(const LocalPoint& lp) const {
44  const float // phi is measured from y axis --> sign of angle is sign of x * yAxisOrientation --> use atan2(x,y), not atan2(y,x)
45  phi( std::atan2( lp.x(), yDistanceToIntersection( lp.y() ) )),
46  aStrip( ( phi - yAxisOrientation() * phiOfOneEdge() )/angularWidth());
47  return std::max(float(0), std::min( (float)nstrips(), aStrip ));
48 }
49 
51  return LocalPoint( yAxisOrientation() * originToIntersection() * tan( stripAngle(strip) ), 0 );
52 }
53 
55  const float // y = (L/cos(phi))*mp.y()*cos(phi)
56  y( mp.y()*detHeight() + yCentreOfStripPlane() ),
58  return LocalPoint( x, y );
59 }
60 
62  const float // phi is [pi/2 - conventional local phi], use atan2(x,y) rather than atan2(y,x)
63  phi( yAxisOrientation() * std::atan2( lp.x(), yDistanceToIntersection( lp.y() ) ));
65  ( lp.y() - yCentreOfStripPlane() ) / detHeight() );
66 }
67 
68 LocalError CSCRadialStripTopology::localError(float strip, float stripErr2) const {
69  const double
70  phi(stripAngle(strip)), t1(std::tan(phi)), t2(t1*t1),
71  // s1(std::sin(phi)), c1(std::cos(phi)),
72  // cs(s1*c1), s2(s1*s1), c2(1-s2), // rotation matrix
73 
74  tt( stripErr2 * std::pow( centreToIntersection()*angularWidth() ,2.f) ), // tangential sigma^2 *c2
75  rr( std::pow(detHeight(), 2.f) * (1.f/12.f) ), // radial sigma^2( uniform prob density along strip) *c2
76 
77  xx( tt + t2*rr ),
78  yy( t2*tt + rr ),
79  xy( t1*( rr - tt ) );
80 
81  return LocalError( xx, xy, yy );
82 }
83 
85  const double
86  phi(stripAngle(mp.x())), s1(std::sin(phi)), c1(std::cos(phi)),
87  cs(s1*c1), s2(s1*s1), c2(1-s2), // rotation matrix
88 
89  T( angularWidth() * ( centreToIntersection() + yAxisOrientation()*mp.y()*detHeight()) / c1 ), // tangential measurement unit (local pitch)
90  R( detHeight()/ c1 ), // radial measurement unit (strip length)
91  tt( me.uu() * T*T ), // tangential sigma^2
92  rr( me.vv() * R*R ), // radial sigma^2
93  tr( me.uv() * T*R ),
94 
95  xx( c2*tt + 2*cs*tr + s2*rr ),
96  yy( s2*tt - 2*cs*tr + c2*rr ),
97  xy( cs*( rr - tt ) + tr*( c2 - s2 ) );
98 
99  return LocalError( xx, xy, yy );
100 }
101 
103  const double
104  yHitToInter(yDistanceToIntersection(p.y())),
105  t(yAxisOrientation() * p.x() / yHitToInter), // tan(strip angle)
106  cs(t/(1+t*t)), s2(t*cs), c2(1-s2), // rotation matrix
107 
108  T2( 1./(std::pow(angularWidth(),2.f) * ( std::pow(p.x(),2.f) + std::pow(yHitToInter,2)) )), // 1./tangential measurement unit (local pitch) ^2
109  R2( c2/std::pow(detHeight(),2.f) ), // 1./ radial measurement unit (strip length) ^2
110 
111  uu( ( c2*e.xx() - 2*cs*e.xy() + s2*e.yy() ) * T2 ),
112  vv( ( s2*e.xx() + 2*cs*e.xy() + c2*e.yy() ) * R2 ),
113  uv( ( cs*( e.xx() - e.yy() ) + e.xy()*( c2 - s2 ) ) * std::sqrt (T2*R2) );
114 
115  return MeasurementError(uu, uv, vv);
116 }
117 
118 
120  // The local pitch is the local x width of the strip at the local (x,y)
121  const int istrip = std::min(nstrips(), static_cast<int>(strip(lp)) + 1); // which strip number
122  const float fangle = stripAngle(static_cast<float>(istrip) - 0.5); // angle of strip centre
123  return
125  std::pow( std::cos(fangle-0.5f*angularWidth()), 2.f);
126 }
float xx() const
Definition: LocalError.h:24
float vv() const
auto_ptr< ClusterSequence > cs
T y() const
Definition: PV2DBase.h:46
virtual int nstrips() const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
virtual int channel(const LocalPoint &) const
T y() const
Definition: PV3DBase.h:63
virtual float localPitch(const LocalPoint &) const
virtual float strip(const LocalPoint &) const
tuple s2
Definition: indexGen.py:106
float xy() const
Definition: LocalError.h:25
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
CSCRadialStripTopology(int ns, float aw, float dh, float r, float yAx=1.f, float yMid=0.)
float yy() const
Definition: LocalError.h:26
const T & max(const T &a, const T &b)
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:18
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float xOfStrip(int strip, float y) const
float uu() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
virtual float localStripLength(const LocalPoint &) const
double f[11][100]
virtual LocalPoint localPosition(float strip) const
#define LogTrace(id)
float yDistanceToIntersection(float y) const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const
virtual LocalError localError(float strip, float stripErr2) const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
Definition: DDAxes.h:10
virtual float stripAngle(float strip) const
T x() const
Definition: PV2DBase.h:45
long double T
T x() const
Definition: PV3DBase.h:62
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
virtual int nearestStrip(const LocalPoint &) const
tuple dh
Definition: cuy.py:353
float uv() const
Definition: DDAxes.h:10