CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCWireTopology.cc
Go to the documentation of this file.
2 
6 
8 
9 #include "CLHEP/Units/GlobalSystemOfUnits.h"
10 
11 #include <cmath>
12 
14  delete theWireGrouping;
15  delete theWireGeometry;
16 }
17 
19  const CSCWireGroupPackage& wg,
20  double yOfFirstWire,
21  float wireAngleInDegrees ) :
22  theWireGrouping( 0 ), theWireGeometry( 0 ),
23  theAlignmentPinToFirstWire( wg.alignmentPinToFirstWire / 10. ) {
24 
25  // Pass consecutiveGroups and wiresInConsecutiveGroups
26  // directly on to theWireGrouping ctor. These vectors
27  // are transient info and can go once ctor is complete.
28 
31 
32  const float zeroprecision = 1.E-06; // blur zero a bit, for comparisons
33 
34  float wireAngleInRadians = wireAngleInDegrees*degree;
35 
36  //@@ Conversion from mm to cm
37  float wireSpacing = wg.wireSpacing / 10.; // in cm
38  float nw = wg.narrowWidthOfWirePlane / 10.; // in cm
39  float ww = wg.wideWidthOfWirePlane / 10.; // in cm
40  float lw = wg.lengthOfWirePlane / 10.; // in cm
41 
42  LogTrace("CSCWireTopology|CSC") <<
43  "CSCWireTopology constructing CSCWireGeometry with:\n" <<
44  " wireSpacing = " << wireSpacing*10. << " (mm) " <<
45  ", yOfFirstWire = " << yOfFirstWire << " (cm) " <<
46  ", wireAngle = " << wireAngleInDegrees << " (deg) = " << wireAngleInRadians << " (rads)" <<
47  ", extent: n, w, l = " << nw << ", " << ww << ", " << lw << " (cm)";
48 
49  if ( fabs(wireAngleInDegrees) > zeroprecision ) {
50  theWireGeometry = new CSCSlantedWireGeometry( wireSpacing, yOfFirstWire, nw, ww, lw, wireAngleInRadians );
51  }
52  else {
53  theWireGeometry = new CSCNonslantedWireGeometry( wireSpacing, yOfFirstWire, nw, ww, lw );
54  }
55 }
56 
58  theAlignmentPinToFirstWire(mewt.theAlignmentPinToFirstWire) {
60  else theWireGrouping = 0;
62  else theWireGeometry = 0;
63 
64 }
65 
67  if ( &mewt != this ) {
68  delete theWireGrouping;
69  if ( mewt.theWireGrouping )
71  else
72  theWireGrouping = 0;
73 
74  delete theWireGeometry;
75  if ( mewt.theWireGeometry )
77  else
78  theWireGeometry = 0;
79 
81 
82  }
83  return *this;
84 }
85 
87  edm::LogWarning("CSC") << "CSCWireTopology: localPosition unimplemented. Don't use it." << "\n";
88  return LocalPoint();
89 }
90 
92  const MeasurementError& ) const {
93  edm::LogWarning("CSC") << "CSCWireTopology: localError unimplemented. Don't use it." << "\n";
94  return LocalError();
95 }
96 
98  const LocalPoint& ) const {
99  edm::LogWarning("CSC") << "CSCWireTopology: measurementPosition unimplemented. Don't use it." << "\n";
100  return MeasurementPoint();
101 }
102 
104  const LocalError& ) const {
105  edm::LogWarning("CSC") << "CSCWireTopology: measurementError unimplemented. Don't use it." << "\n";
106  return MeasurementError();
107 }
108 
109 int CSCWireTopology::channel( const LocalPoint& p ) const {
110  int wire = theWireGeometry->nearestWire( p );
111  int group = theWireGrouping->wireGroup( wire );
112  return group; // 0 means out of range or dead region
113 }
114 
115 float CSCWireTopology::yOfWireGroup(int wireGroup, float x) const {
116  float wire = middleWireOfGroup( wireGroup );
117  return theWireGeometry->yOfWire( wire, x );
118 }
119 
120 float CSCWireTopology::yResolution( int wireGroup ) const {
121  // Return the resolution in the wire group measurement (in cm).
122  // To really be resolution in local y this should be scaled by Sin
123  // factors involving strip and wire angles, and also add a contribution
124  // from strip measurement (which is negligible w.r.t. wire resolution.)
125  // These factors can increase the number here by up to 1.26.
126 
127  // Should be improvable for smaller partial wire groups
128 
129  return wireSpacing() * theWireGrouping->numberOfWiresPerGroup( wireGroup ) / sqrt(12.);
130 }
131 
132 std::pair<float, float> CSCWireTopology::equationOfWire( float wire ) const {
133  return theWireGeometry->equationOfWire( wire );
134 }
135 
137  // Reset y to lie within bounds of wire plane at top and bottom.
138 
139  std::pair<float, float> ylim = theWireGeometry->yLimitsOfWirePlane();
140 
141  if ( y < ylim.first ) {
142  y = ylim.first;
143  }
144  else if ( y > ylim.second ) {
145  y = ylim.second;
146  }
147  return y;
148 }
149 
151  // Returns true if arg falls within y limits of wire plane; false otherwise.
152 
153  std::pair<float, float> ylim = theWireGeometry->yLimitsOfWirePlane();
154 
155  if ( y < ylim.first ) {
156  return false;
157  }
158  else if ( y > ylim.second ) {
159  return false;
160  }
161  return true;
162 }
virtual int channel(const LocalPoint &p) const
virtual CSCWireGeometry * clone() const =0
std::pair< float, float > equationOfWire(float wire) const
CSCWireTopology(const CSCWireGroupPackage &wg, double yOfFirstWire, float wireAngleInDegrees)
virtual int wireGroup(int wire) const =0
virtual int numberOfWiresPerGroup(int wireGroup) const =0
double theAlignmentPinToFirstWire
CSCWireGrouping * theWireGrouping
double wireSpacing() const
float yOfWireGroup(int wireGroup, float x=0.) const
CSCWireTopology & operator=(const CSCWireTopology &)
virtual float yOfWire(float wire, float x=0.) const =0
bool insideYOfWirePlane(float y) const
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
std::pair< float, float > yLimitsOfWirePlane() const
T sqrt(T t)
Definition: SSEVec.h:46
#define LogTrace(id)
virtual int nearestWire(const LocalPoint &lp) const =0
virtual LocalError localError(const MeasurementPoint &, const MeasurementError &) const
float middleWireOfGroup(int wireGroup) const
virtual MeasurementError measurementError(const LocalPoint &, const LocalError &) const
virtual CSCWireGrouping * clone() const =0
std::pair< float, float > equationOfWire(float wire) const
virtual MeasurementPoint measurementPosition(const LocalPoint &) const
virtual LocalPoint localPosition(const MeasurementPoint &) const
float yResolution(int wireGroup=1) const
float restrictToYOfWirePlane(float y) const
virtual ~CSCWireTopology()
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
Definition: DDAxes.h:10
CSCWireGeometry * theWireGeometry