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 const float DTTopology::sensibleWidth() const{
00041 return theWidth-IBeamThickness;
00042 }
00043
00044 const float DTTopology::sensibleHeight() const{
00045 return theHeight-plateThickness;
00046 }
00047
00048 LocalPoint DTTopology::localPosition( const MeasurementPoint& mp) const{
00049 return LocalPoint( (mp.x() - theFirstChannel)*theWidth + theOffSet.x() ,
00050 (1-mp.y())*theLength + theOffSet.y());
00051 }
00052
00053 LocalError DTTopology::localError( const MeasurementPoint& mp, const MeasurementError& me) const{
00054 return LocalError(me.uu()*(theWidth*theWidth), 0,
00055 me.vv()*(theLength*theLength));
00056 }
00057
00058 MeasurementPoint DTTopology::measurementPosition( const LocalPoint& lp) const{
00059 return MeasurementPoint( static_cast<int>( (lp.x()-theOffSet.x())/theWidth + theFirstChannel),
00060 1 - (lp.y()-theOffSet.y())/theLength);
00061 }
00062
00063 MeasurementError DTTopology::measurementError( const LocalPoint& lp, const LocalError& le) const{
00064 return MeasurementError(le.xx()/(theWidth*theWidth),0,
00065 le.yy()/(theLength*theLength));
00066 }
00067
00068 int DTTopology::channel( const LocalPoint& lp) const{
00069 return static_cast<int>( (lp.x()-theOffSet.x())/theWidth + theFirstChannel);
00070 }
00071
00072
00073 float DTTopology::wirePosition(int wireNumber) const{
00074 if (wireNumber - (theFirstChannel-1) <= 0 || wireNumber > lastChannel() )
00075 throw cms::Exception("InvalidWireNumber") << "DTTopology::wirePosition:"
00076 << " Requested wire number: "<< wireNumber
00077 << " ,but the first wire number is "<< theFirstChannel
00078 << " and the last wire number is "<< lastChannel()
00079 << std::endl;
00080 else
00081 return (wireNumber - (theFirstChannel-1) - 0.5)*theWidth + theOffSet.x();
00082 }
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 DTTopology::Side DTTopology::onWhichBorder(float x, float y, float z) const{
00095
00096
00097
00098
00099 const float epsilon = 0.0015;
00100
00101
00102
00103
00104
00105
00106 Side side = none;
00107
00108 if ( fabs(z) > ( sensibleHeight()/2.-epsilon) ||
00109 (fabs(x) > ( sensibleWidth()/2.-IBeamWingLength-epsilon) &&
00110 fabs(z) > ( sensibleHeight()/2.-IBeamWingThickness-epsilon) ) ){
00111
00112 if (z > 0.) side = zMax;
00113 else side = zMin;
00114 }
00115
00116 else if ( fabs(x) > ( sensibleWidth()/2.-epsilon) ){
00117 if (x > 0.) side = xMax;
00118 else side = xMin;
00119 }
00120
00121 return side;
00122 }
00123
00124
00125
00126 DTTopology::Side DTTopology::onWhichBorder_old(float x, float y, float z) const{
00127
00128
00129
00130
00131 const float epsilon = 0.0015;
00132
00133 Side side = none;
00134
00135 if ( fabs(z) > ( sensibleHeight()/2.-epsilon)) {
00136 if (z > 0.) {
00137 side = zMax;
00138 } else {
00139 side = zMin;
00140 }
00141 } else if ( fabs(x) > ( sensibleWidth()/2.-epsilon)) {
00142 if (x > 0.) {
00143 side = xMax;
00144 } else {
00145 side = xMin;
00146 }
00147 }
00148
00149 return side;
00150 }
00151