CMS 3D CMS Logo

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 
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 }
CSCWireTopology::insideYOfWirePlane
bool insideYOfWirePlane(float y) const
Definition: CSCWireTopology.cc:148
Point2DBase
Definition: Point2DBase.h:9
DDAxes::y
CSCWireGroupPackage::lengthOfWirePlane
double lengthOfWirePlane
Definition: CSCWireGroupPackage.h:37
MessageLogger.h
CSCNonslantedWireGeometry
Definition: CSCNonslantedWireGeometry.h:16
CSCWireTopology::theAlignmentPinToFirstWire
double theAlignmentPinToFirstWire
Definition: CSCWireTopology.h:190
CSCWireTopology::theWireGeometry
CSCWireGeometry * theWireGeometry
Definition: CSCWireTopology.h:188
CSCWireGeometry::clone
virtual CSCWireGeometry * clone() const =0
CSCWireGroupPackage::consecutiveGroups
Container consecutiveGroups
Definition: CSCWireGroupPackage.h:28
CSCWireTopology::localPosition
LocalPoint localPosition(const MeasurementPoint &) const override
Definition: CSCWireTopology.cc:84
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCWireTopology::yOfWireGroup
float yOfWireGroup(int wireGroup, float x=0.) const
Definition: CSCWireTopology.cc:114
angle_units::operators::convertDegToRad
constexpr long double convertDegToRad(NumType degrees)
Definition: angle_units.h:27
CSCWireTopology::operator=
CSCWireTopology & operator=(const CSCWireTopology &)
Definition: CSCWireTopology.cc:65
DDAxes::x
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
geant_units::operators
Definition: GeantUnits.h:18
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
CSCGangedWireGrouping
Definition: CSCGangedWireGrouping.h:18
CSCWireTopology::CSCWireTopology
CSCWireTopology(const CSCWireGroupPackage &wg, double yOfFirstWire, float wireAngleInDegrees)
Definition: CSCWireTopology.cc:21
CSCWireGeometry::yLimitsOfWirePlane
std::pair< float, float > yLimitsOfWirePlane() const
Definition: CSCWireGeometry.cc:186
CSCWireTopology::channel
int channel(const LocalPoint &p) const override
Definition: CSCWireTopology.cc:108
CSCWireTopology::equationOfWire
std::pair< float, float > equationOfWire(float wire) const
Definition: CSCWireTopology.cc:131
CSCWireTopology::measurementPosition
MeasurementPoint measurementPosition(const LocalPoint &) const override
Definition: CSCWireTopology.cc:96
CSCWireGeometry::yOfWire
virtual float yOfWire(float wire, float x=0.) const =0
CSCWireTopology::middleWireOfGroup
float middleWireOfGroup(int wireGroup) const
Definition: CSCWireTopology.h:131
CSCWireTopology::yResolution
float yResolution(int wireGroup=1) const
Definition: CSCWireTopology.cc:119
CSCWireTopology::measurementError
MeasurementError measurementError(const LocalPoint &, const LocalError &) const override
Definition: CSCWireTopology.cc:102
MeasurementError
Definition: MeasurementError.h:8
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
CSCWireGroupPackage::narrowWidthOfWirePlane
double narrowWidthOfWirePlane
Definition: CSCWireGroupPackage.h:35
CSCWireGroupPackage::wideWidthOfWirePlane
double wideWidthOfWirePlane
Definition: CSCWireGroupPackage.h:36
Point3DBase< float, LocalTag >
CSCSlantedWireGeometry
Definition: CSCSlantedWireGeometry.h:15
CSCWireTopology::restrictToYOfWirePlane
float restrictToYOfWirePlane(float y) const
Definition: CSCWireTopology.cc:135
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
CSCWireGroupPackage::wireSpacing
double wireSpacing
Definition: CSCWireGroupPackage.h:33
CSCWireTopology.h
LocalError
Definition: LocalError.h:12
GeantUnits.h
CSCWireGroupPackage::wiresInEachGroup
Container wiresInEachGroup
Definition: CSCWireGroupPackage.h:31
CSCWireGroupPackage
Definition: CSCWireGroupPackage.h:18
CSCWireTopology::wireGroup
int wireGroup(int wire) const
Definition: CSCWireTopology.h:123
CSCWireTopology::~CSCWireTopology
~CSCWireTopology() override
Definition: CSCWireTopology.cc:16
CSCSlantedWireGeometry.h
CSCWireGroupPackage::numberOfGroups
int numberOfGroups
Definition: CSCWireGroupPackage.h:32
CSCGangedWireGrouping.h
CSCWireGrouping::clone
virtual CSCWireGrouping * clone() const =0
CSCNonslantedWireGeometry.h
CSCWireTopology::localError
LocalError localError(const MeasurementPoint &, const MeasurementError &) const override
Definition: CSCWireTopology.cc:90
genVertex_cff.x
x
Definition: genVertex_cff.py:12
CSCWireTopology
Definition: CSCWireTopology.h:18
detailsBasic3DVector::y
float float y
Definition: extBasic3DVector.h:14
CSCWireTopology::theWireGrouping
CSCWireGrouping * theWireGrouping
Definition: CSCWireTopology.h:187
geant_units::operators::convertMmToCm
constexpr NumType convertMmToCm(NumType millimeters)
Definition: GeantUnits.h:62
geant_units
Definition: GeantUnits.h:11
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
CSCWireGrouping::wireGroup
virtual int wireGroup(int wire) const =0
CSCWireGrouping::numberOfWiresPerGroup
virtual int numberOfWiresPerGroup(int wireGroup) const =0
CSCWireGeometry::equationOfWire
std::pair< float, float > equationOfWire(float wire) const
Definition: CSCWireGeometry.cc:166
CSCWireTopology::wireSpacing
double wireSpacing() const
Definition: CSCWireTopology.h:59
CSCWireGeometry::nearestWire
virtual int nearestWire(const LocalPoint &lp) const =0
watchdog.group
group
Definition: watchdog.py:82