Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:07:53

0001 #include "Geometry/CommonTopologies/interface/RectangularStripTopology.h"
0002 
0003 #include <iostream>
0004 #include <cmath>
0005 #include <algorithm>
0006 
0007 RectangularStripTopology::RectangularStripTopology(int ns, float p, float l)
0008     : thePitch(p), theNumberOfStrips(ns), theStripLength(l) {
0009   theOffset = -0.5f * theNumberOfStrips * thePitch;
0010 
0011 #ifdef VERBOSE
0012   cout << "Constructing RectangularStripTopology with"
0013        << " nstrips = " << ns << " pitch = " << p << " length = " << l << endl;
0014 #endif
0015 }
0016 
0017 LocalPoint RectangularStripTopology::localPosition(float strip) const {
0018   return LocalPoint(strip * thePitch + theOffset, 0.0f);
0019 }
0020 
0021 LocalPoint RectangularStripTopology::localPosition(const MeasurementPoint& mp) const {
0022   return LocalPoint(mp.x() * thePitch + theOffset, mp.y() * theStripLength);
0023 }
0024 
0025 LocalError RectangularStripTopology::localError(float /*strip*/, float stripErr2) const {
0026   return LocalError(stripErr2 * thePitch * thePitch, 0.f, theStripLength * theStripLength * (1.f / 12.f));
0027 }
0028 
0029 LocalError RectangularStripTopology::localError(const MeasurementPoint& /*mp*/, const MeasurementError& merr) const {
0030   return LocalError(merr.uu() * thePitch * thePitch,
0031                     merr.uv() * thePitch * theStripLength,
0032                     merr.vv() * theStripLength * theStripLength);
0033 }
0034 
0035 float RectangularStripTopology::strip(const LocalPoint& lp) const {
0036   float aStrip = (lp.x() - theOffset) / thePitch;
0037   if (aStrip < 0)
0038     aStrip = 0;
0039   else if (aStrip > theNumberOfStrips)
0040     aStrip = theNumberOfStrips;
0041   return aStrip;
0042 }
0043 
0044 float RectangularStripTopology::coveredStrips(const LocalPoint& lp1, const LocalPoint& lp2) const {
0045   return (lp1.x() - lp2.x()) / thePitch;
0046 }
0047 
0048 MeasurementPoint RectangularStripTopology::measurementPosition(const LocalPoint& lp) const {
0049   return MeasurementPoint((lp.x() - theOffset) / thePitch, lp.y() / theStripLength);
0050 }
0051 
0052 MeasurementError RectangularStripTopology::measurementError(const LocalPoint& /*lp*/, const LocalError& lerr) const {
0053   return MeasurementError(lerr.xx() / (thePitch * thePitch),
0054                           lerr.xy() / (thePitch * theStripLength),
0055                           lerr.yy() / (theStripLength * theStripLength));
0056 }