19 #include "xercesc/parsers/XercesDOMParser.hpp"
20 #include "xercesc/dom/DOM.hpp"
21 #include "xercesc/sax/HandlerBase.hpp"
22 #include "xercesc/util/XMLString.hpp"
23 #include "xercesc/util/PlatformUtils.hpp"
24 #include "xercesc/util/XercesDefs.hpp"
49 : m_fileName(
fileName), idealGeometryLabel(idealLabel) {
53 str_name = XMLString::transcode(
"name");
74 str_rawId = XMLString::transcode(
"rawId");
75 str_wheel = XMLString::transcode(
"wheel");
79 str_layer = XMLString::transcode(
"layer");
81 str_ring = XMLString::transcode(
"ring");
83 str_axisx = XMLString::transcode(
"axisx");
84 str_axisy = XMLString::transcode(
"axisy");
85 str_axisz = XMLString::transcode(
"axisz");
86 str_angle = XMLString::transcode(
"angle");
87 str_x = XMLString::transcode(
"x");
88 str_y = XMLString::transcode(
"y");
89 str_z = XMLString::transcode(
"z");
90 str_phix = XMLString::transcode(
"phix");
91 str_phiy = XMLString::transcode(
"phiy");
92 str_phiz = XMLString::transcode(
"phiz");
93 str_alpha = XMLString::transcode(
"alpha");
94 str_beta = XMLString::transcode(
"beta");
95 str_gamma = XMLString::transcode(
"gamma");
96 str_rphi = XMLString::transcode(
"rphi");
97 str_phi = XMLString::transcode(
"phi");
98 str_xx = XMLString::transcode(
"xx");
99 str_xy = XMLString::transcode(
"xy");
100 str_xz = XMLString::transcode(
"xz");
101 str_xa = XMLString::transcode(
"xa");
102 str_xb = XMLString::transcode(
"xb");
103 str_xc = XMLString::transcode(
"xc");
104 str_yy = XMLString::transcode(
"yy");
105 str_yz = XMLString::transcode(
"yz");
106 str_ya = XMLString::transcode(
"ya");
107 str_yb = XMLString::transcode(
"yb");
108 str_yc = XMLString::transcode(
"yc");
109 str_zz = XMLString::transcode(
"zz");
110 str_za = XMLString::transcode(
"za");
111 str_zb = XMLString::transcode(
"zb");
112 str_zc = XMLString::transcode(
"zc");
113 str_aa = XMLString::transcode(
"aa");
114 str_ab = XMLString::transcode(
"ab");
115 str_ac = XMLString::transcode(
"ac");
116 str_bb = XMLString::transcode(
"bb");
117 str_bc = XMLString::transcode(
"bc");
118 str_cc = XMLString::transcode(
"cc");
119 str_none = XMLString::transcode(
"none");
120 str_ideal = XMLString::transcode(
"ideal");
222 for (align::Alignables::const_iterator ali = alignables.begin(); ali != alignables.end(); ++ali) {
229 alignableNavigator[(*ali)->geomDetId().rawId()] = *ali;
238 align::Alignables::const_iterator alignable = alignables.begin();
239 align::Alignables::const_iterator ideal = ideals.begin();
241 while (alignable != alignables.end() && ideal != ideals.end()) {
242 alitoideal[*alignable] = *ideal;
244 fillAliToIdeal(alitoideal, (*alignable)->components(), (*ideal)->components());
250 if (alignable != alignables.end() || ideal != ideals.end()) {
252 <<
"alignable and ideal-alignable trees are out of sync (this should never happen)";
265 std::map<unsigned int, Alignable *> alignableNavigator;
270 std::map<unsigned int, Alignable *> ideal_alignableNavigator;
271 recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->DTBarrel());
272 recursiveGetId(ideal_alignableNavigator, ideal_alignableMuon->CSCEndcaps());
276 }
catch (
const XMLException &toCatch) {
277 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw an exception on initialization." << std::endl;
280 XercesDOMParser *
parser =
new XercesDOMParser();
281 parser->setValidationScheme(XercesDOMParser::Val_Always);
283 XERCES_CPP_NAMESPACE::ErrorHandler *errHandler = (XERCES_CPP_NAMESPACE::ErrorHandler *)(
new HandlerBase());
284 parser->setErrorHandler(errHandler);
288 }
catch (
const XMLException &toCatch) {
289 char *message = XMLString::transcode(toCatch.getMessage());
290 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw this exception: " << message << std::endl;
291 }
catch (
const DOMException &toCatch) {
292 char *message = XMLString::transcode(toCatch.msg);
293 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw this exception: " << message << std::endl;
294 }
catch (
const SAXException &toCatch) {
295 char *message = XMLString::transcode(toCatch.getMessage());
296 throw cms::Exception(
"XMLException") <<
"Xerces XML parser threw this exception: " << message << std::endl;
299 DOMDocument *
doc =
parser->getDocument();
300 DOMElement *node_MuonAlignment =
doc->getDocumentElement();
304 std::map<Alignable *, Alignable *> alitoideal;
309 std::map<std::string, std::map<Alignable *, bool> > alicollections;
312 if (
collection->getParentNode() == node_MuonAlignment) {
316 if (node_name ==
nullptr) {
317 throw cms::Exception(
"XMLException") <<
"<collection> requires a name attribute" << std::endl;
319 char *ascii_name = XMLString::transcode(node_name->getValue());
323 std::map<Alignable *, bool> aliset;
324 for (
unsigned int j = 0;
j <
children->getLength();
j++) {
327 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
328 Alignable *ali =
getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
329 if (ali ==
nullptr) {
330 throw cms::Exception(
"XMLException") <<
"<collection> must contain only alignables" << std::endl;
337 alicollections[
name] = aliset;
341 for (
unsigned int i = 0;
i < operations->getLength();
i++) {
342 DOMElement *operation = (DOMElement *)(operations->item(
i));
343 if (operation->getParentNode() != node_MuonAlignment) {
344 throw cms::Exception(
"XMLException") <<
"All operations must be top-level elements" << std::endl;
347 DOMNodeList *
children = operation->getChildNodes();
349 std::map<Alignable *, bool> aliset;
350 std::vector<DOMNode *> nodesToRemove;
351 for (
unsigned int j = 0;
j <
children->getLength();
j++) {
354 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
355 Alignable *ali =
getNode(alignableNavigator, (DOMElement *)(node), alignableObjectId);
356 if (ali !=
nullptr) {
358 nodesToRemove.push_back(node);
362 DOMAttr *node_name = ((DOMElement *)(node))->getAttributeNode(
str_name);
363 if (node_name ==
nullptr) {
364 throw cms::Exception(
"XMLException") <<
"<collection> requires a name attribute" << std::endl;
366 char *ascii_name = XMLString::transcode(node_name->getValue());
370 std::map<std::string, std::map<Alignable *, bool> >::const_iterator alicollections_iter =
371 alicollections.find(
name);
372 if (alicollections_iter == alicollections.end()) {
374 <<
"<collection name=\"" <<
name <<
"\"> hasn't been defined" << std::endl;
377 for (std::map<Alignable *, bool>::const_iterator aliiter = alicollections_iter->second.begin();
378 aliiter != alicollections_iter->second.end();
380 aliset[aliiter->first] =
true;
383 nodesToRemove.push_back(node);
393 for (std::vector<DOMNode *>::const_iterator node = nodesToRemove.begin(); node != nodesToRemove.end(); ++node) {
394 operation->removeChild(*node);
396 children = operation->getChildNodes();
398 for (
unsigned int j = 0;
j <
children->getLength();
j++) {
400 if (node->getNodeType() == DOMNode::ELEMENT_NODE) {
406 do_setape((DOMElement *)(node), aliset, alitoideal);
434 char *message = XMLString::transcode(node->getNodeName());
435 throw cms::Exception(
"XMLException") <<
"Unrecognized operation: \"" << message <<
"\"" << std::endl;
447 delete ideal_alignableMuon;
448 return alignableMuon;
452 const XERCES_CPP_NAMESPACE::DOMElement *node,
481 std::map<unsigned int, Alignable *> &alignableNavigator,
482 const XERCES_CPP_NAMESPACE::DOMElement *node,
484 unsigned int rawId = 0;
486 DOMAttr *node_rawId = node->getAttributeNode(
str_rawId);
487 if (node_rawId !=
nullptr) {
489 rawId = XMLString::parseInt(node_rawId->getValue());
490 }
catch (
const XMLException &toCatch) {
491 throw cms::Exception(
"XMLException") <<
"Value of \"rawId\" must be an integer" << std::endl;
498 DOMAttr *node_wheel = node->getAttributeNode(
str_wheel);
499 if (node_wheel ==
nullptr)
500 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"wheel\" attribute" << std::endl;
502 wheel = XMLString::parseInt(node_wheel->getValue());
503 }
catch (
const XMLException &toCatch) {
504 throw cms::Exception(
"XMLException") <<
"Value of \"wheel\" must be an integer" << std::endl;
508 DOMAttr *node_station = node->getAttributeNode(
str_station);
509 if (node_station ==
nullptr)
510 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"station\" attribute" << std::endl;
512 station = XMLString::parseInt(node_station->getValue());
513 }
catch (
const XMLException &toCatch) {
514 throw cms::Exception(
"XMLException") <<
"Value of \"station\" must be an integer" << std::endl;
518 DOMAttr *node_sector = node->getAttributeNode(
str_sector);
519 if (node_sector ==
nullptr)
520 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"sector\" attribute" << std::endl;
522 sector = XMLString::parseInt(node_sector->getValue());
523 }
catch (
const XMLException &toCatch) {
524 throw cms::Exception(
"XMLException") <<
"Value of \"sector\" must be an integer" << std::endl;
528 DOMAttr *node_superlayer = node->getAttributeNode(
str_superlayer);
529 if (node_superlayer ==
nullptr)
531 <<
"DT node is missing required \"superlayer\" attribute" << std::endl;
533 superlayer = XMLString::parseInt(node_superlayer->getValue());
534 }
catch (
const XMLException &toCatch) {
535 throw cms::Exception(
"XMLException") <<
"Value of \"superlayer\" must be an integer" << std::endl;
539 DOMAttr *node_layer = node->getAttributeNode(
str_layer);
540 if (node_layer ==
nullptr)
541 throw cms::Exception(
"XMLException") <<
"DT node is missing required \"layer\" attribute" << std::endl;
543 layer = XMLString::parseInt(node_layer->getValue());
544 }
catch (
const XMLException &toCatch) {
545 throw cms::Exception(
"XMLException") <<
"Value of \"layer\" must be an integer" << std::endl;
555 rawId = layerId.
rawId();
558 Alignable *ali = alignableNavigator[rawId];
560 throw cms::Exception(
"XMLException") <<
"rawId \"" << rawId <<
"\" is not recognized" << std::endl;
565 if (ali ==
nullptr) {
567 <<
"rawId \"" << rawId <<
"\" is not a " << alignableObjectId.
idToString(structureType) << std::endl;
574 std::map<unsigned int, Alignable *> &alignableNavigator,
575 const XERCES_CPP_NAMESPACE::DOMElement *node,
579 DOMAttr *node_rawId = node->getAttributeNode(
str_rawId);
580 if (node_rawId !=
nullptr) {
582 rawId = XMLString::parseInt(node_rawId->getValue());
583 }
catch (
const XMLException &toCatch) {
584 throw cms::Exception(
"XMLException") <<
"Value of \"rawId\" must be an integer" << std::endl;
590 DOMAttr *node_endcap = node->getAttributeNode(
str_endcap);
591 if (node_endcap ==
nullptr)
592 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"endcap\" attribute" << std::endl;
594 endcap = XMLString::parseInt(node_endcap->getValue());
595 }
catch (
const XMLException &toCatch) {
596 throw cms::Exception(
"XMLException") <<
"Value of \"endcap\" must be an integer" << std::endl;
602 DOMAttr *node_station = node->getAttributeNode(
str_station);
603 if (node_station ==
nullptr)
604 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"station\" attribute" << std::endl;
606 station = XMLString::parseInt(node_station->getValue());
607 }
catch (
const XMLException &toCatch) {
608 throw cms::Exception(
"XMLException") <<
"Value of \"station\" must be an integer" << std::endl;
612 DOMAttr *node_ring = node->getAttributeNode(
str_ring);
613 if (node_ring ==
nullptr)
614 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"ring\" attribute" << std::endl;
616 ring = XMLString::parseInt(node_ring->getValue());
617 }
catch (
const XMLException &toCatch) {
618 throw cms::Exception(
"XMLException") <<
"Value of \"ring\" must be an integer" << std::endl;
622 DOMAttr *node_chamber = node->getAttributeNode(
str_chamber);
623 if (node_chamber ==
nullptr)
624 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"chamber\" attribute" << std::endl;
626 chamber = XMLString::parseInt(node_chamber->getValue());
627 }
catch (
const XMLException &toCatch) {
628 throw cms::Exception(
"XMLException") <<
"Value of \"chamber\" must be an integer" << std::endl;
632 DOMAttr *node_layer = node->getAttributeNode(
str_layer);
633 if (node_layer ==
nullptr)
634 throw cms::Exception(
"XMLException") <<
"CSC node is missing required \"layer\" attribute" << std::endl;
636 layer = XMLString::parseInt(node_layer->getValue());
637 }
catch (
const XMLException &toCatch) {
638 throw cms::Exception(
"XMLException") <<
"Value of \"layer\" must be an integer" << std::endl;
647 rawId = layerId.
rawId();
650 Alignable *ali = alignableNavigator[rawId];
652 throw cms::Exception(
"XMLException") <<
"rawId \"" << rawId <<
"\" is not recognized" << std::endl;
657 if (ali ==
nullptr) {
659 <<
"rawId \"" << rawId <<
"\" is not a " << alignableObjectId.
idToString(structureType) << std::endl;
666 unsigned int len = XMLString::stringLen(
str);
667 char *cstr = XMLString::transcode(
str);
668 std::stringstream errmessage;
669 errmessage <<
"Value of \"" << attribute <<
"\" must be a double, not \"" << cstr <<
"\"" << std::endl;
674 if (cstr[
i] ==
'-') {
677 }
else if (cstr[
i] ==
'+')
682 while (cstr[
i] !=
'.' && cstr[
i] !=
'e' && cstr[
i] !=
'E' &&
i < len) {
683 if (cstr[
i] <
'0' || cstr[
i] >
'9') {
693 if (cstr[
i] ==
'.') {
697 while (cstr[
i] !=
'e' && cstr[
i] !=
'E' &&
i < len) {
698 if (cstr[
i] <
'0' || cstr[
i] >
'9') {
703 output += (cstr[
i] -
'0') * place;
709 if (cstr[
i] ==
'e' || cstr[
i] ==
'E') {
713 bool expminus =
false;
714 if (cstr[
i] ==
'-') {
717 }
else if (cstr[
i] ==
'+')
721 if (cstr[
i] <
'0' || cstr[
i] >
'9') {
745 std::map<Alignable *, bool> &aliset,
746 std::map<Alignable *, Alignable *> &alitoideal)
const {
747 DOMAttr *node_relativeto = node->getAttributeNode(
str_relativeto);
748 if (node_relativeto ==
nullptr)
749 throw cms::Exception(
"XMLException") <<
"<setposition> is missing required \"relativeto\" attribute" << std::endl;
759 char *message = XMLString::transcode(node_relativeto->getValue());
760 throw cms::Exception(
"XMLException") <<
"relativeto must be \"none\", \"ideal\", or \"container\", not \""
761 << message <<
"\"" << std::endl;
764 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
789 oldrot = oldrot * globalRotation.
transposed();
792 double x = oldpos.
x();
793 double y = oldpos.
y();
794 double z = oldpos.
z();
796 double phix = atan2(oldrot.
yz(), oldrot.
zz());
797 double phiy = asin(-oldrot.
xz());
798 double phiz = atan2(oldrot.
xy(), oldrot.
xx());
801 double alpha = oldEulerAngles(1);
802 double beta = oldEulerAngles(2);
803 double gamma = oldEulerAngles(3);
807 DOMAttr *node_x = node->getAttributeNode(
str_x);
808 DOMAttr *node_y = node->getAttributeNode(
str_y);
809 DOMAttr *node_z = node->getAttributeNode(
str_z);
811 if (node_x !=
nullptr)
813 if (node_y !=
nullptr)
815 if (node_z !=
nullptr)
819 DOMAttr *node_phix = node->getAttributeNode(
str_phix);
820 DOMAttr *node_phiy = node->getAttributeNode(
str_phiy);
821 DOMAttr *node_phiz = node->getAttributeNode(
str_phiz);
822 DOMAttr *node_alpha = node->getAttributeNode(
str_alpha);
823 DOMAttr *node_beta = node->getAttributeNode(
str_beta);
824 DOMAttr *node_gamma = node->getAttributeNode(
str_gamma);
827 bool phixyz = (node_phix !=
nullptr || node_phiy !=
nullptr || node_phiz !=
nullptr);
828 bool alphabetagamma = (node_alpha !=
nullptr || node_beta !=
nullptr || node_gamma !=
nullptr);
829 if (phixyz && alphabetagamma)
831 <<
"<setposition> must either have phix, phiy, and phiz or alpha, beta, and gamma, but not both" << std::endl;
832 if (!phixyz && !alphabetagamma)
833 alphabetagamma =
true;
836 if (node_phix !=
nullptr)
838 if (node_phiy !=
nullptr)
840 if (node_phiz !=
nullptr)
849 rot = rotX * rotY * rotZ;
852 else if (alphabetagamma) {
853 if (node_alpha !=
nullptr)
855 if (node_beta !=
nullptr)
857 if (node_gamma !=
nullptr)
862 eulerAngles(1) =
alpha;
863 eulerAngles(2) =
beta;
864 eulerAngles(3) =
gamma;
892 if (container !=
nullptr) {
943 if (survey !=
nullptr) {
944 matrix6x6 = survey->
errors();
950 std::map<Alignable *, bool> &aliset,
951 std::map<Alignable *, Alignable *> &alitoideal)
const {
952 DOMAttr *node_xx = node->getAttributeNode(
str_xx);
953 DOMAttr *node_xy = node->getAttributeNode(
str_xy);
954 DOMAttr *node_xz = node->getAttributeNode(
str_xz);
955 DOMAttr *node_xa = node->getAttributeNode(
str_xa);
956 DOMAttr *node_xb = node->getAttributeNode(
str_xb);
957 DOMAttr *node_xc = node->getAttributeNode(
str_xc);
958 DOMAttr *node_yy = node->getAttributeNode(
str_yy);
959 DOMAttr *node_yz = node->getAttributeNode(
str_yz);
960 DOMAttr *node_ya = node->getAttributeNode(
str_ya);
961 DOMAttr *node_yb = node->getAttributeNode(
str_yb);
962 DOMAttr *node_yc = node->getAttributeNode(
str_yc);
963 DOMAttr *node_zz = node->getAttributeNode(
str_zz);
964 DOMAttr *node_za = node->getAttributeNode(
str_za);
965 DOMAttr *node_zb = node->getAttributeNode(
str_zb);
966 DOMAttr *node_zc = node->getAttributeNode(
str_zc);
967 DOMAttr *node_aa = node->getAttributeNode(
str_aa);
968 DOMAttr *node_ab = node->getAttributeNode(
str_ab);
969 DOMAttr *node_ac = node->getAttributeNode(
str_ac);
970 DOMAttr *node_bb = node->getAttributeNode(
str_bb);
971 DOMAttr *node_bc = node->getAttributeNode(
str_bc);
972 DOMAttr *node_cc = node->getAttributeNode(
str_cc);
974 if (node_xx ==
nullptr)
975 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xx\" attribute" << std::endl;
976 if (node_xy ==
nullptr)
977 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xy\" attribute" << std::endl;
978 if (node_xz ==
nullptr)
979 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xz\" attribute" << std::endl;
980 if (node_xa ==
nullptr)
981 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xa\" attribute" << std::endl;
982 if (node_xb ==
nullptr)
983 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xb\" attribute" << std::endl;
984 if (node_xc ==
nullptr)
985 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"xc\" attribute" << std::endl;
986 if (node_yy ==
nullptr)
987 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yy\" attribute" << std::endl;
988 if (node_yz ==
nullptr)
989 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yz\" attribute" << std::endl;
990 if (node_ya ==
nullptr)
991 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"ya\" attribute" << std::endl;
992 if (node_yb ==
nullptr)
993 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yb\" attribute" << std::endl;
994 if (node_yc ==
nullptr)
995 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"yc\" attribute" << std::endl;
996 if (node_zz ==
nullptr)
997 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"zz\" attribute" << std::endl;
998 if (node_za ==
nullptr)
999 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"za\" attribute" << std::endl;
1000 if (node_zb ==
nullptr)
1001 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"zb\" attribute" << std::endl;
1002 if (node_zc ==
nullptr)
1003 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"zc\" attribute" << std::endl;
1004 if (node_aa ==
nullptr)
1005 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"aa\" attribute" << std::endl;
1006 if (node_ab ==
nullptr)
1007 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"ab\" attribute" << std::endl;
1008 if (node_ac ==
nullptr)
1009 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"ac\" attribute" << std::endl;
1010 if (node_bb ==
nullptr)
1011 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"bb\" attribute" << std::endl;
1012 if (node_bc ==
nullptr)
1013 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"bc\" attribute" << std::endl;
1014 if (node_cc ==
nullptr)
1015 throw cms::Exception(
"XMLException") <<
"<setape> is missing required \"cc\" attribute" << std::endl;
1018 matrix6x6(0, 0) =
parseDouble(node_xx->getValue(),
"xx");
1019 matrix6x6(0, 1) =
parseDouble(node_xy->getValue(),
"xy");
1020 matrix6x6(0, 2) =
parseDouble(node_xz->getValue(),
"xz");
1021 matrix6x6(0, 3) =
parseDouble(node_xa->getValue(),
"xa");
1022 matrix6x6(0, 4) =
parseDouble(node_xb->getValue(),
"xb");
1023 matrix6x6(0, 5) =
parseDouble(node_xc->getValue(),
"xc");
1024 matrix6x6(1, 1) =
parseDouble(node_yy->getValue(),
"yy");
1025 matrix6x6(1, 2) =
parseDouble(node_yz->getValue(),
"yz");
1026 matrix6x6(1, 3) =
parseDouble(node_ya->getValue(),
"ya");
1027 matrix6x6(1, 4) =
parseDouble(node_yb->getValue(),
"yb");
1028 matrix6x6(1, 5) =
parseDouble(node_yc->getValue(),
"yc");
1029 matrix6x6(2, 2) =
parseDouble(node_zz->getValue(),
"zz");
1030 matrix6x6(2, 3) =
parseDouble(node_za->getValue(),
"za");
1031 matrix6x6(2, 4) =
parseDouble(node_zb->getValue(),
"zb");
1032 matrix6x6(2, 5) =
parseDouble(node_zc->getValue(),
"zc");
1033 matrix6x6(3, 3) =
parseDouble(node_aa->getValue(),
"aa");
1034 matrix6x6(3, 4) =
parseDouble(node_ab->getValue(),
"ab");
1035 matrix6x6(3, 5) =
parseDouble(node_ac->getValue(),
"ac");
1036 matrix6x6(4, 4) =
parseDouble(node_bb->getValue(),
"bb");
1037 matrix6x6(4, 5) =
parseDouble(node_bc->getValue(),
"bc");
1038 matrix6x6(5, 5) =
parseDouble(node_cc->getValue(),
"cc");
1040 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1047 std::map<Alignable *, bool> &aliset,
1048 std::map<Alignable *, Alignable *> &alitoideal)
const {
1049 DOMAttr *node_xx = node->getAttributeNode(
str_xx);
1050 DOMAttr *node_xy = node->getAttributeNode(
str_xy);
1051 DOMAttr *node_xz = node->getAttributeNode(
str_xz);
1052 DOMAttr *node_xa = node->getAttributeNode(
str_xa);
1053 DOMAttr *node_xb = node->getAttributeNode(
str_xb);
1054 DOMAttr *node_xc = node->getAttributeNode(
str_xc);
1055 DOMAttr *node_yy = node->getAttributeNode(
str_yy);
1056 DOMAttr *node_yz = node->getAttributeNode(
str_yz);
1057 DOMAttr *node_ya = node->getAttributeNode(
str_ya);
1058 DOMAttr *node_yb = node->getAttributeNode(
str_yb);
1059 DOMAttr *node_yc = node->getAttributeNode(
str_yc);
1060 DOMAttr *node_zz = node->getAttributeNode(
str_zz);
1061 DOMAttr *node_za = node->getAttributeNode(
str_za);
1062 DOMAttr *node_zb = node->getAttributeNode(
str_zb);
1063 DOMAttr *node_zc = node->getAttributeNode(
str_zc);
1064 DOMAttr *node_aa = node->getAttributeNode(
str_aa);
1065 DOMAttr *node_ab = node->getAttributeNode(
str_ab);
1066 DOMAttr *node_ac = node->getAttributeNode(
str_ac);
1067 DOMAttr *node_bb = node->getAttributeNode(
str_bb);
1068 DOMAttr *node_bc = node->getAttributeNode(
str_bc);
1069 DOMAttr *node_cc = node->getAttributeNode(
str_cc);
1071 if (node_xx ==
nullptr)
1072 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xx\" attribute" << std::endl;
1073 if (node_xy ==
nullptr)
1074 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xy\" attribute" << std::endl;
1075 if (node_xz ==
nullptr)
1076 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xz\" attribute" << std::endl;
1077 if (node_xa ==
nullptr)
1078 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xa\" attribute" << std::endl;
1079 if (node_xb ==
nullptr)
1080 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xb\" attribute" << std::endl;
1081 if (node_xc ==
nullptr)
1082 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"xc\" attribute" << std::endl;
1083 if (node_yy ==
nullptr)
1084 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yy\" attribute" << std::endl;
1085 if (node_yz ==
nullptr)
1086 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yz\" attribute" << std::endl;
1087 if (node_ya ==
nullptr)
1088 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"ya\" attribute" << std::endl;
1089 if (node_yb ==
nullptr)
1090 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yb\" attribute" << std::endl;
1091 if (node_yc ==
nullptr)
1092 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"yc\" attribute" << std::endl;
1093 if (node_zz ==
nullptr)
1094 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"zz\" attribute" << std::endl;
1095 if (node_za ==
nullptr)
1096 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"za\" attribute" << std::endl;
1097 if (node_zb ==
nullptr)
1098 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"zb\" attribute" << std::endl;
1099 if (node_zc ==
nullptr)
1100 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"zc\" attribute" << std::endl;
1101 if (node_aa ==
nullptr)
1102 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"aa\" attribute" << std::endl;
1103 if (node_ab ==
nullptr)
1104 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"ab\" attribute" << std::endl;
1105 if (node_ac ==
nullptr)
1106 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"ac\" attribute" << std::endl;
1107 if (node_bb ==
nullptr)
1108 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"bb\" attribute" << std::endl;
1109 if (node_bc ==
nullptr)
1110 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"bc\" attribute" << std::endl;
1111 if (node_cc ==
nullptr)
1112 throw cms::Exception(
"XMLException") <<
"<setsurveyerr> is missing required \"cc\" attribute" << std::endl;
1115 matrix6x6(0, 0) =
parseDouble(node_xx->getValue(),
"xx");
1116 matrix6x6(0, 1) =
parseDouble(node_xy->getValue(),
"xy");
1117 matrix6x6(0, 2) =
parseDouble(node_xz->getValue(),
"xz");
1118 matrix6x6(0, 3) =
parseDouble(node_xa->getValue(),
"xa");
1119 matrix6x6(0, 4) =
parseDouble(node_xb->getValue(),
"xb");
1120 matrix6x6(0, 5) =
parseDouble(node_xc->getValue(),
"xc");
1121 matrix6x6(1, 1) =
parseDouble(node_yy->getValue(),
"yy");
1122 matrix6x6(1, 2) =
parseDouble(node_yz->getValue(),
"yz");
1123 matrix6x6(1, 3) =
parseDouble(node_ya->getValue(),
"ya");
1124 matrix6x6(1, 4) =
parseDouble(node_yb->getValue(),
"yb");
1125 matrix6x6(1, 5) =
parseDouble(node_yc->getValue(),
"yc");
1126 matrix6x6(2, 2) =
parseDouble(node_zz->getValue(),
"zz");
1127 matrix6x6(2, 3) =
parseDouble(node_za->getValue(),
"za");
1128 matrix6x6(2, 4) =
parseDouble(node_zb->getValue(),
"zb");
1129 matrix6x6(2, 5) =
parseDouble(node_zc->getValue(),
"zc");
1130 matrix6x6(3, 3) =
parseDouble(node_aa->getValue(),
"aa");
1131 matrix6x6(3, 4) =
parseDouble(node_ab->getValue(),
"ab");
1132 matrix6x6(3, 5) =
parseDouble(node_ac->getValue(),
"ac");
1133 matrix6x6(4, 4) =
parseDouble(node_bb->getValue(),
"bb");
1134 matrix6x6(4, 5) =
parseDouble(node_bc->getValue(),
"bc");
1135 matrix6x6(5, 5) =
parseDouble(node_cc->getValue(),
"cc");
1137 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1144 std::map<Alignable *, bool> &aliset,
1145 std::map<Alignable *, Alignable *> &alitoideal)
const {
1146 DOMAttr *node_x = node->getAttributeNode(
str_x);
1147 DOMAttr *node_y = node->getAttributeNode(
str_y);
1148 DOMAttr *node_z = node->getAttributeNode(
str_z);
1149 if (node_x ==
nullptr)
1150 throw cms::Exception(
"XMLException") <<
"<moveglobal> is missing required \"x\" attribute" << std::endl;
1151 if (node_y ==
nullptr)
1152 throw cms::Exception(
"XMLException") <<
"<moveglobal> is missing required \"y\" attribute" << std::endl;
1153 if (node_z ==
nullptr)
1154 throw cms::Exception(
"XMLException") <<
"<moveglobal> is missing required \"z\" attribute" << std::endl;
1161 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1170 if (survey !=
nullptr) {
1171 matrix6x6 = survey->
errors();
1178 std::map<Alignable *, bool> &aliset,
1179 std::map<Alignable *, Alignable *> &alitoideal)
const {
1180 DOMAttr *node_x = node->getAttributeNode(
str_x);
1181 DOMAttr *node_y = node->getAttributeNode(
str_y);
1182 DOMAttr *node_z = node->getAttributeNode(
str_z);
1183 if (node_x ==
nullptr)
1184 throw cms::Exception(
"XMLException") <<
"<movelocal> is missing required \"x\" attribute" << std::endl;
1185 if (node_y ==
nullptr)
1186 throw cms::Exception(
"XMLException") <<
"<movelocal> is missing required \"y\" attribute" << std::endl;
1187 if (node_z ==
nullptr)
1188 throw cms::Exception(
"XMLException") <<
"<movelocal> is missing required \"z\" attribute" << std::endl;
1195 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1199 ali->
move(globalVector);
1205 if (survey !=
nullptr) {
1206 matrix6x6 = survey->
errors();
1213 std::map<Alignable *, bool> &aliset,
1214 std::map<Alignable *, Alignable *> &alitoideal)
const {
1215 DOMAttr *node_axisx = node->getAttributeNode(
str_axisx);
1216 DOMAttr *node_axisy = node->getAttributeNode(
str_axisy);
1217 DOMAttr *node_axisz = node->getAttributeNode(
str_axisz);
1218 DOMAttr *node_angle = node->getAttributeNode(
str_angle);
1219 if (node_axisx ==
nullptr)
1220 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"axisx\" attribute" << std::endl;
1221 if (node_axisy ==
nullptr)
1222 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"axisy\" attribute" << std::endl;
1223 if (node_axisz ==
nullptr)
1224 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"axisz\" attribute" << std::endl;
1225 if (node_angle ==
nullptr)
1226 throw cms::Exception(
"XMLException") <<
"<rotatelocal> is missing required \"angle\" attribute" << std::endl;
1234 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1243 if (survey !=
nullptr) {
1244 matrix6x6 = survey->
errors();
1251 std::map<Alignable *, bool> &aliset,
1252 std::map<Alignable *, Alignable *> &alitoideal)
const {
1253 DOMAttr *node_rphi = node->getAttributeNode(
str_rphi);
1254 DOMAttr *node_phi = node->getAttributeNode(
str_phi);
1255 if (node_rphi ==
nullptr && node_phi ==
nullptr)
1256 throw cms::Exception(
"XMLException") <<
"<rotatebeamline> is missing required \"*phi\" attribute" << std::endl;
1257 if (node_rphi !=
nullptr && node_phi !=
nullptr)
1258 throw cms::Exception(
"XMLException") <<
"<rotatebeamline> can't have both an \"rphi\" and a \"phi\" attribute"
1262 if (node_rphi !=
nullptr) {
1268 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1274 double phi0 =
pos.phi();
1275 double deltaphi =
value;
1276 if (node_rphi !=
nullptr)
1287 if (survey !=
nullptr) {
1288 matrix6x6 = survey->
errors();
1295 std::map<Alignable *, bool> &aliset,
1296 std::map<Alignable *, Alignable *> &alitoideal)
const {
1297 DOMAttr *node_x = node->getAttributeNode(
str_x);
1298 DOMAttr *node_y = node->getAttributeNode(
str_y);
1299 DOMAttr *node_z = node->getAttributeNode(
str_z);
1300 DOMAttr *node_angle = node->getAttributeNode(
str_angle);
1301 if (node_x ==
nullptr)
1302 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"x\" attribute" << std::endl;
1303 if (node_y ==
nullptr)
1304 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"y\" attribute" << std::endl;
1305 if (node_z ==
nullptr)
1306 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"z\" attribute" << std::endl;
1307 if (node_angle ==
nullptr)
1308 throw cms::Exception(
"XMLException") <<
"<rotateglobalaxis> is missing required \"angle\" attribute" << std::endl;
1315 for (std::map<Alignable *, bool>::const_iterator aliiter = aliset.begin(); aliiter != aliset.end(); ++aliiter) {
1327 double q3 =
sin(
angle / 2.) * cprime;
1333 double pos2z = 2. * (q3 *
q1 -
q0 *
q2) *
pos.x() + 2. * (q3 *
q2 +
q0 *
q1) *
pos.y() +
1336 double movex = pos2x -
pos.x();
1337 double movey = pos2y -
pos.y();
1338 double movez = pos2z -
pos.z();
1345 if (survey !=
nullptr) {
1346 matrix6x6 = survey->
errors();