#include <Geometry/CSCGeometry/interface/CSCWireGeometry.h>
Public Member Functions | |
virtual CSCWireGeometry * | clone () const =0 |
Allow proper copying of derived classes via base pointer. | |
CSCWireGeometry (double wireSpacing, double yOfFirstWire, double narrowWidthOfPlane, double wideWidthOfPlane, double lengthOfPlane) | |
Constructor from wire spacing (in cm). | |
std::pair< float, float > | equationOfWire (float wire) const |
Return slope and intercept of straight line representing a wire in 2-dim local coordinates. | |
LocalPoint | intersection (float m1, float c1, float m2, float c2) const |
2D point of intersection of two straight lines defined by y = m1*x + c1 and y = m2*x + c2 (in local coordinates x, y) | |
double | lengthOfPlane () const |
Extent of wire plane along long axis of trapezoid. | |
double | narrowWidthOfPlane () const |
Extent of wire plane at narrow end of trapezoid. | |
virtual int | nearestWire (const LocalPoint &lp) const =0 |
The nearest (virtual) wire to a given LocalPoint. | |
double | wideWidthOfPlane () const |
Extent of wire plane at wide end of trapezoid. | |
virtual float | wireAngle () const =0 |
The angle of the wires w.r.t local x axis (in radians). | |
std::pair< LocalPoint, LocalPoint > | wireEnds (float wire) const |
Return 2-dim local coords of the two ends of a wire. | |
double | wireSpacing () const |
The spacing between wires (cm). | |
std::vector< float > | wireValues (float wire) const |
Return mid-point of a wire in local coordinates, and its length across the chamber volume, in a vector as x, y, length. | |
std::pair< float, float > | yLimitsOfWirePlane () const |
Return pair containing y extremes of wire-plane: p.first = low y, p.second= high y. | |
double | yOfFirstWire () const |
The local y of the first wire. | |
virtual float | yOfWire (float wire, float x=0.) const =0 |
Local y of a given wire 'number' (float) at given x. | |
virtual | ~CSCWireGeometry () |
Private Attributes | |
double | theLengthOfPlane |
double | theNarrowWidthOfPlane |
double | theWideWidthOfPlane |
double | theWireSpacing |
double | theYOfFirstWire |
Definition at line 17 of file CSCWireGeometry.h.
virtual CSCWireGeometry::~CSCWireGeometry | ( | ) | [inline, virtual] |
CSCWireGeometry::CSCWireGeometry | ( | double | wireSpacing, | |
double | yOfFirstWire, | |||
double | narrowWidthOfPlane, | |||
double | wideWidthOfPlane, | |||
double | lengthOfPlane | |||
) | [inline] |
Constructor from wire spacing (in cm).
Definition at line 24 of file CSCWireGeometry.h.
00025 : 00026 theWireSpacing( wireSpacing ), theYOfFirstWire( yOfFirstWire ), 00027 theNarrowWidthOfPlane( narrowWidthOfPlane ), theWideWidthOfPlane( wideWidthOfPlane ), 00028 theLengthOfPlane( lengthOfPlane ) {}
virtual CSCWireGeometry* CSCWireGeometry::clone | ( | ) | const [pure virtual] |
Allow proper copying of derived classes via base pointer.
Implemented in CSCNonslantedWireGeometry, and CSCSlantedWireGeometry.
Referenced by CSCWireTopology::CSCWireTopology(), and CSCWireTopology::operator=().
std::pair< float, float > CSCWireGeometry::equationOfWire | ( | float | wire | ) | const |
Return slope and intercept of straight line representing a wire in 2-dim local coordinates.
The return value is a pair p with p.first = m, p.second = c, where y=mx+c.
Definition at line 176 of file CSCWireGeometry.cc.
References cw, LogTrace, mw, funct::tan(), wireAngle(), and yOfWire().
Referenced by CSCWireTopology::equationOfWire().
00176 { 00177 00178 const float fprec = 1.E-06; 00179 00180 // slope of wire 00181 float wangle = wireAngle(); 00182 float mw = 0; 00183 if ( fabs(wangle) > fprec ) mw = tan( wangle ); 00184 00185 // intercept of wire 00186 float cw = yOfWire( wire ); 00187 00188 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire=" << wire << 00189 ", wire angle = " << wangle << 00190 ", intercept on y axis=" << cw; 00191 00192 return std::pair<float,float>(mw, cw); 00193 }
LocalPoint CSCWireGeometry::intersection | ( | float | m1, | |
float | c1, | |||
float | m2, | |||
float | c2 | |||
) | const |
2D point of intersection of two straight lines defined by
y = m1*x + c1 and y = m2*x + c2
(in local coordinates x, y)
Definition at line 7 of file CSCWireGeometry.cc.
Referenced by wireEnds().
00008 { 00009 00010 // Calculate the point of intersection of two straight lines (in 2-dim) 00011 // BEWARE! Do not call with m1 = m2 ! No trapping ! 00012 00013 float x = (c2-c1)/(m1-m2); 00014 float y = (m1*c2-m2*c1)/(m1-m2); 00015 return LocalPoint( x, y ); 00016 }
double CSCWireGeometry::lengthOfPlane | ( | ) | const [inline] |
Extent of wire plane along long axis of trapezoid.
Definition at line 57 of file CSCWireGeometry.h.
References theLengthOfPlane.
Referenced by CSCWireTopology::lengthOfPlane(), wireEnds(), and yLimitsOfWirePlane().
00057 { 00058 return theLengthOfPlane; }
double CSCWireGeometry::narrowWidthOfPlane | ( | ) | const [inline] |
Extent of wire plane at narrow end of trapezoid.
Definition at line 45 of file CSCWireGeometry.h.
References theNarrowWidthOfPlane.
Referenced by CSCWireTopology::narrowWidthOfPlane(), wireEnds(), and yLimitsOfWirePlane().
00045 { 00046 return theNarrowWidthOfPlane; }
virtual int CSCWireGeometry::nearestWire | ( | const LocalPoint & | lp | ) | const [pure virtual] |
The nearest (virtual) wire to a given LocalPoint.
Beware that this wire might not exist or be read out!
Implemented in CSCNonslantedWireGeometry, and CSCSlantedWireGeometry.
Referenced by CSCWireTopology::channel(), and CSCWireTopology::nearestWire().
double CSCWireGeometry::wideWidthOfPlane | ( | ) | const [inline] |
Extent of wire plane at wide end of trapezoid.
Definition at line 51 of file CSCWireGeometry.h.
References theWideWidthOfPlane.
Referenced by CSCWireTopology::wideWidthOfPlane(), and wireEnds().
00051 { 00052 return theWideWidthOfPlane; }
virtual float CSCWireGeometry::wireAngle | ( | ) | const [pure virtual] |
The angle of the wires w.r.t local x axis (in radians).
Implemented in CSCNonslantedWireGeometry, and CSCSlantedWireGeometry.
Referenced by equationOfWire(), CSCWireTopology::wireAngle(), wireEnds(), and yLimitsOfWirePlane().
std::pair< LocalPoint, LocalPoint > CSCWireGeometry::wireEnds | ( | float | wire | ) | const |
Return 2-dim local coords of the two ends of a wire.
The returned value is a pair of LocalPoints.
Definition at line 35 of file CSCWireGeometry.cc.
References c1, c2, ct, cw, i, intersection(), j, len, lengthOfPlane(), LogTrace, m1, mw, narrowWidthOfPlane(), pw1, pw2, funct::tan(), wideWidthOfPlane(), wireAngle(), ww, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), yOfFirstWire(), and yOfWire().
Referenced by CSCWireTopology::wireEnds(), and wireValues().
00035 { 00036 00037 // return local (x, y) of each end of wire. 00038 // If wire does not intersect active area set all values to 0. 00039 00040 const float fprec = 1.E-06; 00041 00042 // slope of wire 00043 float wangle = wireAngle(); 00044 float mw = 0; 00045 if ( fabs(wangle) > fprec ) mw = tan( wireAngle() ); 00046 00047 // intercept of wire 00048 float cw = yOfWire( wire ); 00049 00050 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire=" << wire << 00051 ", wire angle = " << wangle << 00052 ", intercept on y axis=" << cw; 00053 00054 // Find extent of wire plane 00055 double ww = wideWidthOfPlane(); 00056 double nw = narrowWidthOfPlane(); 00057 double len = lengthOfPlane(); 00058 00059 // slope & intercept of line defining one non-parallel edge of wire-plane trapezoid 00060 float m1 = 2.*len/(ww-nw); 00061 float c1 = 0.; 00062 if ( fabs(wangle) < fprec ) { 00063 c1 = yOfFirstWire() - nw*len/(ww-nw) ; // non-ME11 00064 } 00065 else { 00066 c1 = -len/2. - nw*len/(ww-nw); // ME11 00067 } 00068 00069 // slope & intercept of other non-parallel edge of wire-plane trapezoid 00070 float m2 = -m1; 00071 float c2 = c1; 00072 00073 // wire intersects edge 1 at 00074 LocalPoint pw1 = intersection(mw, cw, m1, c1); 00075 // wire intersects edge 2 at 00076 LocalPoint pw2 = intersection(mw, cw, m2, c2); 00077 00078 float x1 = pw1.x(); 00079 float y1 = pw1.y(); 00080 00081 float x2 = pw2.x(); 00082 float y2 = pw2.y(); 00083 00084 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire intersects edges of plane at " << 00085 "\n x1=" << x1 << " y1=" << y1 << 00086 " x2=" << x2 << " y2=" << y2; 00087 00088 // WIRES ARE NOT TILTED? 00089 00090 if ( fabs(wangle) < fprec ) { 00091 00092 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wires are not tilted "; 00093 return std::pair< LocalPoint, LocalPoint >( LocalPoint(x1,y1), LocalPoint(x2,y2) ); 00094 } 00095 00096 // WIRES ARE TILTED 00097 00098 // ht and hb will be used to check where wire intersects edges of wire plane 00099 float ht = ww/2. ; 00100 float hb = nw/2. ; 00101 float mt = 0.; // slope of top edge 00102 float mb = 0.; //slope of bottom edge 00103 float cb = -len/2.; // intercept bottom edge of wire plane 00104 float ct = len/2.; // intercept top edge of wire plane 00105 00106 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: slopes & intercepts " << 00107 "\n mt=" << mt << " ct=" << ct << " mb=" << mb << " cb=" << cb << 00108 "\n m1=" << m1 << " c1=" << c1 << " m2=" << m2 << " c2=" << c2 << 00109 "\n mw=" << mw << " cw=" << cw; 00110 00111 // wire intersects top edge at 00112 LocalPoint pwt = intersection(mw, cw, mt, ct); 00113 // wire intersects bottom edge at 00114 LocalPoint pwb = intersection(mw, cw, mb, cb); 00115 00116 // get the local coordinates 00117 float xt = pwt.x(); 00118 float yt = pwt.y(); 00119 00120 float xb = pwb.x(); 00121 float yb = pwb.y(); 00122 00123 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire intersects top & bottom of wire plane at " << 00124 "\n xt=" << xt << " yt=" << yt << 00125 " xb=" << xb << " yb=" << yb ; 00126 00127 float xWireEnd[4], yWireEnd[4]; 00128 00129 int i = 0; 00130 if ( fabs(x1) >= hb && fabs(x1) <= ht ) { 00131 // wire does intersect side edge 1 of wire plane 00132 xWireEnd[i] = x1; 00133 yWireEnd[i] = y1; 00134 i++; 00135 } 00136 if ( fabs(xb) <= hb ) { 00137 // wire does intersect bottom edge of wire plane 00138 xWireEnd[i] = xb; 00139 yWireEnd[i] = yb; 00140 i++; 00141 } 00142 if ( fabs(x2) >= hb && fabs(x2) <= ht ) { 00143 // wire does intersect side edge 2 of wire plane 00144 xWireEnd[i] = x2; 00145 yWireEnd[i] = y2; 00146 i++; 00147 } 00148 if ( fabs(xt) <= ht ) { 00149 // wire does intersect top edge of wire plane 00150 xWireEnd[i] = xt; 00151 yWireEnd[i] = yt; 00152 i++; 00153 } 00154 00155 if ( i != 2 ) { 00156 // the wire does not intersect the wire plane (!) 00157 00158 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire does not intersect wire plane!!"; 00159 // throw cms::Exception("BadCSCGeometry") << "the wire has " << i << 00160 // " ends!" << "\n"; 00161 00162 return std::pair< LocalPoint, LocalPoint >( LocalPoint(0.,0.), LocalPoint(0.,0.) ); 00163 } 00164 00165 LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: ME11 wire ends "; 00166 for ( int j = 0; j<i; j++ ) { 00167 LogTrace("CSCWireGeometry|CSC") << " x = " << xWireEnd[j] << " y = " << yWireEnd[j]; 00168 } 00169 00170 return std::pair< LocalPoint, LocalPoint > 00171 ( LocalPoint(xWireEnd[0],yWireEnd[0]), LocalPoint(xWireEnd[1],yWireEnd[1]) ); 00172 }
double CSCWireGeometry::wireSpacing | ( | ) | const [inline] |
The spacing between wires (cm).
Definition at line 33 of file CSCWireGeometry.h.
References theWireSpacing.
Referenced by CSCSlantedWireGeometry::nearestWire(), CSCNonslantedWireGeometry::nearestWire(), CSCWireTopology::wireSpacing(), CSCSlantedWireGeometry::yOfWire(), and CSCNonslantedWireGeometry::yOfWire().
00033 { 00034 return theWireSpacing; }
std::vector< float > CSCWireGeometry::wireValues | ( | float | wire | ) | const |
Return mid-point of a wire in local coordinates, and its length across the chamber volume, in a vector as x, y, length.
Definition at line 18 of file CSCWireGeometry.cc.
References d2, lat::ends(), funct::sqrt(), and wireEnds().
Referenced by CSCWireTopology::wireValues().
00018 { 00019 00020 // return x and y of mid-point of wire, and length of wire, as 3-dim vector. 00021 // If wire does not intersect active area the returned vector is filled with 0's. 00022 00023 std::pair< LocalPoint, LocalPoint > ends = wireEnds( wire ); 00024 00025 std::vector<float> buf(3); // note all elem init to 0 00026 00027 buf[0] = (ends.first.x() + ends.second.x())/2.; // x is first elem of first & second pairs 00028 buf[1] = (ends.first.y() + ends.second.y())/2.; // y is second elem of first & second pairs 00029 float d2 = (ends.first.x() - ends.second.x()) * (ends.first.x() - ends.second.x()) + 00030 (ends.first.y() - ends.second.y()) * (ends.first.y() - ends.second.y()); 00031 buf[2] = sqrt(d2) ; 00032 return buf; 00033 }
std::pair< float, float > CSCWireGeometry::yLimitsOfWirePlane | ( | ) | const |
Return pair containing y extremes of wire-plane: p.first = low y, p.second= high y.
This is supposed to approximate the 'sensitive' region covered by wires (and strips) but there is no sophisticated handling of edge effects, or attempt to estimate a precise region overlapped by both wires and strips.
Definition at line 197 of file CSCWireGeometry.cc.
References lengthOfPlane(), narrowWidthOfPlane(), funct::tan(), wireAngle(), and yOfFirstWire().
Referenced by CSCWireTopology::insideYOfWirePlane(), and CSCWireTopology::restrictToYOfWirePlane().
00197 { 00198 00199 const float fprec = 0.1; // wire angle is either 0 or 29 degrees = 0.506 rads 00200 float ylow = yOfFirstWire(); // non-ME11 chambers 00201 float wangle = wireAngle(); 00202 if ( fabs(wangle) > fprec ) { 00203 ylow += tan( wangle ) * narrowWidthOfPlane()/2.; // correction for ME11 00204 } 00205 float yhigh = ylow + lengthOfPlane(); // add extent of wire plane in y 00206 00207 return std::pair<float, float>(ylow, yhigh); 00208 }
double CSCWireGeometry::yOfFirstWire | ( | ) | const [inline] |
The local y of the first wire.
Definition at line 39 of file CSCWireGeometry.h.
References theYOfFirstWire.
Referenced by CSCNonslantedWireGeometry::nearestWire(), wireEnds(), yLimitsOfWirePlane(), and CSCNonslantedWireGeometry::yOfWire().
00039 { 00040 return theYOfFirstWire; }
virtual float CSCWireGeometry::yOfWire | ( | float | wire, | |
float | x = 0. | |||
) | const [pure virtual] |
Local y of a given wire 'number' (float) at given x.
Implemented in CSCNonslantedWireGeometry, and CSCSlantedWireGeometry.
Referenced by equationOfWire(), wireEnds(), CSCWireTopology::yOfWire(), and CSCWireTopology::yOfWireGroup().
double CSCWireGeometry::theLengthOfPlane [private] |
double CSCWireGeometry::theNarrowWidthOfPlane [private] |
double CSCWireGeometry::theWideWidthOfPlane [private] |
double CSCWireGeometry::theWireSpacing [private] |
double CSCWireGeometry::theYOfFirstWire [private] |