00001 #include <Geometry/CommonTopologies/interface/CSCRadialStripTopology.h>
00002 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00003
00004 #include <cmath>
00005 #include <algorithm>
00006
00007 CSCRadialStripTopology::CSCRadialStripTopology(int ns, float aw, float dh, float r, float yAx, float yMid) :
00008 theNumberOfStrips(ns), theAngularWidth(aw),
00009 theDetHeight(dh), theCentreToIntersection(r),
00010 theYAxisOrientation(yAx), yCentre( yMid) {
00011
00012
00013 thePhiOfOneEdge = -(0.5*theNumberOfStrips) * theAngularWidth * yAx;
00014
00015 LogTrace("CSCRadialStripTopology") << "CSCRadialStripTopology: constructed with"
00016 << " strips = " << ns
00017 << " width = " << aw << " rad "
00018 << " det_height = " << dh
00019 << " ctoi = " << r
00020 << " phi_edge = " << thePhiOfOneEdge << " rad "
00021 << " y_ax_ori = " << theYAxisOrientation
00022 << " y_det_centre = " << yCentre
00023 << "\n";
00024 }
00025
00026 int CSCRadialStripTopology::channel(const LocalPoint& lp) const { return std::min( int( strip(lp) ), theNumberOfStrips-1 ) ;}
00027
00028 int CSCRadialStripTopology::nearestStrip(const LocalPoint & lp) const { return std::min( nstrips(), static_cast<int>( std::max(float(0), strip(lp)) ) + 1);}
00029
00030 float CSCRadialStripTopology::stripAngle(float strip) const { return phiOfOneEdge() + yAxisOrientation() * strip * angularWidth() ;}
00031
00032 float CSCRadialStripTopology::yDistanceToIntersection( float y ) const { return yAxisOrientation()*y + originToIntersection() ;}
00033
00034 float CSCRadialStripTopology::localStripLength(const LocalPoint& lp) const {
00035 return detHeight() * std::sqrt(1.f + std::pow( lp.x()/yDistanceToIntersection(lp.y()), 2.f) );
00036 }
00037
00038 float CSCRadialStripTopology::xOfStrip(int strip, float y) const {
00039 return
00040 yAxisOrientation() * yDistanceToIntersection( y ) * std::tan( stripAngle(static_cast<float>(strip) - 0.5 ) );
00041 }
00042
00043 float CSCRadialStripTopology::strip(const LocalPoint& lp) const {
00044 const float
00045 phi( std::atan2( lp.x(), yDistanceToIntersection( lp.y() ) )),
00046 aStrip( ( phi - yAxisOrientation() * phiOfOneEdge() )/angularWidth());
00047 return std::max(float(0), std::min( (float)nstrips(), aStrip ));
00048 }
00049
00050 LocalPoint CSCRadialStripTopology::localPosition(float strip) const {
00051 return LocalPoint( yAxisOrientation() * originToIntersection() * tan( stripAngle(strip) ), 0 );
00052 }
00053
00054 LocalPoint CSCRadialStripTopology::localPosition(const MeasurementPoint& mp) const {
00055 const float
00056 y( mp.y()*detHeight() + yCentreOfStripPlane() ),
00057 x( yAxisOrientation() * yDistanceToIntersection( y ) * std::tan ( stripAngle( mp.x() ) ) );
00058 return LocalPoint( x, y );
00059 }
00060
00061 MeasurementPoint CSCRadialStripTopology::measurementPosition(const LocalPoint& lp) const {
00062 const float
00063 phi( yAxisOrientation() * std::atan2( lp.x(), yDistanceToIntersection( lp.y() ) ));
00064 return MeasurementPoint( yAxisOrientation()*( phi-phiOfOneEdge() ) / angularWidth(),
00065 ( lp.y() - yCentreOfStripPlane() ) / detHeight() );
00066 }
00067
00068 LocalError CSCRadialStripTopology::localError(float strip, float stripErr2) const {
00069 const double
00070 phi(stripAngle(strip)), t1(std::tan(phi)), t2(t1*t1),
00071
00072
00073
00074 tt( stripErr2 * std::pow( centreToIntersection()*angularWidth() ,2.f) ),
00075 rr( std::pow(detHeight(), 2.f) * (1.f/12.f) ),
00076
00077 xx( tt + t2*rr ),
00078 yy( t2*tt + rr ),
00079 xy( t1*( rr - tt ) );
00080
00081 return LocalError( xx, xy, yy );
00082 }
00083
00084 LocalError CSCRadialStripTopology::localError(const MeasurementPoint& mp, const MeasurementError& me) const {
00085 const double
00086 phi(stripAngle(mp.x())), s1(std::sin(phi)), c1(std::cos(phi)),
00087 cs(s1*c1), s2(s1*s1), c2(1-s2),
00088
00089 T( angularWidth() * ( centreToIntersection() + yAxisOrientation()*mp.y()*detHeight()) / c1 ),
00090 R( detHeight()/ c1 ),
00091 tt( me.uu() * T*T ),
00092 rr( me.vv() * R*R ),
00093 tr( me.uv() * T*R ),
00094
00095 xx( c2*tt + 2*cs*tr + s2*rr ),
00096 yy( s2*tt - 2*cs*tr + c2*rr ),
00097 xy( cs*( rr - tt ) + tr*( c2 - s2 ) );
00098
00099 return LocalError( xx, xy, yy );
00100 }
00101
00102 MeasurementError CSCRadialStripTopology::measurementError(const LocalPoint& p, const LocalError& e) const {
00103 const double
00104 yHitToInter(yDistanceToIntersection(p.y())),
00105 t(yAxisOrientation() * p.x() / yHitToInter),
00106 cs(t/(1+t*t)), s2(t*cs), c2(1-s2),
00107
00108 T2( 1./(std::pow(angularWidth(),2.f) * ( std::pow(p.x(),2.f) + std::pow(yHitToInter,2)) )),
00109 R2( c2/std::pow(detHeight(),2.f) ),
00110
00111 uu( ( c2*e.xx() - 2*cs*e.xy() + s2*e.yy() ) * T2 ),
00112 vv( ( s2*e.xx() + 2*cs*e.xy() + c2*e.yy() ) * R2 ),
00113 uv( ( cs*( e.xx() - e.yy() ) + e.xy()*( c2 - s2 ) ) * std::sqrt (T2*R2) );
00114
00115 return MeasurementError(uu, uv, vv);
00116 }
00117
00118
00119 float CSCRadialStripTopology::localPitch(const LocalPoint& lp) const {
00120
00121 const int istrip = std::min(nstrips(), static_cast<int>(strip(lp)) + 1);
00122 const float fangle = stripAngle(static_cast<float>(istrip) - 0.5);
00123 return
00124 yDistanceToIntersection( lp.y() ) * std::sin(angularWidth()) /
00125 std::pow( std::cos(fangle-0.5f*angularWidth()), 2.f);
00126 }