CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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,
8  float l,
9  float r0) :
10  theNumberOfStrips(ns), thePitch(p),
11  theDistToBeam(r0), theDetHeight(l) {
12  theOffset = -theNumberOfStrips/2. * thePitch;
13  theYAxOr = 1;
14 #ifdef VERBOSE
15  cout<<"Constructing TrapezoidalStripTopology with"
16  <<" nstrips = "<<ns
17  <<" pitch = "<<p
18  <<" length = "<<l
19  <<" r0 ="<<r0
20  <<endl;
21 #endif
22 }
23 
24 TrapezoidalStripTopology::TrapezoidalStripTopology(int ns, float p,
25  float l,
26  float r0, int yAx) :
27  theNumberOfStrips(ns), thePitch(p),
28  theDistToBeam(r0), theDetHeight(l), theYAxOr(yAx){
29  theOffset = -theNumberOfStrips/2. * thePitch;
30 #ifdef VERBOSE
31  cout<<"Constructing TrapezoidalStripTopology with"
32  <<" nstrips = "<<ns
33  <<" pitch = "<<p
34  <<" length = "<<l
35  <<" r0 ="<<r0
36  <<" yAxOrientation ="<<yAx
37  <<endl;
38 #endif
39 }
40 
42 TrapezoidalStripTopology::localPosition(float strip) const {
43  return LocalPoint( strip*thePitch + theOffset, 0.0);
44 }
45 
47 TrapezoidalStripTopology::localPosition(const MeasurementPoint& mp) const {
48  float y = mp.y()*theDetHeight;
49  float x = (mp.x()*thePitch +
50  theOffset)*(theYAxOr*y+theDistToBeam)/theDistToBeam;
51  return LocalPoint(x,y);
52 }
53 
55 TrapezoidalStripTopology::localError(float strip, float stripErr2) const {
56  float lt,lc2,ls2,lslc;
57  float localL2,localP2;
58  float sl2,sp2;
59  // angle from strip to local frame (see CMS TN / 95-170)
60  lt = -(strip*thePitch + theOffset)*theYAxOr/theDistToBeam;
61  lc2 = 1.f/(1.+lt*lt);
62  lslc = lt*lc2;
63  ls2 = 1.f-lc2;
64  localL2 = theDetHeight*theDetHeight / lc2;
65  localP2 = thePitch*thePitch*lc2;
66  sl2 = localL2/12.;
67  sp2 = stripErr2*localP2;
68  return LocalError(lc2*sp2+ls2*sl2,
69  lslc*(sp2-sl2),
70  ls2*sp2+lc2*sl2);
71 }
72 
74 TrapezoidalStripTopology::localError(const MeasurementPoint& mp,
75  const MeasurementError& merr) const {
76  float lt,lc2,ls2,lslc;
77  float localL,localP;
78  float sl2,sp2,spl;
79  // angle from strip to local frame (see CMS TN / 95-170)
80  lt = -(mp.x()*thePitch + theOffset)*theYAxOr/theDistToBeam;
81  lc2 = 1./(1.+lt*lt);
82  lslc = lt*lc2;
83  ls2 = 1.f-lc2;
84  localL = theDetHeight / std::sqrt(lc2);
85  localP = localPitch(localPosition(mp));
86  sp2 = merr.uu() * localP*localP;
87  sl2 = merr.vv() * localL*localL;
88  spl = merr.uv() * localP*localL;
89  return LocalError(lc2*sp2+ls2*sl2-2*lslc*spl,
90  lslc*(sp2-sl2)+(lc2-ls2)*spl,
91  ls2*sp2+lc2*sl2+2*lslc*spl);
92 }
93 
94 float
95 TrapezoidalStripTopology::strip(const LocalPoint& lp) const {
96  float aStrip =
97  ((lp.x()*theDistToBeam/(theYAxOr*lp.y()+theDistToBeam))-theOffset)/thePitch;
98  if (aStrip < 0 ) aStrip = 0;
99  else if (aStrip > theNumberOfStrips) aStrip = theNumberOfStrips;
100  return aStrip;
101 }
102 
104 TrapezoidalStripTopology::measurementPosition(const LocalPoint& lp) const {
105  return
106  MeasurementPoint(((lp.x()*theDistToBeam/(theYAxOr*lp.y()+theDistToBeam))-theOffset)/thePitch,
107  lp.y()/theDetHeight);
108 }
109 
111 TrapezoidalStripTopology::measurementError(const LocalPoint& lp,
112  const LocalError& lerr) const {
113  float lt,lc2,ls2,lslc;
114  float localL,localP;
115  float sl2,sp2,spl;
116  lt = -lp.x()/(theYAxOr*lp.y()+theDistToBeam)*theYAxOr;
117  lc2 = 1./(1.+lt*lt);
118  lslc = lt*lc2;
119  ls2 = 1.-lc2;
120  localL = theDetHeight / std::sqrt(lc2);
121  localP = localPitch(lp);
122  sp2 = lc2*lerr.xx()+ls2*lerr.yy()+2*lslc*lerr.xy();
123  sl2 = ls2*lerr.xx()+lc2*lerr.yy()-2*lslc*lerr.xy();
124  spl = lslc*(lerr.yy()-lerr.xx())+(lc2-ls2)*lerr.xy();
125  return MeasurementError(sp2/(localP*localP),
126  spl/(localP*localL),
127  sl2/(localL*localL));
128 
129 }
130 
131 int
132 TrapezoidalStripTopology::channel(const LocalPoint& lp) const {
133  return std::min(int(strip(lp)),theNumberOfStrips-1);
134 }
135 
136 float
137 TrapezoidalStripTopology::pitch() const {
138  return thePitch;
139 }
140 
141 float
142 TrapezoidalStripTopology::localPitch(const LocalPoint& lp) const {
143  float x=lp.x();
144  float y=theYAxOr*lp.y()+theDistToBeam;
145  return thePitch*y/(theDistToBeam*std::sqrt(1.f+x*x/(y*y)));
146 }
147 
148 float
149 TrapezoidalStripTopology::stripAngle(float strip) const {
150  return std::atan( -(strip*thePitch + theOffset)*theYAxOr/theDistToBeam );
151 }
152 
153 int
154 TrapezoidalStripTopology::nstrips() const {
155  return theNumberOfStrips;
156 }
157 
158 float TrapezoidalStripTopology::shiftOffset( float pitch_fraction) {
159  theOffset += thePitch * pitch_fraction;
160  return theOffset;
161 }
162 
163 float TrapezoidalStripTopology::localStripLength(const LocalPoint& lp)
164  const {
165  float ltan = -lp.x()/(theYAxOr*lp.y()+theDistToBeam)*theYAxOr;
166  float localL = theDetHeight * std::sqrt(1.f+ltan*ltan);
167  // float lcos2 = 1.f/(1.f+ltan*ltan);
168  // float localL = theDetHeight / std::sqrt(lcos2);
169 
170  return localL;
171 }
172 
float xx() const
Definition: LocalError.h:24
float vv() const
T y() const
Definition: PV2DBase.h:46
T y() const
Definition: PV3DBase.h:63
float xy() const
Definition: LocalError.h:25
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
float yy() const
Definition: LocalError.h:26
T sqrt(T t)
Definition: SSEVec.h:48
float uu() const
double f[11][100]
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62
float uv() const