CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RectangularStripTopology.cc
Go to the documentation of this file.
2 
3 #include <iostream>
4 #include <cmath>
5 #include <algorithm>
6 
7 RectangularStripTopology::RectangularStripTopology(int ns, float p, float l) :
8  thePitch(p), theNumberOfStrips(ns), theStripLength(l) {
9  theOffset = -0.5f*theNumberOfStrips * thePitch;
10 
11 #ifdef VERBOSE
12  cout <<"Constructing RectangularStripTopology with"
13  <<" nstrips = "<<ns
14  <<" pitch = "<<p
15  <<" length = "<<l
16  <<endl;
17 #endif
18 }
19 
21 RectangularStripTopology::localPosition(float strip) const {
22  return LocalPoint( strip*thePitch + theOffset, 0.0f);
23 }
24 
26 RectangularStripTopology::localPosition(const MeasurementPoint& mp) const {
27  return LocalPoint( mp.x()*thePitch+theOffset, mp.y()*theStripLength);
28 }
29 
31 RectangularStripTopology::localError(float /*strip*/, float stripErr2) const{
32  return LocalError(stripErr2 * thePitch*thePitch,
33  0.f,
34  theStripLength*theStripLength*(1.f/12.f));
35 }
36 
38 RectangularStripTopology::localError(const MeasurementPoint& /*mp*/,
39  const MeasurementError& merr) const{
40  return LocalError(merr.uu() * thePitch*thePitch,
41  merr.uv() * thePitch*theStripLength,
42  merr.vv() * theStripLength*theStripLength);
43 }
44 
45 float
46 RectangularStripTopology::strip(const LocalPoint& lp) const {
47  float aStrip = (lp.x() - theOffset) / thePitch;
48  if (aStrip < 0 ) aStrip = 0;
49  else if (aStrip > theNumberOfStrips) aStrip = theNumberOfStrips;
50  return aStrip;
51 }
52 
53 float
54 RectangularStripTopology::coveredStrips(const LocalPoint& lp1, const LocalPoint& lp2) const {
55  return (lp1.x()-lp2.x())/thePitch;
56 }
57 
59 RectangularStripTopology::measurementPosition(const LocalPoint& lp) const {
60  return MeasurementPoint((lp.x()-theOffset)/thePitch,
61  lp.y()/theStripLength);
62 }
63 
65 RectangularStripTopology::measurementError(const LocalPoint& /*lp*/,
66  const LocalError& lerr) const {
67  return MeasurementError(lerr.xx()/(thePitch*thePitch),
68  lerr.xy()/(thePitch*theStripLength),
69  lerr.yy()/(theStripLength*theStripLength));
70 }
71 
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
float uu() const
double f[11][100]
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV2DBase.h:45
T x() const
Definition: PV3DBase.h:62
float uv() const