Go to the documentation of this file.00001
00008 #include "Geometry/DTGeometry/interface/DTTopology.h"
00009 #include <FWCore/Utilities/interface/Exception.h>
00010
00011 #include <iostream>
00012
00013
00014
00015 const float DTTopology::theWidth = 4.2;
00016 const float DTTopology::theHeight = 1.3;
00017
00018 const float DTTopology::IBeamWingThickness = 0.13;
00019 const float DTTopology::IBeamWingLength = 0.635;
00020
00021 const float DTTopology::plateThickness = 0.15;
00022 const float DTTopology::IBeamThickness = 0.13;
00023
00024 DTTopology::DTTopology(int firstWire, int nChannels,float semilenght): theFirstChannel(firstWire),
00025 theNChannels(nChannels),
00026 theLength(semilenght*2){
00027 theOffSet = Local2DPoint(-theNChannels/2. * theWidth, -theLength/2.);
00028
00029 #ifdef VERBOSE
00030 cout <<"Constructing DTTopology with:"<<endl
00031 <<"number of wires = "<<theNChannels
00032 <<", first wire number = "<<theFirstChannel<<endl
00033 <<", width = "<<theWidth
00034 <<", height = "<<theHeight
00035 <<", length = "<<theLength
00036 <<endl;
00037 #endif
00038 }
00039
00040 float
00041 DTTopology::sensibleWidth() const
00042 {
00043 return theWidth-IBeamThickness;
00044 }
00045
00046 float
00047 DTTopology::sensibleHeight() const
00048 {
00049 return theHeight-plateThickness;
00050 }
00051
00052 LocalPoint
00053 DTTopology::localPosition( const MeasurementPoint& mp) const
00054 {
00055 return LocalPoint( (mp.x() - theFirstChannel)*theWidth + theOffSet.x() ,
00056 (1-mp.y())*theLength + theOffSet.y());
00057 }
00058
00059 LocalError
00060 DTTopology::localError( const MeasurementPoint& , const MeasurementError& me) const
00061 {
00062 return LocalError(me.uu()*(theWidth*theWidth), 0,
00063 me.vv()*(theLength*theLength));
00064 }
00065
00066 MeasurementPoint
00067 DTTopology::measurementPosition( const LocalPoint& lp) const
00068 {
00069 return MeasurementPoint( static_cast<int>( (lp.x()-theOffSet.x())/theWidth + theFirstChannel),
00070 1 - (lp.y()-theOffSet.y())/theLength);
00071 }
00072
00073 MeasurementError
00074 DTTopology::measurementError( const LocalPoint& , const LocalError& le) const
00075 {
00076 return MeasurementError(le.xx()/(theWidth*theWidth),0,
00077 le.yy()/(theLength*theLength));
00078 }
00079
00080 int
00081 DTTopology::channel( const LocalPoint& lp) const
00082 {
00083 return static_cast<int>( (lp.x()-theOffSet.x())/theWidth + theFirstChannel);
00084 }
00085
00086
00087 float
00088 DTTopology::wirePosition(int wireNumber) const
00089 {
00090 if (!isWireValid( wireNumber ))
00091 throw cms::Exception("InvalidWireNumber") << "DTTopology::wirePosition:"
00092 << " Requested wire number: "<< wireNumber
00093 << " ,but the first wire number is "<< theFirstChannel
00094 << " and the last wire number is "<< lastChannel()
00095 << std::endl;
00096 else
00097 return (wireNumber - (theFirstChannel-1) - 0.5)*theWidth + theOffSet.x();
00098 }
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 DTTopology::Side
00111 DTTopology::onWhichBorder(float x, float , float z) const
00112 {
00113
00114
00115
00116
00117 const float epsilon = 0.0015;
00118
00119
00120
00121
00122
00123
00124 Side side = none;
00125
00126 if ( fabs(z) > ( sensibleHeight()/2.-epsilon) ||
00127 (fabs(x) > ( sensibleWidth()/2.-IBeamWingLength-epsilon) &&
00128 fabs(z) > ( sensibleHeight()/2.-IBeamWingThickness-epsilon) ) ){
00129
00130 if (z > 0.) side = zMax;
00131 else side = zMin;
00132 }
00133
00134 else if ( fabs(x) > ( sensibleWidth()/2.-epsilon) ){
00135 if (x > 0.) side = xMax;
00136 else side = xMin;
00137 }
00138
00139 return side;
00140 }
00141
00142
00143
00144 DTTopology::Side
00145 DTTopology::onWhichBorder_old(float x, float , float z) const
00146 {
00147
00148
00149
00150
00151 const float epsilon = 0.0015;
00152
00153 Side side = none;
00154
00155 if ( fabs(z) > ( sensibleHeight()/2.-epsilon)) {
00156 if (z > 0.) {
00157 side = zMax;
00158 } else {
00159 side = zMin;
00160 }
00161 } else if ( fabs(x) > ( sensibleWidth()/2.-epsilon)) {
00162 if (x > 0.) {
00163 side = xMax;
00164 } else {
00165 side = xMin;
00166 }
00167 }
00168
00169 return side;
00170 }
00171