CMS 3D CMS Logo

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