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