CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCWireTopology.cc
Go to the documentation of this file.
2 
6 
8 
10 
11 #include <cmath>
12 
13 using namespace geant_units;
14 using namespace geant_units::operators;
15 
17  delete theWireGrouping;
18  delete theWireGeometry;
19 }
20 
21 CSCWireTopology::CSCWireTopology(const CSCWireGroupPackage& wg, double yOfFirstWire, float wireAngleInDegrees)
22  : theWireGrouping(nullptr), theWireGeometry(nullptr), theAlignmentPinToFirstWire(wg.alignmentPinToFirstWire / 10.) {
23  // Pass consecutiveGroups and wiresInConsecutiveGroups
24  // directly on to theWireGrouping ctor. These vectors
25  // are transient info and can go once ctor is complete.
26 
28 
29  const float zeroprecision = 1.E-06; // blur zero a bit, for comparisons
30 
31  float wireAngleInRadians = convertDegToRad(wireAngleInDegrees);
32 
33  //@@ Conversion from mm to cm
36  float ww = convertMmToCm(wg.wideWidthOfWirePlane);
37  float lw = convertMmToCm(wg.lengthOfWirePlane);
38 
39  LogTrace("CSCWireTopology|CSC") << "CSCWireTopology constructing CSCWireGeometry with:\n"
40  << " wireSpacing = " << wireSpacing * 10. << " (mm) "
41  << ", yOfFirstWire = " << yOfFirstWire << " (cm) "
42  << ", wireAngle = " << wireAngleInDegrees << " (deg) = " << wireAngleInRadians
43  << " (rads)"
44  << ", extent: n, w, l = " << nw << ", " << ww << ", " << lw << " (cm)";
45 
46  if (fabs(wireAngleInDegrees) > zeroprecision) {
47  theWireGeometry = new CSCSlantedWireGeometry(wireSpacing, yOfFirstWire, nw, ww, lw, wireAngleInRadians);
48  } else {
49  theWireGeometry = new CSCNonslantedWireGeometry(wireSpacing, yOfFirstWire, nw, ww, lw);
50  }
51 }
52 
54  : theAlignmentPinToFirstWire(mewt.theAlignmentPinToFirstWire) {
55  if (mewt.theWireGrouping)
57  else
58  theWireGrouping = nullptr;
59  if (mewt.theWireGeometry)
61  else
62  theWireGeometry = nullptr;
63 }
64 
66  if (&mewt != this) {
67  delete theWireGrouping;
68  if (mewt.theWireGrouping)
70  else
71  theWireGrouping = nullptr;
72 
73  delete theWireGeometry;
74  if (mewt.theWireGeometry)
76  else
77  theWireGeometry = nullptr;
78 
80  }
81  return *this;
82 }
83 
85  edm::LogWarning("CSC") << "CSCWireTopology: localPosition unimplemented. Don't use it."
86  << "\n";
87  return LocalPoint();
88 }
89 
91  edm::LogWarning("CSC") << "CSCWireTopology: localError unimplemented. Don't use it."
92  << "\n";
93  return LocalError();
94 }
95 
97  edm::LogWarning("CSC") << "CSCWireTopology: measurementPosition unimplemented. Don't use it."
98  << "\n";
99  return MeasurementPoint();
100 }
101 
103  edm::LogWarning("CSC") << "CSCWireTopology: measurementError unimplemented. Don't use it."
104  << "\n";
105  return MeasurementError();
106 }
107 
109  int wire = theWireGeometry->nearestWire(p);
110  int group = theWireGrouping->wireGroup(wire);
111  return group; // 0 means out of range or dead region
112 }
113 
114 float CSCWireTopology::yOfWireGroup(int wireGroup, float x) const {
115  float wire = middleWireOfGroup(wireGroup);
116  return theWireGeometry->yOfWire(wire, x);
117 }
118 
119 float CSCWireTopology::yResolution(int wireGroup) const {
120  // Return the resolution in the wire group measurement (in cm).
121  // To really be resolution in local y this should be scaled by Sin
122  // factors involving strip and wire angles, and also add a contribution
123  // from strip measurement (which is negligible w.r.t. wire resolution.)
124  // These factors can increase the number here by up to 1.26.
125 
126  // Should be improvable for smaller partial wire groups
127 
128  return wireSpacing() * theWireGrouping->numberOfWiresPerGroup(wireGroup) / sqrt(12.);
129 }
130 
131 std::pair<float, float> CSCWireTopology::equationOfWire(float wire) const {
132  return theWireGeometry->equationOfWire(wire);
133 }
134 
136  // Reset y to lie within bounds of wire plane at top and bottom.
137 
138  std::pair<float, float> ylim = theWireGeometry->yLimitsOfWirePlane();
139 
140  if (y < ylim.first) {
141  y = ylim.first;
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  } else if (y > ylim.second) {
156  return false;
157  }
158  return true;
159 }
virtual CSCWireGeometry * clone() const =0
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
std::pair< float, float > equationOfWire(float wire) const
constexpr double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
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
LocalPoint localPosition(const MeasurementPoint &) const override
double wireSpacing() const
float yOfWireGroup(int wireGroup, float x=0.) const
#define LogTrace(id)
CSCWireTopology & operator=(const CSCWireTopology &)
virtual float yOfWire(float wire, float x=0.) const =0
bool insideYOfWirePlane(float y) const
~CSCWireTopology() override
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
std::pair< float, float > yLimitsOfWirePlane() const
T sqrt(T t)
Definition: SSEVec.h:19
uint16_t const *__restrict__ x
Definition: gpuClustering.h:43
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
virtual int nearestWire(const LocalPoint &lp) const =0
float middleWireOfGroup(int wireGroup) const
tuple group
Definition: watchdog.py:82
constexpr NumType convertMmToCm(NumType millimeters)
Definition: angle_units.h:44
virtual CSCWireGrouping * clone() const =0
std::pair< float, float > equationOfWire(float wire) const
float yResolution(int wireGroup=1) const
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
float restrictToYOfWirePlane(float y) const
Log< level::Warning, false > LogWarning
int channel(const LocalPoint &p) const override
MeasurementPoint measurementPosition(const LocalPoint &) const override
CSCWireGeometry * theWireGeometry