36 #include <type_traits>
60 void endJob()
override;
62 void validateCSCChamberGeometry();
63 void validateCSCLayerGeometry();
65 void compareTransform(
const GlobalPoint&,
const TGeoMatrix*);
66 void compareShape(
const GeomDet*,
const float*);
69 float getDiff(
const float,
const float);
71 void makeHistograms(
const char*);
72 void makeHistograms2(
const char*);
73 void makeHistogram(
const string&, vector<float>&);
76 globalDistances_.clear();
78 bottomWidths_.clear();
84 yAxisOrientation_.clear();
86 yCentreOfStripPlane_.clear();
87 angularWidth_.clear();
88 centreToIntersection_.clear();
89 phiOfOneEdge_.clear();
121 : tokCSC_{esConsumes<CSCGeometry, MuonGeometryRecord>(
edm::ESInputTag{})},
131 LogVerbatim(
"CSCGeometry") <<
"Validating CSC chamber geometry";
146 LogVerbatim(
"CSCGeometry") <<
"Failed to get matrix of CSC chamber with detid: " << chId.
rawId();
154 LogVerbatim(
"CSCGeometry") <<
"Failed to get shape of CSC chamber with detid: " << chId.
rawId();
179 const double wire_spacing = wiretopo->
wireSpacing();
180 const float wire_angle = wiretopo->
wireAngle();
183 for (
int istrips = 1; istrips <= n_strips; istrips++) {
185 sOffset_.push_back(fabs(strips_offset - parameters[4]));
187 angularWidth_.push_back(fabs(angular_width - parameters[5]));
189 phiOfOneEdge_.push_back(fabs(phi_of_one_edge - parameters[3]));
192 LogVerbatim(
"CSCGeometry") <<
"ATTENTION! nStrips == 0";
196 for (
int iwires = 1; iwires <= n_wire; iwires++) {
197 wireSpacing_.push_back(fabs(wire_spacing - parameters[6]));
198 wireAngle_.push_back(fabs(wire_angle - parameters[7]));
201 LogVerbatim(
"CSCGeometry") <<
"ATTENTION! nWires == 0";
208 double local[3] = {0.0, 0.0, 0.0};
211 matrix->LocalToMaster(local, global);
214 if ((distance >= 0.0) && (distance < 1.0
e-7))
221 float shapeBottomWidth;
223 float shapeThickness;
226 shapeTopWidth = shape[2];
227 shapeBottomWidth = shape[1];
228 shapeLength = shape[4];
229 shapeThickness = shape[3];
230 }
else if (shape[0] == 2) {
231 shapeTopWidth = shape[1];
232 shapeBottomWidth = shape[1];
233 shapeLength = shape[2];
234 shapeThickness = shape[3];
236 LogVerbatim(
"CSCGeometry") <<
"Failed to get box or trapezoid from shape";
241 float topWidth, bottomWidth;
246 array<const float, 4>
const& ps = tpbs->parameters();
254 }
else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
257 bottomWidth = topWidth;
260 LogVerbatim(
"CSCGeometry") <<
"Failed to get bounds";
264 topWidths_.push_back(fabs(shapeTopWidth - topWidth));
265 bottomWidths_.push_back(fabs(shapeBottomWidth - bottomWidth));
266 lengths_.push_back(fabs(shapeLength - length));
267 thicknesses_.push_back(fabs(shapeThickness - thickness));
271 return sqrt((p1.
x() - p2.
x()) * (p1.
x() - p2.
x()) + (p1.
y() - p2.
y()) * (p1.
y() - p2.
y()) +
272 (p1.
z() - p2.
z()) * (p1.
z() - p2.
z()));
279 return (val1 - val2);
287 string gdn = d +
": distance between points in global coordinates";
290 string twn = d +
": absolute difference between top widths (along X)";
293 string bwn = d +
": absolute difference between bottom widths (along X)";
296 string ln = d +
": absolute difference between lengths (along Y)";
299 string tn = d +
": absolute difference between thicknesses (along Z)";
308 string ns = d +
": absolute difference between Y Axis Orientation of the Strips";
311 string pi = d +
": absolute difference between Strips Offset";
314 string pl = d +
": absolute difference between 'Y centre' of the Strips Planes";
317 string aw = d +
": absolute difference between 'angular width' of the Strips ";
320 string ci = d +
": absolute difference between 'centre to intersection' of the Strips ";
323 string po = d +
": absolute difference between 'phi of one edge' of the Strips ";
326 string ws = d +
": absolute difference between 'wire spacing' of the Wires ";
329 string wa = d +
": absolute difference between 'wire angle' of the Wires ";
337 const auto [minE, maxE] = minmax_element(
begin(data),
end(data));
339 TH1D
hist(name.c_str(), name.c_str(), 100, *minE * (1 + 0.10), *maxE * (1 + 0.10));
341 for (
auto const& it : data)
344 hist.GetXaxis()->SetTitle(
"[cm]");
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
float centreToIntersection() const override
void validateCSCChamberGeometry()
Point3DBase< Scalar, LocalTag > LocalPoint
const CSCWireTopology * wireTopology() const
virtual float length() const =0
vector< float > phiOfOneEdge_
void compareTransform(const GlobalPoint &, const TGeoMatrix *)
const float * getParameters(unsigned int id) const
#define DEFINE_FWK_MODULE(type)
vector< float > yAxisOrientation_
vector< float > bottomWidths_
float phiOfOneEdge() const override
Global3DPoint GlobalPoint
constexpr uint32_t rawId() const
get the raw id
float getDiff(const float, const float)
vector< float > wireAngle_
float stripOffset(void) const
const Bounds & bounds() const
int numberOfStrips() const
const ChamberContainer & chambers() const
Return a vector of all chambers.
void compareShape(const GeomDet *, const float *)
void analyze(const edm::Event &, const edm::EventSetup &) override
double wireSpacing() const
const TGeoMatrix * getMatrix(unsigned int id) const
vector< float > centreToIntersection_
const Plane & surface() const
The nominal surface of the GeomDet.
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
float yAxisOrientation() const override
void makeHistograms2(const char *)
virtual float thickness() const =0
bool getData(T &iHolder) const
const float * getShapePars(unsigned int id) const
float wireAngle() const override
vector< float > angularWidth_
vector< float > topWidths_
void loadMap(const char *fileName)
Abs< T >::type abs(const T &t)
int numberOfWires() const
void validateCSCLayerGeometry()
float angularWidth() const override
const CSCGeometry * cscGeometry_
vector< float > yCentreOfStripPlane_
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > tokCSC_
const CSCStripTopology * topology() const
enable_if<!numeric_limits< T >::is_integer, bool >::type almost_equal(T x, T y, int ulp)
float yCentreOfStripPlane() const override
void makeHistogram(const string &, vector< float > &)
~CSCGeometryValidate() override
char data[epos_bytes_allocation]
void makeHistograms(const char *)
vector< float > globalDistances_
vector< float > thicknesses_
CSCGeometryValidate(const ParameterSet &)
float getDistance(const GlobalPoint &, const GlobalPoint &)
vector< float > wireSpacing_
virtual float width() const =0
const LayerContainer & layers() const
Return a vector of all layers.