60 const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *> &frames);
95 std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>
m_frames;
96 std::vector<MuonGeometrySanityCheckPoint>
m_points;
114 throw cms::Exception(
"BadConfig") <<
"Printout must be \"all\" or \"bad\"." << std::endl;
119 throw cms::Exception(
"BadConfig") <<
"Tolerance must be positive." << std::endl;
124 std::vector<edm::ParameterSet> frames = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"frames");
125 for (std::vector<edm::ParameterSet>::const_iterator
frame = frames.begin();
frame != frames.end(); ++
frame) {
128 throw cms::Exception(
"BadConfig") <<
"Custom frame \"" <<
name <<
"\" has been defined twice." << std::endl;
133 std::vector<edm::ParameterSet>
points = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"points");
140 for (std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::iterator iter =
m_frames.begin();
149 std::vector<double> numbers = iConfig.
getParameter<std::vector<double> >(
"matrix");
150 if (numbers.size() != 9) {
151 throw cms::Exception(
"BadConfig") <<
"Custom frame \"" <<
name <<
"\" has a matrix which is not 3x3." << std::endl;
155 matrix[0][0] = numbers[0];
156 matrix[0][1] = numbers[1];
157 matrix[0][2] = numbers[2];
158 matrix[1][0] = numbers[3];
159 matrix[1][1] = numbers[4];
160 matrix[1][2] = numbers[5];
161 matrix[2][0] = numbers[6];
162 matrix[2][1] = numbers[7];
163 matrix[2][2] = numbers[8];
169 throw cms::Exception(
"BadConfig") <<
"Could not invert matrix for custom frame \"" <<
name <<
"\"." << std::endl;
223 const edm::ParameterSet &iConfig,
const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *> &frames) {
226 bool parsing_error =
false;
231 parsing_error =
true;
233 if (!parsing_error &&
barrel) {
246 bool wheel_digit =
false;
256 parsing_error =
true;
259 parsing_error =
true;
263 bool station_digit =
false;
267 station_digit =
true;
271 parsing_error =
true;
274 parsing_error =
true;
278 bool sector_digit =
false;
286 parsing_error =
true;
290 bool superlayer_digit =
false;
297 superlayer_digit =
true;
300 if (!superlayer_digit)
301 parsing_error =
true;
313 if (!parsing_error) {
314 bool no_such_chamber =
false;
316 if (wheel < -2 || wheel > 2)
317 no_such_chamber =
true;
318 if (station < 1 || station > 4)
319 no_such_chamber =
true;
320 if (
station == 4 && (sector < 1 || sector > 14))
321 no_such_chamber =
true;
322 if (
station < 4 && (sector < 1 || sector > 12))
323 no_such_chamber =
true;
325 if (no_such_chamber) {
327 <<
station <<
"/" << sector << std::endl;
330 if (superlayer == 0) {
334 bool no_such_superlayer =
false;
335 if (superlayer < 1 || superlayer > 3)
336 no_such_superlayer =
true;
337 if (
station == 4 && superlayer == 2)
338 no_such_superlayer =
true;
340 if (no_such_superlayer) {
342 <<
station <<
"/" << sector <<
"/" << superlayer << std::endl;
349 bool no_such_layer =
false;
350 if (layer < 1 || layer > 4)
351 no_such_layer =
true;
355 <<
"Layer doesn't exist: MB" << (
plus ?
"+" :
"-") <<
wheel <<
"/" <<
station <<
"/" << sector <<
"/"
356 << superlayer <<
"/" <<
layer << std::endl;
364 }
else if (!parsing_error &&
endcap) {
375 parsing_error =
true;
378 bool station_digit =
false;
382 station_digit =
true;
388 parsing_error =
true;
391 parsing_error =
true;
395 bool ring_digit =
false;
403 parsing_error =
true;
406 parsing_error =
true;
410 bool chamber_digit =
false;
414 chamber_digit =
true;
418 parsing_error =
true;
422 bool layer_digit =
false;
432 parsing_error =
true;
435 if (!parsing_error) {
436 bool no_such_chamber =
false;
440 if (station < 1 || station > 4)
441 no_such_chamber =
true;
442 if (
station == 1 && (ring < 1 || ring > 4))
443 no_such_chamber =
true;
444 if (
station > 1 && (ring < 1 || ring > 2))
445 no_such_chamber =
true;
446 if (
station == 1 && (chamber < 1 || chamber > 36))
447 no_such_chamber =
true;
448 if (
station > 1 &&
ring == 1 && (chamber < 1 || chamber > 18))
449 no_such_chamber =
true;
450 if (
station > 1 &&
ring == 2 && (chamber < 1 || chamber > 36))
451 no_such_chamber =
true;
453 if (no_such_chamber) {
462 bool no_such_layer =
false;
463 if (layer < 1 || layer > 6)
464 no_such_layer =
true;
482 const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::const_iterator frameIter =
493 }
else if (frameIter != frames.end()) {
500 std::vector<double>
point = iConfig.
getParameter<std::vector<double> >(
"displacement");
501 if (
point.size() != 3) {
503 <<
" doesn't have exactly three components." << std::endl;
509 if (
entry !=
nullptr) {
513 if (
point.size() != 3) {
515 <<
" doesn't have exactly three components." << std::endl;
524 if (
entry !=
nullptr) {
531 if (
entry !=
nullptr) {
533 const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::const_iterator frameIter =
544 }
else if (frameIter != frames.end()) {
560 output <<
"MB" << (
id.wheel() > 0 ?
"+" :
"") <<
id.
wheel() <<
"/" <<
id.station() <<
"/" <<
id.sector();
563 output <<
"MB" << (
id.wheel() > 0 ?
"+" :
"") <<
id.
wheel() <<
"/" <<
id.station() <<
"/" <<
id.sector() <<
"/"
567 output <<
"MB" << (
id.wheel() > 0 ?
"+" :
"") <<
id.
wheel() <<
"/" <<
id.station() <<
"/" <<
id.sector() <<
"/"
568 <<
id.superlayer() <<
"/" <<
id.layer();
571 output <<
"ME" << (
id.endcap() == 1 ?
"+" :
"-") <<
id.
station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
574 output <<
"ME" << (
id.endcap() == 1 ?
"+" :
"-") <<
id.
station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber() <<
"/"
589 int num_transformed = 0;
608 chamberPos.
y() +
point->displacement.y(),
609 chamberPos.
z() +
point->displacement.z());
649 chamberPos.
x() + transformed.
x(), chamberPos.
y() + transformed.
y(), chamberPos.
z() + transformed.
z());
701 if (
point->has_expectation) {
703 double residx =
result.x() -
point->expectation.x();
704 double residy =
result.y() -
point->expectation.y();
705 double residz =
result.z() -
point->expectation.z();
710 output <<
" BAD " << residx <<
" " << residy <<
" " << residz << std::endl;
712 output <<
" GOOD " << residx <<
" " << residy <<
" " << residz << std::endl;
715 output <<
" UNTESTED 0 0 0" << std::endl;
724 <<
"SUMMARY transformed: " << num_transformed <<
" tested: " << num_tested <<
" bad: " << num_bad
725 <<
" good: " << (num_tested - num_bad) << std::endl;