CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/Geometry/CommonTopologies/src/RectangularStripTopology.cc

Go to the documentation of this file.
00001 #include "Geometry/CommonTopologies/interface/RectangularStripTopology.h"
00002 
00003 #include <iostream>
00004 #include <cmath>
00005 #include <algorithm>
00006 
00007 RectangularStripTopology::RectangularStripTopology(int ns, float p, float l) : 
00008   thePitch(p), theNumberOfStrips(ns), theStripLength(l) { 
00009   theOffset = -0.5f*theNumberOfStrips * thePitch;
00010 
00011 #ifdef VERBOSE
00012   cout <<"Constructing RectangularStripTopology with"
00013        <<" nstrips = "<<ns
00014        <<" pitch = "<<p
00015        <<" length = "<<l
00016        <<endl;
00017 #endif
00018 }
00019   
00020 LocalPoint 
00021 RectangularStripTopology::localPosition(float strip) const {
00022   return LocalPoint( strip*thePitch + theOffset, 0.0f);
00023 }
00024 
00025 LocalPoint 
00026 RectangularStripTopology::localPosition(const MeasurementPoint& mp) const {
00027   return LocalPoint( mp.x()*thePitch+theOffset, mp.y()*theStripLength);
00028 }
00029 
00030 LocalError 
00031 RectangularStripTopology::localError(float strip, float stripErr2) const{
00032   return LocalError(stripErr2 * thePitch*thePitch,
00033                     0.f,
00034                     theStripLength*theStripLength*(1.f/12.f));
00035 }
00036 
00037 LocalError 
00038 RectangularStripTopology::localError(const MeasurementPoint& mp,
00039   const MeasurementError& merr) const{
00040   return LocalError(merr.uu() * thePitch*thePitch,
00041                     merr.uv() * thePitch*theStripLength,
00042                     merr.vv() * theStripLength*theStripLength);
00043 }
00044   
00045 float 
00046 RectangularStripTopology::strip(const LocalPoint& lp) const {
00047   float aStrip = (lp.x() - theOffset) / thePitch;
00048   if (aStrip < 0 ) aStrip = 0;
00049   else if (aStrip > theNumberOfStrips)  aStrip = theNumberOfStrips;
00050   return aStrip;
00051 }
00052 
00053 MeasurementPoint 
00054 RectangularStripTopology::measurementPosition(const LocalPoint& lp) const {
00055   return MeasurementPoint((lp.x()-theOffset)/thePitch,
00056                           lp.y()/theStripLength);
00057 }
00058 
00059 MeasurementError 
00060 RectangularStripTopology::measurementError(const LocalPoint& lp,
00061   const LocalError& lerr) const {
00062   return MeasurementError(lerr.xx()/(thePitch*thePitch),
00063                           lerr.xy()/(thePitch*theStripLength),
00064                           lerr.yy()/(theStripLength*theStripLength));
00065 }
00066 
00067 int 
00068 RectangularStripTopology::channel(const LocalPoint& lp) const {
00069   return std::min(int(strip(lp)),theNumberOfStrips-1);
00070 }
00071 
00072 float 
00073 RectangularStripTopology::pitch() const { 
00074   return thePitch;
00075 }
00076   
00077 float 
00078 RectangularStripTopology::localPitch(const LocalPoint& lp) const {
00079   return thePitch;
00080 }
00081   
00082 float 
00083 RectangularStripTopology::stripAngle(float strip) const {
00084   return 0;
00085 }
00086   
00087 int 
00088 RectangularStripTopology::nstrips() const { 
00089   return theNumberOfStrips;
00090 }
00091