#include <CSCWireGeometry.h>
Public Member Functions | |
virtual CSCWireGeometry * | clone () const =0 |
CSCWireGeometry (double wireSpacing, double yOfFirstWire, double narrowWidthOfPlane, double wideWidthOfPlane, double lengthOfPlane) | |
std::pair< float, float > | equationOfWire (float wire) const |
LocalPoint | intersection (float m1, float c1, float m2, float c2) const |
double | lengthOfPlane () const |
double | narrowWidthOfPlane () const |
virtual int | nearestWire (const LocalPoint &lp) const =0 |
double | wideWidthOfPlane () const |
virtual float | wireAngle () const =0 |
std::pair< LocalPoint, LocalPoint > | wireEnds (float wire) const |
double | wireSpacing () const |
std::vector< float > | wireValues (float wire) const |
std::pair< float, float > | yLimitsOfWirePlane () const |
double | yOfFirstWire () const |
virtual float | yOfWire (float wire, float x=0.) const =0 |
virtual | ~CSCWireGeometry () |
Private Attributes | |
double | theLengthOfPlane |
double | theNarrowWidthOfPlane |
double | theWideWidthOfPlane |
double | theWireSpacing |
double | theYOfFirstWire |
An ABC defining interface for geometry related to angle which wires of a detector modelled by a WireTopology make with the local x axis.
Definition at line 17 of file CSCWireGeometry.h.
virtual CSCWireGeometry::~CSCWireGeometry | ( | ) | [inline, virtual] |
Definition at line 19 of file CSCWireGeometry.h.
{}
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.
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 LogTrace, funct::tan(), wireAngle(), and yOfWire().
Referenced by CSCWireTopology::equationOfWire().
{ const float fprec = 1.E-06; // slope of wire float wangle = wireAngle(); float mw = 0; if ( fabs(wangle) > fprec ) mw = tan( wangle ); // intercept of wire float cw = yOfWire( wire ); LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire=" << wire << ", wire angle = " << wangle << ", intercept on y axis=" << cw; return std::pair<float,float>(mw, cw); }
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.
References alignmentValidation::c1, x, and detailsBasic3DVector::y.
Referenced by wireEnds().
{ // Calculate the point of intersection of two straight lines (in 2-dim) // BEWARE! Do not call with m1 = m2 ! No trapping ! float x = (c2-c1)/(m1-m2); float y = (m1*c2-m2*c1)/(m1-m2); return LocalPoint( x, y ); }
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().
{ 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().
{ 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().
{ 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 alignmentValidation::c1, i, intersection(), j, lengthOfPlane(), LogTrace, narrowWidthOfPlane(), funct::tan(), wideWidthOfPlane(), wireAngle(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), yOfFirstWire(), and yOfWire().
Referenced by CSCWireTopology::wireEnds(), and wireValues().
{ // return local (x, y) of each end of wire. // If wire does not intersect active area set all values to 0. const float fprec = 1.E-06; // slope of wire float wangle = wireAngle(); float mw = 0; if ( fabs(wangle) > fprec ) mw = tan( wireAngle() ); // intercept of wire float cw = yOfWire( wire ); LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire=" << wire << ", wire angle = " << wangle << ", intercept on y axis=" << cw; // Find extent of wire plane double ww = wideWidthOfPlane(); double nw = narrowWidthOfPlane(); double len = lengthOfPlane(); // slope & intercept of line defining one non-parallel edge of wire-plane trapezoid float m1 = 2.*len/(ww-nw); float c1 = 0.; if ( fabs(wangle) < fprec ) { c1 = yOfFirstWire() - nw*len/(ww-nw) ; // non-ME11 } else { c1 = -len/2. - nw*len/(ww-nw); // ME11 } // slope & intercept of other non-parallel edge of wire-plane trapezoid float m2 = -m1; float c2 = c1; // wire intersects edge 1 at LocalPoint pw1 = intersection(mw, cw, m1, c1); // wire intersects edge 2 at LocalPoint pw2 = intersection(mw, cw, m2, c2); float x1 = pw1.x(); float y1 = pw1.y(); float x2 = pw2.x(); float y2 = pw2.y(); LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire intersects edges of plane at " << "\n x1=" << x1 << " y1=" << y1 << " x2=" << x2 << " y2=" << y2; // WIRES ARE NOT TILTED? if ( fabs(wangle) < fprec ) { LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wires are not tilted "; return std::pair< LocalPoint, LocalPoint >( LocalPoint(x1,y1), LocalPoint(x2,y2) ); } // WIRES ARE TILTED // ht and hb will be used to check where wire intersects edges of wire plane float ht = ww/2. ; float hb = nw/2. ; float mt = 0.; // slope of top edge float mb = 0.; //slope of bottom edge float cb = -len/2.; // intercept bottom edge of wire plane float ct = len/2.; // intercept top edge of wire plane LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: slopes & intercepts " << "\n mt=" << mt << " ct=" << ct << " mb=" << mb << " cb=" << cb << "\n m1=" << m1 << " c1=" << c1 << " m2=" << m2 << " c2=" << c2 << "\n mw=" << mw << " cw=" << cw; // wire intersects top edge at LocalPoint pwt = intersection(mw, cw, mt, ct); // wire intersects bottom edge at LocalPoint pwb = intersection(mw, cw, mb, cb); // get the local coordinates float xt = pwt.x(); float yt = pwt.y(); float xb = pwb.x(); float yb = pwb.y(); LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire intersects top & bottom of wire plane at " << "\n xt=" << xt << " yt=" << yt << " xb=" << xb << " yb=" << yb ; float xWireEnd[4], yWireEnd[4]; int i = 0; if ( fabs(x1) >= hb && fabs(x1) <= ht ) { // wire does intersect side edge 1 of wire plane xWireEnd[i] = x1; yWireEnd[i] = y1; i++; } if ( fabs(xb) <= hb ) { // wire does intersect bottom edge of wire plane xWireEnd[i] = xb; yWireEnd[i] = yb; i++; } if ( fabs(x2) >= hb && fabs(x2) <= ht ) { // wire does intersect side edge 2 of wire plane xWireEnd[i] = x2; yWireEnd[i] = y2; i++; } if ( fabs(xt) <= ht ) { // wire does intersect top edge of wire plane xWireEnd[i] = xt; yWireEnd[i] = yt; i++; } if ( i != 2 ) { // the wire does not intersect the wire plane (!) LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: wire does not intersect wire plane!!"; // throw cms::Exception("BadCSCGeometry") << "the wire has " << i << // " ends!" << "\n"; return std::pair< LocalPoint, LocalPoint >( LocalPoint(0.,0.), LocalPoint(0.,0.) ); } LogTrace("CSCWireGeometry|CSC") << "CSCWireGeometry: ME11 wire ends "; for ( int j = 0; j<i; j++ ) { LogTrace("CSCWireGeometry|CSC") << " x = " << xWireEnd[j] << " y = " << yWireEnd[j]; } return std::pair< LocalPoint, LocalPoint > ( LocalPoint(xWireEnd[0],yWireEnd[0]), LocalPoint(xWireEnd[1],yWireEnd[1]) ); }
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().
{ 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 mathSSE::sqrt(), and wireEnds().
Referenced by CSCWireTopology::wireValues().
{ // return x and y of mid-point of wire, and length of wire, as 3-dim vector. // If wire does not intersect active area the returned vector is filled with 0's. std::pair< LocalPoint, LocalPoint > ends = wireEnds( wire ); std::vector<float> buf(3); // note all elem init to 0 buf[0] = (ends.first.x() + ends.second.x())/2.; // x is first elem of first & second pairs buf[1] = (ends.first.y() + ends.second.y())/2.; // y is second elem of first & second pairs float d2 = (ends.first.x() - ends.second.x()) * (ends.first.x() - ends.second.x()) + (ends.first.y() - ends.second.y()) * (ends.first.y() - ends.second.y()); buf[2] = sqrt(d2) ; return buf; }
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 abs, lengthOfPlane(), narrowWidthOfPlane(), funct::tan(), wireAngle(), and yOfFirstWire().
Referenced by CSCWireTopology::insideYOfWirePlane(), and CSCWireTopology::restrictToYOfWirePlane().
{ const float fprec = 0.1; // wire angle is either 0 or 29 degrees = 0.506 rads float ylow = yOfFirstWire(); // non-ME11 chambers float wangle = wireAngle(); if ( fabs(wangle) > fprec ) { ylow += tan( std::abs(wangle) ) * narrowWidthOfPlane()/2.; // correction for ME11 } float yhigh = ylow + lengthOfPlane(); // add extent of wire plane in y return std::pair<float, float>(ylow, yhigh); }
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().
{ 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] |
Definition at line 119 of file CSCWireGeometry.h.
Referenced by lengthOfPlane().
double CSCWireGeometry::theNarrowWidthOfPlane [private] |
Definition at line 117 of file CSCWireGeometry.h.
Referenced by narrowWidthOfPlane().
double CSCWireGeometry::theWideWidthOfPlane [private] |
Definition at line 118 of file CSCWireGeometry.h.
Referenced by wideWidthOfPlane().
double CSCWireGeometry::theWireSpacing [private] |
Definition at line 115 of file CSCWireGeometry.h.
Referenced by wireSpacing().
double CSCWireGeometry::theYOfFirstWire [private] |
Definition at line 116 of file CSCWireGeometry.h.
Referenced by yOfFirstWire().