23 #include <type_traits>
47 void endJob()
override;
49 void validateDTChamberGeometry();
50 void validateDTLayerGeometry();
52 void compareTransform(
const GlobalPoint&,
const TGeoMatrix*);
53 void compareShape(
const GeomDet*,
const float*);
56 float getDiff(
const float,
const float);
59 void makeHistogram(
const string&, vector<float>&);
62 globalDistances_.clear();
64 bottomWidths_.clear();
84 : dtGeometryToken_{esConsumes<DTGeometry, MuonGeometryRecord>(
edm::ESInputTag{})},
85 infileName_(iConfig.getUntrackedParameter<
string>(
"infileName",
"cmsGeom10.root")),
86 outfileName_(iConfig.getUntrackedParameter<
string>(
"outfileName",
"validateDTGeometry.root")),
87 tolerance_(iConfig.getUntrackedParameter<
int>(
"tolerance", 6)) {
88 fwGeometry_.loadMap(infileName_.c_str());
89 outFile_ =
new TFile(outfileName_.c_str(),
"RECREATE");
96 LogVerbatim(
"DTGeometry") <<
"Validating DT chamber geometry";
99 LogVerbatim(
"DTGeometry") <<
"Validating DT layer geometry";
102 LogVerbatim(
"DTGeometry") <<
"Invalid DT geometry";
115 LogVerbatim(
"DTGeometry") <<
"Failed to get matrix of DT chamber with detid: " << chId.
rawId();
124 LogVerbatim(
"DTGeometry") <<
"Failed to get shape of DT chamber with detid: " << chId.
rawId();
137 vector<float> wire_positions;
146 LogVerbatim(
"DTGeometry") <<
"Failed to get matrix of DT layer with detid: " << layerId.
rawId();
155 LogVerbatim(
"DTGeometry") <<
"Failed to get shape of DT layer with detid: " << layerId.
rawId();
164 LogVerbatim(
"DTGeometry") <<
"Parameters empty for DT layer with detid: " << layerId.
rawId();
168 float width = it->surface().bounds().width();
171 float thickness = it->surface().bounds().thickness();
174 float length = it->surface().bounds().length();
177 int firstChannel = it->specificTopology().firstChannel();
180 int lastChannel = it->specificTopology().lastChannel();
184 for (
int wireN = firstChannel; wireN - lastChannel <= 0; ++wireN) {
185 float localX1 = it->specificTopology().wirePosition(wireN);
187 wire_positions.emplace_back(
getDiff(localX1, localX2));
196 double local[3] = {0.0, 0.0, 0.0};
207 float shapeBottomWidth;
209 float shapeThickness;
212 shapeTopWidth = shape[2];
213 shapeBottomWidth = shape[1];
214 shapeLength = shape[4];
215 shapeThickness = shape[3];
216 }
else if (shape[0] == 2) {
217 shapeTopWidth = shape[1];
218 shapeBottomWidth = shape[1];
219 shapeLength = shape[2];
220 shapeThickness = shape[3];
222 LogVerbatim(
"DTGeometry") <<
"Failed to get box or trapezoid from shape";
226 float topWidth, bottomWidth;
232 array<const float, 4>
const& ps = tpbs->parameters();
240 }
else if ((dynamic_cast<const RectangularPlaneBounds*>(bounds))) {
243 bottomWidth = topWidth;
246 LogVerbatim(
"DTGeometry") <<
"Failed to get bounds";
249 topWidths_.push_back(fabs(shapeTopWidth - topWidth));
250 bottomWidths_.push_back(fabs(shapeBottomWidth - bottomWidth));
251 lengths_.push_back(fabs(shapeLength - length));
257 (
p1.z() -
p2.z()) * (
p1.z() -
p2.z()));
264 return (val1 - val2);
272 string gdn =
d +
": distance between points in global coordinates";
275 string twn =
d +
": absolute difference between top widths (along X)";
278 string bwn =
d +
": absolute difference between bottom widths (along X)";
281 string ln =
d +
": absolute difference between lengths (along Y)";
284 string tn =
d +
": absolute difference between thicknesses (along Z)";
294 TH1D
hist(
name.c_str(),
name.c_str(), 100, *minE * (1 + 0.10), *
maxE * (1 + 0.10));
296 for (
auto const& it :
data)
299 hist.GetXaxis()->SetTitle(
"[cm]");