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