Go to the documentation of this file.00001 #include "Geometry/CSCGeometry/interface/CSCWireTopology.h"
00002
00003 #include "Geometry/CSCGeometry/src/CSCGangedWireGrouping.h"
00004 #include "Geometry/CSCGeometry/src/CSCNonslantedWireGeometry.h"
00005 #include "Geometry/CSCGeometry/src/CSCSlantedWireGeometry.h"
00006
00007 #include <FWCore/MessageLogger/interface/MessageLogger.h>
00008
00009 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00010
00011 #include <cmath>
00012
00013 CSCWireTopology::~CSCWireTopology() {
00014 delete theWireGrouping;
00015 delete theWireGeometry;
00016 }
00017
00018 CSCWireTopology::CSCWireTopology(
00019 const CSCWireGroupPackage& wg,
00020 double yOfFirstWire,
00021 float wireAngleInDegrees ) :
00022 theWireGrouping( 0 ), theWireGeometry( 0 ),
00023 theAlignmentPinToFirstWire( wg.alignmentPinToFirstWire / 10. ) {
00024
00025
00026
00027
00028
00029 theWireGrouping = new CSCGangedWireGrouping( wg.consecutiveGroups,
00030 wg.wiresInEachGroup, wg.numberOfGroups );
00031
00032 const float zeroprecision = 1.E-06;
00033
00034 float wireAngleInRadians = wireAngleInDegrees*degree;
00035
00036
00037 float wireSpacing = wg.wireSpacing / 10.;
00038 float nw = wg.narrowWidthOfWirePlane / 10.;
00039 float ww = wg.wideWidthOfWirePlane / 10.;
00040 float lw = wg.lengthOfWirePlane / 10.;
00041
00042 LogTrace("CSCWireTopology|CSC") <<
00043 "CSCWireTopology constructing CSCWireGeometry with:\n" <<
00044 " wireSpacing = " << wireSpacing*10. << " (mm) " <<
00045 ", yOfFirstWire = " << yOfFirstWire << " (cm) " <<
00046 ", wireAngle = " << wireAngleInDegrees << " (deg) = " << wireAngleInRadians << " (rads)" <<
00047 ", extent: n, w, l = " << nw << ", " << ww << ", " << lw << " (cm)";
00048
00049 if ( fabs(wireAngleInDegrees) > zeroprecision ) {
00050 theWireGeometry = new CSCSlantedWireGeometry( wireSpacing, yOfFirstWire, nw, ww, lw, wireAngleInRadians );
00051 }
00052 else {
00053 theWireGeometry = new CSCNonslantedWireGeometry( wireSpacing, yOfFirstWire, nw, ww, lw );
00054 }
00055 }
00056
00057 CSCWireTopology::CSCWireTopology( const CSCWireTopology& mewt ) :
00058 theAlignmentPinToFirstWire(mewt.theAlignmentPinToFirstWire) {
00059 if (mewt.theWireGrouping) theWireGrouping = mewt.theWireGrouping->clone();
00060 else theWireGrouping = 0;
00061 if (mewt.theWireGeometry) theWireGeometry = mewt.theWireGeometry->clone();
00062 else theWireGeometry = 0;
00063
00064 }
00065
00066 CSCWireTopology& CSCWireTopology::operator=( const CSCWireTopology& mewt ) {
00067 if ( &mewt != this ) {
00068 delete theWireGrouping;
00069 if ( mewt.theWireGrouping )
00070 theWireGrouping = mewt.theWireGrouping->clone();
00071 else
00072 theWireGrouping = 0;
00073
00074 delete theWireGeometry;
00075 if ( mewt.theWireGeometry )
00076 theWireGeometry = mewt.theWireGeometry->clone();
00077 else
00078 theWireGeometry = 0;
00079
00080 theAlignmentPinToFirstWire = mewt.theAlignmentPinToFirstWire;
00081
00082 }
00083 return *this;
00084 }
00085
00086 LocalPoint CSCWireTopology::localPosition( const MeasurementPoint& ) const {
00087 edm::LogWarning("CSC") << "CSCWireTopology: localPosition unimplemented. Don't use it." << "\n";
00088 return LocalPoint();
00089 }
00090
00091 LocalError CSCWireTopology::localError( const MeasurementPoint&,
00092 const MeasurementError& ) const {
00093 edm::LogWarning("CSC") << "CSCWireTopology: localError unimplemented. Don't use it." << "\n";
00094 return LocalError();
00095 }
00096
00097 MeasurementPoint CSCWireTopology::measurementPosition(
00098 const LocalPoint& ) const {
00099 edm::LogWarning("CSC") << "CSCWireTopology: measurementPosition unimplemented. Don't use it." << "\n";
00100 return MeasurementPoint();
00101 }
00102
00103 MeasurementError CSCWireTopology::measurementError( const LocalPoint&,
00104 const LocalError& ) const {
00105 edm::LogWarning("CSC") << "CSCWireTopology: measurementError unimplemented. Don't use it." << "\n";
00106 return MeasurementError();
00107 }
00108
00109 int CSCWireTopology::channel( const LocalPoint& p ) const {
00110 int wire = theWireGeometry->nearestWire( p );
00111 int group = theWireGrouping->wireGroup( wire );
00112 return group;
00113 }
00114
00115 float CSCWireTopology::yOfWireGroup(int wireGroup, float x) const {
00116 float wire = middleWireOfGroup( wireGroup );
00117 return theWireGeometry->yOfWire( wire, x );
00118 }
00119
00120 float CSCWireTopology::yResolution( int wireGroup ) const {
00121
00122
00123
00124
00125
00126
00127
00128
00129 return wireSpacing() * theWireGrouping->numberOfWiresPerGroup( wireGroup ) / sqrt(12.);
00130 }
00131
00132 std::pair<float, float> CSCWireTopology::equationOfWire( float wire ) const {
00133 return theWireGeometry->equationOfWire( wire );
00134 }
00135
00136 float CSCWireTopology::restrictToYOfWirePlane( float y ) const {
00137
00138
00139 std::pair<float, float> ylim = theWireGeometry->yLimitsOfWirePlane();
00140
00141 if ( y < ylim.first ) {
00142 y = ylim.first;
00143 }
00144 else if ( y > ylim.second ) {
00145 y = ylim.second;
00146 }
00147 return y;
00148 }
00149
00150 bool CSCWireTopology::insideYOfWirePlane( float y ) const {
00151
00152
00153 std::pair<float, float> ylim = theWireGeometry->yLimitsOfWirePlane();
00154
00155 if ( y < ylim.first ) {
00156 return false;
00157 }
00158 else if ( y > ylim.second ) {
00159 return false;
00160 }
00161 return true;
00162 }