CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DTTopology.cc
Go to the documentation of this file.
1 
8 
9 #include <iostream>
10 
11 // FIXME now put by hand, check the number!
12 
13 const float DTTopology::theWidth = 4.2; // cm
14 const float DTTopology::theHeight = 1.3; // cm ...
15 
16 const float DTTopology::IBeamWingThickness = 0.13; // cm
17 const float DTTopology::IBeamWingLength = 0.635; // cm
18 
19 const float DTTopology::plateThickness = 0.15; // aluminium plate: 1.5 mm
20 const float DTTopology::IBeamThickness = 0.13; // I-beam thickness: 1.3 mm
21 
22 DTTopology::DTTopology(int firstWire, int nChannels, float semilenght)
23  : theFirstChannel(firstWire), theNChannels(nChannels), theLength(semilenght * 2) {
25 
26 #ifdef VERBOSE
27  cout << "Constructing DTTopology with:" << endl
28  << "number of wires = " << theNChannels << ", first wire number = " << theFirstChannel << endl
29  << ", width = " << theWidth << ", height = " << theHeight << ", length = " << theLength << endl;
30 #endif
31 }
32 
34 
36 
38  return LocalPoint((mp.x() - theFirstChannel) * theWidth + theOffSet.x(), (1 - mp.y()) * theLength + theOffSet.y());
39 }
40 
42  return LocalError(me.uu() * (theWidth * theWidth), 0, me.vv() * (theLength * theLength));
43 }
44 
46  return MeasurementPoint(static_cast<int>((lp.x() - theOffSet.x()) / theWidth + theFirstChannel),
47  1 - (lp.y() - theOffSet.y()) / theLength);
48 }
49 
51  return MeasurementError(le.xx() / (theWidth * theWidth), 0, le.yy() / (theLength * theLength));
52 }
53 
54 int DTTopology::channel(const LocalPoint& lp) const {
55  return static_cast<int>((lp.x() - theOffSet.x()) / theWidth + theFirstChannel);
56 }
57 
58 // return the x wire position in the layer, starting from its wire number.
59 float DTTopology::wirePosition(int wireNumber) const {
60  if (!isWireValid(wireNumber)) //- (theFirstChannel-1) <= 0. || wireNumber > lastChannel() )
61  throw cms::Exception("InvalidWireNumber")
62  << "DTTopology::wirePosition:"
63  << " Requested wire number: " << wireNumber << " ,but the first wire number is " << theFirstChannel
64  << " and the last wire number is " << lastChannel() << std::endl;
65  else
66  return (wireNumber - (theFirstChannel - 1) - 0.5) * theWidth + theOffSet.x();
67 }
68 
69 /*
70 // return the x wire position in the layer r.f., starting from its wire number.
71 float DTTopology::wirePosition(int wireNumber) const{
72  int layerCoord = theNChannels - wireNumber + theFirstChannel;
73  return (layerCoord - 0.5)*theWidth + theOffSet.x();
74 }
75 */
76 
77 //New cell geometry
78 DTTopology::Side DTTopology::onWhichBorder(float x, float /*y*/, float z) const {
79  // epsilon = Tolerance to determine if a hit starts/ends on the cell border.
80  // Current value comes from CMSIM, where hit position is
81  // always ~10um far from surface. For OSCAR the discrepancy is < 1um.
82  const float epsilon = 0.0015; // 15 um
83 
84  // with new geometry the cell shape is not rectangular, but is a
85  // rectangular with the I-beam "Wing" subtracted.
86  // The height of the Wing is 1.0 mm and the length is 6.35 mm: these 4
87  // volumens must be taken into account when the border is computed
88 
89  Side side = none;
90 
91  if (fabs(z) > (sensibleHeight() / 2. - epsilon) ||
92  (fabs(x) > (sensibleWidth() / 2. - IBeamWingLength - epsilon) &&
93  fabs(z) > (sensibleHeight() / 2. - IBeamWingThickness - epsilon))) { //FIXME
94 
95  if (z > 0.)
96  side = zMax; // This is currently the INNER surface.
97  else
98  side = zMin;
99  }
100 
101  else if (fabs(x) > (sensibleWidth() / 2. - epsilon)) {
102  if (x > 0.)
103  side = xMax;
104  else
105  side = xMin;
106  } // FIXME: else if ymax, ymin...
107 
108  return side;
109 }
110 
111 //Old geometry of the DT
112 DTTopology::Side DTTopology::onWhichBorder_old(float x, float /*y*/, float z) const {
113  // epsilon = Tolerance to determine if a hit starts/ends on the cell border.
114  // Current value comes from CMSIM, where hit position is
115  // always ~10um far from surface. For OSCAR the discrepancy is < 1um.
116  const float epsilon = 0.0015; // 15 um
117 
118  Side side = none;
119 
120  if (fabs(z) > (sensibleHeight() / 2. - epsilon)) {
121  if (z > 0.) {
122  side = zMax; // This is currently the INNER surface.
123  } else {
124  side = zMin;
125  }
126  } else if (fabs(x) > (sensibleWidth() / 2. - epsilon)) {
127  if (x > 0.) {
128  side = xMax;
129  } else {
130  side = xMin;
131  }
132  } // FIXME: else if ymax, ymin...
133 
134  return side;
135 }
float wirePosition(int wireNumber) const
Returns the x position in the layer of a given wire number.
Definition: DTTopology.cc:59
static const float IBeamWingLength
Definition: DTTopology.h:106
float xx() const
Definition: LocalError.h:22
MeasurementPoint measurementPosition(const LocalPoint &) const override
Definition: DTTopology.cc:45
static const float IBeamWingThickness
Definition: DTTopology.h:105
float vv() const
float sensibleHeight() const
Returns the height of the actual sensible volume of the cell.
Definition: DTTopology.cc:35
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
T y() const
Definition: PV2DBase.h:44
Side onWhichBorder(float x, float y, float z) const
Definition: DTTopology.cc:78
int theFirstChannel
Definition: DTTopology.h:98
static const float plateThickness
Definition: DTTopology.h:107
T y() const
Definition: PV3DBase.h:60
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
Definition: DTTopology.cc:41
int theNChannels
Definition: DTTopology.h:99
Point2DBase< double, LocalTag > Local2DPoint
Definition: Topology.h:53
float sensibleWidth() const
Returns the width of the actual sensible volume of the cell.
Definition: DTTopology.cc:33
LocalPoint localPosition(const MeasurementPoint &) const override
Definition: DTTopology.cc:37
float float float z
int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:81
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
float yy() const
Definition: LocalError.h:24
float uu() const
Local2DPoint theOffSet
Definition: DTTopology.h:110
static const float theHeight
Definition: DTTopology.h:102
Side
Sides of the cell.
Definition: DTTopology.h:89
static const float theWidth
Definition: DTTopology.h:101
DTTopology(int firstWire, int nChannels, float semilenght)
Constructor: number of first wire, total # of wires in the layer and their lenght.
Definition: DTTopology.cc:22
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
Conversion to the measurement frame.
Definition: DTTopology.cc:50
float theLength
Definition: DTTopology.h:103
Side onWhichBorder_old(float x, float y, float z) const
Returns the side of the cell in which resides the point (x,y,z) (old cell geometry).
Definition: DTTopology.cc:112
int channel(const LocalPoint &p) const override
Definition: DTTopology.cc:54
bool isWireValid(const int wireNumber) const
Definition: DTTopology.h:64
float x
tuple cout
Definition: gather_cfg.py:144
T x() const
Definition: PV2DBase.h:43
T x() const
Definition: PV3DBase.h:59
static const float IBeamThickness
Definition: DTTopology.h:108