CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/Geometry/CSCGeometry/src/OffsetRadialStripTopology.cc

Go to the documentation of this file.
00001 // This is OffsetRadialStripTopology.cc
00002 
00003 // Implementation and use of base class RST depends crucially on stripAngle() being defined
00004 // to include the angular strip offset relative to the local coordinate frame, while
00005 // phiOfOneEdge() remains unchanged from its RST interpretation (i.e. phiOfOneEdge remains
00006 // measured relative to the symmetry axis of the strip plane even in the OffsetRST case.)
00007 // To help understand the implementation below I use the notation 'prime' for the local
00008 // coordinate system rotated from the true local coordinate system by the angular offset
00009 // of the offset RST. Thus the 'prime' system is aligned with the symmetry axes of the
00010 // strip plane of the ORST.
00011 // The following functions in the base class RST work fine for the ORST too since
00012 // they're implemented in terms of stripAngle() and this is overridden for the ORST
00013 // so that the angular offset is included:
00014 //  xOfStrip(.)
00015 //  localPitch(.)
00016 //  localError(.,.)
00017 //  localError(.,.)
00018 //  measurementError(.,.)
00019 
00020 #include <Geometry/CSCGeometry/interface/OffsetRadialStripTopology.h>
00021 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00022 
00023 #include <iostream>
00024 #include <cmath>
00025 
00026 OffsetRadialStripTopology::OffsetRadialStripTopology( 
00027   int numberOfStrips, float stripPhiPitch,
00028   float detectorHeight, float radialDistance,
00029   float stripOffset, float yCentre ) :
00030   RadialStripTopology( numberOfStrips, stripPhiPitch, detectorHeight, radialDistance, +1, yCentre),
00031              theStripOffset( stripOffset )
00032 { 
00033   float rotate_by = stripOffset * angularWidth(); // now in angular units (radians, I hope)
00034   theCosOff = cos(rotate_by);
00035   theSinOff = sin(rotate_by);
00036 
00037   LogTrace("CSCStripTopology|CSC") << "fractional strip offset = " << stripOffset <<
00038     "\n angle = " << rotate_by << 
00039     " cos = " << theCosOff << " sin = " << theSinOff;
00040 }
00041 
00042 LocalPoint OffsetRadialStripTopology::localPosition(const MeasurementPoint & mp) const {
00043   // Local coordinates are (x,y). Coordinates along symmetry axes of strip
00044   // plane are (x',y'). These are rotated w.r.t. (x,y)
00045 
00046   // You might first think you could implement this as follows (cf. measurementPosition below):
00047   //  LocalPoint lpp = RST::localPosition(MP);
00048   //  return this->toLocal(lpp);
00049   // But this does not work because RST::localPosition makes use of stripAngle() - virtual - and thus
00050   // this is not the appropriate angle - it has the offset added, which is unwanted in this case!
00051   // So have to implement it directly...
00052 
00053   // 1st component of MP measures angular position within strip plane
00054   float phi = phiOfOneEdge() + mp.x() * angularWidth();
00055   // 2nd component of MP is fractional position along strip, with range +/-0.5,
00056   // so distance along strip, measured from mid-point of length of strip, is
00057   //     mp.y() * (length of strip). 
00058   // Distance in direction of coordinate y' is
00059   //    mp.y() * (length of strip) * cos(phi)
00060   // where phi is angle between strip and y' axis.
00061   // But (length of strip) = detHeight/cos(phi), so
00062   float yprime =  mp.y() * detHeight() + yCentreOfStripPlane();
00063   float xprime = ( originToIntersection() + yprime ) * tan ( phi );
00064   //  Rotate to (x,y)
00065   return toLocal(xprime, yprime);
00066 }
00067 
00068 MeasurementPoint OffsetRadialStripTopology::measurementPosition( const LocalPoint& lp ) const {
00069   LocalPoint lpp = this->toPrime(lp); // in prime system, aligned with strip plane sym axes
00070   return RadialStripTopology::measurementPosition(lpp); // now can use the base class method
00071 }
00072 
00073 float OffsetRadialStripTopology::strip(const LocalPoint& lp) const {
00074   LocalPoint pnt = toPrime(lp);
00075   float phi = atan2( pnt.x(), pnt.y()+originToIntersection() );
00076   float fstrip = ( phi - phiOfOneEdge() ) / angularWidth();
00077   fstrip = ( fstrip>=0. ? fstrip : 0. );
00078   fstrip = ( fstrip<=nstrips() ? fstrip : nstrips() );
00079   return fstrip;
00080 }
00081 
00082 float OffsetRadialStripTopology::stripAngle(float strip) const {
00083   return ( phiOfOneEdge() + (strip+theStripOffset)*angularWidth() );
00084 }
00085 
00086 LocalPoint OffsetRadialStripTopology::toLocal(float xprime, float yprime) const {
00087   float x =  theCosOff * xprime + theSinOff * yprime
00088              + originToIntersection() * theSinOff;
00089   float y = -theSinOff * xprime + theCosOff * yprime
00090              - originToIntersection() * (1. - theCosOff);
00091   return LocalPoint(x, y);
00092 }
00093 
00094 LocalPoint OffsetRadialStripTopology::toPrime(const LocalPoint& lp) const {
00095   float xprime = theCosOff * lp.x() - theSinOff * lp.y()
00096                   - originToIntersection() * theSinOff;
00097   float yprime = theSinOff * lp.x() + theCosOff * lp.y()
00098                   - originToIntersection() * (1. - theCosOff);
00099   return LocalPoint(xprime, yprime);
00100 }
00101 
00102 std::ostream & operator<<(std::ostream & os, const OffsetRadialStripTopology & orst)
00103 {
00104   os << "OffsetRadialStripTopology isa "
00105      <<  static_cast<const RadialStripTopology&>( orst )
00106      << "fractional strip offset   " << orst.stripOffset()
00107      << "\ncos(angular offset)       " << orst.theCosOff
00108      << "\nsin(angular offset)       " << orst.theSinOff << std::endl;
00109   return os;
00110 }
00111