CMS 3D CMS Logo

TrapezoidalStripTopology.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <cmath>
5 #include <algorithm>
6 
7 TrapezoidalStripTopology::TrapezoidalStripTopology(int ns, float p, float l, float r0)
8  : theNumberOfStrips(ns), thePitch(p), theDistToBeam(r0), theDetHeight(l) {
10  theYAxOr = 1;
11 #ifdef VERBOSE
12  cout << "Constructing TrapezoidalStripTopology with"
13  << " nstrips = " << ns << " pitch = " << p << " length = " << l << " r0 =" << r0 << endl;
14 #endif
15 }
16 
17 TrapezoidalStripTopology::TrapezoidalStripTopology(int ns, float p, float l, float r0, int yAx)
18  : theNumberOfStrips(ns), thePitch(p), theDistToBeam(r0), theDetHeight(l), theYAxOr(yAx) {
20 #ifdef VERBOSE
21  cout << "Constructing TrapezoidalStripTopology with"
22  << " nstrips = " << ns << " pitch = " << p << " length = " << l << " r0 =" << r0 << " yAxOrientation =" << yAx
23  << endl;
24 #endif
25 }
26 
28  return LocalPoint(strip * thePitch + theOffset, 0.0);
29 }
30 
32  float y = mp.y() * theDetHeight;
33  float x = (mp.x() * thePitch + theOffset) * (theYAxOr * y + theDistToBeam) / theDistToBeam;
34  return LocalPoint(x, y);
35 }
36 
37 LocalError TrapezoidalStripTopology::localError(float strip, float stripErr2) const {
38  float lt, lc2, ls2, lslc;
39  float localL2, localP2;
40  float sl2, sp2;
41  // angle from strip to local frame (see CMS TN / 95-170)
43  lc2 = 1.f / (1. + lt * lt);
44  lslc = lt * lc2;
45  ls2 = 1.f - lc2;
46  localL2 = theDetHeight * theDetHeight / lc2;
47  localP2 = thePitch * thePitch * lc2;
48  sl2 = localL2 / 12.;
49  sp2 = stripErr2 * localP2;
50  return LocalError(lc2 * sp2 + ls2 * sl2, lslc * (sp2 - sl2), ls2 * sp2 + lc2 * sl2);
51 }
52 
54  float lt, lc2, ls2, lslc;
55  float localL, localP;
56  float sl2, sp2, spl;
57  // angle from strip to local frame (see CMS TN / 95-170)
58  lt = -(mp.x() * thePitch + theOffset) * theYAxOr / theDistToBeam;
59  lc2 = 1. / (1. + lt * lt);
60  lslc = lt * lc2;
61  ls2 = 1.f - lc2;
62  localL = theDetHeight / std::sqrt(lc2);
63  localP = localPitch(localPosition(mp));
64  sp2 = merr.uu() * localP * localP;
65  sl2 = merr.vv() * localL * localL;
66  spl = merr.uv() * localP * localL;
67  return LocalError(lc2 * sp2 + ls2 * sl2 - 2 * lslc * spl,
68  lslc * (sp2 - sl2) + (lc2 - ls2) * spl,
69  ls2 * sp2 + lc2 * sl2 + 2 * lslc * spl);
70 }
71 
73  float aStrip = ((lp.x() * theDistToBeam / (theYAxOr * lp.y() + theDistToBeam)) - theOffset) / thePitch;
74  if (aStrip < 0)
75  aStrip = 0;
76  else if (aStrip > theNumberOfStrips)
77  aStrip = theNumberOfStrips;
78  return aStrip;
79 }
80 
82  return MeasurementPoint(((lp.x() * theDistToBeam / (theYAxOr * lp.y() + theDistToBeam)) - theOffset) / thePitch,
83  lp.y() / theDetHeight);
84 }
85 
87  float lt, lc2, ls2, lslc;
88  float localL, localP;
89  float sl2, sp2, spl;
90  lt = -lp.x() / (theYAxOr * lp.y() + theDistToBeam) * theYAxOr;
91  lc2 = 1. / (1. + lt * lt);
92  lslc = lt * lc2;
93  ls2 = 1. - lc2;
94  localL = theDetHeight / std::sqrt(lc2);
95  localP = localPitch(lp);
96  sp2 = lc2 * lerr.xx() + ls2 * lerr.yy() + 2 * lslc * lerr.xy();
97  sl2 = ls2 * lerr.xx() + lc2 * lerr.yy() - 2 * lslc * lerr.xy();
98  spl = lslc * (lerr.yy() - lerr.xx()) + (lc2 - ls2) * lerr.xy();
99  return MeasurementError(sp2 / (localP * localP), spl / (localP * localL), sl2 / (localL * localL));
100 }
101 
103  return std::min(int(strip(lp)), theNumberOfStrips - 1);
104 }
105 
106 float TrapezoidalStripTopology::pitch() const { return thePitch; }
107 
109  float x = lp.x();
110  float y = theYAxOr * lp.y() + theDistToBeam;
111  return thePitch * y / (theDistToBeam * std::sqrt(1.f + x * x / (y * y)));
112 }
113 
115  return std::atan(-(strip * thePitch + theOffset) * theYAxOr / theDistToBeam);
116 }
117 
119 
120 float TrapezoidalStripTopology::shiftOffset(float pitch_fraction) {
121  theOffset += thePitch * pitch_fraction;
122  return theOffset;
123 }
124 
126  float ltan = -lp.x() / (theYAxOr * lp.y() + theDistToBeam) * theYAxOr;
127  float localL = theDetHeight * std::sqrt(1.f + ltan * ltan);
128  // float lcos2 = 1.f/(1.f+ltan*ltan);
129  // float localL = theDetHeight / std::sqrt(lcos2);
130 
131  return localL;
132 }
MeasurementPoint measurementPosition(const LocalPoint &) const override
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:19
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