CMS 3D CMS Logo

TrapezoidalStripTopology.cc
Go to the documentation of this file.
3 
4 #include <iostream>
5 #include <cmath>
6 #include <algorithm>
7 
8 //#define EDM_ML_DEBUG
9 
11  : theNumberOfStrips(ns), thePitch(p), theDistToBeam(r0), theDetHeight(l) {
13  theYAxOr = 1;
14 #ifdef EDM_ML_DEBUG
15  edm::LogVerbatim("CommonTopologies") << "Constructing TrapezoidalStripTopology with nstrips = " << ns
16  << " pitch = " << p << " length = " << l << " r0 =" << r0;
17 #endif
18 }
19 
20 TrapezoidalStripTopology::TrapezoidalStripTopology(int ns, float p, float l, float r0, int yAx)
21  : theNumberOfStrips(ns), thePitch(p), theDistToBeam(r0), theDetHeight(l), theYAxOr(yAx) {
23 #ifdef EDM_ML_DEBUG
24  edm::LogVerbatim("CommonTopologies") << "Constructing TrapezoidalStripTopology with nstrips = " << ns
25  << " pitch = " << p << " length = " << l << " r0 =" << r0
26  << " yAxOrientation =" << yAx;
27 #endif
28 }
29 
31  return LocalPoint(strip * thePitch + theOffset, 0.0);
32 }
33 
35  float y = mp.y() * theDetHeight;
36  float x = (mp.x() * thePitch + theOffset) * (theYAxOr * y + theDistToBeam) / theDistToBeam;
37  return LocalPoint(x, y);
38 }
39 
40 LocalError TrapezoidalStripTopology::localError(float strip, float stripErr2) const {
41  float lt, lc2, ls2, lslc;
42  float localL2, localP2;
43  float sl2, sp2;
44  // angle from strip to local frame (see CMS TN / 95-170)
46  lc2 = 1.f / (1. + lt * lt);
47  lslc = lt * lc2;
48  ls2 = 1.f - lc2;
49  localL2 = theDetHeight * theDetHeight / lc2;
50  localP2 = thePitch * thePitch * lc2;
51  sl2 = localL2 / 12.;
52  sp2 = stripErr2 * localP2;
53  return LocalError(lc2 * sp2 + ls2 * sl2, lslc * (sp2 - sl2), ls2 * sp2 + lc2 * sl2);
54 }
55 
57  float lt, lc2, ls2, lslc;
58  float localL, localP;
59  float sl2, sp2, spl;
60  // angle from strip to local frame (see CMS TN / 95-170)
61  lt = -(mp.x() * thePitch + theOffset) * theYAxOr / theDistToBeam;
62  lc2 = 1. / (1. + lt * lt);
63  lslc = lt * lc2;
64  ls2 = 1.f - lc2;
65  localL = theDetHeight / std::sqrt(lc2);
66  localP = localPitch(localPosition(mp));
67  sp2 = merr.uu() * localP * localP;
68  sl2 = merr.vv() * localL * localL;
69  spl = merr.uv() * localP * localL;
70  return LocalError(lc2 * sp2 + ls2 * sl2 - 2 * lslc * spl,
71  lslc * (sp2 - sl2) + (lc2 - ls2) * spl,
72  ls2 * sp2 + lc2 * sl2 + 2 * lslc * spl);
73 }
74 
76  float aStrip = ((lp.x() * theDistToBeam / (theYAxOr * lp.y() + theDistToBeam)) - theOffset) / thePitch;
77  if (aStrip < 0)
78  aStrip = 0;
79  else if (aStrip > theNumberOfStrips)
80  aStrip = theNumberOfStrips;
81  return aStrip;
82 }
83 
85  return MeasurementPoint(((lp.x() * theDistToBeam / (theYAxOr * lp.y() + theDistToBeam)) - theOffset) / thePitch,
86  lp.y() / theDetHeight);
87 }
88 
90  float lt, lc2, ls2, lslc;
91  float localL, localP;
92  float sl2, sp2, spl;
93  lt = -lp.x() / (theYAxOr * lp.y() + theDistToBeam) * theYAxOr;
94  lc2 = 1. / (1. + lt * lt);
95  lslc = lt * lc2;
96  ls2 = 1. - lc2;
97  localL = theDetHeight / std::sqrt(lc2);
98  localP = localPitch(lp);
99  sp2 = lc2 * lerr.xx() + ls2 * lerr.yy() + 2 * lslc * lerr.xy();
100  sl2 = ls2 * lerr.xx() + lc2 * lerr.yy() - 2 * lslc * lerr.xy();
101  spl = lslc * (lerr.yy() - lerr.xx()) + (lc2 - ls2) * lerr.xy();
102  return MeasurementError(sp2 / (localP * localP), spl / (localP * localL), sl2 / (localL * localL));
103 }
104 
106  return std::min(int(strip(lp)), theNumberOfStrips - 1);
107 }
108 
109 float TrapezoidalStripTopology::pitch() const { return thePitch; }
110 
112  float x = lp.x();
113  float y = theYAxOr * lp.y() + theDistToBeam;
114  return thePitch * y / (theDistToBeam * std::sqrt(1.f + x * x / (y * y)));
115 }
116 
118  return std::atan(-(strip * thePitch + theOffset) * theYAxOr / theDistToBeam);
119 }
120 
122 
123 float TrapezoidalStripTopology::shiftOffset(float pitch_fraction) {
124  theOffset += thePitch * pitch_fraction;
125  return theOffset;
126 }
127 
129  float ltan = -lp.x() / (theYAxOr * lp.y() + theDistToBeam) * theYAxOr;
130  float localL = theDetHeight * std::sqrt(1.f + ltan * ltan);
131  // float lcos2 = 1.f/(1.f+ltan*ltan);
132  // float localL = theDetHeight / std::sqrt(lcos2);
133 
134  return localL;
135 }
MeasurementPoint measurementPosition(const LocalPoint &) const override
Log< level::Info, true > LogVerbatim
float uu() const
float localStripLength(const LocalPoint &aLP) const override
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
virtual float shiftOffset(float pitch_fraction)
int channel(const LocalPoint &) const override
float stripAngle(float strip) const override
float localPitch(const LocalPoint &) const override
T x() const
Definition: PV2DBase.h:43
T y() const
Definition: PV2DBase.h:44
float yy() const
Definition: LocalError.h:24
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
T sqrt(T t)
Definition: SSEVec.h:23
double f[11][100]
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
float strip(const LocalPoint &) const override
float uv() const
float xy() const
Definition: LocalError.h:23
TrapezoidalStripTopology(int nstrip, float pitch, float detheight, float r0)
float vv() const
LocalError localError(float strip, float stripErr2) const override
float xx() const
Definition: LocalError.h:22
LocalPoint localPosition(float strip) const override