60 const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *> &frames);
95 std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>
m_frames;
96 std::vector<MuonGeometrySanityCheckPoint>
m_points;
118 throw cms::Exception(
"BadConfig") <<
"Printout must be \"all\" or \"bad\"." << std::endl;
123 throw cms::Exception(
"BadConfig") <<
"Tolerance must be positive." << std::endl;
128 std::vector<edm::ParameterSet> frames = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"frames");
129 for (std::vector<edm::ParameterSet>::const_iterator
frame = frames.begin();
frame != frames.end(); ++
frame) {
132 throw cms::Exception(
"BadConfig") <<
"Custom frame \"" <<
name <<
"\" has been defined twice." << std::endl;
137 std::vector<edm::ParameterSet>
points = iConfig.
getParameter<std::vector<edm::ParameterSet> >(
"points");
144 for (std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::iterator iter =
m_frames.begin();
153 std::vector<double> numbers = iConfig.
getParameter<std::vector<double> >(
"matrix");
154 if (numbers.size() != 9) {
155 throw cms::Exception(
"BadConfig") <<
"Custom frame \"" <<
name <<
"\" has a matrix which is not 3x3." << std::endl;
159 matrix[0][0] = numbers[0];
160 matrix[0][1] = numbers[1];
161 matrix[0][2] = numbers[2];
162 matrix[1][0] = numbers[3];
163 matrix[1][1] = numbers[4];
164 matrix[1][2] = numbers[5];
165 matrix[2][0] = numbers[6];
166 matrix[2][1] = numbers[7];
167 matrix[2][2] = numbers[8];
173 throw cms::Exception(
"BadConfig") <<
"Could not invert matrix for custom frame \"" <<
name <<
"\"." << std::endl;
227 const edm::ParameterSet &iConfig,
const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *> &frames) {
230 bool parsing_error =
false;
235 parsing_error =
true;
237 if (!parsing_error &&
barrel) {
250 bool wheel_digit =
false;
260 parsing_error =
true;
263 parsing_error =
true;
267 bool station_digit =
false;
271 station_digit =
true;
275 parsing_error =
true;
278 parsing_error =
true;
282 bool sector_digit =
false;
290 parsing_error =
true;
294 bool superlayer_digit =
false;
301 superlayer_digit =
true;
304 if (!superlayer_digit)
305 parsing_error =
true;
317 if (!parsing_error) {
318 bool no_such_chamber =
false;
320 if (wheel < -2 || wheel > 2)
321 no_such_chamber =
true;
322 if (station < 1 || station > 4)
323 no_such_chamber =
true;
324 if (
station == 4 && (sector < 1 || sector > 14))
325 no_such_chamber =
true;
326 if (
station < 4 && (sector < 1 || sector > 12))
327 no_such_chamber =
true;
329 if (no_such_chamber) {
331 <<
station <<
"/" << sector << std::endl;
334 if (superlayer == 0) {
338 bool no_such_superlayer =
false;
339 if (superlayer < 1 || superlayer > 3)
340 no_such_superlayer =
true;
341 if (
station == 4 && superlayer == 2)
342 no_such_superlayer =
true;
344 if (no_such_superlayer) {
346 <<
station <<
"/" << sector <<
"/" << superlayer << std::endl;
353 bool no_such_layer =
false;
354 if (layer < 1 || layer > 4)
355 no_such_layer =
true;
359 <<
"Layer doesn't exist: MB" << (
plus ?
"+" :
"-") <<
wheel <<
"/" <<
station <<
"/" << sector <<
"/" 360 << superlayer <<
"/" <<
layer << std::endl;
368 }
else if (!parsing_error &&
endcap) {
379 parsing_error =
true;
382 bool station_digit =
false;
386 station_digit =
true;
392 parsing_error =
true;
395 parsing_error =
true;
399 bool ring_digit =
false;
407 parsing_error =
true;
410 parsing_error =
true;
414 bool chamber_digit =
false;
418 chamber_digit =
true;
422 parsing_error =
true;
426 bool layer_digit =
false;
436 parsing_error =
true;
439 if (!parsing_error) {
440 bool no_such_chamber =
false;
444 if (station < 1 || station > 4)
445 no_such_chamber =
true;
446 if (
station == 1 && (ring < 1 || ring > 4))
447 no_such_chamber =
true;
448 if (
station > 1 && (ring < 1 || ring > 2))
449 no_such_chamber =
true;
450 if (
station == 1 && (chamber < 1 || chamber > 36))
451 no_such_chamber =
true;
452 if (
station > 1 &&
ring == 1 && (chamber < 1 || chamber > 18))
453 no_such_chamber =
true;
454 if (
station > 1 &&
ring == 2 && (chamber < 1 || chamber > 36))
455 no_such_chamber =
true;
457 if (no_such_chamber) {
466 bool no_such_layer =
false;
467 if (layer < 1 || layer > 6)
468 no_such_layer =
true;
486 const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::const_iterator frameIter =
497 }
else if (frameIter != frames.end()) {
504 std::vector<double>
point = iConfig.
getParameter<std::vector<double> >(
"displacement");
505 if (
point.size() != 3) {
507 <<
" doesn't have exactly three components." << std::endl;
513 if (
entry !=
nullptr) {
517 if (
point.size() != 3) {
519 <<
" doesn't have exactly three components." << std::endl;
528 if (
entry !=
nullptr) {
535 if (
entry !=
nullptr) {
537 const std::map<std::string, const MuonGeometrySanityCheckCustomFrame *>::const_iterator frameIter =
548 }
else if (frameIter != frames.end()) {
564 output <<
"MB" << (
id.wheel() > 0 ?
"+" :
"") <<
id.
wheel() <<
"/" <<
id.station() <<
"/" <<
id.sector();
567 output <<
"MB" << (
id.wheel() > 0 ?
"+" :
"") <<
id.
wheel() <<
"/" <<
id.station() <<
"/" <<
id.sector() <<
"/" 571 output <<
"MB" << (
id.wheel() > 0 ?
"+" :
"") <<
id.
wheel() <<
"/" <<
id.station() <<
"/" <<
id.sector() <<
"/" 572 <<
id.superlayer() <<
"/" <<
id.layer();
575 output <<
"ME" << (
id.endcap() == 1 ?
"+" :
"-") <<
id.
station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber();
578 output <<
"ME" << (
id.endcap() == 1 ?
"+" :
"-") <<
id.
station() <<
"/" <<
id.ring() <<
"/" <<
id.chamber() <<
"/" 590 int num_transformed = 0;
609 chamberPos.
y() +
point->displacement.y(),
610 chamberPos.
z() +
point->displacement.z());
650 chamberPos.
x() + transformed.
x(), chamberPos.
y() + transformed.
y(), chamberPos.
z() + transformed.
z());
702 if (
point->has_expectation) {
704 double residx =
result.x() -
point->expectation.x();
705 double residy =
result.y() -
point->expectation.y();
706 double residz =
result.z() -
point->expectation.z();
711 output <<
" BAD " << residx <<
" " << residy <<
" " << residz << std::endl;
713 output <<
" GOOD " << residx <<
" " << residy <<
" " << residz << std::endl;
716 output <<
" UNTESTED 0 0 0" << std::endl;
725 <<
"SUMMARY transformed: " << num_transformed <<
" tested: " << num_tested <<
" bad: " << num_bad
726 <<
" good: " << (num_tested - num_bad) << std::endl;
std::vector< MuonGeometrySanityCheckPoint > m_points
void analyze(const edm::Event &, const edm::EventSetup &iConfig) override
T getParameter(std::string const &) const
Point3DBase< Scalar, LocalTag > LocalPoint
const MuonGeometrySanityCheckCustomFrame * outputCustomFrame
Global3DPoint GlobalPoint
int number(std::string s)
std::map< std::string, const MuonGeometrySanityCheckCustomFrame * > m_frames
LocalPoint toLocal(const GlobalPoint &gp) const
constexpr std::array< uint8_t, layerIndexSize > layer
static std::string const input
AlgebraicMatrix matrixInverse
std::string detName() const
CLHEP::HepMatrix AlgebraicMatrix
const GeomDet * idToDet(DetId) const override
MuonGeometrySanityCheckPoint(const edm::ParameterSet &iConfig, const std::map< std::string, const MuonGeometrySanityCheckCustomFrame *> &frames)
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
bool getData(T &iHolder) const
const edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeomToken_
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
MuonGeometrySanityCheckCustomFrame(const edm::ParameterSet &iConfig, std::string name)
CLHEP::HepVector AlgebraicVector
const Plane & surface() const
The nominal surface of the GeomDet.
Entry const * retrieveUnknown(char const *) const
GlobalPoint transform(GlobalPoint point) const
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
MuonGeometrySanityCheck(const edm::ParameterSet &iConfig)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
bool numeric(std::string s)
GlobalPoint transformInverse(GlobalPoint point) const
const MuonGeometrySanityCheckCustomFrame * customFrame
const GeomDet * idToDet(DetId) const override
~MuonGeometrySanityCheck() override