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) {
61 
62 }
63 
65  if ( &mewt != this ) {
66  delete theWireGrouping;
67  if ( mewt.theWireGrouping )
69  else
70  theWireGrouping = 0;
71 
72  delete theWireGeometry;
73  if ( mewt.theWireGeometry )
75  else
76  theWireGeometry = 0;
77 
79 
80  }
81  return *this;
82 }
83 
85  edm::LogWarning("CSC") << "CSCWireTopology: localPosition unimplemented. Don't use it." << "\n";
86  return LocalPoint();
87 }
88 
90  const MeasurementError& ) const {
91  edm::LogWarning("CSC") << "CSCWireTopology: localError unimplemented. Don't use it." << "\n";
92  return LocalError();
93 }
94 
96  const LocalPoint& ) const {
97  edm::LogWarning("CSC") << "CSCWireTopology: measurementPosition unimplemented. Don't use it." << "\n";
98  return MeasurementPoint();
99 }
100 
102  const LocalError& ) const {
103  edm::LogWarning("CSC") << "CSCWireTopology: measurementError unimplemented. Don't use it." << "\n";
104  return MeasurementError();
105 }
106 
107 int CSCWireTopology::channel( const LocalPoint& p ) const {
108  int wire = theWireGeometry->nearestWire( p );
109  int group = theWireGrouping->wireGroup( wire );
110  return group; // 0 means out of range or dead region
111 }
112 
113 float CSCWireTopology::yOfWireGroup(int wireGroup, float x) const {
114  float wire = middleWireOfGroup( wireGroup );
115  return theWireGeometry->yOfWire( wire, x );
116 }
117 
118 float CSCWireTopology::yResolution( int wireGroup ) const {
119  // Return the resolution in the wire group measurement (in cm).
120  // To really be resolution in local y this should be scaled by Sin
121  // factors involving strip and wire angles, and also add a contribution
122  // from strip measurement (which is negligible w.r.t. wire resolution.)
123  // These factors can increase the number here by up to 1.26.
124 
125  // Should be improvable for smaller partial wire groups
126 
127  return wireSpacing() * theWireGrouping->numberOfWiresPerGroup( wireGroup ) / sqrt(12.);
128 }
129 
130 std::pair<float, float> CSCWireTopology::equationOfWire( float wire ) const {
131  return theWireGeometry->equationOfWire( wire );
132 }
133 
135  // Reset y to lie within bounds of wire plane at top and bottom.
136 
137  std::pair<float, float> ylim = theWireGeometry->yLimitsOfWirePlane();
138 
139  if ( y < ylim.first ) {
140  y = ylim.first;
141  }
142  else if ( y > ylim.second ) {
143  y = ylim.second;
144  }
145  return y;
146 }
147 
149  // Returns true if arg falls within y limits of wire plane; false otherwise.
150 
151  std::pair<float, float> ylim = theWireGeometry->yLimitsOfWirePlane();
152 
153  if ( y < ylim.first ) {
154  return false;
155  }
156  else if ( y > ylim.second ) {
157  return false;
158  }
159  return true;
160 }
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:28
#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